Browse code

Optimised MUL2 by powers of 2 to SFT2

Andrew Alderwick authored on 24/05/2021 21:52:11
Showing 14 changed files
... ...
@@ -7,6 +7,7 @@
7 7
 %MOD { DUP2 DIV MUL SUB }
8 8
 %TOS { #00 SWP }
9 9
 %2// { #01 SFT2 }
10
+%8** { #30 SFT2 }
10 11
 
11 12
 ( devices )
12 13
 
... ...
@@ -105,11 +106,11 @@ RTN
105 106
 	( save pos ) .anchor/y STZ2 .anchor/x STZ2
106 107
 	#00 #0f
107 108
 	&loop
108
-		( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x LDZ2 ADD2 .Screen/x DEO2
109
-		( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y LDZ2 ADD2 .Screen/y DEO2
109
+		( save-x ) OVR #03 MOD TOS 8** .anchor/x LDZ2 ADD2 .Screen/x DEO2
110
+		( save-y ) OVR #03 DIV TOS 8** .anchor/y LDZ2 ADD2 .Screen/y DEO2
110 111
 		( get digit* ) OVR STHkr #02 MUL TOS ;digits ADD2 LDA2 
111 112
 		( get bit ) ROT #0e SWP SUB SFT2 #0001 AND2 
112
-		( set tile ) #0008 MUL2 ;tiles ADD2 
113
+		( set tile ) 8** ;tiles ADD2 
113 114
 		( set style ) .style LDZ #10 MUL TOS ADD2
114 115
 		.Screen/addr DEO2
115 116
 		( draw ) #21 .Screen/color DEO
... ...
@@ -9,6 +9,10 @@
9 9
 %++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
10 10
 %<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
11 11
 
12
+%2** { #10 SFT2 } %2// { #01 SFT2 }
13
+%4** { #20 SFT2 } %4// { #02 SFT2 }
14
+%8** { #30 SFT2 } %8// { #03 SFT2 }
15
+
12 16
 %TOB { SWP POP } %TOS { #00 SWP }
13 17
 %RTN { JMP2r }
14 18
 %MOD { DUP2 / * - }
... ...
@@ -85,14 +89,14 @@
85 89
 	#01 .piano/octave STZ
86 90
 
87 91
 	( find center )
88
-	.Screen/width DEI2 #0002 // .center/x STZ2
89
-	.Screen/height DEI2 #0002 // .center/y STZ2
92
+	.Screen/width DEI2 2// .center/x STZ2
93
+	.Screen/height DEI2 2// .center/y STZ2
90 94
 
91 95
 	( place frame )
92 96
 	.center/x LDZ2 PAD-WIDTH #0003 ** -- #0010 -- .frame/x1 STZ2
93 97
 	.center/y LDZ2 #0050 -- .frame/y1 STZ2
94 98
 	.center/x LDZ2 PAD-WIDTH #0003 ** ++ #0010 ++ .frame/x2 STZ2
95
-	.frame/y1 LDZ2 PAD-HEIGHT #0004 ** ++ #0028 ++ .frame/y2 STZ2
99
+	.frame/y1 LDZ2 PAD-HEIGHT 4** ++ #0028 ++ .frame/y2 STZ2
96 100
 
97 101
 	( place pad-view )
98 102
 	.frame/x1 LDZ2 .pad-view/x1 STZ2
... ...
@@ -136,7 +140,7 @@
136 140
 		( load sample )
137 141
 		OVR TOS #0019 ** ;pad-path ++ .File/name DEO2
138 142
 		OVR #04 / #10 * .Audio0/length + DEI2 .File/length DEO2
139
-		OVR TOS #0002 ** ;pad-addr ++ LDA2 .File/load DEO2
143
+		OVR TOS 2** ;pad-addr ++ LDA2 .File/load DEO2
140 144
 		( draw pad )
141 145
 		OVR #01 ;draw-pad JSR2
142 146
 		( draw mixer )
... ...
@@ -287,8 +291,8 @@ BRK
287 291
 
288 292
 @on-touch-oct ( -> )
289 293
 	
290
-	.Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 // TOB #08 ! ,&no-mod JCN
291
-		.Mouse/y DEI2 .oct-view/y1 LDZ2 -- #0008 // TOB 
294
+	.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #08 ! ,&no-mod JCN
295
+		.Mouse/y DEI2 .oct-view/y1 LDZ2 -- 8// TOB 
292 296
 		DUP #00 ! ,&no-incr JCN
293 297
 			.piano/octave LDZ #01 + .piano/octave STZ &no-incr
294 298
 		DUP #02 ! ,&no-decr JCN
... ...
@@ -299,8 +303,8 @@ BRK
299 303
 		BRK
300 304
 	&no-mod
301 305
 
302
-	.Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 // TOB #06 GTH ,&no-key JCN
303
-		.Mouse/x DEI2 .oct-view/x1 LDZ2 -- #0008 // 
306
+	.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// TOB #06 GTH ,&no-key JCN
307
+		.Mouse/x DEI2 .oct-view/x1 LDZ2 -- 8// 
304 308
 		( set pitch of pad )
305 309
 		DUP2 ;notes ++ LDA .pads/last LDZ SWP .piano/octave LDZ #02 - #0c * + 
306 310
 		( save ) SWP TOS ;pad-pitch ++ STA 
... ...
@@ -321,7 +325,7 @@ BRK
321 325
 	( highlight )
322 326
 	DUP #02 ;draw-pad JSR2
323 327
 	( addr )
324
-	DUP TOS #0002 ** ;pad-addr ++ LDA2 STH2
328
+	DUP TOS 2** ;pad-addr ++ LDA2 STH2
325 329
 	DUP #04 / #10 * .Audio0/addr + STH2r ROT DEO2
326 330
 	( pitch )
327 331
 	DUP TOS ;pad-pitch ++ LDA STH 
... ...
@@ -355,7 +359,7 @@ RTN
355 359
 		&no-dot
356 360
 		OVR TOS #0010 ** [ DUP2r STH2r ] ++ LDA 
357 361
 		#02 /
358
-		TOS #0004 // .wav-view/y1 LDZ2 ++ .Screen/y DEO2
362
+		TOS 4// .wav-view/y1 LDZ2 ++ .Screen/y DEO2
359 363
 		.Screen/x DEI2 #0001 ++ .Screen/x DEO2
360 364
 		( draw ) #02 .Screen/color DEO
361 365
 		( incr ) SWP #01 + SWP
... ...
@@ -417,14 +421,14 @@ RTN
417 421
 	OVR2 #0003 ++ .Screen/x DEO2
418 422
 	DUP2 #0014 ++ .Screen/y DEO2
419 423
 	( get pitch ) STHkr TOS ;pad-pitch ++ LDA
420
-	#0c / TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
424
+	#0c / TOS 8** ;font-hex ++ .Screen/addr DEO2
421 425
 	#21 .Screen/color DEO
422 426
 
423 427
 	( draw octave )
424 428
 	OVR2 #000b ++ .Screen/x DEO2
425 429
 	DUP2 #0014 ++ .Screen/y DEO2
426 430
 	( get pitch ) STHkr TOS ;pad-pitch ++ LDA
427
-	#0c MOD TOS #0008 ** ;font-notes ++ .Screen/addr DEO2
431
+	#0c MOD TOS 8** ;font-notes ++ .Screen/addr DEO2
428 432
 	#21 .Screen/color DEO
429 433
 
430 434
 	POP2 POP2
... ...
@@ -455,7 +459,7 @@ RTN
455 459
 	.oct-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
456 460
 	#21 .Screen/color DEO
457 461
 
458
-	;font-hex .piano/octave LDZ #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2
462
+	;font-hex .piano/octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2
459 463
 	.oct-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
460 464
 	#23 .Screen/color DEO
461 465
 
... ...
@@ -589,7 +593,7 @@ RTN
589 593
 	( load ) STH STH2 .Screen/y DEO2 .Screen/x DEO2
590 594
 	STH2r
591 595
 	&loop
592
-		DUP2 LDA #00 SWP #0030 -- #0008 ** ;font-num-uc ++ .Screen/addr DEO2 
596
+		DUP2 LDA #00 SWP #0030 -- 8** ;font-num-uc ++ .Screen/addr DEO2 
593 597
 		( draw ) STHkr .Screen/color DEO
594 598
 		( incr ) #0001 ++
595 599
 		( incr ) .Screen/x DEI2 #0008 ++ .Screen/x DEO2
... ...
@@ -16,6 +16,7 @@
16 16
 %MOD8 { #07 AND } %MOD2 { #01 AND }
17 17
 %SFL  { #40 SFT SFT }
18 18
 %2//  { #01 SFT2 } %8//  { #03 SFT2 }
19
+%2**  { #10 SFT2 } %8**  { #30 SFT2 }
19 20
 
20 21
 %WIDTH { #40 }   %HEIGHT { #40 }
21 22
 %BANK1 { #8000 } %BANK2 { #a000 }
... ...
@@ -151,10 +152,10 @@ BRK
151 152
 
152 153
 	#00 HEIGHT
153 154
 	&ver
154
-		OVR TOS #0002 ** .anchor/y LDZ2 ++ .Screen/y DEO2
155
+		OVR TOS 2** .anchor/y LDZ2 ++ .Screen/y DEO2
155 156
 		#00 WIDTH
156 157
 		&hor
157
-			OVR TOS #0002 ** .anchor/x LDZ2 ++ .Screen/x DEO2
158
+			OVR TOS 2** .anchor/x LDZ2 ++ .Screen/x DEO2
158 159
 			GET-ITERATORS ,get-cell JSR #01 + .Screen/color DEO
159 160
 			INCR
160 161
 			NEQk ,&hor JCN
... ...
@@ -256,15 +257,15 @@ RTN
256 257
 @draw-short ( short* color -- )
257 258
 
258 259
 	STH SWP 
259
-	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
260
+	DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
260 261
 	( draw ) STHkr .Screen/color DEO
261
-	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
262
+	#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
262 263
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
263 264
 	( draw ) STHkr .Screen/color DEO
264
-	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
265
+	DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
265 266
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
266 267
 	( draw ) STHkr .Screen/color DEO
267
-	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
268
+	#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
268 269
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
269 270
 	( draw ) STHr .Screen/color DEO
270 271
 
... ...
@@ -2,10 +2,10 @@
2 2
 
3 3
 %RTN { JMP2r }
4 4
 %8++ { #0008 ADD2 } %8-- { #0008 SUB2 }
5
-%8** { #0008 MUL2 } %8// { #03 SFT2 }
5
+%8** { #30 SFT2 }   %8// { #03 SFT2 }
6 6
 %++ { #0001 ADD2 }  %2// { #01 SFT2 }
7 7
 %MOD8 { #07 AND }
8
-%TRACK { ;track/ch1 #00 .track/active LDZ #0020 MUL2 ADD2 }
8
+%TRACK { ;track/ch1 #00 .track/active LDZ #50 SFT2 ADD2 }
9 9
 
10 10
 ( variables )
11 11
 
... ...
@@ -14,6 +14,7 @@
14 14
 %2//  { #01 SFT2 }
15 15
 %4//  { #02 SFT2 }
16 16
 %8//  { #03 SFT2 }
17
+%8**  { #30 SFT2 }
17 18
 
18 19
 %WAVEFORM { #1000 }
19 20
 
... ...
@@ -295,7 +296,7 @@ RTN
295 296
 	.octave-view/y1 LDZ2 #0010 ++ .Screen/y DEO2
296 297
 	#21 .Screen/color DEO
297 298
 
298
-	;font-hex .octave LDZ #03 + #00 SWP #0008 ** ++ .Screen/addr DEO2
299
+	;font-hex .octave LDZ #03 + #00 SWP 8** ++ .Screen/addr DEO2
299 300
 	.octave-view/y1 LDZ2 #0008 ++ .Screen/y DEO2
300 301
 	#23 .Screen/color DEO
301 302
 
... ...
@@ -425,15 +426,15 @@ RTN
425 426
 @draw-short ( short* color -- )
426 427
 
427 428
 	STH SWP 
428
-	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
429
+	DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
429 430
 	( draw ) STHkr .Screen/color DEO
430
-	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
431
+	#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
431 432
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
432 433
 	( draw ) STHkr .Screen/color DEO
433
-	DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
434
+	DUP #04 SFT TOS 8** ;font-hex ++ .Screen/addr DEO2
434 435
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
435 436
 	( draw ) STHkr .Screen/color DEO
436
-	#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
437
+	#0f AND TOS 8** ;font-hex ++ .Screen/addr DEO2
437 438
 	.Screen/x DEI2 #0008 ++ .Screen/x DEO2
438 439
 	( draw ) STHr .Screen/color DEO
439 440
 
... ...
@@ -4,6 +4,8 @@
4 4
 %++  { #0001 ADD2 }
5 5
 %2// { #01 SFT2 }
6 6
 %4// { #02 SFT2 }
7
+%4** { #20 SFT2 }
8
+%8** { #30 SFT2 }
7 9
 %8+  { #0008 ADD2 }
8 10
 %STEP8 { #33 SFT2 }
9 11
 
... ...
@@ -213,28 +215,28 @@ RTN
213 215
 	.window/x1 LDZ2 #0038 ADD2 .Screen/x DEO2 
214 216
 	.System/b DEI2 #28 ;draw-short JSR2
215 217
 
216
-	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0010 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/r1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
217
-	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0020 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/g1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
218
-	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0030 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/b1 .selection LDZ ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
218
+	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0010 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/r1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
219
+	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0020 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/g1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
220
+	.window/x1 LDZ2 #0060 ADD2 .window/y1 LDZ2 #0030 ADD2 .window/x1 LDZ2 #0090 ADD2 #00 ;theme/b1 .selection LDZ ADD LDA 4** #01 ;draw-slider JSR2
219 221
 
220 222
 	.window/x1 LDZ2 #0050 ADD2 .Screen/x DEO2
221 223
 	.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
222
-	;radio_icns #00 .selection LDZ #00 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
224
+	;radio_icns #00 .selection LDZ #00 EQU 8** ADD2 .Screen/addr DEO2
223 225
 	#25 .Screen/color DEO
224 226
 
225 227
 	.window/x1 LDZ2 #0060 ADD2 .Screen/x DEO2
226 228
 	.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
227
-	;radio_icns #00 .selection LDZ #01 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
229
+	;radio_icns #00 .selection LDZ #01 EQU 8** ADD2 .Screen/addr DEO2
228 230
 	#25 .Screen/color DEO
229 231
 
230 232
 	.window/x1 LDZ2 #0070 ADD2 .Screen/x DEO2
231 233
 	.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
232
-	;radio_icns #00 .selection LDZ #02 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
234
+	;radio_icns #00 .selection LDZ #02 EQU 8** ADD2 .Screen/addr DEO2
233 235
 	#25 .Screen/color DEO
234 236
 
235 237
 	.window/x1 LDZ2 #0080 ADD2 .Screen/x DEO2
236 238
 	.window/y1 LDZ2 #0040 ADD2 .Screen/y DEO2
237
-	;radio_icns #00 .selection LDZ #03 EQU #0008 MUL2 ADD2 .Screen/addr DEO2
239
+	;radio_icns #00 .selection LDZ #03 EQU 8** ADD2 .Screen/addr DEO2
238 240
 	#25 .Screen/color DEO
239 241
 
240 242
 RTN
... ...
@@ -328,7 +330,7 @@ RTN
328 330
 	.Screen/x DEO2 
329 331
 	STH2r
330 332
 	&loop
331
-		DUP2 LDA #00 SWP #0008 MUL2 
333
+		DUP2 LDA #00 SWP 8**
332 334
 		;font ADD2 .Screen/addr DEO2 
333 335
 		( draw ) STHkr .Screen/color DEO
334 336
 		( incr ) ++
... ...
@@ -341,15 +343,15 @@ RTN
341 343
 @draw-short ( short* color -- )
342 344
 
343 345
 	STH SWP 
344
-	DUP #04 SFT #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
346
+	DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
345 347
 	( draw ) STHkr .Screen/color DEO
346
-	#0f AND #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
348
+	#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
347 349
 	.Screen/x DEI2 8+ .Screen/x DEO2
348 350
 	( draw ) STHkr .Screen/color DEO
349
-	DUP #04 SFT #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
351
+	DUP #04 SFT #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
350 352
 	.Screen/x DEI2 8+ .Screen/x DEO2
351 353
 	( draw ) STHkr .Screen/color DEO
352
-	#0f AND #00 SWP #0008 MUL2 ;font-hex ADD2 .Screen/addr DEO2
354
+	#0f AND #00 SWP 8** ;font-hex ADD2 .Screen/addr DEO2
353 355
 	.Screen/x DEI2 8+ .Screen/x DEO2
354 356
 	( draw ) STHr .Screen/color DEO
355 357
 
... ...
@@ -1,7 +1,7 @@
1 1
 ( dev/audio )
2 2
 
3
-@timer    $1
4
-@progress $1
3
+%4** { #20 SFT2 }
4
+%8** { #30 SFT2 }
5 5
 
6 6
 ( devices )
7 7
 
... ...
@@ -9,6 +9,13 @@
9 9
 |20 @Screen     [ &vector $2 &width    $2 &height $2 &pad   $2 &x      $2 &y    $2 &addr  $2 &color $1 ]
10 10
 |30 @Audio0     [ &vector $2 &position $2 &output $1 &pad   $3 &adsr   $2 &length $2 &addr $2 &volume $1 &pitch $1 ]
11 11
 
12
+( variables )
13
+
14
+|0000
15
+
16
+@timer    $1
17
+@progress $1
18
+
12 19
 |0100 ( -> )
13 20
 	
14 21
 	( theme )
... ...
@@ -42,8 +49,8 @@ BRK
42 49
 	#20  .Screen/color DEO
43 50
 
44 51
 	( draw note )
45
-	#00 SWP #0004 MUL2 #0100 SUB2 .Screen/y DEO2
46
-	#00 .progress LDZ #0008 MUL2 .Screen/x DEO2
52
+	#00 SWP 4** #0100 SUB2 .Screen/y DEO2
53
+	#00 .progress LDZ 8** .Screen/x DEO2
47 54
 	;dot .Screen/addr DEO2
48 55
 	#21 .Screen/color DEO
49 56
 
... ...
@@ -2,6 +2,7 @@
2 2
 
3 3
 %2// { #01 SFT2 }
4 4
 %4// { #02 SFT2 }
5
+%2** { #10 SFT2 }
5 6
 
6 7
 %RTN     { JMP2r }
7 8
 %MOD     { DUP2 DIV MUL SUB }
... ...
@@ -54,13 +55,13 @@ BRK
54 55
 	#0080 SCALEX #0080 SCALEY .needles/hx LDZ2 .needles/hy LDZ2 #00 ;draw-line JSR2
55 56
 
56 57
 	( place )
57
-	#00 .DateTime/second DEI #0002 MUL2 ;table ADD2 LDA2
58
+	#00 .DateTime/second DEI 2** ;table ADD2 LDA2
58 59
 		#00 SWP SCALEY .needles/sy STZ2
59 60
 		#00 SWP SCALEX .needles/sx STZ2
60
-	#00 .DateTime/minute DEI #0002 MUL2 ;table ADD2 LDA2
61
+	#00 .DateTime/minute DEI 2** ;table ADD2 LDA2
61 62
 		#00 SWP 4// #0003 MUL2 #0020 ADD2 SCALEY .needles/my STZ2
62 63
 		#00 SWP 4// #0003 MUL2 #0020 ADD2 SCALEX .needles/mx STZ2
63
-	#00 .DateTime/hour DEI 12HOURS #05 MUL #0002 MUL2 ;table ADD2 LDA2
64
+	#00 .DateTime/hour DEI 12HOURS #05 MUL 2** ;table ADD2 LDA2
64 65
 		#00 SWP 2// #0040 ADD2 SCALEY .needles/hy STZ2
65 66
 		#00 SWP 2// #0040 ADD2 SCALEX .needles/hx STZ2
66 67
 
... ...
@@ -72,7 +73,7 @@ BRK
72 73
 	( circle )
73 74
 	#00 #3c
74 75
 	&loop
75
-		( load ) OVR #00 SWP #0002 MUL2 ;table ADD2 LDA2
76
+		( load ) OVR #00 SWP 2** ;table ADD2 LDA2
76 77
 		#00 SWP SCALEY .Screen/y DEO2
77 78
 		#00 SWP SCALEX .Screen/x DEO2
78 79
 		OVR #0f MOD #00 EQU #01 ADD .Screen/color DEO
... ...
@@ -115,8 +116,8 @@ RTN
115 116
 	( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
116 117
 	.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
117 118
 	.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
118
-	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
119
-	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
119
+	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
120
+	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
120 121
 	.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
121 122
 	&loop
122 123
 		.line/x LDZ2 .Screen/x DEO2 
... ...
@@ -124,7 +125,7 @@ RTN
124 125
 		.color LDZ .Screen/color DEO
125 126
 		[ .line/x LDZ2 .line/x0 LDZ2 EQU2 ] 
126 127
 		[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN
127
-		.line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
128
+		.line/e1 LDZ2 2** .line/e2 STZ2
128 129
 		.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
129 130
 			.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
130 131
 			.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
... ...
@@ -4,6 +4,7 @@
4 4
 %ABS2  { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 }
5 5
 %LTS2  { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
6 6
 %GTS2  { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
7
+%2** { #10 SFT2 }
7 8
 
8 9
 ( devices )
9 10
 
... ...
@@ -94,8 +95,8 @@ RTN
94 95
 	( load ) .color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
95 96
 	.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
96 97
 	.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
97
-	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
98
-	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
98
+	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
99
+	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
99 100
 	.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
100 101
 	&loop
101 102
 		.line/x LDZ2 .Screen/x DEO2 
... ...
@@ -103,7 +104,7 @@ RTN
103 104
 		.color LDZ .Screen/color DEO
104 105
 		[ .line/x LDZ2 .line/x0 LDZ2 EQU2 ] 
105 106
 		[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] #0101 EQU2 ,&end JCN
106
-		.line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
107
+		.line/e1 LDZ2 2** .line/e2 STZ2
107 108
 		.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
108 109
 			.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
109 110
 			.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
... ...
@@ -2,6 +2,7 @@
2 2
 
3 3
 %RTN { JMP2r }
4 4
 %2// { #01 SFT2 }
5
+%8** { #30 SFT2 }
5 6
 
6 7
 ( devices )
7 8
 
... ...
@@ -51,7 +52,7 @@ RTN
51 52
 	( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2 .Screen/x DEO2
52 53
 	.label/addr LDZ2
53 54
 	&loop
54
-		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
55
+		( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
55 56
 		( incr ) #0001 ADD2
56 57
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
57 58
 		DUP2 LDA ,&loop JCN
... ...
@@ -62,10 +63,10 @@ RTN
62 63
 @draw-label-middle ( x y color addr -- )
63 64
 	
64 65
 	( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
65
-	( align ) .label/addr LDZ2 ;get-text-length JSR2 #0008 MUL2 2// SUB2 .Screen/x DEO2
66
+	( align ) .label/addr LDZ2 ;get-text-length JSR2 8** 2// SUB2 .Screen/x DEO2
66 67
 	.label/addr LDZ2
67 68
 	&loop
68
-		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
69
+		( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
69 70
 		( incr ) #0001 ADD2
70 71
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
71 72
 		DUP2 LDA ,&loop JCN
... ...
@@ -76,10 +77,10 @@ RTN
76 77
 @draw-label-right ( x y color addr -- )
77 78
 	
78 79
 	( load ) .label/addr STZ2 .label/color STZ .Screen/y DEO2
79
-	( align ) .label/addr LDZ2 ;get-text-length JSR2 #0008 MUL2 SUB2 .Screen/x DEO2
80
+	( align ) .label/addr LDZ2 ;get-text-length JSR2 8** SUB2 .Screen/x DEO2
80 81
 	.label/addr LDZ2
81 82
 	&loop
82
-		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
83
+		( draw ) DUP2 LDA #00 SWP 8** ;font ADD2 .Screen/addr DEO2 .label/color LDZ .Screen/color DEO
83 84
 		( incr ) #0001 ADD2
84 85
 		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
85 86
 		DUP2 LDA ,&loop JCN
... ...
@@ -3,7 +3,9 @@
3 3
 %RTN { JMP2r }
4 4
 %++  { #0001 ADD2 }
5 5
 %--  { #0001 SUB2 }
6
-%8+  { #0008 ADD2 }
6
+%8++  { #0008 ADD2 }
7
+%2** { #10 SFT2 }
8
+%4** { #20 SFT2 }
7 9
 %ABS2 { DUP2 #0f SFT2 EQU #04 JCN #ffff MUL2 }
8 10
 %LTS2  { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
9 11
 %GTS2  { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
... ...
@@ -49,13 +51,13 @@ BRK
49 51
 	( load ) .color STZ -- .line/y0 STZ2 -- .line/x0 STZ2 .line/y STZ2 .line/x STZ2
50 52
 	.line/x0 LDZ2 .line/x LDZ2 SUB2 ABS2 .line/dx STZ2
51 53
 	.line/y0 LDZ2 .line/y LDZ2 SUB2 ABS2 #0000 SWP2 SUB2 .line/dy STZ2
52
-	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sx STZ2
53
-	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 #0002 MUL2 ADD2 .line/sy STZ2
54
+	#ffff #00 .line/x LDZ2 .line/x0 LDZ2 LTS2 2** ADD2 .line/sx STZ2
55
+	#ffff #00 .line/y LDZ2 .line/y0 LDZ2 LTS2 2** ADD2 .line/sy STZ2
54 56
 	.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
55 57
 	&loop
56 58
 		.line/x LDZ2 .Screen/x DEO2 .line/y LDZ2 .Screen/y DEO2 .color LDZ .Screen/color DEO
57 59
 		.line/x LDZ2 .line/x0 LDZ2 EQU2 .line/y LDZ2 .line/y0 LDZ2 EQU2 #0101 EQU2 ,&end JCN
58
-		.line/e1 LDZ2 #0002 MUL2 .line/e2 STZ2
60
+		.line/e1 LDZ2 2** .line/e2 STZ2
59 61
 		.line/e2 LDZ2 .line/dy LDZ2 LTS2 ,&skipy JCN
60 62
 			.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
61 63
 			.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
... ...
@@ -115,16 +117,16 @@ RTN
115 117
 
116 118
 	( load ) .color STZ .circle/r STZ2 .circle/yc STZ2 .circle/xc STZ2
117 119
 	#0000 .circle/x STZ2 .circle/r LDZ2 .circle/y STZ2
118
-	.circle/r LDZ2 #0002 MUL2 .circle/d STZ2
120
+	.circle/r LDZ2 2** .circle/d STZ2
119 121
 	( draw ) ;&seg JSR2
120 122
 	&loop
121 123
 		( incr ) .circle/x LDZ2 ++ .circle/x STZ2
122 124
 		.circle/d LDZ2 #0001 LTS2 ,&else JCN
123 125
 			( decr ) .circle/y LDZ2 -- .circle/y STZ2
124
-			.circle/x LDZ2 .circle/y LDZ2 SUB2 #0004 MUL2 .circle/d LDZ2 ADD2 .circle/d STZ2
126
+			.circle/x LDZ2 .circle/y LDZ2 SUB2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
125 127
 			;&end JMP2
126 128
 		&else
127
-			.circle/x LDZ2 #0004 MUL2 .circle/d LDZ2 ADD2 .circle/d STZ2
129
+			.circle/x LDZ2 4** .circle/d LDZ2 ADD2 .circle/d STZ2
128 130
 		&end
129 131
 		( draw ) ;&seg JSR2
130 132
 		.circle/y LDZ2 .circle/x LDZ2 -- GTS2 ,&loop JCN
... ...
@@ -151,10 +153,10 @@ RTN
151 153
 		&hor
152 154
 			( save ) OVR2 .Screen/x DEO2
153 155
 			( draw ) .color LDZ .Screen/color DEO
154
-			( incr ) SWP2 8+ SWP2
156
+			( incr ) SWP2 8++ SWP2
155 157
 			OVR2 OVR2 LTH2 ,&hor JCN
156 158
 		POP2 POP2
157
-		( incr ) SWP2 8+ SWP2
159
+		( incr ) SWP2 8++ SWP2
158 160
 		OVR2 OVR2 LTH2 ,&ver JCN
159 161
 	POP2 POP2
160 162
 
... ...
@@ -388,7 +388,7 @@
388 388
 	&not-end
389 389
 	,asma-parse-hex-digit JSR
390 390
 	DUP #f0 AND ,&fail JCN
391
-	LIT2r 0010 MUL2r
391
+	LITr 40 SFT2r
392 392
 	#00 STH STH ADD2r
393 393
 	#0001 ADD2
394 394
 	,&loop JMP
... ...
@@ -8,6 +8,7 @@
8 8
 %h { .DateTime/hour   DEI }
9 9
 %m { .DateTime/minute DEI }
10 10
 %s { .DateTime/second DEI }
11
+%8** { #30 SFT2 }
11 12
 
12 13
 ( devices )
13 14
 
... ...
@@ -68,7 +69,7 @@
68 69
 	#0120 #00 h MUL2
69 70
 	#00c0 #00 m MUL2 ADD2
70 71
 	#00f8 #00 s MUL2 ADD2
71
-	#0271 #00 .fps/next LDZ MUL2 #00 .fps/current LDZ DIV2 #0008 MUL2 ADD2
72
+	#0271 #00 .fps/next LDZ MUL2 #00 .fps/current LDZ DIV2 8** ADD2
72 73
 	#01b0 ;modf JSR2 SWP2 #0017 MUL2 #03e8 DIV2 .neralie/n6 STZ POP
73 74
 
74 75
 	( add up units and tens of pulses, store in n5 and n4 )
... ...
@@ -109,11 +110,11 @@
109 110
 	JMP2r
110 111
 
111 112
 @letter ( index* -- )
112
-	#0008 MUL2 ;font-letters ADD2 .Screen/addr DEO2
113
+	8** ;font-letters ADD2 .Screen/addr DEO2
113 114
 	,digit/middle JMP
114 115
 
115 116
 @digit ( index* -- )
116
-	#0008 MUL2 ;font-numbers ADD2 .Screen/addr DEO2
117
+	8** ;font-numbers ADD2 .Screen/addr DEO2
117 118
 	&middle
118 119
 	.neralie/color LDZ #20 ADD .Screen/color DEO
119 120
 	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
... ...
@@ -13,8 +13,8 @@
13 13
 
14 14
 %RTN { JMP2r }
15 15
 %++ { #01 ADD } %-- { #01 SUB }
16
-%8+ { #0008 ADD2 }
17
-%8* { #0008 MUL2 } %8/ { #03 SFT2 }
16
+%8++ { #0008 ADD2 }
17
+%8** { #30 SFT2 } %8// { #03 SFT2 }
18 18
 %MOD { DUP2 DIV MUL SUB }
19 19
 %MOD8 { #07 AND }
20 20
 %MOD2 { #01 AND }
... ...
@@ -61,8 +61,8 @@
61 61
 	( vectors ) ;on-frame .Screen/vector DEO2
62 62
 
63 63
 	( find size )
64
-	.Screen/width DEI2 8/ SWP POP .grid/width STZ
65
-	.Screen/height DEI2 8/ SWP POP #02 SUB .grid/height STZ
64
+	.Screen/width DEI2 8// SWP POP .grid/width STZ
65
+	.Screen/height DEI2 8// SWP POP #02 SUB .grid/height STZ
66 66
 
67 67
 	( fill grid with dots )
68 68
 
... ...
@@ -123,8 +123,8 @@ BRK
123 123
 @on-mouse
124 124
 	
125 125
 	.Mouse/state DEI #00 EQU ,&no-touch JCN
126
-		.Mouse/x DEI2 8/ SWP POP .selection/x1 STZ
127
-		.Mouse/y DEI2 8/ SWP POP .selection/y1 STZ
126
+		.Mouse/x DEI2 8// SWP POP .selection/x1 STZ
127
+		.Mouse/y DEI2 8// SWP POP .selection/y1 STZ
128 128
 		;redraw JSR2
129 129
 	&no-touch
130 130
 
... ...
@@ -202,7 +202,7 @@ RTN
202 202
 		POP2 ;font RTN
203 203
 	&no-bar
204 204
 	STH POP2 STHr
205
-	#20 SUB #00 SWP #0008 MUL2 ;font ADD2
205
+	#20 SUB #00 SWP 8** ;font ADD2
206 206
 
207 207
 RTN
208 208
 
... ...
@@ -489,19 +489,19 @@ RTN
489 489
 	( Positionx )
490 490
 	#0000 .Screen/x DEO2
491 491
 	.selection/x1 LDZ
492
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
492
+		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
493 493
 	#22 .Screen/color DEO
494 494
 	#0008 .Screen/x DEO2
495
-		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
495
+		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
496 496
 	#22 .Screen/color DEO
497 497
 
498 498
 	( Positiony )
499 499
 	#0010 .Screen/x DEO2
500 500
 	.selection/y1 LDZ
501
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
501
+		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
502 502
 	#22 .Screen/color DEO
503 503
 	#0018 .Screen/x DEO2
504
-		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
504
+		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
505 505
 	#22 .Screen/color DEO
506 506
 
507 507
 	#0020 .Screen/x DEO2
... ...
@@ -511,10 +511,10 @@ RTN
511 511
 	( Frame )
512 512
 	#0030 .Screen/x DEO2
513 513
 	.timer/frame LDZ
514
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
514
+		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
515 515
 	#22 .Screen/color DEO
516 516
 	#0038 .Screen/x DEO2
517
-		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
517
+		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
518 518
 	#22 .Screen/color DEO
519 519
 
520 520
 	#0040 .Screen/x DEO2
... ...
@@ -524,20 +524,20 @@ RTN
524 524
 	( Speed )
525 525
 	#0050 .Screen/x DEO2
526 526
 	.timer/speed LDZ
527
-		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
527
+		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
528 528
 	#22 .Screen/color DEO
529 529
 	#0058 .Screen/x DEO2
530
-		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
530
+		#0f AND LDA-CHAR #20 SUB #00 SWP 8** ;font ADD2 .Screen/addr DEO2
531 531
 	#22 .Screen/color DEO
532 532
 
533 533
 	( TODO: Signal VU )
534 534
 
535 535
 	( File )
536 536
 	.Screen/width DEI2 #0028 SUB2 .Screen/x DEO2
537
-	.Screen/x DEI2 8+ .Screen/x DEO2 ;eye_icns .Screen/addr DEO2 #21 .Screen/color DEO
538
-	.Screen/x DEI2 8+ .Screen/x DEO2 ;filestate_icn .Screen/addr DEO2 #21 .Screen/color DEO
539
-	.Screen/x DEI2 8+ .Screen/x DEO2 ;load_icn .Screen/addr DEO2 #21 .Screen/color DEO
540
-	.Screen/x DEI2 8+ .Screen/x DEO2 ;save_icn .Screen/addr DEO2 #21 .Screen/color DEO
537
+	.Screen/x DEI2 8++ .Screen/x DEO2 ;eye_icns .Screen/addr DEO2 #21 .Screen/color DEO
538
+	.Screen/x DEI2 8++ .Screen/x DEO2 ;filestate_icn .Screen/addr DEO2 #21 .Screen/color DEO
539
+	.Screen/x DEI2 8++ .Screen/x DEO2 ;load_icn .Screen/addr DEO2 #21 .Screen/color DEO
540
+	.Screen/x DEI2 8++ .Screen/x DEO2 ;save_icn .Screen/addr DEO2 #21 .Screen/color DEO
541 541
 
542 542
 RTN
543 543
 
... ...
@@ -545,10 +545,10 @@ RTN
545 545
 	
546 546
 	#00 .grid/height LDZ
547 547
 	&ver
548
-		( pos-y ) OVR #00 SWP #0008 MUL2 .Screen/y DEO2
548
+		( pos-y ) OVR #00 SWP 8** .Screen/y DEO2
549 549
 		#00 .grid/width LDZ
550 550
 		&hor
551
-			( pos-x ) OVR #00 SWP #0008 MUL2 .Screen/x DEO2
551
+			( pos-x ) OVR #00 SWP 8** .Screen/x DEO2
552 552
 			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
553 553
 			( sprite ) DUP2 ;get-cell-sprite JSR2 .Screen/addr DEO2
554 554
 			( draw ) ;is-selected JSR2 #0d MUL #21 ADD .Screen/color DEO