2022-03-27 14:53:24 -04:00
|
|
|
( Console:
|
|
|
|
Prints Hello Uxn!, and listens for incoming stdin events on enter. )
|
2021-02-20 18:00:34 -05:00
|
|
|
|
2022-03-27 14:53:24 -04:00
|
|
|
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|
2021-04-21 08:45:17 -04:00
|
|
|
|
2021-04-21 12:48:04 -04:00
|
|
|
|0100 ( -> )
|
2021-02-20 18:00:34 -05:00
|
|
|
|
2022-03-27 14:53:24 -04:00
|
|
|
( set vector )
|
|
|
|
;on-console .Console/vector DEO2
|
|
|
|
( print hello )
|
|
|
|
;hello-txt
|
2021-08-08 13:21:58 -04:00
|
|
|
&while
|
2022-03-27 14:53:24 -04:00
|
|
|
LDAk .Console/write DEO
|
2021-08-17 22:40:07 -04:00
|
|
|
INC2 LDAk ,&while JCN
|
2021-05-17 18:13:46 -04:00
|
|
|
POP2
|
2021-07-28 18:41:07 -04:00
|
|
|
|
2021-05-13 11:47:18 -04:00
|
|
|
BRK
|
2021-02-20 18:00:34 -05:00
|
|
|
|
2022-03-27 14:53:24 -04:00
|
|
|
@on-console ( -> )
|
|
|
|
|
|
|
|
;yousaid-txt ,print-str JSR
|
|
|
|
.Console/read DEI .Console/write DEO
|
|
|
|
#0a .Console/write DEO
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@print-str ( str* -- )
|
|
|
|
|
|
|
|
&while
|
|
|
|
LDAk #18 DEO
|
|
|
|
INC2 LDAk ,&while JCN
|
|
|
|
POP2
|
|
|
|
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@hello-txt "Hello 20 "Uxn! $1
|
|
|
|
@yousaid-txt "You 20 "said: 20 $1
|