uxn

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

screen.bounds.tal (3683B)


      1 |00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
      2 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
      3 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
      4 
      5 |0100
      6 
      7 @on-reset ( -> )
      8 	#375e .System/r DEO2
      9 	#286c .System/g DEO2
     10 	#2358 .System/b DEO2
     11 	;on-mouse .Mouse/vector DEO2
     12 	<draw-guide>
     13 	BRK
     14 
     15 @on-mouse ( -> )
     16 	( | clear background )
     17 	#0000 DUP2 .Screen/x DEO2
     18 	.Screen/y DEO2
     19 	#80 .Screen/pixel DEO
     20 	<draw-guide>
     21 	( | cursor )
     22 	#41 ;cursor-icn <update-cursor>
     23 	( | draw portrait )
     24 	.Screen/x DEI2k #0008 ADD2 ROT DEO2
     25 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
     26 	[ LIT2 36 -Screen/auto ] DEO
     27 	#81 <draw-portrait>
     28 	.Screen/x DEI2k #0010 SUB2 ROT DEO2
     29 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
     30 	#91 <draw-portrait>
     31 	.Screen/x DEI2k #0000 SUB2 ROT DEO2
     32 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
     33 	#b1 <draw-portrait>
     34 	.Screen/x DEI2k #0010 ADD2 ROT DEO2
     35 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
     36 	#a1 <draw-portrait>
     37 	( <draw-box>
     38 	.Screen/y DEI2k #0060 SUB2 ROT DEO2
     39 	<draw-box> )
     40 	BRK
     41 
     42 @<draw-portrait> ( color -- )
     43 	;portrait-chr .Screen/addr DEO2
     44 	.Screen/sprite DEOk DEOk DEOk DEO
     45 	JMP2r
     46 
     47 @<draw-box> ( -- )
     48 	;box-icn .Screen/addr DEO2
     49 	#05 .Screen/sprite DEOk DEOk DEOk DEO
     50 	JMP2r
     51 
     52 @<draw-circle> ( color -- )
     53 	#01 .Screen/auto DEO
     54 	;circle-chr .Screen/addr DEO2
     55 	DUP .Screen/sprite DEO
     56 	DUP #10 ORA .Screen/sprite DEO
     57 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     58 	DUP #20 ORA .Screen/sprite DEO
     59 	#30 ORA .Screen/sprite DEO
     60 	JMP2r
     61 
     62 @<draw-guide> ( -- )
     63 	#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
     64 	#f2 .Screen/auto DEO
     65 	;guide-icn .Screen/addr DEO2
     66 	#1000
     67 	&l ( -- ) 
     68 		#01 .Screen/sprite DEO
     69 		INC GTHk ?&l 
     70 	POP2
     71 	( | circles )
     72 	#0010 DUP2 .Screen/x DEO2 .Screen/y DEO2
     73 	#02 <draw-circle>
     74 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     75 	#82 <draw-circle>
     76 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     77 	#05 <draw-circle>
     78 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     79 	#85 <draw-circle>
     80 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     81 	#03 <draw-circle>
     82 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     83 	#83 <draw-circle>
     84 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     85 	#0a <draw-circle>
     86 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
     87 	#8a <draw-circle>
     88 	JMP2r
     89 
     90 @<update-cursor> ( color addr* -- )
     91 	[ LIT2 00 -Screen/auto ] DEO
     92 	;fill-icn .Screen/addr DEO2
     93 	#40 <draw-cursor>
     94 	.Mouse/x DEI2 ,<draw-cursor>/x STR2
     95 	.Mouse/y DEI2 ,<draw-cursor>/y STR2
     96 	.Screen/addr DEO2
     97 
     98 @<draw-cursor> ( color -- )
     99 	[ LIT2 &x $2 ] .Screen/x DEO2
    100 	[ LIT2 &y $2 ] .Screen/y DEO2
    101 	.Screen/sprite DEO
    102 	JMP2r
    103 
    104 @guide-icn [ 0101 0101 0101 01ff ]
    105 
    106 @fill-icn [ ffff ffff ffff ffff ]
    107 
    108 @cursor-icn [ 80c0 e0f0 f8e0 1000 ]
    109 
    110 @portrait-chr [
    111 	070f 1e1d 1b3b 3b3b f0e0 c0c0 d08b 8080
    112 	f76f cf9f 9f5f 5f5f 0000 0007 1c40 4040
    113 	fffb f975 7576 7667 0000 3164 0406 0607
    114 	efef efef eddd 9e1e 0060 8000 0000 0000
    115 	3b2b 280d 0105 0506 8080 8081 e1f1 f1f0
    116 	5f6c 639b 0f27 77ab 4060 639b 0f27 67ab
    117 	0dc8 b0e5 cded fdfc 0dc8 b0e4 ccec fcfc
    118 	5e1e 1c9c 9d1d 5d59 4000 0080 8000 4040
    119 	0607 0707 070e 0e0e f0f0 f0f0 f0e0 e0e0
    120 	fb73 7fb7 bbbf bfdd f373 7b37 3b3f 3f1c
    121 	ffff ffff ffff ffff ffff ffff ffff ff7f
    122 	dba7 97f7 f7ed dd9d c080 90f0 f0e0 c080
    123 	1e0e 0000 0000 0000 c0c0 f0ff ffff ffff
    124 	ee03 0000 0000 0000 0e12 fcff ffff ffff
    125 	fffc f30f 1f1f 1f3f 9f3c f30f dfdf dfbf
    126 	3c80 8080 80c0 c0e0 0003 3fbf bfbf dfef ]
    127 
    128 @box-icn [
    129 	001f 2050 4844 4241 00ff 0000 0000 0000
    130 	00ff 0000 0000 0000 00f8 040a 1222 4282
    131 	4040 4040 4040 4040 8040 2010 0804 0201
    132 	0102 0408 1020 4080 0202 0202 0202 0202
    133 	4040 4040 4040 4040 0102 0408 1020 4080
    134 	8040 2010 0804 0201 0202 0202 0202 0202
    135 	4142 4448 5020 1f00 0000 0000 0000 ff00
    136 	0000 0000 0000 ff00 8242 2212 0a04 f800 ]
    137 
    138 @circle-chr [
    139 	071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
    140 
    141