... | ... |
@@ -2,33 +2,35 @@ |
2 | 2 |
a simple calculator |
3 | 3 |
uxnasm projects/software/calc.tal bin/calc.rom && uxnemu bin/calc.rom ) |
4 | 4 |
|
5 |
-%+ { ADD } %- { SUB } %/ { DIV } |
|
6 |
-%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
7 |
-%++ { ADD2 } %-- { SUB2 } %// { DIV2 } |
|
5 |
+%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
|
6 |
+%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
|
7 |
+%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 } |
|
8 | 8 |
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 } |
9 | 9 |
|
10 |
-%!~ { NEQk NIP } |
|
10 |
+%2* { #10 SFT } %2/ { #01 SFT } %2** { #10 SFT2 } %2// { #01 SFT2 } |
|
11 |
+%4* { #20 SFT } %4/ { #02 SFT } %4** { #20 SFT2 } %4// { #02 SFT2 } |
|
12 |
+%8* { #30 SFT } %8/ { #03 SFT } %8** { #30 SFT2 } %8// { #03 SFT2 } |
|
13 |
+%10* { #40 SFT } %10/ { #04 SFT } %10** { #40 SFT2 } %10// { #04 SFT2 } |
|
14 |
+%20* { #50 SFT } %20/ { #05 SFT } %20** { #50 SFT2 } %20// { #05 SFT2 } |
|
11 | 15 |
|
12 |
-%2* { #10 SFT } |
|
13 |
-%4* { #20 SFT } %4/ { #02 SFT } |
|
14 |
-%8* { #30 SFT } %8/ { #03 SFT } |
|
15 |
-%2** { #10 SFT2 } %2// { #01 SFT2 } |
|
16 |
-%4** { #20 SFT2 } |
|
17 |
-%8** { #30 SFT2 } %8// { #03 SFT2 } |
|
18 |
-%10** { #40 SFT2 } %10// { #04 SFT2 } |
|
19 |
-%20** { #50 SFT2 } |
|
16 |
+%2MOD { #01 AND } %2MOD2 { #0001 AND2 } |
|
17 |
+%4MOD { #03 AND } %4MOD2 { #0003 AND2 } |
|
18 |
+%8MOD { #07 AND } %8MOD2 { #0007 AND2 } |
|
19 |
+%10MOD { #0f AND } %10MOD2 { #000f AND2 } |
|
20 | 20 |
|
21 |
-%2MOD2 { #0001 AND2 } |
|
22 |
-%4MOD { #03 AND } %4MOD2 { #0003 AND2 } |
|
23 |
-%8MOD { #07 AND } |
|
21 |
+%!~ { NEQk NIP } |
|
24 | 22 |
|
25 | 23 |
%DEBUG { ;print-hex/byte JSR2 #0a .Console/write DEO } |
26 | 24 |
%DEBUG2 { ;print-hex/short JSR2 #0a .Console/write DEO } |
27 | 25 |
|
26 |
+%AUTO-NONE { #00 .Screen/auto DEO } |
|
27 |
+%AUTO-X { #01 .Screen/auto DEO } |
|
28 |
+%AUTO-XADDR { #05 .Screen/auto DEO } |
|
29 |
+%AUTO-YADDR { #06 .Screen/auto DEO } |
|
30 |
+ |
|
28 | 31 |
%RELEASE-MOUSE { #0096 DEO } |
29 | 32 |
|
30 | 33 |
%RTN { JMP2r } |
31 |
-%BRK? { #01 JCN BRK } |
|
32 | 34 |
%RTN? { #01 JCN RTN } |
33 | 35 |
%TOS { #00 SWP } |
34 | 36 |
|
... | ... |
@@ -47,7 +49,8 @@ |
47 | 49 |
|0000 |
48 | 50 |
|
49 | 51 |
@input |
50 |
- &length $1 &value $2 |
|
52 |
+ &value $2 |
|
53 |
+ &mode $1 |
|
51 | 54 |
@stack |
52 | 55 |
&length $1 |
53 | 56 |
&items $10 |
... | ... |
@@ -82,7 +85,7 @@ |
82 | 85 |
;on-button .Controller/vector DEO2 |
83 | 86 |
|
84 | 87 |
( setup synth ) |
85 |
- #0110 .Audio0/adsr DEO2 |
|
88 |
+ #0010 .Audio0/adsr DEO2 |
|
86 | 89 |
;sin-pcm .Audio0/addr DEO2 |
87 | 90 |
#0100 .Audio0/length DEO2 |
88 | 91 |
#dd .Audio0/volume DEO |
... | ... |
@@ -120,13 +123,11 @@ BRK |
120 | 123 |
|
121 | 124 |
.Controller/key DEI |
122 | 125 |
( generics ) |
123 |
- #00 !~ ,&no-release JCN ;redraw JSR2 POP BRK &no-release |
|
126 |
+ #00 !~ ,&no-empty JCN ;redraw JSR2 POP BRK &no-empty |
|
127 |
+ #09 !~ ,&no-tab JCN ;toggle-mode JSR2 POP BRK &no-tab |
|
124 | 128 |
#0d !~ ,&no-enter JCN ;do-push JSR2 POP BRK &no-enter |
125 | 129 |
#1b !~ ,&no-esc JCN ;do-pop JSR2 POP BRK &no-esc |
126 |
- #08 !~ ,&no-backspace JCN |
|
127 |
- .input/value LDZ2 #04 SFT2 .input/value STZ2 |
|
128 |
- #ff ;draw-input JSR2 POP BRK |
|
129 |
- &no-backspace |
|
130 |
+ #08 !~ ,&no-backspace JCN ;do-erase JSR2 POP BRK &no-backspace |
|
130 | 131 |
( arithmetic ) |
131 | 132 |
LIT '+ !~ ,&no-add JCN ;do-add JSR2 POP BRK &no-add |
132 | 133 |
LIT '- !~ ,&no-sub JCN ;do-sub JSR2 POP BRK &no-sub |
... | ... |
@@ -156,50 +157,59 @@ BRK |
156 | 157 |
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
157 | 158 |
#41 .Mouse/state DEI #01 = + .Screen/sprite DEO |
158 | 159 |
|
159 |
- ( handle events ) |
|
160 | 160 |
.Mouse/state DEI .pointer/last LDZ |
161 |
+ ( down ) |
|
161 | 162 |
DUP2 #0100 !! ,&no-down JCN |
162 |
- .Mouse/state DEI .pointer/last STZ |
|
163 |
- POP2 |
|
164 | 163 |
.Mouse/x DEI2 .Mouse/y DEI2 |
165 | 164 |
OVR2 OVR2 .keypad-frame ;within-rect JSR2 ;click-keypad JCN2 |
166 | 165 |
OVR2 OVR2 .input-frame ;within-rect JSR2 ;click-input JCN2 |
167 | 166 |
OVR2 OVR2 .modpad-frame ;within-rect JSR2 ;click-modpad JCN2 |
168 | 167 |
OVR2 OVR2 .bitpad-frame ;within-rect JSR2 ;click-bitpad JCN2 |
169 | 168 |
POP2 POP2 |
170 |
- BRK |
|
171 | 169 |
&no-down |
170 |
+ ( up ) |
|
172 | 171 |
DUP2 #0001 !! ,&no-up JCN |
173 |
- .Mouse/state DEI .pointer/last STZ |
|
174 |
- POP2 ;redraw JSR2 BRK |
|
172 |
+ ;redraw JSR2 |
|
175 | 173 |
&no-up |
176 | 174 |
POP2 |
175 |
+ ( record ) |
|
177 | 176 |
.Mouse/state DEI .pointer/last STZ |
178 | 177 |
|
179 | 178 |
BRK |
180 | 179 |
|
181 |
-@click-keypad ( x* y* -> ) |
|
180 |
+@click-keypad ( state* x* y* -> ) |
|
182 | 181 |
|
183 | 182 |
( y ) .keypad-frame/y LDZ2 -- #24 SFT2 |
184 | 183 |
( x ) SWP2 .keypad-frame/x LDZ2 -- 10// 4MOD2 |
185 |
- ( value ) ++ ;keypad/layout ++ LDA |
|
186 |
- ;push-input JSR2 |
|
187 |
- |
|
188 |
- RELEASE-MOUSE |
|
184 |
+ ( value ) ++ ;keypad/layout ++ LDA ;push-input JSR2 |
|
185 |
+ RELEASE-MOUSE POP2 |
|
189 | 186 |
|
190 | 187 |
BRK |
191 | 188 |
|
192 |
-@click-modpad ( x* y* -> ) |
|
189 |
+@click-modpad ( state* x* y* -> ) |
|
193 | 190 |
|
194 | 191 |
( y ) .modpad-frame/y LDZ2 -- #24 SFT2 NIP STH |
195 | 192 |
( x ) .modpad-frame/x LDZ2 -- 10// |
196 | 193 |
( lookup ) STHr + 2** ;keypad/ops ++ LDA2 JSR2 |
197 | 194 |
;draw-bitpad JSR2 |
198 |
- RELEASE-MOUSE |
|
195 |
+ RELEASE-MOUSE POP2 |
|
199 | 196 |
|
200 | 197 |
BRK |
201 | 198 |
|
202 |
-@click-bitpad ( x* y* -> ) |
|
199 |
+@click-input ( state* x* y* -> ) |
|
200 |
+ |
|
201 |
+ POP2 |
|
202 |
+ .input-frame/x LDZ2 -- 8// NIP |
|
203 |
+ DUP #00 ! ,&no-push JCN |
|
204 |
+ ;do-push JSR2 &no-push |
|
205 |
+ DUP #01 ! ,&no-pop JCN |
|
206 |
+ ;do-pop JSR2 &no-pop |
|
207 |
+ POP |
|
208 |
+ RELEASE-MOUSE POP2 |
|
209 |
+ |
|
210 |
+BRK |
|
211 |
+ |
|
212 |
+@click-bitpad ( state* x* y* -> ) |
|
203 | 213 |
|
204 | 214 |
( y ) .bitpad-frame/y LDZ2 -- 8// NIP 8* STH |
205 | 215 |
( x ) .bitpad-frame/x LDZ2 -- 8// NIP |
... | ... |
@@ -213,22 +223,8 @@ BRK |
213 | 223 |
.input/value STZ2 |
214 | 224 |
|
215 | 225 |
;draw-bitpad JSR2 |
216 |
- RELEASE-MOUSE |
|
217 |
- |
|
218 |
-BRK |
|
219 |
- |
|
220 |
-@click-input ( x* y* -> ) |
|
221 |
- |
|
222 |
- POP2 |
|
223 |
- .input-frame/x LDZ2 -- 8// NIP |
|
224 |
- DUP #00 ! ,&no-push JCN |
|
225 |
- ;do-push JSR2 |
|
226 |
- &no-push |
|
227 |
- DUP #01 ! ,&no-pop JCN |
|
228 |
- ;do-pop JSR2 |
|
229 |
- &no-pop |
|
230 |
- POP |
|
231 |
- RELEASE-MOUSE |
|
226 |
+ #ff ;draw-input JSR2 |
|
227 |
+ RELEASE-MOUSE POP2 |
|
232 | 228 |
|
233 | 229 |
BRK |
234 | 230 |
|
... | ... |
@@ -236,8 +232,9 @@ BRK |
236 | 232 |
|
237 | 233 |
DUP #50 + .Audio0/pitch DEO |
238 | 234 |
DUP TOS ;keypad/series ++ LDA ;draw-keypad JSR2 |
239 |
- TOS .input/value LDZ2 10** ++ .input/value STZ2 |
|
240 |
- ( INCZ ) .input/length LDZk INC SWP STZ |
|
235 |
+ ( hex/dec ) |
|
236 |
+ TOS .input/value LDZ2 #00 [ #0a #10 .input/mode LDZ JMP SWP POP ] ** |
|
237 |
+ ++ .input/value STZ2 |
|
241 | 238 |
#ff ;draw-input JSR2 |
242 | 239 |
;draw-bitpad JSR2 |
243 | 240 |
|
... | ... |
@@ -263,13 +260,20 @@ RTN |
263 | 260 |
|
264 | 261 |
RTN |
265 | 262 |
|
263 |
+@toggle-mode ( -- ) |
|
264 |
+ |
|
265 |
+ .input/mode LDZk #00 = SWP STZ |
|
266 |
+ ;redraw JSR2 |
|
267 |
+ |
|
268 |
+RTN |
|
269 |
+ |
|
266 | 270 |
@do-push ( -- ) |
267 | 271 |
|
268 | 272 |
.input/value LDZ2 ADD #00 > JMP RTN |
269 | 273 |
.stack/length LDZ #07 < JMP RTN |
270 |
- |
|
271 | 274 |
#40 .Audio0/pitch DEO |
272 | 275 |
.input/value LDZ2 ;push JSR2 |
276 |
+ ;draw-bitpad JSR2 |
|
273 | 277 |
|
274 | 278 |
RTN |
275 | 279 |
|
... | ... |
@@ -282,6 +286,7 @@ RTN |
282 | 286 |
;draw-stack JSR2 |
283 | 287 |
&continue |
284 | 288 |
#01 ;draw-input JSR2 |
289 |
+ ;draw-bitpad JSR2 |
|
285 | 290 |
|
286 | 291 |
RTN |
287 | 292 |
|
... | ... |
@@ -397,17 +402,22 @@ RTN |
397 | 402 |
|
398 | 403 |
RTN |
399 | 404 |
|
405 |
+@do-erase ( -- ) |
|
406 |
+ |
|
407 |
+ .input/value LDZ2 #04 SFT2 .input/value STZ2 |
|
408 |
+ #ff ;draw-input JSR2 |
|
409 |
+ ;draw-bitpad JSR2 |
|
410 |
+ |
|
411 |
+RTN |
|
412 |
+ |
|
400 | 413 |
@key-value ( key -- value ) |
401 | 414 |
|
402 |
- DUP #2f > OVR #3a < #0101 !! ,&no-num JCN |
|
403 |
- #30 - RTN |
|
404 |
- &no-num |
|
405 |
- DUP #60 > OVR #67 < #0101 !! ,&no-lc JCN |
|
406 |
- #57 - RTN ( #61 - #0a + ) |
|
407 |
- &no-lc |
|
408 |
- DUP #40 > OVR #47 < #0101 !! ,&no-uc JCN |
|
409 |
- #37 - RTN ( #41 - #0a + ) |
|
410 |
- &no-uc |
|
415 |
+ DUP #2f > OVR #3a < #0101 !! ,&no-num JCN |
|
416 |
+ #30 - RTN &no-num |
|
417 |
+ DUP #60 > OVR #67 < #0101 !! ,&no-lc JCN |
|
418 |
+ #57 - RTN ( #61 - #0a + ) &no-lc |
|
419 |
+ DUP #40 > OVR #47 < #0101 !! ,&no-uc JCN |
|
420 |
+ #37 - RTN ( #41 - #0a + ) &no-uc |
|
411 | 421 |
POP #00 |
412 | 422 |
|
413 | 423 |
RTN |
... | ... |
@@ -418,107 +428,62 @@ RTN |
418 | 428 |
#ff ;draw-modpad JSR2 |
419 | 429 |
#ff ;draw-input JSR2 |
420 | 430 |
;draw-bitpad JSR2 |
421 |
- ,draw-stack JSR |
|
431 |
+ ;draw-mode JSR2 |
|
432 |
+ ;draw-stack JSR2 |
|
433 |
+ |
|
434 |
+ #0010 .Screen/x DEO2 |
|
435 |
+ #0010 .Screen/y DEO2 |
|
422 | 436 |
|
423 | 437 |
RTN |
424 | 438 |
|
425 |
-@draw-stack ( -- ) |
|
439 |
+@draw-mode ( -- ) |
|
426 | 440 |
|
427 |
- #08 #00 |
|
428 |
- &loop |
|
429 |
- ( color ) DUP #08 .stack/length LDZ - #01 - > STH |
|
430 |
- ( value ) DUP 2* .stack/items + [ #10 .stack/length LDZ 2* - - ] LDZ2 STH2 |
|
431 |
- ( y ) DUP TOS 8** .input-frame/y LDZ2 ++ #004c -- STH2 |
|
432 |
- ( x ) .input-frame/x LDZ2 #0020 ++ STH2r STH2r STHr ,draw-short JSR |
|
433 |
- INC GTHk ,&loop JCN |
|
434 |
- POP2 |
|
441 |
+ AUTO-XADDR |
|
442 |
+ .input-frame/x LDZ2 .Screen/x DEO2 |
|
443 |
+ .input-frame/y LDZ2 #0014 -- .Screen/y DEO2 |
|
444 |
+ ;modes #00 .input/mode LDZ #0018 MUL2 ++ .Screen/addr DEO2 |
|
445 |
+ #02 .input/mode LDZ + .Screen/sprite DEOk DEOk DEO |
|
446 |
+ AUTO-NONE |
|
435 | 447 |
|
436 | 448 |
RTN |
437 | 449 |
|
438 |
-@draw-short ( x* y* value* color -- ) |
|
450 |
+@draw-stack ( -- ) |
|
439 | 451 |
|
440 |
- STH STH2 |
|
441 |
- .Screen/y DEO2 |
|
442 |
- #0020 ++ .Screen/x DEO2 |
|
443 |
- #0400 |
|
452 |
+ #08 #00 |
|
444 | 453 |
&loop |
445 |
- .Screen/x DEI2 #0008 -- .Screen/x DEO2 |
|
446 |
- ( value ) DUP STH2kr ROT 4* SFT2 #000f AND2 |
|
447 |
- ( value glyph ) 8** ;font-hex ++ .Screen/addr DEO2 |
|
448 |
- ( get color ) ROTr STHkr |
|
449 |
- ( place stack ) ROTr ROTr |
|
450 |
- ( no leading zeros ) |
|
451 |
- OVR STH2kr ,get-length JSR < ,&visible JCN |
|
452 |
- POP #00 |
|
453 |
- &visible |
|
454 |
- ( draw ) .Screen/sprite DEO |
|
454 |
+ .input-frame/x LDZ2 #0018 ++ .Screen/x DEO2 |
|
455 |
+ DUP TOS 8** .input-frame/y LDZ2 ++ #004c -- .Screen/y DEO2 |
|
456 |
+ ( color ) DUP #08 .stack/length LDZ - #01 - > STH |
|
457 |
+ ( value ) DUP 2* .stack/items + [ #10 .stack/length LDZ 2* - - ] LDZ2 |
|
458 |
+ STHr ;draw-number JSR2 |
|
455 | 459 |
INC GTHk ,&loop JCN |
456 | 460 |
POP2 |
457 |
- POP2r POPr |
|
458 |
- |
|
459 |
-RTN |
|
460 |
- |
|
461 |
-@get-length ( short* -- length ) |
|
462 |
- |
|
463 |
- DUP2 #1000 << ,&no4 JCN POP2 #04 RTN &no4 |
|
464 |
- DUP2 #0100 << ,&no3 JCN POP2 #03 RTN &no3 |
|
465 |
- DUP2 #0010 << ,&no2 JCN POP2 #02 RTN &no2 |
|
466 |
- #0000 !! |
|
467 | 461 |
|
468 | 462 |
RTN |
469 | 463 |
|
470 |
-@draw-decimal ( -- ) |
|
471 |
- |
|
472 |
- .bitpad-frame/y2 LDZ2 #0008 ++ .Screen/y DEO2 |
|
473 |
- .center/x LDZ2 #0014 -- .Screen/x DEO2 |
|
474 |
- #01 .Screen/auto DEO |
|
475 |
- |
|
476 |
- .input/value LDZ2 |
|
477 |
- ( 10,000 ) #2710 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ] |
|
478 |
- ( 1,000 ) #03e8 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ] |
|
479 |
- ( 100 ) #0064 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 NIP ] |
|
480 |
- ( 10 ) #0a DIVk DUP ,&digit JSR [ MUL SUB ] |
|
481 |
- ( 1 ) ,&digit JSR |
|
482 |
- #00 .Screen/auto DEO |
|
483 |
- |
|
484 |
-RTN |
|
485 |
- &digit ( num -- ) |
|
486 |
- 8* TOS ;font-hex ++ .Screen/addr DEO2 |
|
487 |
- #03 .Screen/sprite DEO |
|
488 |
- RTN |
|
489 |
- |
|
490 | 464 |
@draw-input ( key -- ) |
491 | 465 |
|
492 | 466 |
STH |
493 |
- |
|
494 | 467 |
( draw value ) |
495 |
- .input-frame/x LDZ2 #0020 ++ |
|
496 |
- .input-frame/y LDZ2 #0003 ++ |
|
497 |
- .input/value LDZ2 |
|
498 |
- #02 |
|
499 |
- ;draw-short JSR2 |
|
500 |
- |
|
468 |
+ .input-frame/x LDZ2 #0018 ++ .Screen/x DEO2 |
|
469 |
+ .input-frame/y LDZ2 #0003 ++ .Screen/y DEO2 |
|
470 |
+ .input/value LDZ2 #02 ;draw-number JSR2 |
|
501 | 471 |
( controls ) |
502 | 472 |
.input-frame/x LDZ2 |
503 | 473 |
.input-frame/y LDZ2 |
504 | 474 |
;stack-icns/push [ STHkr #00 = ] #02 |
505 | 475 |
;draw-key-thin JSR2 |
506 |
- |
|
507 | 476 |
.input-frame/x LDZ2 #0008 ++ |
508 | 477 |
.input-frame/y LDZ2 |
509 | 478 |
;stack-icns/pop [ STHkr #01 = ] #03 |
510 | 479 |
;draw-key-thin JSR2 |
511 |
- |
|
512 | 480 |
( line ) |
513 | 481 |
.input-frame/x LDZ2 |
514 | 482 |
.input-frame/x2 LDZ2 |
515 | 483 |
.input-frame/y LDZ2 #0004 -- #02 |
516 | 484 |
;line-hor-dotted JSR2 |
517 |
- |
|
518 | 485 |
POPr |
519 | 486 |
|
520 |
- ;draw-decimal JSR2 |
|
521 |
- |
|
522 | 487 |
RTN |
523 | 488 |
|
524 | 489 |
@draw-keypad ( key -- ) |
... | ... |
@@ -559,7 +524,7 @@ RTN |
559 | 524 |
|
560 | 525 |
@draw-bitpad ( -- ) |
561 | 526 |
|
562 |
- #10 #00 |
|
527 |
+ #1000 |
|
563 | 528 |
&loop |
564 | 529 |
( y ) DUP 8/ TOS 8** .bitpad-frame/y LDZ2 ++ .Screen/y DEO2 |
565 | 530 |
( x ) DUP 8MOD TOS 8** .bitpad-frame/x LDZ2 ++ .Screen/x DEO2 |
... | ... |
@@ -573,7 +538,7 @@ RTN |
573 | 538 |
|
574 | 539 |
@draw-key ( x* y* glyph* state color -- ) |
575 | 540 |
|
576 |
- ( auto x addr ) #05 .Screen/auto DEO |
|
541 |
+ ( auto x addr ) AUTO-XADDR |
|
577 | 542 |
( color ) ,&color STR |
578 | 543 |
( state ) ,&state STR |
579 | 544 |
( glyph ) ,&glyph STR2 |
... | ... |
@@ -591,30 +556,57 @@ RTN |
591 | 556 |
.Screen/x DEI2 #000c -- .Screen/x DEO2 |
592 | 557 |
.Screen/y DEI2 #0005 -- .Screen/y DEO2 |
593 | 558 |
,&color LDR [ ,&state LDR #09 MUL + ] .Screen/sprite DEO |
594 |
- ( auto none ) #00 .Screen/auto DEO |
|
559 |
+ ( auto none ) AUTO-NONE |
|
595 | 560 |
|
596 | 561 |
RTN |
597 | 562 |
&color $1 &state $1 &glyph $2 |
598 | 563 |
|
599 | 564 |
@draw-key-thin ( x* y* glyph* state color -- ) |
600 | 565 |
|
601 |
- ( auto y addr ) #06 .Screen/auto DEO |
|
602 |
- ( color ) ,&color STR |
|
603 |
- ( state ) ,&state STR |
|
604 |
- ( glyph ) ,&glyph STR2 |
|
605 |
- ( state ) ;button-thin-icns [ #00 ,&state LDR 10** ++ ] .Screen/addr DEO2 |
|
606 |
- ( y ) .Screen/y DEO2 |
|
607 |
- ( x ) .Screen/x DEO2 |
|
608 |
- ( draw background ) |
|
609 |
- ,&color LDR .Screen/sprite DEOk DEO |
|
566 |
+ AUTO-YADDR |
|
567 |
+ ,&color STR ,&state STR ,&glyph STR2 |
|
568 |
+ ( frame ) |
|
569 |
+ ;button-thin-icns #00 [ LIT &state $1 ] 10** ++ .Screen/addr DEO2 |
|
570 |
+ .Screen/y DEO2 .Screen/x DEO2 |
|
571 |
+ [ LIT &color $1 ] .Screen/sprite DEOk DEO |
|
610 | 572 |
( glyph ) |
611 |
- ,&glyph LDR2 .Screen/addr DEO2 |
|
573 |
+ [ LIT2 &glyph $2 ] .Screen/addr DEO2 |
|
612 | 574 |
.Screen/y DEI2 #000c -- .Screen/y DEO2 |
613 | 575 |
#05 .Screen/sprite DEO |
614 |
- ( auto none ) #00 .Screen/auto DEO |
|
576 |
+ AUTO-NONE |
|
577 |
+ |
|
578 |
+RTN |
|
579 |
+ |
|
580 |
+@draw-number ( number* color -- ) |
|
581 |
+ |
|
582 |
+ ,&color STR |
|
583 |
+ .input/mode LDZ ,&decimal JCN |
|
584 |
+ ( hexadecimal ) |
|
585 |
+ AUTO-X |
|
586 |
+ ,&color LDR #00 ,&color STR |
|
587 |
+ #00 ,&digit JSR ,&color STR |
|
588 |
+ SWP |
|
589 |
+ STHk #04 SFT ,&digit JSR |
|
590 |
+ STHr #0f AND ,&digit JSR |
|
591 |
+ STHk #04 SFT ,&digit JSR |
|
592 |
+ STHr #0f AND ,&digit JSR |
|
593 |
+ AUTO-NONE |
|
594 |
+ RTN |
|
595 |
+ &decimal |
|
596 |
+ AUTO-X |
|
597 |
+ #2710 DIV2k DUP2 NIP ,&digit JSR MUL2 SUB2 |
|
598 |
+ #03e8 DIV2k DUP2 NIP ,&digit JSR MUL2 SUB2 |
|
599 |
+ #0064 DIV2k DUP2 NIP ,&digit JSR MUL2 SUB2 NIP |
|
600 |
+ #0a DIVk DUP ,&digit JSR MUL SUB |
|
601 |
+ ,&digit JSR |
|
602 |
+ AUTO-NONE |
|
603 |
+ RTN |
|
604 |
+ &digit |
|
605 |
+ 8* TOS ;font-hex ++ .Screen/addr DEO2 |
|
606 |
+ LIT &color $1 .Screen/sprite DEO |
|
607 |
+ RTN |
|
615 | 608 |
|
616 | 609 |
RTN |
617 |
- &color $1 &state $1 &glyph $2 |
|
618 | 610 |
|
619 | 611 |
( theme ) |
620 | 612 |
|
... | ... |
@@ -645,12 +637,8 @@ RTN |
645 | 637 |
( x > rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN |
646 | 638 |
POP2 POP2 POPr |
647 | 639 |
#01 |
648 |
-RTN |
|
649 |
- &skip |
|
650 |
- POP2 POP2 POPr |
|
651 |
- #00 |
|
652 |
- |
|
653 |
-RTN |
|
640 |
+RTN |
|
641 |
+ &skip POP2 POP2 POPr #00 RTN |
|
654 | 642 |
|
655 | 643 |
@line-hor-dotted ( x0* x1* y* color -- ) |
656 | 644 |
|
... | ... |
@@ -665,38 +653,24 @@ RTN |
665 | 653 |
RTN |
666 | 654 |
|
667 | 655 |
@print-hex ( value* -- ) |
668 |
- |
|
669 |
- &short ( value* -- ) |
|
670 |
- SWP ,&echo JSR |
|
671 |
- &byte ( value -- ) |
|
672 |
- ,&echo JSR |
|
673 |
- RTN |
|
674 | 656 |
|
675 |
- &echo ( value -- ) |
|
676 |
- STHk #04 SFT ,&parse JSR .Console/write DEO |
|
677 |
- STHr #0f AND ,&parse JSR .Console/write DEO |
|
678 |
- RTN |
|
679 |
- &parse ( value -- char ) |
|
680 |
- DUP #09 GTH ,&above JCN #30 + RTN &above #09 - #60 + RTN |
|
657 |
+ SWP ,&byte JSR |
|
658 |
+ &byte ( byte -- ) |
|
659 |
+ STHk #04 SFT ,&parse JSR #18 DEO |
|
660 |
+ STHr #0f AND ,&parse JSR #18 DEO |
|
661 |
+ JMP2r |
|
662 |
+ &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r |
|
663 |
+ &above #57 ADD JMP2r |
|
681 | 664 |
|
682 |
-RTN |
|
665 |
+JMP2r |
|
683 | 666 |
|
684 | 667 |
@keypad |
685 | 668 |
&layout |
686 |
- 0708 090f |
|
687 |
- 0405 060e |
|
688 |
- 0102 030d |
|
689 |
- 000a 0b0c |
|
669 |
+ 0708 090f 0405 060e 0102 030d 000a 0b0c |
|
690 | 670 |
&series |
691 |
- 0c08 090a |
|
692 |
- 0405 0600 |
|
693 |
- 0102 0d0e |
|
694 |
- 0f0b 0703 |
|
671 |
+ 0c08 090a 0405 0600 0102 0d0e 0f0b 0703 |
|
695 | 672 |
&color |
696 |
- 0101 0102 |
|
697 |
- 0101 0102 |
|
698 |
- 0101 0102 |
|
699 |
- 0102 0202 |
|
673 |
+ 0101 0102 0101 0102 0101 0102 0102 0202 |
|
700 | 674 |
&ops |
701 | 675 |
:do-add :do-sub :do-mul :do-div |
702 | 676 |
:do-and :do-ora :do-eor :do-not |
... | ... |
@@ -727,7 +701,17 @@ RTN |
727 | 701 |
007c 8282 7c82 827c 007c 8282 7e02 827c |
728 | 702 |
007c 8202 7e82 827e 00fc 8282 fc82 82fc |
729 | 703 |
007c 8280 8080 827c 00fc 8282 8282 82fc |
730 |
- 007c 8280 f080 827c 007c 8280 f080 8080 |
|
704 |
+ 007e 8080 fe80 807e 007c 8280 f080 8080 |
|
705 |
+ |
|
706 |
+@modes |
|
707 |
+ ( hex ) |
|
708 |
+ 0082 8282 fe82 8282 |
|
709 |
+ 007e 8080 fe80 807e |
|
710 |
+ 0082 4428 1028 4482 |
|
711 |
+ ( dec ) |
|
712 |
+ 00fc 8282 8282 82fc |
|
713 |
+ 007e 8080 fe80 807e |
|
714 |
+ 007c 8280 8080 827c |
|
731 | 715 |
|
732 | 716 |
@mod-icns |
733 | 717 |
0010 1010 fe10 1010 |
... | ... |
@@ -742,35 +726,35 @@ RTN |
742 | 726 |
|
743 | 727 |
@button-icns |
744 | 728 |
( outline ) |
745 |
- 3f40 8080 8080 8080 |
|
746 |
- f804 0202 0202 0202 |
|
747 |
- 8080 8080 8040 3f00 |
|
748 |
- 0202 0202 0204 f800 |
|
729 |
+ 3f40 8080 8080 8080 |
|
730 |
+ f804 0202 0202 0202 |
|
731 |
+ 8080 8080 8040 3f00 |
|
732 |
+ 0202 0202 0204 f800 |
|
749 | 733 |
( full ) |
750 |
- 3f7f ffff ffff ffff |
|
751 |
- f8fc fefe fefe fefe |
|
752 |
- ffff ffff ff7f 3f00 |
|
753 |
- fefe fefe fefc f800 |
|
734 |
+ 3f7f ffff ffff ffff |
|
735 |
+ f8fc fefe fefe fefe |
|
736 |
+ ffff ffff ff7f 3f00 |
|
737 |
+ fefe fefe fefc f800 |
|
754 | 738 |
|
755 | 739 |
@button-thin-icns |
756 | 740 |
( outline ) |
757 |
- 3844 8282 8282 8282 |
|
758 |
- 8282 8282 8244 3800 |
|
741 |
+ 3844 8282 8282 8282 |
|
742 |
+ 8282 8282 8244 3800 |
|
759 | 743 |
( full ) |
760 |
- 387c fefe fefe fefe |
|
761 |
- fefe fefe fe7c 3800 |
|
744 |
+ 387c fefe fefe fefe |
|
745 |
+ fefe fefe fe7c 3800 |
|
762 | 746 |
|
763 | 747 |
@bit-icns |
764 | 748 |
( outline ) |
765 |
- 3844 8282 8244 3800 |
|
749 |
+ 3844 8282 8244 3800 |
|
766 | 750 |
( full ) |
767 |
- 387c fefe fe7c 3800 |
|
751 |
+ 387c fefe fe7c 3800 |
|
768 | 752 |
|
769 | 753 |
@stack-icns |
770 | 754 |
&push |
771 |
- 0000 1028 1000 0000 |
|
755 |
+ 0000 1028 1000 0000 |
|
772 | 756 |
&pop |
773 |
- 0000 2810 2800 0000 |
|
757 |
+ 0000 2810 2800 0000 |
|
774 | 758 |
|
775 | 759 |
@pointer-icn |
776 | 760 |
80c0 e0f0 f8e0 1000 |