| ... | ... |
@@ -3,24 +3,38 @@ |
| 3 | 3 |
|
| 4 | 4 |
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
| 5 | 5 |
|
| 6 |
+|00 |
|
| 7 |
+ |
|
| 8 |
+ @buf |
|
| 9 |
+ |
|
| 6 | 10 |
|0100 ( -> ) |
| 7 | 11 |
|
| 8 | 12 |
( set vector ) |
| 9 | 13 |
;on-console .Console/vector DEO2 |
| 10 | 14 |
( print hello ) |
| 11 |
- ;hello-txt |
|
| 12 |
- &while |
|
| 13 |
- LDAk .Console/write DEO |
|
| 14 |
- INC2 LDAk ,&while JCN |
|
| 15 |
- POP2 |
|
| 15 |
+ ;hello-txt print-str |
|
| 16 | 16 |
|
| 17 | 17 |
BRK |
| 18 | 18 |
|
| 19 | 19 |
@on-console ( -> ) |
| 20 | 20 |
|
| 21 |
- ;yousaid-txt ,print-str JSR |
|
| 22 |
- .Console/read DEI .Console/write DEO |
|
| 23 |
- #0a .Console/write DEO |
|
| 21 |
+ .Console/read DEI .buf skey ?eval |
|
| 22 |
+ |
|
| 23 |
+BRK |
|
| 24 |
+ |
|
| 25 |
+@eval ( -> ) |
|
| 26 |
+ |
|
| 27 |
+ ;buf |
|
| 28 |
+ DUP2 ;quit-txt scmp ?quit |
|
| 29 |
+ ;yousaid-txt print-str |
|
| 30 |
+ DUP2 print-str #0a18 DEO |
|
| 31 |
+ sclr |
|
| 32 |
+ |
|
| 33 |
+BRK |
|
| 34 |
+ |
|
| 35 |
+@quit ( buf* -> ) |
|
| 36 |
+ |
|
| 37 |
+ POP2 #010f DEO |
|
| 24 | 38 |
|
| 25 | 39 |
BRK |
| 26 | 40 |
|
| ... | ... |
@@ -28,10 +42,18 @@ BRK |
| 28 | 42 |
|
| 29 | 43 |
&while |
| 30 | 44 |
LDAk #18 DEO |
| 31 |
- INC2 LDAk ,&while JCN |
|
| 45 |
+ INC2 LDAk ?&while |
|
| 32 | 46 |
POP2 |
| 33 | 47 |
|
| 34 | 48 |
JMP2r |
| 35 | 49 |
|
| 36 |
-@hello-txt "Hello 20 "Uxn! $1 |
|
| 50 |
+@skey ( key buf -- proc ) OVR #21 LTH ?&eval #00 SWP sput #00 JMP2r &eval POP2 #01 JMP2r |
|
| 51 |
+@sclr ( str* -- ) LDAk ?&w POP2 JMP2r &w STH2k #00 STH2r STA INC2 LDAk ?&w POP2 JMP2r |
|
| 52 |
+@scap ( str* -- end* ) LDAk ?&w JMP2r &w INC2 LDAk ?&w JMP2r |
|
| 53 |
+@sput ( chr str* -- ) scap INC2k #00 ROT ROT STA STA JMP2r |
|
| 54 |
+@scmp ( a* b* -- f ) STH2 &l LDAk LDAkr STHr ANDk #00 EQU ?&e NEQk ?&e POP2 INC2 INC2r !&l &e NIP2 POP2r EQU JMP2r |
|
| 55 |
+ |
|
| 56 |
+@hello-txt "Welcome 20 "to 20 "Uxn! 0a $1 |
|
| 37 | 57 |
@yousaid-txt "You 20 "said: 20 $1 |
| 58 |
+@quit-txt "quit $1 |
|
| 59 |
+ |