uxn-utils/tcc/day1.tal

52 lines
866 B
Tal
Raw Normal View History

2022-12-16 14:59:44 -05:00
|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
|0100
#23ef .System/r DEO2
#3b7f .System/g DEO2
#665f .System/b DEO2
,draw-tree JSR
BRK
@draw-tree ( -- )
#0060 .Screen/y DEO2
( star )
#0103
DUP2 ,draw-line JSR
#0203 ,draw-line JSR
,draw-line JSR
( tree )
#8000
&tree
DUP #02 SFT #3f AND DUP ADD STH
DUP #0f AND STHr ADD #01 ,draw-line JSR
INC GTHk ,&tree JCN
POP2
( bark )
#1000
&bark
#0802 ,draw-line JSR
INC GTHk ,&bark JCN
POP2
( ground )
#ff03
@draw-line ( width color -- )
,&c STR
#00 SWP
DUP2 .Screen/width DEI2 #01 SFT2 SWP2 SUB2 ,&o STR2
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