0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-08 23:35:05 +00:00
uxn/projects/examples/devices/console.tal

38 lines
574 B
Tal
Raw Normal View History

( Console:
Prints Hello Uxn!, and listens for incoming stdin events on enter. )
2021-02-20 23:00:34 +00:00
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
2021-04-21 16:48:04 +00:00
|0100 ( -> )
2021-02-20 23:00:34 +00:00
( set vector )
;on-console .Console/vector DEO2
( print hello )
;hello-txt
2021-08-08 17:21:58 +00:00
&while
LDAk .Console/write DEO
2021-08-18 02:40:07 +00:00
INC2 LDAk ,&while JCN
2021-05-17 22:13:46 +00:00
POP2
2021-07-28 22:41:07 +00:00
2021-05-13 15:47:18 +00:00
BRK
2021-02-20 23:00:34 +00: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