diff --git a/tcc/day6.tal b/tcc/day6.tal index 8f7f3b8..98ac7e8 100644 --- a/tcc/day6.tal +++ b/tcc/day6.tal @@ -18,8 +18,18 @@ #01 .Screen/auto DEO ;on-frame .Screen/vector DEO2 + ;text ;draw-text SUB2 ;print JSR2 #0a18 DEO + 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 ( -> ) .Screen/height DEI2 #0000 @@ -35,7 +45,9 @@ BRK INC2 GTH2k ,&v JCN POP2 POP2 .f LDZ2k INC2 #00ff AND2 ROT STZ2 - ;draw-text JSR2 + #0008 #0f ;draw-text JSR2 + #0004 #0a ;draw-text JSR2 + #0000 #05 ;draw-text JSR2 BRK @@ -51,28 +63,6 @@ BRK JMP2r -@draw-text ( -- ) - - ( x ) - #0100 .f LDZ2 #10 SFT2 SUB2 #01ff AND2 #0100 SUB2 - .Screen/x DEO2 - ( text ) - ;text - &w - ( y ) - DUP2 ;text SUB2 #20 SFT2 .f LDZ2 #10 SFT2 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 - #01 .Screen/sprite DEO - INC2 LDAk ,&w JCN - POP2 - -JMP2r - -@text "Tiny 20 "Code 20 "Christmas 20 "2022 $1 - ( @|assets ) @@ -144,4 +134,30 @@ 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 +