uxn-utils/cli/proquints/proquints.tal

72 lines
1.2 KiB
Tal
Raw Permalink Normal View History

2023-05-24 13:45:19 -04:00
( uxncli proquints.rom file.bin )
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
2023-06-20 00:26:57 -04:00
|0000
2023-05-24 13:45:19 -04:00
2023-06-20 00:26:57 -04:00
@src $40
@queue $1
|0100
@on-reset ( -> )
2023-05-24 13:45:19 -04:00
;await-src .Console/vector DEO2
2023-06-20 00:26:57 -04:00
BRK
2023-05-24 13:45:19 -04:00
@await-src ( -> )
.Console/read DEI .src skey ?on-ready
2023-06-20 00:26:57 -04:00
BRK
2023-05-24 13:45:19 -04:00
@on-ready ( -> )
;src .File/name DEO2
#0002 .File/length DEO2
;&buf
2023-06-20 00:26:57 -04:00
&stream ( -- )
2023-05-24 13:45:19 -04:00
DUP2 .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof
2023-06-20 00:26:57 -04:00
LDA2k proquint !&stream
&eof POP2 #0a18 DEO
2023-05-24 13:45:19 -04:00
#010f DEO
2023-06-20 00:26:57 -04:00
BRK &buf $2
2023-05-24 13:45:19 -04:00
(
@|core )
@proquint ( short* -- )
( c1 ) DUP2 #0c emit-con
( v1 ) DUP2 #0a emit-vow
( c2 ) DUP2 #06 emit-con
( v2 ) DUP2 #03 emit-vow
2023-06-20 00:26:57 -04:00
( c3 ) #00 emit-con #20
&emit ( c -- )
#18 DEO
JMP2r
2023-05-24 13:45:19 -04:00
2023-06-20 00:26:57 -04:00
@emit-con
SFT2 #000f AND2 ;&con ADD2 LDA !proquint/emit
&con [ "bdfghjklmnprstvz ]
2023-05-24 13:45:19 -04:00
2023-06-20 00:26:57 -04:00
@emit-vow
SFT2 #0003 AND2 ;&vow ADD2 LDA !proquint/emit
&vow [ "aiou ]
2023-05-24 13:45:19 -04:00
(
@|stdlib )
2023-06-20 00:26:57 -04:00
@skey ( key buf -- proc )
OVR #21 LTH ?&eval
#00 SWP sput #00 JMP2r
&eval POP2 #01 JMP2r
@scap ( str* -- end* )
LDAk #00 NEQ [ JMP JMP2r ]
&w ( -- )
INC2 LDAk ?&w
JMP2r
@sput ( chr str* -- )
scap ROT #00 SWP2 STA2
JMP2r
2023-05-24 13:45:19 -04:00