2023-03-18 00:24:26 -04:00
|
|
|
( uxncli format-c.rom file.bin )
|
2023-03-17 23:35:23 -04:00
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|0000
|
|
|
|
|
|
|
|
@src $40
|
|
|
|
|
2023-11-30 23:04:09 -05:00
|
|
|
|0100
|
2023-03-17 23:35:23 -04:00
|
|
|
|
2023-11-30 23:04:09 -05:00
|
|
|
@on-reset ( -> )
|
2023-11-30 23:25:07 -05:00
|
|
|
;meta #06 DEO2
|
2023-03-17 23:35:23 -04:00
|
|
|
;on-console .Console/vector DEO2
|
2023-11-30 23:04:09 -05:00
|
|
|
BRK
|
2023-03-17 23:35:23 -04:00
|
|
|
|
|
|
|
@on-console ( -> )
|
2023-11-30 23:04:09 -05:00
|
|
|
.Console/read DEI .src skey ?{ BRK }
|
|
|
|
<print-program>
|
|
|
|
#800f DEO
|
|
|
|
BRK
|
2023-03-17 23:35:23 -04:00
|
|
|
|
2023-11-30 23:25:07 -05:00
|
|
|
@meta $1
|
|
|
|
( name ) "Format(C) 0a
|
|
|
|
( details ) "A 20 "C-like 20 "Formatter 0a
|
|
|
|
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
|
|
|
( date ) "30 20 "Nov 20 "2023 $1
|
|
|
|
( fields ) 00
|
|
|
|
|
2023-08-02 11:27:55 -04:00
|
|
|
@<print-program> ( src* -- )
|
2023-11-30 23:04:09 -05:00
|
|
|
;src .File/name DEO2
|
2023-03-17 23:35:23 -04:00
|
|
|
#0001 .File/length DEO2
|
2023-11-30 23:22:49 -05:00
|
|
|
;dict/a <pstr>
|
|
|
|
;src <print-name>
|
|
|
|
;dict/b <pstr>
|
2023-11-30 23:04:09 -05:00
|
|
|
[ LIT2r 0000 ]
|
2023-08-02 11:27:55 -04:00
|
|
|
&stream ( -- )
|
2023-11-30 23:04:09 -05:00
|
|
|
;&buf feof ?&end
|
|
|
|
[ LIT2 "0 18 ] DEO
|
|
|
|
[ LIT2 "x 18 ] DEO
|
|
|
|
[ LIT &buf $1 ] <phex>/b
|
|
|
|
[ LIT2 ", 18 ] DEO
|
|
|
|
#2018 DEO
|
2023-03-17 23:35:23 -04:00
|
|
|
INC2r
|
2023-11-30 23:04:09 -05:00
|
|
|
( lb ) STHkr #0f AND ?{
|
|
|
|
#0a18 DEO
|
|
|
|
#0918 DEO }
|
|
|
|
!&stream
|
|
|
|
&end POP2r #0a18 DEO
|
2023-11-30 23:22:49 -05:00
|
|
|
;dict/c !<pstr>
|
|
|
|
|
|
|
|
@<print-name> ( src* -- )
|
|
|
|
scap/ [ LIT "/ ] srew
|
|
|
|
&w ( -- )
|
|
|
|
LDAk [ LIT ". ] EQU ?&end
|
|
|
|
LDAk #18 DEO
|
|
|
|
INC2 LDAk ?&w
|
|
|
|
&end POP2 JMP2r
|
2023-03-17 23:35:23 -04:00
|
|
|
|
|
|
|
(
|
|
|
|
@|stdlib )
|
|
|
|
|
2023-11-30 23:04:09 -05:00
|
|
|
@skey ( key buf -- proc )
|
|
|
|
OVR #21 LTH ?{
|
|
|
|
#00 SWP scap/ STA
|
|
|
|
#00 JMP2r }
|
|
|
|
POP2 #01 JMP2r
|
|
|
|
|
2023-11-30 23:22:49 -05:00
|
|
|
@srew ( str* char -- )
|
|
|
|
,&t STR
|
|
|
|
&w ( -- )
|
|
|
|
LDAk [ LIT &t $1 ] EQU ?&end
|
|
|
|
#0001 SUB2 LDAk ?&w
|
|
|
|
&end INC2 JMP2r
|
|
|
|
|
2023-11-30 23:04:09 -05:00
|
|
|
@scap ( str* -- end* )
|
|
|
|
&w ( -- )
|
|
|
|
INC2 & LDAk ?&w
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@feof ( buf* -- f )
|
|
|
|
.File/read DEO2
|
|
|
|
.File/success DEI2 #0000 EQU2 JMP2r
|
|
|
|
|
|
|
|
@<phex> ( short* -- )
|
|
|
|
SWP <phex>/b
|
|
|
|
&b ( -- )
|
|
|
|
DUP #04 SFT <phex>/c
|
|
|
|
&c ( -- )
|
|
|
|
#0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@<pstr> ( str* -- )
|
|
|
|
&w ( -- )
|
|
|
|
LDAk #18 DEO
|
|
|
|
INC2 & LDAk ?&w
|
|
|
|
POP2 JMP2r
|
|
|
|
|
2023-11-30 23:22:49 -05:00
|
|
|
@dict &a "unsigned 20 "char 20 $1
|
|
|
|
&b "[] 20 "= 20 "{ 0a 09 $1
|
|
|
|
&c "}; 0a 00
|
2023-03-17 23:35:23 -04:00
|
|
|
|