( 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 .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 [ 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 ;Dict/quit scmp ?{ [ LIT2 -std _&ptr ] STR BRK } ( quit ) #800f DEO BRK @ ( buf* name* -- ) [ LIT2 "" 18 ] DEO / [ LIT2 "" 18 ] DEO [ LIT2 00 -Console/type ] DEI DUP ADD ;Types ADD2 LDA2 / #0a18 DEO JMP2r @ ( str* -- ) LDAk #18 DEO INC2 & LDAk ? 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 " $1 &arg-stdin " $1 &arg-data " $1 &arg-spacer " $1 &arg-end " $1