*
This commit is contained in:
parent
def41120c1
commit
3af4843598
17 changed files with 391 additions and 921 deletions
82
boot/varvara.console.tal
Normal file
82
boot/varvara.console.tal
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
( usage: uxncli console.rom foo "bar baz"
|
||||
| Prints Welcome to Uxn!, and listens for incoming stdin events on enter. )
|
||||
|
||||
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||
|
||||
|000
|
||||
|
||||
@arg $40
|
||||
@std $40
|
||||
|
||||
|100
|
||||
|
||||
@on-reset ( -> )
|
||||
;dict/hello <print-str>
|
||||
.Console/type DEI ?{
|
||||
( | no arguments )
|
||||
;on-std .Console/vector DEO2
|
||||
BRK }
|
||||
;on-arg .Console/vector DEO2
|
||||
BRK
|
||||
|
||||
@on-arg ( -> )
|
||||
[ LIT2 02 -Console/type ] DEI NEQ ?{
|
||||
.Console/read DEI [ LIT2 00 &ptr -arg ] INCk ,&ptr STR
|
||||
STZ2
|
||||
BRK }
|
||||
;arg ;dict/yousent <print-result>
|
||||
[ LIT2 -arg _&ptr ] STR
|
||||
[ LIT2 04 -Console/type ] DEI NEQ ?{ ;on-std .Console/vector DEO2 }
|
||||
BRK
|
||||
|
||||
@on-std ( -> )
|
||||
[ LIT2 0a -Console/read ] DEI EQU ?{
|
||||
.Console/read DEI [ LIT2 00 &ptr -std ] INCk ,&ptr STR
|
||||
STZ2
|
||||
BRK }
|
||||
;std DUP2 ;dict/yousaid <print-result>
|
||||
;dict/quit scmp ?{
|
||||
[ LIT2 -std _&ptr ] STR
|
||||
BRK }
|
||||
( quit ) #800f DEO
|
||||
BRK
|
||||
|
||||
@<print-result> ( buf* name* -- )
|
||||
<print-str>
|
||||
[ LIT2 "" 18 ] DEO
|
||||
<print-str>/
|
||||
[ LIT2 "" 18 ] DEO
|
||||
[ LIT2 00 -Console/type ] DEI DUP ADD ;Types ADD2 LDA2 <print-str>/
|
||||
#0a18 DEO
|
||||
JMP2r
|
||||
|
||||
@<print-str> ( str* -- )
|
||||
LDAk #18 DEO
|
||||
INC2 & LDAk ?<print-str>
|
||||
POP2 JMP2r
|
||||
|
||||
@scmp ( a* b* -- f )
|
||||
STH2
|
||||
&l ( a* b* -- f )
|
||||
LDAk LDAkr STHr NEQk ?&d
|
||||
DUP EOR EQUk ?&d
|
||||
POP2 INC2 INC2r !&l
|
||||
|
||||
&d ( a* c1 c2 b* -- f )
|
||||
NIP2 POP2r EQU JMP2r
|
||||
|
||||
(
|
||||
@|assets )
|
||||
|
||||
@Types =dict/arg-none =dict/arg-stdin =dict/arg-data =dict/arg-spacer =dict/arg-end
|
||||
|
||||
@dict
|
||||
&hello "Welcome 20 "to 20 "Uxn! 0a $1
|
||||
&yousaid "You 20 "said: 20 $1
|
||||
&yousent "You 20 "sent: 20 $1
|
||||
&quit "quit $1
|
||||
&arg-none "<none> $1
|
||||
&arg-stdin "<stdin> $1
|
||||
&arg-data "<data> $1
|
||||
&arg-spacer "<spacer> $1
|
||||
&arg-end "<end> $1
|
||||
Loading…
Add table
Add a link
Reference in a new issue