Browse code

Minor optimizations to noodle

neauoire authored on 25/03/2021 03:00:34
Showing 1 changed files
... ...
@@ -6,20 +6,15 @@
6 6
 	arrows - move zoom
7 7
 	space - toogle zoom
8 8
 	backspace - blank canvas
9
-	m - toggle mirror mode
10 9
 	1-8 - select brush size
11 10
 
12 11
 	TODO
13
-		- Only draw-canvas when mouse has changed
14
-		- Only draw-canvas target tile
15 12
 		- Resize buttons
16 13
 		- Limit size
17 14
 		- Pixel cleanup brush
18 15
 		- Drag canvas content
19
-		- [tool] fill rect
20
-		- [tool] spray
21
-		- [tool] pen
22
-		- [tool] line
16
+	BUGS
17
+		- Zoom drawing with other tools
23 18
 )
24 19
 
25 20
 %RTN   { JMP2r }
... ...
@@ -35,18 +30,23 @@
35 30
 
36 31
 ( variables )
37 32
 
33
+;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 }
34
+;brush { tool 1 size 1 patt 1 drag 1 last 1 oper 2 }
35
+;zoom { active 1 x 2 y 2 }
38 36
 ;center { x 2 y 2 }
37
+( interface )
39 38
 ;toolpane { x1 2 y1 2 x2 2 y2 2 }
40 39
 ;pattpane { x1 2 y1 2 x2 2 y2 2 }
41 40
 ;sizepane { x1 2 y1 2 x2 2 y2 2 }
42
-;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 tool 1 size 1 patt 1 drag 1 last 1 mirror 1 oper 2 }
43
-;zoom { active 1 x 2 y 2 }
41
+;canvas { x1 2 y1 2 x2 2 y2 2 w 2 h 2 }
42
+
44 43
 ;rect { x1 2 y1 2 x2 2 y2 2 }
45 44
 ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
46 45
 ;origin { x1 2 y1 2 x2 2 y2 2 }
47 46
 ;color { byte 1 }
48 47
 ;pt0 { x 2 y 2 }
49 48
 ;pt1 { x 2 y 2 }
49
+;pt2 { x 2 y 2 } ( paint-rect )
50 50
 ;px { x 1 y 1 }
51 51
 
52 52
 ( devices )
... ...
@@ -59,7 +59,7 @@
59 59
 |0150 ;Mouse { x 2 y 2 state 1 chord 1 }
60 60
 |0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
61 61
 |01F0 .RESET .FRAME .ERROR ( vectors )
62
-|01F8 [ f07c f0e2 f0c2 ]   ( palette )
62
+|01F8 [ c0ef c07f c05f ]   ( palette )
63 63
 
64 64
 ( program )
65 65
 
... ...
@@ -69,9 +69,9 @@
69 69
 	#002a =canvas.w #001a =canvas.h
70 70
 
71 71
 	( default brush )
72
-	#04 =cursor.size
73
-	#00 =cursor.patt
74
-	#00 =cursor.tool
72
+	#04 =brush.size
73
+	#00 =brush.patt
74
+	#00 =brush.tool
75 75
 
76 76
 	( load file )
77 77
 	,filepath ,load-file JSR2
... ...
@@ -111,7 +111,7 @@ BRK
111 111
 	,draw-cursor JSR2
112 112
 
113 113
 	( release drag )
114
-	,$no-release ~Mouse.state #00 EQU ~cursor.drag #01 EQU #0101 NEQ2 JMP2?
114
+	,$no-release ~Mouse.state #00 EQU ~brush.drag #01 EQU #0101 NEQ2 JMP2?
115 115
 		~origin.x1 #0002 SUB2 ~origin.y1 #0002 SUB2 ~origin.x2 #0002 ADD2 ~origin.y2 #0002 ADD2 #00 ,fill-rect JSR2
116 116
 		~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #10 ,line-rect JSR2
117 117
 		,draw-background JSR2
... ...
@@ -119,13 +119,13 @@ BRK
119 119
 		,draw-toolpane JSR2
120 120
 		,draw-pattpane JSR2
121 121
 		,draw-sizepane JSR2
122
-		#00 =cursor.drag
122
+		#00 =brush.drag
123 123
 	$no-release
124 124
 
125 125
 	( operations on release line/rect )
126
-	,$no-touch-change ~Mouse.state ~cursor.last EQU JMP2?
127
-		,$no-touch-change ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JMP2?
128
-		,$no-touch-change ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2?
126
+	,$no-touch-change ~Mouse.state ~brush.last EQU JMP2?
127
+	,$no-touch-change ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JMP2?
128
+	,$no-touch-change ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2?
129 129
 		,$no-touch-ondown ~Mouse.state #00 EQU JMP2?
130 130
 			( on down )
131 131
 			~Mouse.x =cursor.dx
... ...
@@ -133,12 +133,12 @@ BRK
133 133
 		$no-touch-ondown
134 134
 		,$no-touch-onup ~Mouse.state #00 NEQ JMP2?
135 135
 			( on up )
136
-			,$no-touch-line ~cursor.tool #02 NEQ JMP2?
137
-				~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 #01 ,paint-line JSR2
136
+			,$no-touch-line ~brush.tool #02 NEQ JMP2?
137
+				~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-line JSR2
138 138
 				,$touch-end JMP2
139 139
 			$no-touch-line
140
-			,$no-touch-rect ~cursor.tool #03 NEQ JMP2?
141
-				~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 #01 ,paint-rect JSR2
140
+			,$no-touch-rect ~brush.tool #03 NEQ JMP2?
141
+				~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-rect JSR2
142 142
 				,$touch-end JMP2
143 143
 			$no-touch-rect
144 144
 		$no-touch-onup
... ...
@@ -148,7 +148,7 @@ BRK
148 148
 
149 149
 		( drag )
150 150
 		,$no-drag ~Controller #02 NEQ JMP2?
151
-			,$no-drag-start ~cursor.drag #00 NEQ JMP2?
151
+			,$no-drag-start ~brush.drag #00 NEQ JMP2?
152 152
 				~canvas.x1 =origin.x1
153 153
 				~canvas.y1 =origin.y1
154 154
 				~canvas.x2 =origin.x2
... ...
@@ -160,7 +160,7 @@ BRK
160 160
 			~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2 
161 161
 			~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2 
162 162
 			~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #13 ,line-rect JSR2
163
-			#01 =cursor.drag
163
+			#01 =brush.drag
164 164
 			,$touch-end JMP2
165 165
 		$no-drag
166 166
 
... ...
@@ -168,8 +168,8 @@ BRK
168 168
 		,$no-touch-sizepane ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 NEQ2 JMP2?
169 169
 		,$no-touch-sizepane ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 NEQ2 JMP2?
170 170
 			( release ) #00 =Mouse.state
171
-			#01 =cursor.tool
172
-			~Mouse.x ~sizepane.x1 SUB2 8/ SWP POP =cursor.size
171
+			#01 =brush.tool
172
+			~Mouse.x ~sizepane.x1 SUB2 8/ SWP POP =brush.size
173 173
 			( draw ) ,draw-sizepane JSR2
174 174
 			( draw ) ,draw-toolpane JSR2
175 175
 			,$touch-end JMP2
... ...
@@ -179,7 +179,7 @@ BRK
179 179
 		,$no-touch-pattpane ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 NEQ2 JMP2?
180 180
 		,$no-touch-pattpane ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 NEQ2 JMP2?
181 181
 			( release ) #00 =Mouse.state
182
-			~Mouse.x ~pattpane.x1 SUB2 8/ SWP POP =cursor.patt
182
+			~Mouse.x ~pattpane.x1 SUB2 8/ SWP POP =brush.patt
183 183
 			( draw ) ,draw-pattpane JSR2
184 184
 			,$touch-end JMP2
185 185
 		$no-touch-pattpane
... ...
@@ -188,7 +188,7 @@ BRK
188 188
 		,$no-touch-toolpane ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 NEQ2 JMP2?
189 189
 		,$no-touch-toolpane ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 NEQ2 JMP2?
190 190
 			( release ) #00 =Mouse.state
191
-			~Mouse.x ~toolpane.x1 SUB2 8/ SWP POP =cursor.tool
191
+			~Mouse.x ~toolpane.x1 SUB2 8/ SWP POP =brush.tool
192 192
 			( draw ) ,draw-toolpane JSR2
193 193
 			,$touch-end JMP2
194 194
 		$no-touch-toolpane
... ...
@@ -198,14 +198,14 @@ BRK
198 198
 		,$no-touch-canvas ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2?
199 199
 
200 200
 			( set cursor operation )
201
-			,add-pixel ,$no-oper ~Mouse.state #01 EQU JMP2? POP2 ,remove-pixel $no-oper =cursor.oper
201
+			,add-pixel ,$no-oper ~Mouse.state #01 EQU JMP2? POP2 ,remove-pixel $no-oper =brush.oper
202 202
 
203
-			,$no-touch-pen ~cursor.tool #00 NEQ JMP2?
204
-				~cursor.x0 ~canvas.x1 SUB2 ~cursor.y0 ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 #01 ,paint-line JSR2
203
+			,$no-touch-pen ~brush.tool #00 NEQ JMP2?
204
+				~cursor.x0 ~canvas.x1 SUB2 ~cursor.y0 ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-line JSR2
205 205
 				,$touch-end JMP2
206 206
 			$no-touch-pen
207 207
 
208
-			,$no-touch-brush ~cursor.tool #01 NEQ JMP2?
208
+			,$no-touch-brush ~brush.tool #01 NEQ JMP2?
209 209
 				~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-brush JSR2
210 210
 				,$touch-end JMP2
211 211
 			$no-touch-brush
... ...
@@ -215,20 +215,17 @@ BRK
215 215
 		( background interface )
216 216
 		,$no-touch-background ~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 JMP2?
217 217
 			~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ 
218
-			DUP2 
219
-			#0000 NEQ2 ,$no-toggle-zoom ROT JMP2?
218
+			DUP2 #0000 NEQ2 ,$no-toggle-zoom ROT JMP2?
220 219
 				~zoom.active #00 EQU =zoom.active
221 220
 				( release ) #00 =Mouse.state
222 221
 				,redraw JSR2
223 222
 			$no-toggle-zoom
224
-			DUP2 
225
-			#0001 NEQ2 ,$no-load-button ROT JMP2?
223
+			DUP2 #0001 NEQ2 ,$no-load-button ROT JMP2?
226 224
 				,filepath ,load-file JSR2
227 225
 				,draw-canvas JSR2
228 226
 				( release ) #00 =Mouse.state
229 227
 			$no-load-button
230
-			DUP2 
231
-			#0002 NEQ2 ,$no-save-button ROT JMP2?
228
+			DUP2 #0002 NEQ2 ,$no-save-button ROT JMP2?
232 229
 				,filepath ,save-file JSR2
233 230
 				( release ) #00 =Mouse.state
234 231
 			$no-save-button
... ...
@@ -257,19 +254,24 @@ BRK
257 254
 			( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space 
258 255
 		DUP #08 NEQ ,$no-backspace ROT JMP2?
259 256
 			( erase ) ,clear JSR2 $no-backspace
260
-		DUP #6d NEQ ,$no-mkey ROT JMP2?
261
-			( mirror ) ~cursor.mirror #00 EQU =cursor.mirror $no-mkey
257
+		DUP #71 NEQ ,$no-qkey ROT JMP2?
258
+			( tool0 ) #00 =brush.tool ,draw-toolpane JSR2 $no-qkey
259
+		DUP #77 NEQ ,$no-wkey ROT JMP2?
260
+			( tool0 ) #01 =brush.tool ,draw-toolpane JSR2 $no-wkey
261
+		DUP #65 NEQ ,$no-ekey ROT JMP2?
262
+			( tool0 ) #02 =brush.tool ,draw-toolpane JSR2 $no-ekey
263
+		DUP #72 NEQ ,$no-rkey ROT JMP2?
264
+			( tool0 ) #03 =brush.tool ,draw-toolpane JSR2 $no-rkey
262 265
 		DUP 
263 266
 			DUP #30 GTH SWP #39 LTH #0101 NEQ2 ,$no-numkey ROT JMP2?
264
-			( size ) ~Keys #31 SUB =cursor.size ,draw-sizepane JSR2 $no-numkey
267
+			( size ) ~Keys #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey
265 268
 		POP
266
-		
267 269
 		( release ) #00 =Keys
268 270
 	$no-keys
269 271
 
270 272
 	~Mouse.x =cursor.x0
271 273
 	~Mouse.y =cursor.y0
272
-	~Mouse.state =cursor.last
274
+	~Mouse.state =brush.last
273 275
 
274 276
 BRK
275 277
 
... ...
@@ -307,16 +309,16 @@ RTN
307 309
 
308 310
 RTN
309 311
 
310
-@paint-line ( x1 y1 x2 y2 color )
312
+@paint-line ( x1 y1 x2 y2 )
311 313
 	
312
-	( load ) =color =line.y0 =line.x0 =line.y =line.x
314
+	( load ) =line.y0 =line.x0 =line.y =line.x
313 315
 	~line.x0 ~line.x SUB2 ABS2 =line.dx
314 316
 	~line.y0 ~line.y SUB2 ABS2 #0000 SWP2 SUB2 =line.dy
315 317
 	#ffff #00 ~line.x ~line.x0 LTS2 #0002 MUL2 ADD2 =line.sx 
316 318
 	#ffff #00 ~line.y ~line.y0 LTS2 #0002 MUL2 ADD2 =line.sy 
317 319
 	~line.dx ~line.dy ADD2 =line.e1
318 320
 	$loop
319
-		( paint ) ~line.x ~line.y ~cursor.oper JSR2
321
+		( paint ) ~line.x ~line.y ~brush.oper JSR2
320 322
 		,$end ~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 JMP2?
321 323
 		~line.e1 #0002 MUL2 =line.e2
322 324
 		,$skipy ~line.e2 ~line.dy LTS2 JMP2?
... ...
@@ -338,22 +340,20 @@ RTN
338 340
 
339 341
 RTN
340 342
 
341
-;rpt { x 2 y 2 }
342
-
343
-@paint-rect ( x1 y1 x2 y2 color )
343
+@paint-rect ( x1 y1 x2 y2  )
344 344
 
345
-	( load ) =color =rect.y2 =rect.x2 DUP2 =rpt.y =rect.y1 DUP2 =rpt.x =rect.x1
345
+	( load ) =rect.y2 =rect.x2 DUP2 =pt2.y =rect.y1 DUP2 =pt2.x =rect.x1
346 346
 	$ver
347
-		~rect.x1 =rpt.x
347
+		~rect.x1 =pt2.x
348 348
 		$hor
349
-			~rpt.x SWP POP =px.x ~rpt.y SWP POP =px.y
349
+			~pt2.x SWP POP =px.x ~pt2.y SWP POP =px.y
350 350
 			,$no-pixel ,patternize JSR2 #00 EQU JMP2?
351
-				( draw ) ~rpt.x ~rpt.y ~cursor.oper JSR2
351
+				( draw ) ~pt2.x ~pt2.y ~brush.oper JSR2
352 352
 			$no-pixel
353
-			( incr ) ~rpt.x ++ =rpt.x
354
-			,$hor ~rpt.x ~rect.x2 LTH2 JMP2?
355
-		~rpt.y ++ =rpt.y
356
-		,$ver ~rpt.y ~rect.y2 LTH2 JMP2?
353
+			( incr ) ~pt2.x ++ =pt2.x
354
+			,$hor ~pt2.x ~rect.x2 LTH2 JMP2?
355
+		~pt2.y ++ =pt2.y
356
+		,$ver ~pt2.y ~rect.y2 LTH2 JMP2?
357 357
 
358 358
 	,draw-canvas JSR2
359 359
 	,draw-toolpane JSR2
... ...
@@ -382,11 +382,11 @@ RTN
382 382
 	$ver
383 383
 		#00 =px.x
384 384
 		$hor
385
-			( addr ) ,size_icn #00 ~cursor.size 8* ADD2
385
+			( addr ) ,size_icn #00 ~brush.size 8* ADD2
386 386
 			( byte ) #00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND 
387 387
 			#00 EQU ,$no-pixel ROT JMP2?
388 388
 				,$no-pixel ,patternize JSR2 #00 EQU JMP2?
389
-				~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~cursor.oper JSR2
389
+				~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~brush.oper JSR2
390 390
 			$no-pixel
391 391
 			( incr ) ~px.x #01 ADD =px.x
392 392
 			,$hor ~px.x #08 LTH JMP2?
... ...
@@ -402,46 +402,44 @@ RTN
402 402
 
403 403
 @patternize
404 404
 
405
-	,$noplain ~cursor.patt #00 NEQ JMP2?
405
+	,$noplain ~brush.patt #00 NEQ JMP2?
406 406
 		#01 RTN
407 407
 	$noplain
408 408
 
409
-	,$notone1 ~cursor.patt #01 NEQ JMP2?
409
+	,$notone1 ~brush.patt #01 NEQ JMP2?
410 410
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0001 AND2 #0000 EQU2 
411 411
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0001 AND2 #0000 EQU2 
412 412
 		#0101 EQU2
413 413
 		RTN
414 414
 	$notone1
415 415
 
416
-	,$notone2 ~cursor.patt #02 NEQ JMP2?
416
+	,$notone2 ~brush.patt #02 NEQ JMP2?
417 417
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 
418 418
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 
419 419
 		#0101 EQU2
420 420
 		RTN
421 421
 	$notone2
422 422
 
423
-	,$notone3 ~cursor.patt #03 NEQ JMP2?
423
+	,$notone3 ~brush.patt #03 NEQ JMP2?
424 424
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0005 AND2 #0000 EQU2 
425 425
 		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0005 AND2 #0000 EQU2 
426 426
 		#0101 EQU2
427 427
 		RTN
428 428
 	$notone3
429 429
 
430
-	,$notone4 ~cursor.patt #04 NEQ JMP2?
431
-		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2 
432
-		RTN
430
+	,$notone4 ~brush.patt #04 NEQ JMP2?
431
+		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ADD2 #0003 AND2 #0000 EQU2  RTN
433 432
 	$notone4
434 433
 
435
-	,$notone5 ~cursor.patt #05 NEQ JMP2?
436
-		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2 
437
-		RTN
434
+	,$notone5 ~brush.patt #05 NEQ JMP2?
435
+		~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 SUB2 #0003 AND2 #0000 EQU2  RTN
438 436
 	$notone5
439 437
 
440
-	,$notone6 ~cursor.patt #06 NEQ JMP2?
438
+	,$notone6 ~brush.patt #06 NEQ JMP2?
441 439
 		~pt0.x #00 ~px.x ADD2 #0001 AND2 SWP POP RTN
442 440
 	$notone6
443 441
 
444
-	,$notone7 ~cursor.patt #07 NEQ JMP2?
442
+	,$notone7 ~brush.patt #07 NEQ JMP2?
445 443
 		~pt0.y #00 ~px.y ADD2 #0001 AND2 SWP POP RTN
446 444
 	$notone7
447 445
 
... ...
@@ -449,7 +447,7 @@ RTN
449 447
 
450 448
 RTN
451 449
 
452
-@get-pixel ( x y )
450
+@get-pixel ( x y -- b )
453 451
 
454 452
 	SWP POP #07 AND =px.y
455 453
 	SWP POP #07 AND =px.x
... ...
@@ -459,7 +457,7 @@ RTN
459 457
 
460 458
 RTN
461 459
 
462
-@add-pixel ( x y )
460
+@add-pixel ( x y  )
463 461
 
464 462
 	=pt1.y =pt1.x
465 463
 	( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 
... ...
@@ -555,19 +553,18 @@ RTN
555 553
 	~Mouse.y =cursor.y
556 554
 
557 555
 	( draw size cursor )
558
-	,$outside-canvas ~cursor.tool #01 NEQ JMP2?
556
+	,$outside-canvas ~brush.tool #01 NEQ JMP2?
559 557
 	,$outside-canvas ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 JMP2?
560 558
 	,$outside-canvas ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 JMP2?	
561 559
 		( do not draw size in toolpane )
562
-		,$outside-canvas
563
-		~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 
564
-		~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 
565
-		#0101 EQU2 JMP2?
560
+		,$outside-canvas ~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 JMP2?
561
+		,$outside-canvas ~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 JMP2?
562
+		,$outside-canvas ~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 JMP2?
566 563
 		( do not draw size when holding alt )
567 564
 		,$outside-canvas ~Controller #02 EQU JMP2?
568 565
 		~cursor.x #0003 SUB2 =Sprite.x
569 566
 		~cursor.y #0003 SUB2 =Sprite.y
570
-		,brush_view #00 ~cursor.size 8* ADD2 =Sprite.addr
567
+		,brush_view #00 ~brush.size 8* ADD2 =Sprite.addr
571 568
 		#11 ~Mouse.state #02 MUL ADD =Sprite.color
572 569
 		,$outside-canvas ~Mouse.state #00 EQU JMP2?
573 570
 			RTN
... ...
@@ -590,7 +587,7 @@ RTN
590 587
 	,tool_icn =Sprite.addr
591 588
 
592 589
 	$tools
593
-		( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~cursor.tool EQU #02 MUL ADD =Sprite.color
590
+		( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Sprite.color
594 591
 		( incr ) ~Sprite.x 8+ =Sprite.x
595 592
 		( incr ) ~Sprite.addr 8+ =Sprite.addr
596 593
 		,$tools ~Sprite.x ~toolpane.x2 LTH2 JMP2?
... ...
@@ -607,7 +604,7 @@ RTN
607 604
 	,patt_icn =Sprite.addr
608 605
 
609 606
 	$patterns
610
-		( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~cursor.patt EQU #02 MUL ADD =Sprite.color
607
+		( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Sprite.color
611 608
 		( incr ) ~Sprite.x 8+ =Sprite.x
612 609
 		( incr ) ~Sprite.addr 8+ =Sprite.addr
613 610
 		,$patterns ~Sprite.x ~pattpane.x2 LTH2 JMP2?
... ...
@@ -624,7 +621,7 @@ RTN
624 621
 	,size_icn =Sprite.addr
625 622
 
626 623
 	$patterns
627
-		( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~cursor.size EQU #02 MUL ADD =Sprite.color
624
+		( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Sprite.color
628 625
 		( incr ) ~Sprite.x 8+ =Sprite.x
629 626
 		( incr ) ~Sprite.addr 8+ =Sprite.addr
630 627
 		,$patterns ~Sprite.x ~sizepane.x2 LTH2 JMP2?
... ...
@@ -787,6 +784,4 @@ RTN
787 784
 
788 785
 @ERROR BRK 
789 786
 
790
-;canvas { w 2 h 2 x1 2 y1 2 x2 2 y2 2 }
791
-
792 787
 @data [ ]