Browse code

Added zoom toggle controls to emulator

neauoire authored on 24/03/2021 16:39:19
Showing 13 changed files
... ...
@@ -12,6 +12,11 @@ To build the Uxn emulator, you must have [SDL2](https://wiki.libsdl.org/).
12 12
 	--cli # Run rom without graphics
13 13
 ```
14 14
 
15
+## Emulator Controls
16
+
17
+- `ctrl+h` toggle debugger
18
+- `alt+h` toggle zoom
19
+
15 20
 ## Uxambly
16 21
 
17 22
 Read more in the [Uxambly Guide](https://wiki.xxiivv.com/site/uxambly.html).
... ...
@@ -28,7 +28,7 @@ else
28 28
 fi
29 29
 
30 30
 echo "Assembling.."
31
-./bin/assembler projects/examples/dev.screen.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' ]; 
... ...
@@ -22,9 +22,9 @@ BRK
22 22
 @print-label ( text )
23 23
 	
24 24
 	$loop NOP
25
-		( send ) DUP2 LDR =Console.char
25
+		( send ) DUP2 PEK2 =Console.char
26 26
 		( incr ) #0001 ADD2
27
-		( loop ) DUP2 LDR #00 NEQ ^$loop MUL JMP 
27
+		( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP 
28 28
 	POP2
29 29
 
30 30
 RTN    
... ...
@@ -24,9 +24,9 @@ BRK
24 24
 @print-label ( text )
25 25
 	
26 26
 	$loop NOP
27
-		( send ) DUP2 LDR =Console.char
27
+		( send ) DUP2 PEK2 =Console.char
28 28
 		( incr ) #0001 ADD2
29
-		( loop ) DUP2 LDR #00 NEQ ^$loop MUL JMP 
29
+		( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP 
30 30
 	POP2
31 31
 
32 32
 RTN
... ...
@@ -1,71 +1,42 @@
1
-( Mouse )
1
+( draw routines )
2 2
 
3 3
 %RTN { JMP2r }
4
+%++  { #0001 ADD2 }
5
+%--  { #0001 SUB2 }
6
+%8+  { #0008 ADD2 }
7
+%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? } 
4 8
 
5
-;label { x 2 y 2 color 1 addr 2 }
6
-;cat { x 2 y 2 } 
7
-;pointer { x 2 y 2 }
8 9
 ;color { byte 1 }
9
-;timer { byte 1 }
10
-
11
-( devices )
10
+;pointer { x 2 y 2 }
11
+;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
12 12
 
13
-|0110 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
13
+|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
14 14
 |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
15 15
 |0150 ;Mouse  { x 2 y 2 state 1 chord 1 }
16 16
 |01F0 .RESET .FRAME .ERROR ( vectors )
17
-|01F8 [ 0f85 0fd5 0fb5 ] ( palette )
18
-
19
-( program )
20
-
21
-|0200 @RESET 
22
-
23
-	( position cat )
24
-	~Screen.width #0002 DIV2 =cat.x 
25
-	~Screen.height #0038 SUB2 =cat.y
26
-	#01 =color
27
-	( draw polycat )
28
-	,draw-polycat JSR2
17
+|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
29 18
 
19
+|0200 @RESET
20
+	
30 21
 BRK
31 22
 
32 23
 @FRAME
33
-	
24
+ 	
25
+ 	( clear )
26
+	~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
27
+
34 28
 	,draw-cursor JSR2
35 29
 
36
-	( reset timer -> move cat tail )
37
-	,no-click ~Mouse.state #00 EQU JMP2?
38
-		#50 =timer
39
-	@no-click
40
-	( detect click )
41
-	,no-click12 ~Mouse.state #11 NEQ JMP2?
42
-		#0058 #0040 #01 ,mouse12_text ,draw-label JSR2
43
-		#10 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2
44
-		~color ,mouse12_icn #0048 #0040 ,draw-sprite JSR2
45
-		,end-click JMP2
46
-	@no-click12
47
-	,no-click1 ~Mouse.state #01 NEQ JMP2?
48
-		#0058 #0040 #01 ,mouse1_text ,draw-label JSR2
49
-		#12 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2
50
-		~color ,mouse1_icn #0048 #0040 ,draw-sprite JSR2
51
-		,end-click JMP2
52
-	@no-click1
53
-	,no-click2 ~Mouse.state #10 NEQ JMP2?
54
-		#0058 #0040 #01 ,mouse2_text ,draw-label JSR2
55
-		#13 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2
56
-		~color ,mouse2_icn #0048 #0040 ,draw-sprite JSR2
57
-		,end-click JMP2
58
-	@no-click2
59
-	( default )
60
-	#0058 #0040 #01 ,mouse0_text ,draw-label JSR2
61
-	~color ,mouse0_icn #0048 #0040 ,draw-sprite JSR2
62
-	@end-click
63
-	( animate )
64
-	,animate-polycat JSR2
65
-	( update last pos )
66
-	~timer #01 ADD =timer
30
+	,$no-touch ~Mouse.state #00 EQU JMP2?
31
+		~Mouse.x =circle.xc
32
+		~Mouse.y =circle.yc
33
+		#0000 =circle.r
34
+	$no-touch
67 35
 
68
-BRK
36
+ 	( draw )
37
+	~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
38
+
39
+BRK 
69 40
 
70 41
 @draw-cursor
71 42
 
... ...
@@ -86,148 +57,37 @@ BRK
86 57
 
87 58
 RTN
88 59
 
89
-@draw-polycat
90
-
91
-	( ears )
92
-	,polycat ~cat.x ~cat.y ,draw-sprite-chr JSR2
93
-	,polycat #0010 ADD2 ~cat.x #0008 ADD2 ~cat.y ,draw-sprite-chr JSR2
94
-	( eye )
95
-	,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
96
-	,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
97
-	( body )
98
-	,polycat #00a0 ADD2 ~cat.x ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
99
-	,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
60
+@draw-circle ( xc yc r color )
100 61
 
101
-RTN
102
-
103
-@animate-polycat
104
-
105
-	( tail )
106
-	~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP2?
107
-		,polycat #00c0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
108
-	@animate-polycat-tail-next0
109
-	~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP2?
110
-		,polycat #00d0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
111
-	@animate-polycat-tail-next1
112
-	~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP2?
113
-		,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
114
-	@animate-polycat-tail-next2
115
-	( look-at )
116
-	~pointer.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP2?
117
-		~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP2?
118
-			,polycat #0040 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
119
-			,polycat #0050 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
120
-		RTN
121
-		@animate-polycat-left-down 
122
-			,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
123
-			,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
124
-		RTN
125
-	@animate-polycat-right
126
-		~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP2?
127
-			,polycat #0060 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
128
-			,polycat #0070 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
129
-		RTN
130
-		@animate-polycat-right-down 
131
-			,polycat #0080 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
132
-			,polycat #0090 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
133
-		RTN
134
-
135
-RTN
136
-
137
-@draw-label ( x y color addr )
138
-	
139
-	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
140
-	~label.addr
62
+	( load ) =color =circle.r =circle.yc =circle.xc
63
+	#0000 =circle.x ~circle.r =circle.y
64
+	~circle.r #0002 MUL2 #0003 SUB2 =circle.d
65
+	( draw ) ,$seg JSR2
141 66
 	$loop
142
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
143
-		( incr ) #0001 ADD2
144
-		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
145
-		DUP2 #0001 ADD2  LDR #00 NEQ ,$loop ROT JMP2?
146
-	POP2
147
-
148
-RTN
149
-
150
-@draw-sprite
151
-
152
-	=Sprite.y
153
-	=Sprite.x
154
-	=Sprite.addr
155
-	=Sprite.color
67
+		( incr ) ~circle.x ++ =circle.x
68
+		,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
69
+			( decr ) ~circle.y -- =circle.y
70
+			~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
71
+			,$end JMP2
72
+		$else
73
+			~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
74
+		$end
75
+		( draw ) ,$seg JSR2
76
+		,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
77
+	RTN
78
+	$seg
79
+		~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
80
+		~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
81
+		~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
82
+		~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
83
+		~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
84
+		~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
85
+		~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
86
+		~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
156 87
 
157 88
 RTN
158 89
 
159
-@draw-sprite-chr
160
-
161
-	=Sprite.y
162
-	=Sprite.x
163
-	=Sprite.addr
164
-	#20 =Sprite.color
165
-
166
-RTN
90
+@ERROR BRK 
167 91
 
168 92
 @clear_icn   [ 0000 0000 0000 0000 ]
169
-@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
170
-@mouse0_icn  [ 7c82 92ee 8282 4438 ]
171
-@mouse1_icn  [ 7cf2 f2ee 8282 4438 ]
172
-@mouse2_icn  [ 7c9e 9eee 8282 4438 ]
173
-@mouse12_icn [ 7cfe feee 8282 4438 ]
174
-
175
-@polycat [
176
-	081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc
177
-	081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f
178
-	ffff ffff ff7f 3f0f f0e7 cfef f77c 3f0f
179
-	ffff ffff fffe fcf0 0783 c1c3 871e fcf0
180
-	ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f
181
-	ffff ffff fffe fcf0 87c3 c183 071e fcf0
182
-	ffff ffff ff7f 3f0f f0e1 c1e0 f07c 3f0f
183
-	ffff ffff fffe fcf0 f7fb f9f3 071e fcf0
184
-	ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f
185
-	ffff ffff fffe fcf0 07f3 f9fb f71e fcf0
186
-	0307 0707 0302 0200 0307 0707 0300 0000
187
-	c0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
188
-	c0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000
189
-	c0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000
190
-]
191
-
192
-@font ( spectrum-zx font ) 
193
-[
194
-	0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
195
-	0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
196
-	007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
197
-	0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
198
-	0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
199
-	003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
200
-	0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
201
-	0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
202
-	0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
203
-	0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
204
-	0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
205
-	0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
206
-	003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
207
-	0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
208
-	003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
209
-	0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
210
-	003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
211
-	0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
212
-	0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
213
-	0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
214
-	007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
215
-	00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
216
-	0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
217
-	0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
218
-	0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
219
-	0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
220
-	0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
221
-	0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
222
-	0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
223
-	0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
224
-	0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
225
-	0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
226
-]
227
-
228
-@mouse0_text   [ no 20 click 00 ]
229
-@mouse1_text   [ mouse 1_ 00 ]
230
-@mouse2_text   [ mouse _2 00 ]
231
-@mouse12_text  [ mouse 12 00 ]
232
- 
233
-@ERROR BRK 
234 93
\ No newline at end of file
94
+@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
235 95
\ No newline at end of file
... ...
@@ -199,16 +199,16 @@ RTN
199 199
 @draw-short ( short )
200 200
 
201 201
 	=addr
202
-	,font_hex #00 ~addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
202
+	,font_hex #00 ~addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
203 203
 	( draw ) #04 =Sprite.color
204 204
 	~Sprite.x 8+ =Sprite.x
205
-	,font_hex #00 ~addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
205
+	,font_hex #00 ~addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
206 206
 	( draw ) #04 =Sprite.color
207 207
 	~Sprite.x 8+ =Sprite.x
208
-	,font_hex #00 ~addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
208
+	,font_hex #00 ~addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
209 209
 	( draw ) #04 =Sprite.color
210 210
 	~Sprite.x 8+ =Sprite.x
211
-	,font_hex #00 ~addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
211
+	,font_hex #00 ~addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
212 212
 	( draw ) #04 =Sprite.color
213 213
 
214 214
 RTN
... ...
@@ -275,10 +275,10 @@ RTN
275 275
 	
276 276
 	( load ) =label.addr =color =Sprite.y =Sprite.x ~label.addr
277 277
 	$loop
278
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color
278
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color
279 279
 		( incr ) ++
280 280
 		( incr ) ~Sprite.x 8+ =Sprite.x
281
-		DUP2 LDR #00 NEQ ,$loop ROT JMP2?
281
+		DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
282 282
 	POP2
283 283
 
284 284
 RTN
... ...
@@ -52,10 +52,10 @@ BRK
52 52
 
53 53
 	,no-click ~Mouse.state #00 EQU JMP2?
54 54
 
55
-		( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR
55
+		( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 PEK2
56 56
 		( mask ) #01 #07 ~Mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB #40 SFT SFT 
57 57
 		ORA
58
-		( save ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR
58
+		( save ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 POK2
59 59
 
60 60
 		,draw-window JSR2
61 61
 		,draw-editor JSR2
... ...
@@ -88,7 +88,7 @@ RTN
88 88
 		$hor
89 89
 			( get bit )
90 90
 			,cell0_icn #00
91
-			~editor.addr #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB SFT #01 AND ( get bit )
91
+			~editor.addr #00 ~pixel.y ADD2 PEK2 #07 ~pixel.x SUB SFT #01 AND ( get bit )
92 92
 			#0008 MUL2 ADD2 =Sprite.addr ( add *8 )
93 93
 			( draw ) #08 =Sprite.color
94 94
 			( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
... ...
@@ -109,10 +109,10 @@ RTN
109 109
 	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
110 110
 	~label.addr
111 111
 	$loop NOP
112
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
112
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
113 113
 		( incr ) #0001 ADD2
114 114
 		( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
115
-		DUP2 LDR #00 NEQ ^$loop MUL JMP
115
+		DUP2 PEK2 #00 NEQ ^$loop MUL JMP
116 116
 	POP2
117 117
 
118 118
 RTN
... ...
@@ -38,10 +38,10 @@ BRK
38 38
 	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
39 39
 	~label.addr
40 40
 	$loop
41
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
41
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
42 42
 		( incr ) #0001 ADD2
43 43
 		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
44
-		DUP2 LDR #00 NEQ ,$loop ROT JMP2?
44
+		DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
45 45
 	POP2
46 46
 
47 47
 RTN
... ...
@@ -52,10 +52,10 @@ RTN
52 52
 	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Sprite.x 
53 53
 	~label.addr
54 54
 	$loop
55
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
55
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
56 56
 		( incr ) #0001 ADD2
57 57
 		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
58
-		DUP2 LDR #00 NEQ ,$loop ROT JMP2?
58
+		DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
59 59
 	POP2
60 60
 
61 61
 RTN
... ...
@@ -66,10 +66,10 @@ RTN
66 66
 	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Sprite.x 
67 67
 	~label.addr
68 68
 	$loop
69
-		( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
69
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
70 70
 		( incr ) #0001 ADD2
71 71
 		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
72
-		DUP2 LDR #00 NEQ ,$loop ROT JMP2?
72
+		DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
73 73
 	POP2
74 74
 
75 75
 RTN
... ...
@@ -79,7 +79,7 @@ RTN
79 79
 	#0000 ( counter )
80 80
 	$loop
81 81
 		( incr ) #0001 ADD2 OVR2 OVR2 ADD2 
82
-		LDR #00 NEQ ,$loop ROT JMP2?
82
+		PEK2 #00 NEQ ,$loop ROT JMP2?
83 83
 	SWP2 POP2
84 84
 
85 85
 RTN
86 86
deleted file mode 100644
... ...
@@ -1,93 +0,0 @@
1
-( draw routines )
2
-
3
-%RTN { JMP2r }
4
-%++  { #0001 ADD2 }
5
-%--  { #0001 SUB2 }
6
-%8+  { #0008 ADD2 }
7
-%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? } 
8
-
9
-;color { byte 1 }
10
-;pointer { x 2 y 2 }
11
-;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
12
-
13
-|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
14
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
15
-|0150 ;Mouse  { x 2 y 2 state 1 chord 1 }
16
-|01F0 .RESET .FRAME .ERROR ( vectors )
17
-|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
18
-
19
-|0200 @RESET
20
-	
21
-BRK
22
-
23
-@FRAME
24
- 	
25
- 	( clear )
26
-	~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
27
-
28
-	,draw-cursor JSR2
29
-
30
-	,$no-touch ~Mouse.state #00 EQU JMP2?
31
-		~Mouse.x =circle.xc
32
-		~Mouse.y =circle.yc
33
-		#0000 =circle.r
34
-	$no-touch
35
-
36
- 	( draw )
37
-	~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
38
-
39
-BRK 
40
-
41
-@draw-cursor
42
-
43
-	( clear last cursor )
44
-	,clear_icn =Sprite.addr 
45
-	~pointer.x =Sprite.x 
46
-	~pointer.y =Sprite.y 
47
-	#10 =Sprite.color
48
-
49
-	( record pointer positions )
50
-	~Mouse.x =pointer.x ~Mouse.y =pointer.y
51
-
52
-	( draw new cursor )
53
-	,cursor_icn =Sprite.addr 
54
-	~pointer.x =Sprite.x 
55
-	~pointer.y =Sprite.y 
56
-	#11 =Sprite.color
57
-
58
-RTN
59
-
60
-@draw-circle ( xc yc r color )
61
-
62
-	( load ) =color =circle.r =circle.yc =circle.xc
63
-	#0000 =circle.x ~circle.r =circle.y
64
-	~circle.r #0002 MUL2 #0003 SUB2 =circle.d
65
-	( draw ) ,$seg JSR2
66
-	$loop
67
-		( incr ) ~circle.x ++ =circle.x
68
-		,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
69
-			( decr ) ~circle.y -- =circle.y
70
-			~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
71
-			,$end JMP2
72
-		$else
73
-			~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
74
-		$end
75
-		( draw ) ,$seg JSR2
76
-		,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
77
-	RTN
78
-	$seg
79
-		~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
80
-		~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
81
-		~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
82
-		~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
83
-		~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
84
-		~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
85
-		~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
86
-		~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
87
-
88
-RTN
89
-
90
-@ERROR BRK 
91
-
92
-@clear_icn   [ 0000 0000 0000 0000 ]
93
-@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
94 0
\ No newline at end of file
... ...
@@ -150,7 +150,7 @@ BRK
150 150
 
151 151
 		( insert )
152 152
 		~selection.to ~selection.from SUB2 ,shift-right JSR2
153
-		~Keys ~selection.from STR
153
+		~Keys ~selection.from POK2
154 154
 		~selection.from ++ =selection.from
155 155
 
156 156
 		$keys-end
... ...
@@ -254,7 +254,7 @@ RTN
254 254
 	,document.body =document.eof
255 255
 	$loop NOP
256 256
 		( incr ) ~document.eof ++ =document.eof
257
-	~document.eof LDR #00 NEQ ^$loop MUL JMP
257
+	~document.eof PEK2 #00 NEQ ^$loop MUL JMP
258 258
 
259 259
 RTN
260 260
 
... ...
@@ -279,7 +279,7 @@ RTN
279 279
 	=i
280 280
 	~selection.from -- =j ( start -> end )
281 281
 	$loop NOP
282
-		( move ) ~j ~i ADD2 LDR ~j STR
282
+		( move ) ~j ~i ADD2 PEK2 ~j POK2
283 283
 		( incr ) ~j ++ =j
284 284
 		~j ~document.eof LTH2 ^$loop MUL JMP
285 285
 	~document.eof ~i SUB2 =document.eof
... ...
@@ -291,7 +291,7 @@ RTN
291 291
 	=i
292 292
 	~document.eof =j ( end -> start )
293 293
 	$loop NOP
294
-		( move ) ~j ~i SUB2 LDR ~j STR
294
+		( move ) ~j ~i SUB2 PEK2 ~j POK2
295 295
 		( decr ) ~j -- =j
296 296
 		~j ~selection.from GTH2 ^$loop MUL JMP
297 297
 	~document.eof ~i ADD2 =document.eof
... ...
@@ -319,10 +319,10 @@ RTN
319 319
 @goto-linestart
320 320
 
321 321
 	$loop NOP
322
-		~selection.from -- LDR #0a EQU RTN?
323
-		~selection.from -- LDR #0d EQU RTN?
322
+		~selection.from -- PEK2 #0a EQU RTN?
323
+		~selection.from -- PEK2 #0d EQU RTN?
324 324
 		( decr ) ~selection.from DUP2 =selection.to -- =selection.from
325
-	~selection.from LDR #00 NEQ ^$loop MUL JMP
325
+	~selection.from PEK2 #00 NEQ ^$loop MUL JMP
326 326
 	( clamp at document body )
327 327
 	~selection.from ,document.body GTH2 RTN?
328 328
 	,document.body DUP2 =selection.from ++ =selection.to
... ...
@@ -332,10 +332,10 @@ RTN
332 332
 @goto-lineend
333 333
 	
334 334
 	$loop NOP
335
-		~selection.from LDR #0a EQU RTN?
336
-		~selection.from LDR #0d EQU RTN?
335
+		~selection.from PEK2 #0a EQU RTN?
336
+		~selection.from PEK2 #0d EQU RTN?
337 337
 		( incr ) ~selection.from ++ DUP2 ++ =selection.to =selection.from
338
-		~selection.from LDR #00 NEQ ^$loop MUL JMP
338
+		~selection.from PEK2 #00 NEQ ^$loop MUL JMP
339 339
 	( clamp at document body )
340 340
 	~selection.from ,document.eof LTH2 RTN?
341 341
 	,document.eof -- DUP2 =selection.from ++ =selection.to
... ...
@@ -347,9 +347,9 @@ RTN
347 347
 	~selection.to =j
348 348
 	$loop NOP
349 349
 		( decr ) ~j -- =j
350
-		,$end ~j LDR #20 EQU JMP2?
351
-		,$end ~j LDR #0a EQU JMP2?
352
-		,$end ~j LDR #0d EQU JMP2?
350
+		,$end ~j PEK2 #20 EQU JMP2?
351
+		,$end ~j PEK2 #0a EQU JMP2?
352
+		,$end ~j PEK2 #0d EQU JMP2?
353 353
 		~j ,document.body GTH2 ^$loop MUL JMP
354 354
 	$end 
355 355
 	( return ) ~j --
... ...
@@ -361,9 +361,9 @@ RTN
361 361
 	~selection.to =j
362 362
 	$loop NOP
363 363
 		( incr ) ~j ++ =j
364
-		,$end ~j LDR #20 EQU JMP2?
365
-		,$end ~j LDR #0a EQU JMP2?
366
-		,$end ~j LDR #0d EQU JMP2?
364
+		,$end ~j PEK2 #20 EQU JMP2?
365
+		,$end ~j PEK2 #0a EQU JMP2?
366
+		,$end ~j PEK2 #0d EQU JMP2?
367 367
 		~j ,document.body GTH2 ^$loop MUL JMP
368 368
 	$end 
369 369
 	( return ) ~j ++
... ...
@@ -375,8 +375,8 @@ RTN
375 375
 	#0000 =j
376 376
 	$loop NOP
377 377
 		( incr ) ~j ++ =j
378
-		,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2?
379
-		,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2?
378
+		,$end ~selection.from ~j SUB2 PEK2 #0a EQU JMP2?
379
+		,$end ~selection.from ~j SUB2 PEK2 #0d EQU JMP2?
380 380
 		~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP
381 381
 	$end 
382 382
 	( return ) ~j
... ...
@@ -388,11 +388,11 @@ RTN
388 388
 	,document.body =j #0000 =pt.y
389 389
 	$loop NOP
390 390
 		,$end ~pt.y ~position.y -- GTH2 JMP2?
391
-		,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2?
391
+		,$no-space ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 JMP2?
392 392
 			( incr ) ~pt.y ++ =pt.y
393 393
 		$no-space
394 394
 		( incr ) ~j ++ =j
395
-	~j LDR #00 NEQ ^$loop MUL JMP
395
+	~j PEK2 #00 NEQ ^$loop MUL JMP
396 396
 	$end
397 397
 	( return ) ~j
398 398
 
... ...
@@ -403,8 +403,8 @@ RTN
403 403
 	,find-line JSR2 ( find line )
404 404
 	#0000 =pt.x
405 405
 	$loop NOP
406
-		,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2?
407
-		,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2?
406
+		,$end ~j ~pt.x ADD2 PEK2 #0a EQU JMP2?
407
+		,$end ~j ~pt.x ADD2 PEK2 #0d EQU JMP2?
408 408
 		( incr ) ~pt.x ++ =pt.x
409 409
 		~pt.x ~position.x -- LTH2 ^$loop MUL JMP
410 410
 	$end
... ...
@@ -426,7 +426,7 @@ RTN
426 426
 	~selection.to ~selection.from SUB2 =j ( end )
427 427
 	~j =clip.len
428 428
 	$loop NOP
429
-		~selection.from ~i ADD2 LDR ,clip.body ~i ADD2 STR
429
+		~selection.from ~i ADD2 PEK2 ,clip.body ~i ADD2 POK2
430 430
 		( incr ) ~i ++ =i
431 431
 		~i ~j LTH2 ^$loop MUL JMP
432 432
 
... ...
@@ -438,7 +438,7 @@ RTN
438 438
 	#0000 =i ( start )
439 439
 	~clip.len =j ( end )
440 440
 	$loop NOP
441
-		,clip.body ~i ADD2 LDR ~selection.from ~i ADD2 STR
441
+		,clip.body ~i ADD2 PEK2 ~selection.from ~i ADD2 POK2
442 442
 		( incr ) ~i ++ =i
443 443
 		~i ~j LTH2 ^$loop MUL JMP
444 444
 
... ...
@@ -448,7 +448,7 @@ RTN
448 448
 	
449 449
 	,document.body =selection.from #0000 =pt.x #0000 =pt.y
450 450
 	$loop
451
-		,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2?
451
+		,$no-space ~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 JMP2?
452 452
 			( incr ) ~pt.y ++ =pt.y
453 453
 			#0000 =pt.x
454 454
 		$no-space
... ...
@@ -458,7 +458,7 @@ RTN
458 458
 		$no-reached
459 459
 		( incr ) ~pt.x ++ =pt.x
460 460
 		( incr ) ~selection.from ++ =selection.from
461
-	,$loop ~selection.from LDR #00 NEQ JMP2?
461
+	,$loop ~selection.from PEK2 #00 NEQ JMP2?
462 462
 
463 463
 RTN
464 464
 
... ...
@@ -484,16 +484,16 @@ RTN
484 484
 @draw-short ( short )
485 485
 
486 486
 	=addr
487
-	,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
487
+	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
488 488
 	( draw ) #0e =Sprite.color
489 489
 	~Sprite.x 8+ =Sprite.x
490
-	,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
490
+	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
491 491
 	( draw ) #0e =Sprite.color
492 492
 	~Sprite.x 8+ =Sprite.x
493
-	,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
493
+	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
494 494
 	( draw ) #0e =Sprite.color
495 495
 	~Sprite.x 8+ =Sprite.x
496
-	,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
496
+	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
497 497
 	( draw ) #0e =Sprite.color
498 498
 
499 499
 RTN
... ...
@@ -531,11 +531,11 @@ RTN
531 531
 	#0000 =j ( j is linebreaks )
532 532
 	$find-offset NOP
533 533
 		,$find-offset-end ~scroll.y ~j EQU2 JMP2?
534
-		,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2?
534
+		,$no-break ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 JMP2?
535 535
 			( incr ) ~j ++ =j
536 536
 		$no-break
537 537
 		( incr ) ~textarea.addr ++ =textarea.addr
538
-	~textarea.addr LDR #00 NEQ ^$find-offset MUL JMP
538
+	~textarea.addr PEK2 #00 NEQ ^$find-offset MUL JMP
539 539
 	$find-offset-end
540 540
 
541 541
 	#0018 =Sprite.x #0000 =Sprite.y
... ...
@@ -546,14 +546,14 @@ RTN
546 546
 		,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2?
547 547
 
548 548
 		( get character )
549
-		,font #00 ~i LDR #20 SUB 8* ADD2 =Sprite.addr
549
+		,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr
550 550
 
551 551
 		( draw ) #01 
552 552
 		~i ~selection.from -- GTH2 
553 553
 		~i ~selection.to LTH2 #0101 EQU2
554 554
 		#05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color
555 555
 
556
-		,$no-linebreak ~i LDR #0a NEQ ~i LDR #0d NEQ #0101 EQU2 JMP2?
556
+		,$no-linebreak ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 JMP2?
557 557
 			( draw linebreak )
558 558
 			,linebreak_icn =Sprite.addr
559 559
 			( draw ) #02
... ...
@@ -585,7 +585,7 @@ RTN
585 585
 		( incr ) ~i ++ =i
586 586
 		( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
587 587
 
588
-	,$loop ~i LDR #00 NEQ JMP2?
588
+	,$loop ~i PEK2 #00 NEQ JMP2?
589 589
 
590 590
 	$end
591 591
 
... ...
@@ -623,10 +623,10 @@ RTN
623 623
 	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
624 624
 	~label.addr
625 625
 	$loop NOP
626
-		( draw ) DUP2 LDR #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
626
+		( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
627 627
 		( incr ) ++
628 628
 		( incr ) ~Sprite.x 8+ =Sprite.x
629
-		DUP2 LDR #00 NEQ ^$loop MUL JMP
629
+		DUP2 PEK2 #00 NEQ ^$loop MUL JMP
630 630
 	POP2
631 631
 	( selection )
632 632
 	~selection.from ,document.body SUB2 ,draw-short JSR2
... ...
@@ -130,11 +130,11 @@ BRK
130 130
 			,not-copy-mode ~bankview.mode #01 NEQ JMP2?
131 131
 				#00 =i
132 132
 				@copy-loop NOP
133
-					( load ) ~tileview.addr ~i ADD LDR 
133
+					( load ) ~tileview.addr ~i ADD PEK2 
134 134
 					( get touch addr )
135 135
 					~Mouse.x ~bankview.x SUB2 STEP8 
136 136
 					~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
137
-					~bankview.addr ADD2 #00 ~i ADD2 STR
137
+					~bankview.addr ADD2 #00 ~i ADD2 POK2
138 138
 					( incr ) ~i #01 ADD =i
139 139
 					~i #08 LTH ^copy-loop MUL JMP
140 140
 				,redraw JSR2 ,click-end JMP2
... ...
@@ -147,7 +147,7 @@ BRK
147 147
 					( get touch addr )
148 148
 					~Mouse.x ~bankview.x SUB2 STEP8 
149 149
 					~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
150
-					~bankview.addr ADD2 #00 ~i ADD2 STR
150
+					~bankview.addr ADD2 #00 ~i ADD2 POK2
151 151
 					( incr ) ~i #01 ADD =i
152 152
 					~i #08 LTH ^erase-loop MUL JMP
153 153
 				,redraw JSR2 ,click-end JMP2
... ...
@@ -173,16 +173,16 @@ BRK
173 173
 			~Mouse.x ~tileview.x SUB2 ~Mouse.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x
174 174
 			~Mouse.y ~tileview.y SUB2 ~Mouse.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y
175 175
 			,no-erase-mode ~Mouse.state #10 NEQ JMP2?
176
-				( load ) ~addr ~pos.y 8/ ADD2 LDR
176
+				( load ) ~addr ~pos.y 8/ ADD2 PEK2
177 177
 				( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL 
178 178
 				#ff EOR AND
179
-				( save ) ~addr ~pos.y 8/ ADD2 STR
179
+				( save ) ~addr ~pos.y 8/ ADD2 POK2
180 180
 				,redraw JSR2 ,click-end JMP2
181 181
 			@no-erase-mode
182
-			( load ) ~addr ~pos.y 8/ ADD2 LDR
182
+			( load ) ~addr ~pos.y 8/ ADD2 PEK2
183 183
 			( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL 
184 184
 			ORA
185
-			( save ) ~addr ~pos.y 8/ ADD2 STR
185
+			( save ) ~addr ~pos.y 8/ ADD2 POK2
186 186
 			,redraw JSR2 ,click-end JMP2
187 187
 
188 188
 		@no-tile-click
... ...
@@ -219,29 +219,29 @@ RTN
219 219
 
220 220
 @op_shiftup
221 221
 	
222
-	~tileview.addr LDR
223
-	~tileview.addr #0001 ADD2 LDR ~tileview.addr STR
224
-	~tileview.addr #0002 ADD2 LDR ~tileview.addr #0001 ADD2 STR
225
-	~tileview.addr #0003 ADD2 LDR ~tileview.addr #0002 ADD2 STR
226
-	~tileview.addr #0004 ADD2 LDR ~tileview.addr #0003 ADD2 STR
227
-	~tileview.addr #0005 ADD2 LDR ~tileview.addr #0004 ADD2 STR
228
-	~tileview.addr #0006 ADD2 LDR ~tileview.addr #0005 ADD2 STR
229
-	~tileview.addr #0007 ADD2 LDR ~tileview.addr #0006 ADD2 STR
230
-	~tileview.addr #0007 ADD2 STR
222
+	~tileview.addr PEK2
223
+	~tileview.addr #0001 ADD2 PEK2 ~tileview.addr POK2
224
+	~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0001 ADD2 POK2
225
+	~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
226
+	~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
227
+	~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
228
+	~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
229
+	~tileview.addr #0007 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
230
+	~tileview.addr #0007 ADD2 POK2
231 231
 
232 232
 RTN
233 233
 
234 234
 @op_shiftdown
235 235
 	
236
-	~tileview.addr #0007 ADD2 LDR
237
-	~tileview.addr #0006 ADD2 LDR ~tileview.addr #0007 ADD2 STR
238
-	~tileview.addr #0005 ADD2 LDR ~tileview.addr #0006 ADD2 STR
239
-	~tileview.addr #0004 ADD2 LDR ~tileview.addr #0005 ADD2 STR
240
-	~tileview.addr #0003 ADD2 LDR ~tileview.addr #0004 ADD2 STR
241
-	~tileview.addr #0002 ADD2 LDR ~tileview.addr #0003 ADD2 STR
242
-	~tileview.addr #0001 ADD2 LDR ~tileview.addr #0002 ADD2 STR
243
-	~tileview.addr LDR ~tileview.addr #0001 ADD2 STR
244
-	~tileview.addr STR
236
+	~tileview.addr #0007 ADD2 PEK2
237
+	~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0007 ADD2 POK2
238
+	~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
239
+	~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
240
+	~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
241
+	~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
242
+	~tileview.addr #0001 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
243
+	~tileview.addr PEK2 ~tileview.addr #0001 ADD2 POK2
244
+	~tileview.addr POK2
245 245
 
246 246
 RTN
247 247
 
... ...
@@ -307,11 +307,10 @@ RTN
307 307
 		#00 =pt.x
308 308
 		~bankview.x =Sprite.x
309 309
 		$hor
310
-			( draw ) #01 =Sprite.color
311
-			,$no-highlight ~Sprite.addr ~tileview.addr LTH2 JMP2?
312
-			,$no-highlight ~Sprite.addr ~tileview.addr #0018 ADD2 GTH2 JMP2?
313
-				( draw ) #0c =Sprite.color
314
-			$no-highlight
310
+			( draw ) #01
311
+				~Sprite.addr ~tileview.addr LTH2 
312
+				~Sprite.addr ~tileview.addr #0018 ADD2 GTH2 
313
+				#0000 EQU2 #06 MUL ADD =Sprite.color
315 314
 			( incr ) ~Sprite.x 8+ =Sprite.x
316 315
 			( incr ) ~Sprite.addr 8+ =Sprite.addr
317 316
 			( incr ) ~pt.x #01 ADD =pt.x
... ...
@@ -383,10 +382,10 @@ RTN
383 382
 	#00 =i
384 383
 	$bytes
385 384
 		~tileview.x #0088 ADD2 =Sprite.x
386
-		,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
385
+		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
387 386
 		( draw ) #02 =Sprite.color
388 387
 		~Sprite.x 8+ =Sprite.x
389
-		,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =Sprite.addr
388
+		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
390 389
 		( draw ) #02 =Sprite.color
391 390
 		( incr ) ~i #01 ADD =i
392 391
 		( incr ) ~Sprite.y 8+ =Sprite.y
... ...
@@ -428,7 +427,7 @@ RTN
428 427
 		$hor
429 428
 			( get bit )
430 429
 			,blank_icn #00
431
-			~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SFT #01 AND ( get bit )
430
+			~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit )
432 431
 			8* ADD2 =Sprite.addr ( add *8 )
433 432
 			( draw ) #01 =Sprite.color
434 433
 			( incr ) ~Sprite.x 8+ =Sprite.x
... ...
@@ -469,16 +468,16 @@ RTN
469 468
 @draw-short ( short )
470 469
 
471 470
 	=addr
472
-	,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
471
+	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
473 472
 	( draw ) #02 =Sprite.color
474 473
 	~Sprite.x 8+ =Sprite.x
475
-	,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr
474
+	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
476 475
 	( draw ) #02 =Sprite.color
477 476
 	~Sprite.x 8+ =Sprite.x
478
-	,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
477
+	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
479 478
 	( draw ) #02 =Sprite.color
480 479
 	~Sprite.x 8+ =Sprite.x
481
-	,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr
480
+	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
482 481
 	( draw ) #02 =Sprite.color
483 482
 
484 483
 RTN
... ...
@@ -527,4 +526,4 @@ RTN
527 526
 
528 527
 @ERROR BRK 
529 528
 
530
-@bank [ ]	
529
+|2000 @bank [ ]	
... ...
@@ -228,7 +228,7 @@ BRK
228 228
 	( from ) ,data
229 229
 	( to ) ~canvas.w ~canvas.h MUL2 #0008 MUL2 ,data ADD2
230 230
 	$loop NOP
231
-		OVR2 #00 ROT ROT STR
231
+		OVR2 #00 ROT ROT POK2
232 232
 		( incr ) SWP2 #0001 ADD2 SWP2
233 233
 		OVR2 OVR2 LTH2 ^$loop SWP JMP?
234 234
 	POP2 POP2
... ...
@@ -278,7 +278,7 @@ RTN
278 278
 		#00 =px.x
279 279
 		$hor
280 280
 			( addr ) ,size_icn #00 ~cursor.size 8* ADD2
281
-			( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND 
281
+			( byte ) #00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND 
282 282
 			#00 EQU ,$no-pixel ROT JMP2?
283 283
 				,$no-pixel ,patternize JSR2 #00 EQU JMP2?
284 284
 				~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~cursor.oper JSR2
... ...
@@ -348,7 +348,7 @@ RTN
348 348
 	SWP POP #07 AND =px.x
349 349
 	( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8*
350 350
 	( add addr ) ,data ADD2
351
-	#00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND
351
+	#00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND
352 352
 
353 353
 RTN
354 354
 
... ...
@@ -356,9 +356,9 @@ RTN
356 356
 
357 357
 	=pt1.y =pt1.x
358 358
 	( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 
359
-	( load ) DUP2 LDR
359
+	( load ) DUP2 PEK2
360 360
 	( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL ORA
361
-	( save ) ROT ROT STR
361
+	( save ) ROT ROT POK2
362 362
 
363 363
 RTN
364 364
 
... ...
@@ -366,9 +366,9 @@ RTN
366 366
 
367 367
 	=pt1.y =pt1.x
368 368
 	( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 
369
-	( load ) DUP2 LDR
369
+	( load ) DUP2 PEK2
370 370
 	( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL #ff EOR AND
371
-	( save ) ROT ROT STR
371
+	( save ) ROT ROT POK2
372 372
 
373 373
 RTN
374 374
 
... ...
@@ -197,6 +197,21 @@ redraw(Uint32 *dst, Uxn *u)
197 197
 	screen.reqdraw = 0;
198 198
 }
199 199
 
200
+void
201
+toggledebug(Uxn *u)
202
+{
203
+	GUIDES = !GUIDES;
204
+	redraw(pixels, u);
205
+}
206
+
207
+void
208
+togglezoom(Uxn *u)
209
+{
210
+	ZOOM = ZOOM == 3 ? 1 : ZOOM + 1;
211
+	SDL_SetWindowSize(gWindow, WIDTH * ZOOM, HEIGHT * ZOOM);
212
+	redraw(pixels, u);
213
+}
214
+
200 215
 void
201 216
 quit(void)
202 217
 {
... ...
@@ -287,9 +302,11 @@ doctrl(Uxn *u, SDL_Event *event, int z)
287 302
 {
288 303
 	Uint8 flag = 0x00;
289 304
 	Uint16 addr = devctrl->addr;
290
-	if(z && event->key.keysym.sym == SDLK_h && SDL_GetModState() & KMOD_LCTRL) {
291
-		GUIDES = !GUIDES;
292
-		redraw(pixels, u);
305
+	if(z && event->key.keysym.sym == SDLK_h) {
306
+		if(SDL_GetModState() & KMOD_LCTRL)
307
+			toggledebug(u);
308
+		if(SDL_GetModState() & KMOD_LALT)
309
+			togglezoom(u);
293 310
 	}
294 311
 	switch(event->key.keysym.sym) {
295 312
 	case SDLK_LCTRL: flag = 0x01; break;