uxn/projects/examples/devices/screen.blending.tal

95 lines
2.2 KiB
Tal
Raw Normal View History

2023-07-26 12:57:36 -04:00
( screen blending modes )
|00 @System &catch $2 &expansion $2 &pad $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|0100
@on-reset ( -> )
( | theme )
#f07f .System/r DEO2
#f0d6 .System/g DEO2
#f0b2 .System/b DEO2
( | size )
#0100 .Screen/width DEO2
2023-11-05 14:07:56 -05:00
#010c .Screen/height DEO2
2023-07-26 12:57:36 -04:00
( | background )
#02 <draw-strippes>
#0080 .Screen/x DEO2
#0000 .Screen/y DEO2
#03 <draw-strippes>
2023-11-05 14:07:56 -05:00
( | 1bpp )
2023-07-26 12:57:36 -04:00
#1000
&l1bg ( -- )
2023-07-26 12:57:36 -04:00
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
2024-02-26 12:25:29 -05:00
DUP <draw-circle>
INC GTHk ?&l1bg
POP2
#1000
&l1fg ( -- )
#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
2024-02-26 12:25:29 -05:00
DUP #40 ORA <draw-circle>
INC GTHk ?&l1fg
2023-11-05 14:07:56 -05:00
POP2
( | 2bpp )
#1000
&l2bg ( -- )
2023-11-05 14:07:56 -05:00
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
2023-07-26 12:57:36 -04:00
DUP #80 ORA <draw-circle>
INC GTHk ?&l2bg
POP2
#1000
&l2fg ( -- )
#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
DUP #c0 ORA <draw-circle>
INC GTHk ?&l2fg
POP2
BRK
@<draw-strippes> ( color -- )
,&color STR
#f2 .Screen/auto DEO
;check-icn .Screen/addr DEO2
#2200
&times ( -- )
[ LIT &color $1 ] .Screen/sprite DEO
INC GTHk ?&times
POP2
JMP2r
2023-07-26 12:57:36 -04:00
@<draw-circle> ( color -- )
#01 .Screen/auto DEO
;circle-chr .Screen/addr DEO2
DUP .Screen/sprite DEO
DUP #10 ORA .Screen/sprite DEO
.Screen/y DEI2k #0008 ADD2 ROT DEO2
DUP #20 ORA .Screen/sprite DEO
DUP #30 ORA .Screen/sprite DEO
@<draw-hex> ( color -- )
.Screen/y DEI2k #000c ADD2 ROT DEO2
#00 SWP #30 SFT ;font-icn ADD2 .Screen/addr DEO2
#09 .Screen/sprite DEO
2023-07-26 12:57:36 -04:00
JMP2r
@check-icn [ 0306 0c18 3060 c081 ]
2023-07-26 12:57:36 -04:00
@circle-chr [
2023-07-26 12:57:36 -04:00
071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
@font-icn ( 0-f )
[
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
007c 8280 f080 827c 007c 8280 f080 8080 ]