(animation.tal) Minor optimizations

This commit is contained in:
neauoire 2022-01-09 13:07:48 -08:00
parent 37497060dc
commit a8c384daec
1 changed files with 30 additions and 25 deletions

View File

@ -1,15 +1,18 @@
( GUI Animation ) ( GUI Animation )
%2// { #01 SFT2 } %2// { #01 SFT2 }
%AUTO-XADDR { #05 .Screen/auto DEO }
( devices ) ( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0000 |0000
@dvd [ &x $2 &y $2 &dx $1 &dy $1 ] @dvd
&x $2 &y $2
&dx $1 &dy $1
( program ) ( program )
@ -27,52 +30,54 @@
.Screen/width DEI2 2// .dvd/x STZ2 .Screen/width DEI2 2// .dvd/x STZ2
.Screen/height DEI2 2// .dvd/y STZ2 .Screen/height DEI2 2// .dvd/y STZ2
AUTO-XADDR
#01 ;draw-dvd JSR2 #01 ;draw-dvd JSR2
BRK BRK
@on-frame ( -> ) @on-frame ( -> )
( clear ) #00 ;draw-dvd JSR2 #00 ;draw-dvd JSR2
( case: hit-right ) .dvd/x LDZ2 .Screen/width DEI2 #0020 SUB2 EQU2 ( case: hit-right ) .dvd/x LDZ2 .Screen/width DEI2 #0020 SUB2 EQU2
( case: hit-left ) .dvd/x LDZ2 #0000 EQU2 ( case: hit-left ) .dvd/x LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipx JCN #0000 EQU2 ,&no-flipx JCN
.dvd/dx LDZ #00 EQU .dvd/dx STZ &no-flipx .dvd/dx LDZk #00 EQU SWP STZ &no-flipx
( case: hit-bottom ) .dvd/y LDZ2 .Screen/height DEI2 #0010 SUB2 EQU2 ( case: hit-bottom ) .dvd/y LDZ2 .Screen/height DEI2 #0010 SUB2 EQU2
( case: hit-top ) .dvd/y LDZ2 #0000 EQU2 ( case: hit-top ) .dvd/y LDZ2 #0000 EQU2
#0000 EQU2 ,&no-flipy JCN #0000 EQU2 ,&no-flipy JCN
.dvd/dy LDZ #00 EQU .dvd/dy STZ &no-flipy .dvd/dy LDZk #00 EQU SWP STZ &no-flipy
( incr ) .dvd/x LDZ2 #0001 #00 .dvd/dx LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/x STZ2 ( incr ) .dvd/x LDZ2 #0001 #00 .dvd/dx LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/x STZ2
( incr ) .dvd/y LDZ2 #0001 #00 .dvd/dy LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/y STZ2 ( incr ) .dvd/y LDZ2 #0001 #00 .dvd/dy LDZ #00 EQU DUP2 ADD2 SUB2 ADD2 .dvd/y STZ2
( draw ) #01 ;draw-dvd JSR2
#01 ;draw-dvd JSR2
BRK BRK
@draw-dvd ( color -- ) @draw-dvd ( color -- )
( stash ) STH STH
;dvd_icn .Screen/addr DEO2 ;dvd_icn .Screen/addr DEO2
[ .dvd/y LDZ2 #0010 ADD2 ] .dvd/y LDZ2 .dvd/x LDZ2 .Screen/x DEO2
&ver .dvd/y LDZ2 .Screen/y DEO2
DUP2 .Screen/y DEO2 #0800
[ .dvd/x LDZ2 #0020 ADD2 ] .dvd/x LDZ2 &loop
&hor DUP #04 NEQ ,&no-lb JCN
DUP2 .Screen/x DEO2 .Screen/x DEI2k #0020 SUB2 ROT DEO2
( draw ) STHkr .Screen/sprite DEO .Screen/y DEI2k #0008 ADD2 ROT DEO2
( next ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 &no-lb
( incr ) #0008 ADD2 STHkr .Screen/sprite DEO
GTH2k ,&hor JCN INC GTHk ,&loop JCN
POP2 POP2 POP2
( incr ) #0008 ADD2 POPr
GTH2k ,&ver JCN
POP2 POP2
( destroy ) POPr
JMP2r JMP2r
@dvd_icn [ @dvd_icn ( 4 x 2 )
001f 3f38 3838 787f 00fe fe7e 7777 e3c3 001f 3f38 3838 787f 00fe fe7e 7777 e3c3
000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc 000f 1f3b 7b77 e7c7 00fc fe8f 8707 0efc
7f00 000f ff7f 0700 0301 00ff f0f8 ff00 7f00 000f ff7f 0700 0301 00ff f0f8 ff00
8700 00ff 7f7f ff00 f000 00e0 fcfc 8000 8700 00ff 7f7f ff00 f000 00e0 fcfc 8000
]