commit 98712d1

Devine Lu Linvega  ·  2024-12-16 16:37:12 +0000 UTC
parent 3fa23b6
Improved screen bounds example
1 files changed,  +58, -47
+58, -47
  1@@ -1,49 +1,60 @@
  2+( )
  3+
  4 |00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1
  5 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
  6 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
  7 
  8-|0100
  9+|100
 10 
 11 @on-reset ( -> )
 12 	#375e .System/r DEO2
 13 	#286c .System/g DEO2
 14 	#2358 .System/b DEO2
 15 	;on-mouse .Mouse/vector DEO2
 16+	( | draw fills )
 17+	#0080 .Screen/x DEO2
 18+	#0080 .Screen/y DEO2
 19+	#82 .Screen/pixel DEO
 20+	#93 .Screen/pixel DEO
 21+	#a1 .Screen/pixel DEO
 22+	( | guide )
 23 	<draw-guide>
 24+	#00a0 .Screen/x DEO2
 25+	#00a0 .Screen/y DEO2
 26+	<draw-portraits>
 27 	BRK
 28 
 29 @on-mouse ( -> )
 30-	( | clear background )
 31+	( | clear foreground )
 32 	#0000 DUP2 .Screen/x DEO2
 33 	.Screen/y DEO2
 34-	#80 .Screen/pixel DEO
 35-	( | draw fills )
 36-	#0080 DUP2 .Screen/x DEO2
 37-	.Screen/y DEO2
 38-	#82 .Screen/pixel DEO
 39-	#93 .Screen/pixel DEO
 40-	#a1 .Screen/pixel DEO
 41+	#c0 .Screen/pixel DEO
 42 	<draw-guide>
 43 	( | cursor )
 44 	#41 ;cursor-icn <update-cursor>
 45-	( | draw portrait )
 46+	<draw-portraits>
 47+	( | 1bpp )
 48+	#0020 .Screen/x DEO2
 49+	#0020 .Screen/y DEO2
 50+	<draw-box>
 51+	BRK
 52+
 53+@<draw-portraits> ( -- )
 54+	( | 2bpp )
 55+	[ LIT2 36 -Screen/auto ] DEO
 56 	.Screen/x DEI2k #0008 ADD2 ROT DEO2
 57 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
 58-	[ LIT2 36 -Screen/auto ] DEO
 59-	#81 <draw-portrait>
 60+	#8140 ORA <draw-portrait>
 61 	.Screen/x DEI2k #0010 SUB2 ROT DEO2
 62 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
 63-	#91 <draw-portrait>
 64+	#9140 ORA <draw-portrait>
 65 	.Screen/x DEI2k #0000 SUB2 ROT DEO2
 66 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
 67-	#b1 <draw-portrait>
 68+	#b140 ORA <draw-portrait>
 69 	.Screen/x DEI2k #0010 ADD2 ROT DEO2
 70 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
 71-	#a1 <draw-portrait>
 72-	( <draw-box>
 73-	.Screen/y DEI2k #0060 SUB2 ROT DEO2
 74-	<draw-box> )
 75-	BRK
 76+	#a140 ORA !<draw-portrait>
 77+
 78 
 79 @<draw-portrait> ( color -- )
 80 	;portrait-chr .Screen/addr DEO2
 81@@ -56,42 +67,44 @@
 82 	JMP2r
 83 
 84 @<draw-circle> ( color -- )
 85-	#01 .Screen/auto DEO
 86-	;circle-chr .Screen/addr DEO2
 87+	[ LITr -Screen/x ] DEI2r ;circle-chr .Screen/addr DEO2
 88 	DUP .Screen/sprite DEO
 89 	DUP #10 ORA .Screen/sprite DEO
 90 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
 91 	DUP #20 ORA .Screen/sprite DEO
 92 	#30 ORA .Screen/sprite DEO
 93+	.Screen/y DEI2k #0008 SUB2 ROT DEO2
 94+	[ LIT2r 0010 ] ADD2r [ LITr -Screen/x ] DEO2r
 95 	JMP2r
 96 
 97 @<draw-guide> ( -- )
 98-	#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
 99+	#0080 DUP2 .Screen/x DEO2
100+	.Screen/y DEO2
101 	#f2 .Screen/auto DEO
102 	;guide-icn .Screen/addr DEO2
103 	#1000
104-	&l ( -- ) 
105-		#05 .Screen/sprite DEO
106-		INC GTHk ?&l 
107+	&>l ( -- )
108+		#01 .Screen/sprite DEO
109+		INC GTHk ?&>l
110 	POP2
111-	( | circles )
112-	#0010 DUP2 .Screen/x DEO2 .Screen/y DEO2
113-	#02 <draw-circle>
114-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
115-	#82 <draw-circle>
116-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
117-	#05 <draw-circle>
118-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
119-	#85 <draw-circle>
120-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
121-	#03 <draw-circle>
122-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
123-	#83 <draw-circle>
124-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
125-	#0a <draw-circle>
126-	.Screen/y DEI2k #0008 ADD2 ROT DEO2
127-	#8a <draw-circle>
128-	JMP2r
129+	( | circles 1bpp )
130+	#0090 .Screen/x DEO2
131+	#0010 .Screen/y DEO2
132+	#01 .Screen/auto DEO
133+	#0f00
134+	&>ll ( -- )
135+		DUP <draw-circle>
136+		INC GTHk ?&>ll
137+	POP2
138+	( | circles 2bpp )
139+	#0090 .Screen/x DEO2
140+	#0020 .Screen/y DEO2
141+	#01 .Screen/auto DEO
142+	#0f00
143+	&>lll ( -- )
144+		DUP #80 ORA <draw-circle>
145+		INC GTHk ?&>lll
146+	POP2 JMP2r
147 
148 @<update-cursor> ( color addr* -- )
149 	[ LIT2 00 -Screen/auto ] DEO
150@@ -107,7 +120,7 @@
151 	.Screen/sprite DEO
152 	JMP2r
153 
154-@guide-icn [ 0101 0101 0101 01ff ]
155+@guide-icn [ 8000 0000 0000 0000 ]
156 
157 @fill-icn [ ffff ffff ffff ffff ]
158 
159@@ -141,7 +154,5 @@
160 	4142 4448 5020 1f00 0000 0000 0000 ff00
161 	0000 0000 0000 ff00 8242 2212 0a04 f800 ]
162 
163-@circle-chr [
164-	071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
165-
166+@circle-chr [ 071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
167