diff --git a/tcc/day9.tal b/tcc/day9.tal index 15f8d06..eec2299 100644 --- a/tcc/day9.tal +++ b/tcc/day9.tal @@ -57,7 +57,21 @@ JMP2r @on-frame ( -> ) ( paint pixels ) - .f LDZ2k INC2 #007f AND2 ROT STZ2 + .f LDZ2 #00ff AND2 + ( x ) + DUP2 #001f ADD2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2 + #00e0 SUB2 ,&x STR2 + ( y ) + DUP2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2 #0018 ADD2 + ,&y STR2 + POP2 + [ LIT2 &x $2 ] + .f LDZ2 #02 SFT2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #09 SFT2 ADD2 + [ LIT2 &y $2 ] + + ;paint-shape JSR2 + + .f LDZ2k INC2 ROT STZ2 BRK @@ -112,6 +126,19 @@ JMP2r JMP2r +@paint-shape ( x* y* -- ) + + ,&y STR2 ,&x STR2 + .f LDZ2 #01 SFT2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #07 SFT2 NIP #00 + &l + #00 OVR STH2 + [ LIT2 &x $2 ] STH2kr #0007 AND2 ADD2 + [ LIT2 &y $2 ] STH2r #03 SFT2 ADD2 ;paint-pixel JSR2 + INC GTHk ,&l JCN + POP2 + +JMP2r + @paint-pixel ( x* y* -- ) OVR2 OVR2 ;get-pixel JSR2 INC2 #03 AND ;put-pixel JSR2