From 6884561c770859bea547c3c5741f42e36072ac45 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 20 Dec 2022 13:59:09 -0800 Subject: [PATCH] * --- tcc/day9.tal | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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