( Z4 Typeface Demo by ~zce ) ( Everything here is licensed under CC0. ) |00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 ] |20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |0000 @sprite [ &p1 $2 &p2 $2 &p3 $2 &p4 $2 ] |0100 #2c5f .System/r DEO2 #2c5f .System/g DEO2 #2ccf .System/b DEO2 ;on-frame .Screen/vector DEO2 BRK @on-frame #01 #0010 #0010 ;draw-text JSR2 BRK @draw-text ( blend x- y- ) ( blend is a byte, and x and y are shorts that determine placement of the text ) OVR2 .Screen/x DEO2 .Screen/y DEO2 ( blend x- ) ( We don't actually need to keep the y- variable because it always increases, unlike the x direction that needs to be reset for a line break. ) ROT #00 SWP SWP2 ( blend- x- ) ( Convert blend to a short because by the time we need it we're dealing with a sufficient number of stack variables. ) ;sprite .Screen/addr DEO2 ;text ( blend- x- *text ) &loop LDAk ( blend- x- *text chr ) DUP #19 GTH ;&continue JCN2 #0000 .sprite/p1 STZ2 #0000 .sprite/p2 STZ2 #0000 .sprite/p3 STZ2 #0000 .sprite/p4 STZ2 #0a NEQ ;¬-line-break JCN2 ( no DUP needed since we don't want chr anymore ) ROT2 DUP .Screen/sprite DEO ROT2 ROT2 .Screen/y DEI2 #0009 ADD2 .Screen/y DEO2 OVR2 .Screen/x DEO2 #0001 ADD2 ,&loop JMP ¬-line-break ROT2 .Screen/sprite DEO POP ( x- *text ) POP2 POP2 ( remove x- *text ) JMP2r &continue DUP #01 AND SWP ( store a flag indicating whether it's an odd or even character ) ( blend- x- *text flg chr ) #20 SUB #02 DIV #00 SWP #0008 MUL2 ;z4-font ADD2 ( calculate sprite it's located in and load it ) ( blend- x- *text flg sprid- ) ROT #01 EQU ,&load-odd JCN ( blend- x- *text sprid- ) LDA2k .sprite/p1 STZ2 #0002 ADD2 LDA2k .sprite/p2 STZ2 #0002 ADD2 LDA2k .sprite/p3 STZ2 #0002 ADD2 LDA2 .sprite/p4 STZ2 ( blend- x- *text ) ,&end-cond JMP &load-odd LDA2k #40 SFT2 .sprite/p1 STZ2 #0002 ADD2 LDA2k #40 SFT2 .sprite/p2 STZ2 #0002 ADD2 LDA2k #40 SFT2 .sprite/p3 STZ2 #0002 ADD2 LDA2 #40 SFT2 .sprite/p4 STZ2 ( blend- x- *text ) &end-cond ROT2 DUP .Screen/sprite DEO ROT2 ROT2 .Screen/x DEI2 #0004 ADD2 .Screen/x DEO2 #0001 ADD2 ;&loop JMP2 @text 48 65 6c 6c 6f 20 66 72 6f 6d 20 75 78 6e 21 20 59 6f 75 27 72 65 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 5a 34 2c 20 61 20 74 79 70 65 66 61 63 65 20 49 20 64 72 65 77 20 75 70 20 6f 6e 20 4e 61 73 75 20 61 6e 64 20 74 72 61 6e 73 66 65 72 72 65 64 20 69 74 20 68 65 72 65 21 0a 41 73 20 79 6f 75 20 63 61 6e 20 73 65 65 2c 20 69 74 27 73 20 61 20 72 65 6d 61 72 6b 61 62 6c 79 20 63 6f 6d 70 61 63 74 20 74 79 70 65 66 61 63 65 2e 20 45 76 65 72 79 20 63 68 61 72 61 63 74 65 72 20 69 73 20 6f 6e 6c 79 20 74 68 72 65 65 20 70 69 78 65 6c 73 20 77 69 64 65 2c 20 0a 61 6e 64 20 74 68 65 20 73 74 6f 72 61 67 65 20 75 73 65 64 20 75 70 20 69 6e 20 74 68 65 20 52 4f 4d 20 69 73 20 6f 6e 6c 79 20 68 61 6c 66 20 74 68 61 74 20 6f 66 20 74 79 70 69 63 61 6c 20 38 78 38 20 66 6f 6e 74 73 2e 20 0a 45 73 70 65 63 69 61 6c 6c 79 20 73 69 6e 63 65 20 74 68 69 73 20 69 73 20 6d 79 20 66 69 72 73 74 20 72 65 61 6c 20 75 78 6e 20 70 72 6f 67 72 61 6d 20 28 6c 65 74 20 61 6c 6f 6e 65 20 6d 79 20 66 69 72 73 74 20 73 74 61 63 6b 2d 62 61 73 65 64 20 70 72 6f 67 72 61 6d 29 2c 20 74 68 65 20 6c 6f 67 69 63 0a 74 6f 20 67 65 74 20 68 61 6c 66 2d 73 69 7a 65 20 73 70 72 69 74 65 73 20 72 65 6e 64 65 72 69 6e 67 20 63 6f 72 72 65 63 74 6c 79 20 77 69 74 68 6f 75 74 20 77 61 73 74 69 6e 67 20 61 6e 79 20 73 70 61 63 65 20 77 61 73 20 71 75 69 74 65 20 61 20 63 68 61 6c 6c 65 6e 67 65 2e 20 42 75 74 20 68 65 79 2c 20 69 74 20 77 6f 72 6b 73 21 0a 0a 44 69 64 20 49 20 6d 65 6e 74 69 6f 6e 20 69 74 27 73 20 67 6f 74 20 31 30 30 25 20 41 53 43 49 49 20 73 75 70 70 6f 72 74 3f 0a 0a 7e 7a 63 65 20 @z4-font 0004 0404 0404 0004 00aa aa0e 0a0e 0a0a 004a eac2 e468 ea4a 0064 84a4 60a0 a060 0028 4482 8282 4428 00a0 40a4 0e04 0000 0000 0000 0e00 4080 0002 0204 0404 0848 0044 aca4 e4a4 a44e 0044 aa22 4482 8ae4 002e 488c a2ea 2a24 006e 8ac2 a2a4 a444 0044 aaaa 4aa6 a24c 0000 0044 0000 0448 0000 204e 804e 2000 0004 8a42 2244 8004 0044 a4ea eaee 8a6a 00c6 a8a8 c8a8 a8c6 00ce a8a8 aca8 a8ce 00e6 8888 ca8a 8a86 00ae a4a4 e4a4 a4ae 00ea 2a2a acaa aa4a 008a 8e8e 8e8a 8aea 00c4 aaaa aaaa aaa4 00c4 aaaa aaca 8c86 00c6 a8a8 c4a2 a2ac 00ea 4a4a 4a4a 4a4e 00aa aaaa aeae 4e4a 00aa aaaa 4aa4 a4a4 00ec 2828 4888 88ec 0086 8242 4242 2226 0040 a000 0000 000e 8040 000c 0206 0a06 0080 80c6 a8a8 a8c6 0020 2064 aaae a866 0060 828e ca86 888e 0084 80cc a4a4 a4ae 0028 08ea 2a2c aa4a 00c0 404c 4e4e 4eea 0000 00c4 aaaa aaa4 0000 00c6 aaaa c682 0000 0066 8884 828c 0000 40ea 4a4a 4a26 0000 00aa aeae 4e46 0000 00aa aa46 a2ac 0002 04e4 2844 84e2 0048 4444 4244 4448 0000 0020 e080 0000