commit 90acf9ceec447738f98102fd4515c60e84292666
parent 6d8e06e879b612a6d7797af34fe7c8c4a67fc1bd
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Sun, 1 Aug 2021 17:44:27 +0100
Animated screen.tal to demonstrate transparent sprites
Diffstat:
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/projects/examples/devices/screen.tal b/projects/examples/devices/screen.tal
@@ -6,6 +6,7 @@
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
+|b0 @DateTime [ &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ]
( variables )
@@ -28,15 +29,21 @@
( draw )
;draw-table JSR2
- ;draw-sprites JSR2
+ ;on-frame .Screen/vector DEO2
;draw-1bpp JSR2
;draw-2bpp JSR2
;draw-pixels JSR2
+
BRK
+@on-frame ( -> )
+ ;draw-background JSR2
+ ;draw-sprites JSR2
+ BRK
+
@draw-table ( -- )
#00 #10
@@ -103,7 +110,19 @@ RTN
SWP #01 ADD SWP
LTHk ,&loop JCN
POP2
-
+
+@draw-background ( -- )
+ ;solid .Screen/addr DEO2
+ #00 #00
+ &loop
+ ( move ) OVR #0f AND #40 SFT #02 DIV #00 SWP
+ .center/x LDZ2 #0040 SUB2 ADD2 .Screen/x DEO2
+ ( move ) OVR #f0 AND #02 DIV #00 SWP
+ .center/y LDZ2 #0040 SUB2 ADD2 .Screen/y DEO2
+ ( draw ) OVR #40 AND .DateTime/second DEI #03 DIV #03 AND ORA .Screen/sprite DEO
+ ( incr ) SWP #01 ADD SWP
+ NEQk ,&loop JCN
+ POP2
RTN
@draw-circle ( x* y* color depth -- )
@@ -141,6 +160,9 @@ RTN
@preview_icn [
0f38 675f dfbf bfbf 0007 1820 2344 4848
+@solid
+ ffff ffff ffff ffff
+
@font-hex
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c