(dvd.tal) Optimized

This commit is contained in:
neauoire 2023-09-29 14:01:13 -04:00
parent f8c7e44ea1
commit c71842aa84
1 changed files with 24 additions and 32 deletions

View File

@ -5,59 +5,51 @@
|0000 |0000
@dvd &x $2 &y $2 &dx $1 &dy $1 @dvd &x $2 &y $2
|0100 ( -> ) |0100
( theme ) @on-reset ( -> )
( | theme )
#4cfd .System/r DEO2 #4cfd .System/r DEO2
#4cf3 .System/g DEO2 #4cf3 .System/g DEO2
#dcf2 .System/b DEO2 #dcf2 .System/b DEO2
( vectors ) ( | vectors )
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
( starting position ) ( | starting position )
.Screen/width DEI2 #01 SFT2 .dvd/x STZ2 .Screen/width DEI2 #01 SFT2 .dvd/x STZ2
.Screen/height DEI2 #01 SFT2 .dvd/y STZ2 .Screen/height DEI2 #01 SFT2 .dvd/y STZ2
( set collisions ) ( | set collisions )
.Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2 .Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2
.Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2 .Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2
( drawing mode ) ( | drawing mode )
[ LIT2 36 -Screen/auto ] DEO [ LIT2 36 -Screen/auto ] DEO
#01 draw-dvd #01 draw-dvd BRK
BRK
@on-frame ( -> ) @on-frame ( -> )
#00 draw-dvd #00 draw-dvd
( x ) ( | x )
.dvd/x LDZ2 .dvd/x LDZ2
DUP2 #0000 EQU2 ?&flip-x ( left ) DUP2 #0000 NEQ2 ?{ #0001 ,&x STR2 }
DUP2 [ LIT2 &hit-hor $2 ] EQU2 ?&flip-x ( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ #ffff ,&x STR2 }
&no-x [ LIT2 &x 0001 ] ADD2 .dvd/x STZ2
[ LIT2 00 -dvd/dx ] LDZ DUP2 ADD2 ADD2 #ffff ADD2 .dvd/x STZ2 ( | y )
( y )
.dvd/y LDZ2 .dvd/y LDZ2
DUP2 #0000 EQU2 ?&flip-y ( top ) DUP2 #0000 NEQ2 ?{ #0001 ,&y STR2 }
DUP2 [ LIT2 &hit-ver $2 ] EQU2 ?&flip-y ( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ #ffff ,&y STR2 }
&no-y [ LIT2 &y 0001 ] ADD2 .dvd/y STZ2
[ LIT2 00 -dvd/dy ] LDZ DUP2 ADD2 ADD2 #ffff ADD2 .dvd/y STZ2 #01 draw-dvd BRK
#01 draw-dvd
BRK
&flip-x .dvd/dx LDZk #00 EQU SWP STZ !&no-x
&flip-y .dvd/dy LDZk #00 EQU SWP STZ !&no-y
@draw-dvd ( color -- ) @draw-dvd ( color -- )
;dvd-icn .Screen/addr DEO2
;dvd_icn .Screen/addr DEO2
.dvd/x LDZ2 .Screen/x DEO2 .dvd/x LDZ2 .Screen/x DEO2
.dvd/y LDZ2 .Screen/y DEO2 .dvd/y LDZ2 .Screen/y DEO2
.Screen/sprite DEOk DEO .Screen/sprite DEOk
DEO
JMP2r
JMP2r @dvd-icn ( 4 x 2 )
[
@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