console.tal (1652B)
1 ( usage: uxncli console.rom foo "bar baz" 2 | Prints Welcome to Uxn!, and listens for incoming stdin events on enter. ) 3 4 |10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 5 6 |000 7 8 @arg $40 9 @std $40 10 11 |100 12 13 @on-reset ( -> ) 14 ;Dict/hello <print-str> 15 .Console/type DEI ?{ 16 ( | no arguments ) 17 ;on-std .Console/vector DEO2 18 BRK } 19 ;on-arg .Console/vector DEO2 20 BRK 21 22 @on-arg ( -> ) 23 [ LIT2 02 -Console/type ] DEI NEQ ?{ 24 .Console/read DEI [ LIT2 00 &ptr -arg ] INCk ,&ptr STR 25 STZ2 26 BRK } 27 ;arg ;Dict/yousent <print-result> 28 [ LIT2 -arg _&ptr ] STR 29 [ LIT2 04 -Console/type ] DEI NEQ ?{ ;on-std .Console/vector DEO2 } 30 BRK 31 32 @on-std ( -> ) 33 [ LIT2 0a -Console/read ] DEI EQU ?{ 34 .Console/read DEI [ LIT2 00 &ptr -std ] INCk ,&ptr STR 35 STZ2 36 BRK } 37 ;std DUP2 ;Dict/yousaid <print-result> 38 ;Dict/quit scmp ?{ 39 [ LIT2 -std _&ptr ] STR 40 BRK } 41 ( quit ) #800f DEO 42 BRK 43 44 @<print-result> ( buf* name* -- ) 45 <print-str> 46 [ LIT2 "" 18 ] DEO 47 <print-str>/ 48 [ LIT2 "" 18 ] DEO 49 [ LIT2 00 -Console/type ] DEI DUP ADD ;Types ADD2 LDA2 <print-str>/ 50 #0a18 DEO 51 JMP2r 52 53 @<print-str> ( str* -- ) 54 LDAk #18 DEO 55 INC2 & LDAk ?<print-str> 56 POP2 JMP2r 57 58 @scmp ( a* b* -- f ) 59 STH2 60 &l ( a* b* -- f ) 61 LDAk LDAkr STHr NEQk ?&d 62 DUP EOR EQUk ?&d 63 POP2 INC2 INC2r !&l 64 65 &d ( a* c1 c2 b* -- f ) 66 NIP2 POP2r EQU JMP2r 67 68 ( 69 @|assets ) 70 71 @Types =Dict/arg-none =Dict/arg-stdin =Dict/arg-data =Dict/arg-spacer =Dict/arg-end 72 73 @Dict 74 &hello "Welcome 20 "to 20 "Uxn! 0a $1 75 &yousaid "You 20 "said: 20 $1 76 &yousent "You 20 "sent: 20 $1 77 &quit "quit $1 78 &arg-none "<none> $1 79 &arg-stdin "<stdin> $1 80 &arg-data "<data> $1 81 &arg-spacer "<spacer> $1 82 &arg-end "<end> $1 83