diff --git a/projects/examples/demos/dvd.tal b/projects/examples/demos/dvd.tal index 8b35544..054a1d5 100644 --- a/projects/examples/demos/dvd.tal +++ b/projects/examples/demos/dvd.tal @@ -2,12 +2,11 @@ |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 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 - -|0000 +|000 @dvd &x $2 &y $2 -|0100 +|100 @on-reset ( -> ) ( | theme ) @@ -17,30 +16,35 @@ ( | vectors ) ;on-frame .Screen/vector DEO2 ( | starting position ) - .Screen/width DEI2 #01 SFT2 .dvd/x STZ2 - .Screen/height DEI2 #01 SFT2 .dvd/y STZ2 - ( | set collisions ) - .Screen/width DEI2 #0020 SUB2 ;on-frame/hit-hor STA2 - .Screen/height DEI2 #0010 SUB2 ;on-frame/hit-ver STA2 + .Screen/width DEI2 DUP2 #01 SFT2 .dvd/x STZ2 + #0020 SUB2 ;on-frame/hit-hor STA2 + .Screen/height DEI2 DUP2 #01 SFT2 .dvd/y STZ2 + #0010 SUB2 ;on-frame/hit-ver STA2 ( | drawing mode ) [ LIT2 36 -Screen/auto ] DEO - #01 draw-dvd BRK + #01 + BRK @on-frame ( -> ) - #00 draw-dvd + #00 ( | x ) .dvd/x LDZ2 - ( left ) ORAk ?{ #0001 ,&x STR2 } - ( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ #ffff ,&x STR2 } - [ LIT2 &x 0001 ] ADD2 .dvd/x STZ2 + ( left ) ORAk ?{ + [ LIT2 ADD2 _&x ] STR } + ( right ) DUP2 [ LIT2 &hit-hor $2 ] NEQ2 ?{ + [ LIT2 SUB2 _&x ] STR } + #0001 [ &x ADD2 ] .dvd/x STZ2 ( | y ) .dvd/y LDZ2 - ( top ) ORAk ?{ #0001 ,&y STR2 } - ( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ #ffff ,&y STR2 } - [ LIT2 &y 0001 ] ADD2 .dvd/y STZ2 - #01 draw-dvd BRK + ( top ) ORAk ?{ + [ LIT2 ADD2 _&y ] STR } + ( bottom ) DUP2 [ LIT2 &hit-ver $2 ] NEQ2 ?{ + [ LIT2 ADD2 _&y ] STR } + #0001 [ &y ADD2 ] .dvd/y STZ2 + #01 + BRK -@draw-dvd ( color -- ) +@ ( color -- ) ;dvd-icn .Screen/addr DEO2 .dvd/x LDZ2 .Screen/x DEO2 .dvd/y LDZ2 .Screen/y DEO2