uxn-utils/tcc/day8.tal

118 lines
2.3 KiB
Tal
Raw Normal View History

2022-12-19 20:19:46 -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
|0000
@f $2
|0100
( theme )
#ff0f .System/r DEO2
#0fa0 .System/g DEO2
#0f20 .System/b DEO2
( size )
#0100 .Screen/width DEO2
#0080 .Screen/height DEO2
( animate )
#01 .Screen/auto DEO
;on-frame .Screen/vector DEO2
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 ( -> )
;draw-bg JSR2
2022-12-19 20:36:49 -05:00
2022-12-19 21:07:25 -05:00
#3000
&l
#00 OVR #20 SFT2 ;draw-circle/offset STA2
#00 OVR .f LDZ2 #00 SFT2 ADD2 ;draw-circles JSR2
INC GTHk ,&l JCN
POP2
2022-12-19 20:36:49 -05:00
2022-12-19 20:19:46 -05:00
.f LDZ2k INC2 #007f AND2 ROT STZ2
BRK
@draw-bg ( -- )
2022-12-19 21:07:25 -05:00
#0000 .Screen/y DEO2
#0008 .f LDZ2 #01 SFT2 #004f AND2 SUB2 .Screen/x DEO2
2022-12-19 20:19:46 -05:00
#f1 .Screen/auto DEO
;tile-icn .Screen/addr DEO2
2022-12-19 21:07:25 -05:00
#2200
2022-12-19 20:19:46 -05:00
&l
2022-12-19 21:07:25 -05:00
DUP #01 AND .Screen/sprite DEO
2022-12-19 20:19:46 -05:00
INC GTHk ,&l JCN
POP2
JMP2r
2022-12-19 21:07:25 -05:00
@draw-circles ( offset* -- )
2022-12-19 20:36:49 -05:00
2022-12-19 21:07:25 -05:00
STH2
2022-12-19 20:36:49 -05:00
#1000
&l
2022-12-19 21:07:25 -05:00
#00 OVR #40 SFT2 STH2kr ADD2 ;draw-circle JSR2
2022-12-19 20:36:49 -05:00
INC GTHk ,&l JCN
POP2
2022-12-19 21:07:25 -05:00
POP2r
2022-12-19 20:36:49 -05:00
JMP2r
2022-12-19 20:19:46 -05:00
@draw-circle ( offset* -- )
( x )
2022-12-19 21:07:25 -05:00
DUP2 #001f ADD2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2
[ LIT2 &offset $2 ] ADD2
#0030 SUB2
2022-12-19 20:36:49 -05:00
.Screen/x DEO2
2022-12-19 20:19:46 -05:00
( y )
2022-12-19 21:07:25 -05:00
DUP2 #007f AND2 #10 SFT2 ;cos ADD2 LDA2 #0a SFT2 #0018 ADD2
2022-12-19 20:36:49 -05:00
.Screen/y DEO2
2022-12-19 20:19:46 -05:00
#16 .Screen/auto DEO
;circle-icn .Screen/addr DEO2
2022-12-19 21:07:25 -05:00
POP2
,&offset LDR2 .f LDZ2 ADD2 #04 SFT2
#0003 AND2 ;&colors ADD2 LDA .Screen/sprite DEOk DEO
2022-12-19 20:19:46 -05:00
JMP2r
2022-12-19 21:07:25 -05:00
&colors 05 0a 0f 0a
2022-12-19 20:19:46 -05:00
(
@|assets )
@tile-icn
2022-12-19 21:07:25 -05:00
ffff ffff ffff ffff
2022-12-19 20:19:46 -05:00
@circle-icn
030f 3f3f 7f7f ffff c0f0 fcfc fefe ffff
ffff 7f7f 3f3f 0f03 ffff fefe fcfc f0c0
@cos ( cos256 )
ffff ffff ffff fefe fdfc fcfb faf9 f8f7
f6f5 f3f2 f0ef edec eae8 e6e4 e2e0 dedc
dad8 d5d3 d1ce ccc9 c7c4 c1bf bcb9 b6b3
b0ae aba8 a5a2 9f9c 9895 928f 8c89 8683
807c 7976 7370 6d6a 6763 605d 5a57 5451
4f4c 4946 4340 3e3b 3836 3331 2e2c 2a27
2523 211f 1d1b 1917 1513 1210 0f0d 0c0a
0908 0706 0504 0303 0201 0100 0000 0000
0000 0000 0000 0101 0203 0304 0506 0708
090a 0c0d 0f10 1213 1517 191b 1d1f 2123
2527 2a2c 2e31 3336 383b 3e40 4346 494c
4f51 5457 5a5d 6063 676a 6d70 7376 797c
7f83 8689 8c8f 9295 989c 9fa2 a5a8 abae
b0b3 b6b9 bcbf c1c4 c7c9 ccce d1d3 d5d8
dadc dee0 e2e4 e6e8 eaec edef f0f2 f3f5
f6f7 f8f9 fafb fcfc fdfe feff ffff ffff