0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-12-03 02:57:25 +00:00
uxn/projects/examples/devices/screen.blending.tal

94 lines
2.2 KiB
Tal

( 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
#010c .Screen/height DEO2
( | background )
#02 <draw-strippes>
#0080 .Screen/x DEO2
#0000 .Screen/y DEO2
#03 <draw-strippes>
( | 1bpp )
#1000
&l1bg ( -- )
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
DUP #80 ORA #0f AND <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
DUP #c0 ORA #0f AND <draw-circle>
INC GTHk ?&l1fg
POP2
( | 2bpp )
#1000
&l2bg ( -- )
#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
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
@<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
JMP2r
@check-icn [ 0306 0c18 3060 c081 ]
@circle-chr [
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 ]