uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

screen.blending.tal (2254B)


      1 ( screen blending modes )
      2 
      3 |00 @System &catch $2 &expansion $2 &pad $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
      4 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
      5 
      6 |0100
      7 
      8 @on-reset ( -> )
      9 	( | theme )
     10 	#f07f .System/r DEO2
     11 	#f0d6 .System/g DEO2
     12 	#f0b2 .System/b DEO2
     13 	( | size )
     14 	#0100 .Screen/width DEO2
     15 	#010c .Screen/height DEO2
     16 	( | background )
     17 	#02 <draw-strippes>
     18 	#0080 .Screen/x DEO2
     19 	#0000 .Screen/y DEO2
     20 	#03 <draw-strippes>
     21 	( | 1bpp )
     22 	#1000
     23 	&l1bg ( -- )
     24 		#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
     25 		#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
     26 		DUP <draw-circle>
     27 		INC GTHk ?&l1bg
     28 	POP2
     29 	#1000
     30 	&l1fg ( -- )
     31 		#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
     32 		#00 OVR #02 SFT #50 SFT2 #0008 ADD2 .Screen/y DEO2
     33 		DUP #40 ORA <draw-circle>
     34 		INC GTHk ?&l1fg
     35 	POP2
     36 	( | 2bpp )
     37 	#1000
     38 	&l2bg ( -- )
     39 		#00 OVR #03 AND #50 SFT2 #0008 ADD2 .Screen/x DEO2
     40 		#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
     41 		DUP #80 ORA <draw-circle>
     42 		INC GTHk ?&l2bg
     43 	POP2
     44 	#1000
     45 	&l2fg ( -- )
     46 		#00 OVR #03 AND #50 SFT2 #0088 ADD2 .Screen/x DEO2
     47 		#00 OVR #02 SFT #50 SFT2 #0088 ADD2 .Screen/y DEO2
     48 		DUP #c0 ORA <draw-circle>
     49 		INC GTHk ?&l2fg
     50 	POP2
     51 	BRK
     52 
     53 @<draw-strippes> ( color -- )
     54 	,&color STR
     55 	#f2 .Screen/auto DEO
     56 	;check-icn .Screen/addr DEO2
     57 	#2200
     58 	&times ( -- )
     59 		[ LIT &color $1 ] .Screen/sprite DEO
     60 		INC GTHk ?&times
     61 	POP2
     62 	JMP2r
     63 
     64 @<draw-circle> ( color -- )
     65 	#01 .Screen/auto DEO
     66 	;circle-chr .Screen/addr DEO2
     67 	DUP .Screen/sprite DEO
     68 	DUP #10 ORA .Screen/sprite DEO
     69 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     70 	DUP #20 ORA .Screen/sprite DEO
     71 	DUP #30 ORA .Screen/sprite DEO
     72 
     73 @<draw-hex> ( color -- )
     74 	.Screen/y DEI2k #000c ADD2 ROT DEO2
     75 	#00 SWP #30 SFT ;font-icn ADD2 .Screen/addr DEO2
     76 	#09 .Screen/sprite DEO
     77 	JMP2r
     78 
     79 @check-icn [ 0306 0c18 3060 c081 ]
     80 
     81 @circle-chr [
     82 	071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
     83 
     84 @font-icn ( 0-f )
     85 	[
     86 	007c 8282 8282 827c 0030 1010 1010 1010
     87 	007c 8202 7c80 80fe 007c 8202 1c02 827c
     88 	000c 1424 4484 fe04 00fe 8080 7c02 827c
     89 	007c 8280 fc82 827c 007c 8202 1e02 0202
     90 	007c 8282 7c82 827c 007c 8282 7e02 827c
     91 	007c 8202 7e82 827e 00fc 8282 fc82 82fc
     92 	007c 8280 8080 827c 00fc 8282 8282 82fc
     93 	007c 8280 f080 827c 007c 8280 f080 8080 ]
     94