uxn-utils/cli/symbols/sym.tal

75 lines
1.2 KiB
Tal
Raw Normal View History

2023-07-01 13:47:51 -04:00
( uxncli sym.rom file.bin.sym )
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
2024-02-23 22:18:29 -05:00
|000
2023-07-01 13:47:51 -04:00
@src $40
2024-02-23 22:18:29 -05:00
|100
2023-07-01 13:47:51 -04:00
@on-reset ( -> )
.Console/type DEI ?{
;Dict/usage <perr>/
2023-07-01 13:47:51 -04:00
#010f DEO
BRK }
2023-07-01 13:47:51 -04:00
;await-src .Console/vector DEO2
BRK
@await-src ( -> )
.Console/read DEI .src skey ?{ BRK }
2023-07-01 13:47:51 -04:00
;src .File/name DEO2
#8000 .File/length DEO2
;sym DUP2 .File/read DEO2
.File/success DEI2 ADD2 ;sym
&l ( -- )
LDA2k <phex>
#2018 DEO
INC2 INC2 DUP2 <pstr>/
#0a18 DEO
scap/ INC2 GTH2k ?&l
POP2 #800f DEO
2023-07-01 13:47:51 -04:00
BRK
(
@|stdlib )
@skey ( key buf -- proc )
OVR #21 LTH ?{
#00 SWP sput #00 JMP2r }
POP2 #01 JMP2r
2023-07-01 13:47:51 -04:00
@scap ( str* -- end* )
2024-02-23 22:18:29 -05:00
INC2 & LDAk ?scap
2023-07-01 13:47:51 -04:00
JMP2r
@sput ( chr str* -- )
scap/ ROT #00 SWP2 STA2
2023-07-01 13:47:51 -04:00
JMP2r
@<phex> ( short* -- )
SWP <phex>/b
&b ( -- )
DUP #04 SFT <phex>/c
&c ( -- )
#0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD #18 DEO
JMP2r
@<pstr> ( err* -- )
2024-02-23 22:18:29 -05:00
LDAk #19 DEO
INC2 & LDAk ?<pstr>
2023-07-01 13:47:51 -04:00
POP2 JMP2r
@<perr> ( err* -- )
2024-02-23 22:18:29 -05:00
LDAk #19 DEO
INC2 & LDAk ?<perr>
2023-07-01 13:47:51 -04:00
POP2 JMP2r
(
@|res )
@Dict &usage "usage: 20 "sym.rom 20 "input.bin.sym 0a $1
@sym