Browse code

Optimization on noodle

neauoire authored on 06/04/2021 17:45:53
Showing 9 changed files
... ...
@@ -26,14 +26,11 @@ Read more in the [Uxambly Guide](https://wiki.xxiivv.com/site/uxambly.html).
26 26
 
27 27
 ( devices )
28 28
 
29
-|0100 ;Console { pad 8 char 1 byte 1 short 2 }
30
-|0200 ^RESET JMP
31
-|0204 ,ERROR JMP2
32
-|0208 ,FRAME JMP2
29
+|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 }
33 30
 
34 31
 ( program )
35 32
 
36
-@RESET 
33
+|0200
37 34
 	
38 35
 	,text1 ,print-label JSR2
39 36
 	,text2 ,print-label JSR2
... ...
@@ -54,9 +51,6 @@ RTN
54 51
 
55 52
 @text1 [ Welcome 20 to 20 UxnVM 0a00 ]
56 53
 @text2 [ Hello 20 World 0a00 ] 
57
-
58
-@FRAME BRK
59
-@ERROR BRK 
60 54
 ```
61 55
 
62 56
 ## TODOs
... ...
@@ -28,7 +28,7 @@ else
28 28
 fi
29 29
 
30 30
 echo "Assembling.."
31
-./bin/assembler projects/software/nasu.usm bin/boot.rom
31
+./bin/assembler projects/software/noodle.usm bin/boot.rom
32 32
 
33 33
 echo "Running.."
34 34
 if [ "${2}" = '--cli' ]; 
... ...
@@ -4,12 +4,11 @@
4 4
 
5 5
 ( devices )
6 6
 
7
-|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
8 7
 |0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 }
9 8
 
10 9
 ( program )
11 10
 
12
-|0200 @RESET 
11
+|0200
13 12
 	
14 13
 	,text1 ,print-label JSR2
15 14
 	,text2 ,print-label JSR2
... ...
@@ -11,16 +11,11 @@
11 11
 ( devices )
12 12
 
13 13
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
14
-|0110 ;Console { pad 8 char 1 byte 1 short 2 }
15 14
 |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
16 15
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
17 16
 |0140 ;Controller { vector 2 p1 1 }
18
-|0150 ;Keys { vector 2 key 1 }
19
-|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
20
-|0170 ;File { pad 8 name 2 length 2 load 2 save 2 }
21
-|0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
22 17
 
23
-|0200 @RESET 
18
+|0200
24 19
 
25 20
 	( theme ) #0daf =System.r #02ff =System.g #035f =System.b
26 21
 	( vectors ) ,FRAME =Screen.vector
... ...
@@ -3,13 +3,8 @@
3 3
 %RTN { JMP2r }
4 4
 %8+  { #0008 ADD2 }
5 5
 %8*  { #0030 SFT2 }
6
-%MOD2 { #03 AND  }
7
-
8
-;cursor { x 2 y 2 }
9 6
 
10 7
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
11
-|0110 ;Console { pad 8 char 1 byte 1 short 2 }
12
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
13 8
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
14 9
 |0140 ;Controller { vector 2 button 1 }
15 10
 |0150 ;Keys { vector 2 key 1 }
... ...
@@ -92,5 +87,3 @@ RTN
92 87
 	0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
93 88
 	0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
94 89
 ]
95
-
96
-;text { body 2 }
... ...
@@ -3,19 +3,14 @@
3 3
 %RTN { JMP2r }
4 4
 %++  { #0001 ADD2 }
5 5
 %--  { #0001 SUB2 }
6
-%8+  { #0008 ADD2 }
7
-%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? } 
8 6
 
9 7
 ;color { byte 1 }
10 8
 ;pointer { x 2 y 2 }
11 9
 ;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
12 10
 
13 11
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
14
-|0110 ;Console { pad 8 char 1 byte 1 short 2 }
15 12
 |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
16 13
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
17
-|0140 ;Controller { vector 2 button 1 }
18
-|0150 ;Keys { vector 2 key 1 }
19 14
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
20 15
 
21 16
 ( program )
... ...
@@ -23,17 +18,24 @@
23 18
 |0200
24 19
 
25 20
 	( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
21
+	( vectors ) ,on-screen =Screen.vector
26 22
 	( vectors ) ,on-mouse =Mouse.vector
27 23
 
28 24
 BRK
29 25
 
26
+@on-screen
27
+	
28
+	( clear ) ~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
29
+	( draw ) ~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
30
+
31
+BRK
32
+
30 33
 @on-mouse
31 34
  	
32
- 	( clear )
33
-	~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
34
-
35 35
 	,draw-cursor JSR2
36 36
 
37
+	( clear ) ~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
38
+
37 39
 	~Mouse.state #00 EQU ^$no-touch JNZ
38 40
 		~Mouse.x DUP2 =circle.xc
39 41
 		~Mouse.y DUP2 =circle.yc
... ...
@@ -41,9 +43,6 @@ BRK
41 43
 		( release ) #00 =Mouse.state
42 44
 	$no-touch
43 45
 
44
- 	( draw )
45
-	~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
46
-
47 46
 BRK 
48 47
 
49 48
 @draw-cursor ( -- )
... ...
@@ -22,11 +22,8 @@
22 22
 }
23 23
 
24 24
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
25
-|0110 ;Console { pad 8 char 1 byte 1 short 2 }
26 25
 |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
27 26
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
28
-|0140 ;Controller { vector 2 button 1 }
29
-|0150 ;Keys { vector 2 key 1 }
30 27
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
31 28
 
32 29
 ( program )
... ...
@@ -53,6 +50,67 @@
53 50
 	~Screen.width #0002 DIV2 =center.x
54 51
 	~Screen.height #0002 DIV2 =center.y
55 52
 
53
+	,update-theme JSR2
54
+	,draw-background JSR2
55
+	,draw-window JSR2
56
+
57
+BRK
58
+
59
+@on-mouse 
60
+	
61
+	,draw-cursor JSR2
62
+
63
+	~Mouse.state #00 NEQ ,$no-skip JNZ2 BRK $no-skip
64
+
65
+	~Mouse.y ~window.y1 SUB2 STEP8 
66
+
67
+	DUP2 #0010 NEQ2 ^$no-touch-red JNZ
68
+		~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-red JNZ
69
+		~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-red JNZ
70
+		( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.r1 #00 ~selection ADD2 POK2
71
+	$no-touch-red
72
+	DUP2 #0020 NEQ2 ^$no-touch-green JNZ
73
+		~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-green JNZ
74
+		~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-green JNZ
75
+		( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.g1 #00 ~selection ADD2 POK2
76
+	$no-touch-green
77
+	DUP2 #0030 NEQ2 ^$no-touch-blue JNZ
78
+		~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-blue JNZ
79
+		~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-blue JNZ
80
+		( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.b1 #00 ~selection ADD2 POK2
81
+	$no-touch-blue
82
+	DUP2 #0040 NEQ2 ^$no-touch-radio JNZ
83
+		~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-radio JNZ
84
+		~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-radio JNZ
85
+		~Mouse.x ~window.x1 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 S2B =selection
86
+	$no-touch-radio
87
+
88
+	POP2
89
+
90
+	,update-theme JSR2
91
+	,draw-window JSR2 
92
+
93
+BRK 
94
+
95
+@update-theme
96
+
97
+	#0108 PEK2 #0f AND ~theme.r1 #40 SFT ADD #0108 POK2
98
+	#010a PEK2 #0f AND ~theme.g1 #40 SFT ADD #010a POK2
99
+	#010c PEK2 #0f AND ~theme.b1 #40 SFT ADD #010c POK2
100
+	#0108 PEK2 #f0 AND ~theme.r2 ADD #0108 POK2
101
+	#010a PEK2 #f0 AND ~theme.g2 ADD #010a POK2
102
+	#010c PEK2 #f0 AND ~theme.b2 ADD #010c POK2
103
+	#0109 PEK2 #0f AND ~theme.r3 #40 SFT ADD #0109 POK2
104
+	#010b PEK2 #0f AND ~theme.g3 #40 SFT ADD #010b POK2
105
+	#010d PEK2 #0f AND ~theme.b3 #40 SFT ADD #010d POK2
106
+	#0109 PEK2 #f0 AND ~theme.r4 ADD #0109 POK2
107
+	#010b PEK2 #f0 AND ~theme.g4 ADD #010b POK2
108
+	#010d PEK2 #f0 AND ~theme.b4 ADD #010d POK2
109
+
110
+RTN
111
+
112
+@draw-background
113
+	
56 114
 	( draw hor line )
57 115
 	#0000 =Screen.x ~center.y =Screen.y
58 116
 	#0000 ~Screen.width ( from/to )
... ...
@@ -81,64 +139,6 @@
81 139
 		DUP2 LTH ^$draw-blends JNZ
82 140
 	POP POP
83 141
 
84
-	,update-theme JSR2
85
-	,draw-window JSR2
86
-
87
-BRK
88
-
89
-@on-mouse 
90
-	
91
-	~Mouse.state #00 EQU ,$no-touch JNZ2
92
-
93
-		~Mouse.y ~window.y1 SUB2 STEP8 
94
-
95
-		DUP2 #0010 NEQ2 ^$no-touch-red JNZ
96
-			~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-red JNZ
97
-			~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-red JNZ
98
-			( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.r1 #00 ~selection ADD2 POK2
99
-		$no-touch-red
100
-		DUP2 #0020 NEQ2 ^$no-touch-green JNZ
101
-			~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-green JNZ
102
-			~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-green JNZ
103
-			( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.g1 #00 ~selection ADD2 POK2
104
-		$no-touch-green
105
-		DUP2 #0030 NEQ2 ^$no-touch-blue JNZ
106
-			~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-blue JNZ
107
-			~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-blue JNZ
108
-			( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.b1 #00 ~selection ADD2 POK2
109
-		$no-touch-blue
110
-		DUP2 #0040 NEQ2 ^$no-touch-radio JNZ
111
-			~Mouse.x ~window.x1 #0050 ADD2 LTH2 ^$no-touch-radio JNZ
112
-			~Mouse.x ~window.x1 #008c ADD2 GTH2 ^$no-touch-radio JNZ
113
-			~Mouse.x ~window.x1 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 S2B =selection
114
-		$no-touch-radio
115
-
116
-		POP2
117
-
118
-		,update-theme JSR2
119
-		,draw-window JSR2 
120
-		
121
-	$no-touch
122
-
123
-	,draw-cursor JSR2
124
-
125
-BRK 
126
-
127
-@update-theme
128
-
129
-	#0108 PEK2 #0f AND ~theme.r1 #40 SFT ADD #0108 POK2
130
-	#010a PEK2 #0f AND ~theme.g1 #40 SFT ADD #010a POK2
131
-	#010c PEK2 #0f AND ~theme.b1 #40 SFT ADD #010c POK2
132
-	#0108 PEK2 #f0 AND ~theme.r2 ADD #0108 POK2
133
-	#010a PEK2 #f0 AND ~theme.g2 ADD #010a POK2
134
-	#010c PEK2 #f0 AND ~theme.b2 ADD #010c POK2
135
-	#0109 PEK2 #0f AND ~theme.r3 #40 SFT ADD #0109 POK2
136
-	#010b PEK2 #0f AND ~theme.g3 #40 SFT ADD #010b POK2
137
-	#010d PEK2 #0f AND ~theme.b3 #40 SFT ADD #010d POK2
138
-	#0109 PEK2 #f0 AND ~theme.r4 ADD #0109 POK2
139
-	#010b PEK2 #f0 AND ~theme.g4 ADD #010b POK2
140
-	#010d PEK2 #f0 AND ~theme.b4 ADD #010d POK2
141
-
142 142
 RTN
143 143
 
144 144
 @draw-window
... ...
@@ -15,12 +15,8 @@
15 15
 ( devices )
16 16
 
17 17
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
18
-|0110 ;Console { pad 8 char 1 byte 1 short 2 }
19 18
 |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
20 19
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
21
-|0140 ;Controller { vector 2 button 1 }
22
-|0150 ;Keys { vector 2 key 1 }
23
-|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
24 20
 |0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
25 21
 |01a0 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
26 22
 
... ...
@@ -62,12 +62,15 @@
62 62
 
63 63
 ( program )
64 64
 
65
-|0200 @RESET
65
+|0200
66 66
 	
67 67
 	( theme ) 
68 68
 	#e0fa =theme.r0 #30fa =theme.g0 #30fa =theme.b0 ( normal mode )
69 69
 	#00fe =theme.r1 #00f3 =theme.g1 #00f3 =theme.b1 ( presentation mode )
70
-	( vectors ) ,FRAME =Screen.vector
70
+	( vectors ) ,on-screen =Screen.vector
71
+	( vectors ) ,on-key =Keys.vector
72
+	( vectors ) ,on-button =Controller.vector
73
+	( vectors ) ,on-mouse =Mouse.vector
71 74
 
72 75
 	~theme.r0 =System.r ~theme.g0 =System.g ~theme.b0 =System.b
73 76
 
... ...
@@ -93,10 +96,23 @@
93 96
 
94 97
 BRK
95 98
 
96
-@FRAME ( -- )
99
+@on-screen ( -- )
100
+	
101
+	~document.edit #01 NEQ ^$no-edit JNZ
102
+		#0008 =Sprite.x 
103
+		~Screen.height #0010 SUB2 =Sprite.y
104
+		,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2
105
+		$clear
106
+			#00 =Sprite.color
107
+			~Sprite.x 8+ DUP2 =Sprite.x
108
+			~Screen.width LTH2 ^$clear JNZ
109
+		( blink ) ~timer #01 ADD =timer
110
+	$no-edit
97 111
 
98
-	~document.edit #01 EQU ,on-rename JNZ2
112
+BRK
99 113
 
114
+@on-mouse
115
+	
100 116
 	,draw-cursor JSR2
101 117
 
102 118
 	( release drag )
... ...
@@ -262,79 +278,80 @@ BRK
262 278
 
263 279
 	$no-touch
264 280
 
265
-	~Controller.button #00 EQU ,$no-ctrl JNZ2
266
-		~Controller.button #f0 AND
267
-			DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ
268
-				( move ) ~zoom.y -- =zoom.y $no-up
269
-			DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ
270
-				( move ) ~zoom.y ++ =zoom.y $no-down
271
-			DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ
272
-				( move ) ~zoom.x -- =zoom.x $no-left
273
-			DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ
274
-				( move ) ~zoom.x ++ =zoom.x $no-right
275
-		#00 EQU #04 JNZ ,draw-canvas JSR2
276
-	$no-ctrl
277
-	
278
-	~Keys.key #00 EQU ,$no-keys JNZ2
279
-		~Keys.key 
280
-		DUP #20 NEQ ^$no-space JNZ
281
-			( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space 
282
-		DUP #08 NEQ ^$no-backspace JNZ
283
-			( erase ) ,clear JSR2 $no-backspace
284
-		DUP #71 NEQ ^$no-qkey JNZ
285
-			( tool0 ) #00 =brush.tool ,draw-toolpane JSR2 $no-qkey
286
-		DUP #77 NEQ ^$no-wkey JNZ
287
-			( tool0 ) #01 =brush.tool ,draw-toolpane JSR2 $no-wkey
288
-		DUP #65 NEQ ^$no-ekey JNZ
289
-			( tool0 ) #02 =brush.tool ,draw-toolpane JSR2 $no-ekey
290
-		DUP #72 NEQ ^$no-rkey JNZ
291
-			( tool0 ) #03 =brush.tool ,draw-toolpane JSR2 $no-rkey
292
-		DUP #74 NEQ ^$no-tkey JNZ
293
-			( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey
294
-		DUP 
295
-			DUP #30 GTH SWP #39 LTH #0101 NEQ2 ^$no-numkey JNZ
296
-			( size ) ~Keys.key #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey
297
-		POP
298
-		( release ) #00 =Keys
299
-	$no-keys
300
-
301 281
 	~Mouse.x =cursor.x0
302 282
 	~Mouse.y =cursor.y0
303 283
 	~Mouse.state =brush.last
304 284
 
305 285
 BRK
306 286
 
307
-@on-rename ( -- )
308
-
309
-	~Keys.key #00 EQU ,$no-keys JNZ2
287
+@on-button
288
+	
289
+	( if in renaming mode )
290
+	~document.edit #01 NEQ ,$no-edit JNZ2
310 291
 		( enter )
311
-		~Keys.key #0d NEQ ^$no-enter JNZ
292
+		~Controller.button #08 NEQ ^$no-edit-enter JNZ
312 293
 			#00 =document.edit
313
-			,redraw JSR2 BRK
314
-			$no-enter
294
+			,redraw JSR2
295
+			BRK
296
+			$no-edit-enter
315 297
 		( backspace )
316
-		~Keys.key #08 NEQ ^$no-backspace JNZ
317
-			~path.length #00 EQU ^$end JNZ
298
+		~Controller.button #04 NEQ ^$no-edit-backspace JNZ
299
+			~path.length #00 EQU ^$edit-end JNZ
318 300
 			~path.length #01 SUB =path.length
319
-			^$end JMP
320
-			$no-backspace
301
+			#00 ,path.name #00 ~path.length ADD2 POK2
302
+			BRK
303
+			$no-edit-backspace
304
+		$edit-end
305
+		BRK
306
+	$no-edit
307
+
308
+	~Controller.button #f0 AND
309
+		DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ
310
+			( move ) ~zoom.y -- =zoom.y $no-up
311
+		DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ
312
+			( move ) ~zoom.y ++ =zoom.y $no-down
313
+		DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ
314
+			( move ) ~zoom.x -- =zoom.x $no-left
315
+		DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ
316
+			( move ) ~zoom.x ++ =zoom.x $no-right
317
+	#00 EQU #04 JNZ ,draw-canvas JSR2
318
+
319
+BRK
320
+
321
+@on-key
322
+	
323
+	( if in renaming mode )
324
+	~document.edit #01 NEQ ,$no-edit JNZ2
321 325
 		( default )
322
-		~path.length #1f EQU ^$end JNZ
326
+		~path.length #1f EQU ^$edit-end JNZ
323 327
 			~Keys.key ,path.name #00 ~path.length ADD2 POK2
324 328
 			~path.length #01 ADD =path.length
325
-			$end
329
+			$edit-end
326 330
 		#00 ,path.name #00 ~path.length ADD2 POK2
327
-		#00 =Keys.key
328
-	$no-keys
329
-	( draw )
330
-	#0008 =Sprite.x ~Screen.height #0010 SUB2 =Sprite.y
331
-	,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2
332
-	$clear
333
-		#00 =Sprite.color
334
-		~Sprite.x 8+ DUP2 =Sprite.x
335
-		~Screen.width LTH2 ^$clear JNZ
336
-	( blink timer )
337
-	~timer #01 ADD =timer
331
+		( release ) #00 =Keys.key
332
+		BRK
333
+	$no-edit
334
+
335
+	~Keys.key 
336
+	DUP #20 NEQ ^$no-space JNZ
337
+		( toggle zoom ) ~zoom.active #00 EQU =zoom.active ,redraw JSR2 $no-space 
338
+	DUP #08 NEQ ^$no-backspace JNZ
339
+		( erase ) ,clear JSR2 $no-backspace
340
+	DUP #71 NEQ ^$no-qkey JNZ
341
+		( tool0 ) #00 =brush.tool ,draw-toolpane JSR2 $no-qkey
342
+	DUP #77 NEQ ^$no-wkey JNZ
343
+		( tool0 ) #01 =brush.tool ,draw-toolpane JSR2 $no-wkey
344
+	DUP #65 NEQ ^$no-ekey JNZ
345
+		( tool0 ) #02 =brush.tool ,draw-toolpane JSR2 $no-ekey
346
+	DUP #72 NEQ ^$no-rkey JNZ
347
+		( tool0 ) #03 =brush.tool ,draw-toolpane JSR2 $no-rkey
348
+	DUP #74 NEQ ^$no-tkey JNZ
349
+		( tool0 ) #04 =brush.tool ,draw-toolpane JSR2 $no-tkey
350
+	DUP 
351
+		DUP #30 GTH SWP #39 LTH #0101 NEQ2 ^$no-numkey JNZ
352
+		( size ) ~Keys.key #31 SUB =brush.size ,draw-sizepane JSR2 $no-numkey
353
+	POP
354
+	( release ) #00 =Keys.key
338 355
 
339 356
 BRK
340 357