diff --git a/tcc/day8.tal b/tcc/day8.tal new file mode 100644 index 0000000..44c863d --- /dev/null +++ b/tcc/day8.tal @@ -0,0 +1,182 @@ +|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 + +|0000 + + @f $2 + +|0100 + + ( theme ) + #ff0f .System/r DEO2 + #0fa0 .System/g DEO2 + #0f20 .System/b DEO2 + ( size ) + #0100 .Screen/width DEO2 + #0080 .Screen/height DEO2 + ( animate ) + #01 .Screen/auto DEO + ;on-frame .Screen/vector DEO2 + +BRK + +@print ( short* -- ) + + SWP ,&byte JSR + &byte ( byte -- ) DUP #04 SFT ,&char JSR + &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO + +JMP2r + +@on-frame ( -> ) + + ;draw-bg JSR2 + #0000 ;draw-circle JSR2 + .f LDZ2k INC2 #007f AND2 ROT STZ2 + +BRK + +@draw-bg ( -- ) + + #0000 + DUP2 .Screen/x DEO2 + .Screen/y DEO2 + #f1 .Screen/auto DEO + ;tile-icn .Screen/addr DEO2 + #2000 + &l + DUP #01 AND #07 ADD .Screen/sprite DEO + INC GTHk ,&l JCN + POP2 + +JMP2r + +@draw-circle ( offset* -- ) + + ( x ) + DUP2 .f LDZ2 ADD2 #001f ADD2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2 .Screen/x DEO2 + ( y ) + .f LDZ2 ADD2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2 #0018 ADD2 .Screen/y DEO2 + + #16 .Screen/auto DEO + ;circle-icn .Screen/addr DEO2 + #05 .Screen/sprite DEOk DEO + +JMP2r + +@pixel ( x* y* -- ) + + STH2k + ADD2k .f LDZ2 SUB2 ADD2 + ( y ) DUP2 ADD2 #00ff AND2 INC2 ;cos ADD2 LDA STH + .f LDZ2 ADD2 + ( x ) #00ff AND2 DUP2 ADD2 ;cos ADD2 LDA STHr + ADD .f LDZ2 STH2r ADD2 DUP2 ADD2 NIP ADD + #04 SFT .Screen/pixel DEO + +JMP2r + +( +@|assets ) + +@tile-icn + 0103 070f 1f3f 7fff +@circle-icn + 030f 3f3f 7f7f ffff c0f0 fcfc fefe ffff + ffff 7f7f 3f3f 0f03 ffff fefe fcfc f0c0 + +@font ( atari8 ) +0000 0000 0000 0000 6060 6060 6000 6000 +6666 6600 0000 0000 006c fe6c 6cfe 6c00 +183e 603c 067c 1800 0066 6c18 3066 4600 +386c 3870 decc 7600 6060 6000 0000 0000 +1c30 3030 3030 1c00 380c 0c0c 0c0c 3800 +0066 3cff 3c66 0000 0018 187e 1818 0000 +0000 0000 0030 3060 0000 007e 0000 0000 +0000 0000 0018 1800 0306 0c18 3060 c000 +3c66 6e76 6666 3c00 1838 1818 1818 7e00 +3c66 060c 1830 7e00 7e0c 180c 0666 3c00 +0c1c 3c6c 7e0c 0c00 7e60 7c06 0666 3c00 +3c60 607c 6666 3c00 7e06 0c18 3030 3000 +3c66 663c 6666 3c00 3c66 663e 060c 3800 +0018 1800 0018 1800 0018 1800 1818 3000 +0c18 3060 3018 0c00 0000 7e00 007e 0000 +3018 0c06 0c18 3000 3c66 060c 1800 1800 +3c66 6e6a 6e60 3e00 183c 6666 7e66 6600 +7c66 667c 6666 7c00 3c66 6060 6066 3c00 +786c 6666 666c 7800 7e60 607c 6060 7e00 +7e60 607c 6060 6000 3e60 606e 6666 3e00 +6666 667e 6666 6600 3c18 1818 1818 3c00 +3e06 0606 0666 3c00 666c 7870 786c 6600 +6060 6060 6060 7e00 c6ee fed6 c6c6 c600 +6676 7e7e 6e66 6600 3c66 6666 6666 3c00 +7c66 667c 6060 6000 3c66 6666 766c 3600 +7c66 667c 6c66 6600 3c66 603c 0666 3c00 +7e18 1818 1818 1800 6666 6666 6666 3e00 +6666 6666 663c 1800 c6c6 c6d6 feee c600 +6666 3c18 3c66 6600 6666 663c 1818 1800 +7e06 0c18 3060 7e00 3c30 3030 3030 3c00 +c060 3018 0c06 0300 3c0c 0c0c 0c0c 3c00 +1038 6cc6 0000 0000 0000 0000 0000 fe00 +0060 3018 0000 0000 0000 3c06 3e66 3e00 +6060 7c66 6666 7c00 0000 3c60 6060 3c00 +0606 3e66 6666 3e00 0000 3c66 7e60 3c00 +1c30 7c30 3030 3000 0000 3e66 663e 067c +6060 7c66 6666 6600 1800 3818 1818 3c00 +1800 1818 1818 1870 6060 666c 786c 6600 +3818 1818 1818 3c00 0000 ecfe d6c6 c600 +0000 7c66 6666 6600 0000 3c66 6666 3c00 +0000 7c66 6666 7c60 0000 3e66 6666 3e06 +0000 7c66 6060 6000 0000 3e60 3c06 7c00 +0018 7e18 1818 0e00 0000 6666 6666 3e00 +0000 6666 663c 1800 0000 c6c6 d67c 6c00 +0000 663c 183c 6600 0000 6666 663e 067c +0000 7e0c 1830 7e00 1c30 3060 3030 1c00 +1818 1818 1818 1818 380c 0c06 0c0c 3800 +0000 60f2 9e0c 0000 3c42 9985 8599 423c + +@cos ( cos256 ) +ffff ffff ffff fefe fdfc fcfb faf9 f8f7 +f6f5 f3f2 f0ef edec eae8 e6e4 e2e0 dedc +dad8 d5d3 d1ce ccc9 c7c4 c1bf bcb9 b6b3 +b0ae aba8 a5a2 9f9c 9895 928f 8c89 8683 +807c 7976 7370 6d6a 6763 605d 5a57 5451 +4f4c 4946 4340 3e3b 3836 3331 2e2c 2a27 +2523 211f 1d1b 1917 1513 1210 0f0d 0c0a +0908 0706 0504 0303 0201 0100 0000 0000 +0000 0000 0000 0101 0203 0304 0506 0708 +090a 0c0d 0f10 1213 1517 191b 1d1f 2123 +2527 2a2c 2e31 3336 383b 3e40 4346 494c +4f51 5457 5a5d 6063 676a 6d70 7376 797c +7f83 8689 8c8f 9295 989c 9fa2 a5a8 abae +b0b3 b6b9 bcbf c1c4 c7c9 ccce d1d3 d5d8 +dadc dee0 e2e4 e6e8 eaec edef f0f2 f3f5 +f6f7 f8f9 fafb fcfc fdfe feff ffff ffff + +$200 + +@draw-text ( offset* color -- ) + + STH + ( x ) + #0100 .f LDZ2 ADD2 DUP2 ADD2 SUB2 #01ff AND2 #0100 SUB2 + .Screen/x DEO2 + ( text ) + ;text + &w + ( y ) + DUP2 ;text SUB2 #20 SFT2 .f LDZ2 DUP2 ADD2 SUB2 #00ff AND2 ;cos ADD2 LDA #00 SWP #02 SFT2 #0020 ADD2 + .Screen/y DEO2 + ( addr* ) + LDAk #20 SUB #00 SWP #30 SFT2 ;font ADD2 + .Screen/addr DEO2 + STHkr .Screen/sprite DEO + INC2 LDAk ,&w JCN + POP2 + POPr + +JMP2r + +@text "Tiny 20 "Code 20 "Christmas 20 "2022 $1 + +