diff --git a/ttc/day1.tal b/ttc/day1.tal new file mode 100644 index 0000000..9b940ad --- /dev/null +++ b/ttc/day1.tal @@ -0,0 +1,50 @@ +|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 +|10 @Console &vector $2 &read $1 &pad $5 &write $1 +|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 + +|0100 + + #23ef .System/r DEO2 + #3b7f .System/g DEO2 + #665f .System/b DEO2 + ;draw-tree JSR2 + +BRK + +@draw-tree ( -- ) + + #0060 .Screen/y DEO2 + ( star ) + #0103 ;draw-line JSR2 + #0203 ;draw-line JSR2 + #0103 ;draw-line JSR2 + ( tree ) + #8000 + &tree + DUP #02 SFT #3f AND DUP ADD STH + DUP #0f AND STHr ADD #01 ;draw-line JSR2 + INC GTHk ,&tree JCN + POP2 + ( bark ) + #1000 + &bark + #0802 ;draw-line JSR2 + INC GTHk ,&bark JCN + POP2 + ( ground ) + #ff01 + +@draw-line ( width color -- ) + + ,&c STR + #00 OVR .Screen/width DEI2 #01 SFT2 SWP2 SUB2 ,&o STR2 + #00 SWP DUP2 ADD2 INC2 #0000 + &l + DUP2 [ LIT2 &o $2 ] ADD2 .Screen/x DEO2 + [ LIT &c $1 ] .Screen/pixel DEO + INC2 GTH2k ,&l JCN + POP2 POP2 + .Screen/y DEI2k INC2 ROT DEO2 + +JMP2r +