( uxncli format-c.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 |0000 @src $40 |0100 @on-reset ( -> ) ;meta #06 DEO2 ;on-console .Console/vector DEO2 BRK @on-console ( -> ) .Console/read DEI .src skey ?{ BRK } #800f DEO BRK @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 @ ( src* -- ) ;src .File/name DEO2 #0001 .File/length DEO2 ;dict/a ;src ;dict/b [ LIT2r 0000 ] &stream ( -- ) ;&buf feof ?&end [ LIT2 "0 18 ] DEO [ LIT2 "x 18 ] DEO [ LIT &buf $1 ] /b [ LIT2 ", 18 ] DEO #2018 DEO INC2r ( lb ) STHkr #0f AND ?{ #0a18 DEO #0918 DEO } !&stream &end POP2r #0a18 DEO ;dict/c ! @ ( src* -- ) scap/ [ LIT "/ ] srew &w ( -- ) LDAk [ LIT ". ] EQU ?&end LDAk #18 DEO INC2 LDAk ?&w &end POP2 JMP2r ( @|stdlib ) @skey ( key buf -- proc ) OVR #21 LTH ?{ #00 SWP scap/ STA #00 JMP2r } POP2 #01 JMP2r @srew ( str* char -- ) ,&t STR &w ( -- ) LDAk [ LIT &t $1 ] EQU ?&end #0001 SUB2 LDAk ?&w &end INC2 JMP2r @scap ( str* -- end* ) &w ( -- ) INC2 & LDAk ?&w JMP2r @feof ( buf* -- f ) .File/read DEO2 .File/success DEI2 #0000 EQU2 JMP2r @ ( short* -- ) SWP /b &b ( -- ) DUP #04 SFT /c &c ( -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r @ ( str* -- ) &w ( -- ) LDAk #18 DEO INC2 & LDAk ?&w POP2 JMP2r @dict &a "unsigned 20 "char 20 $1 &b "[] 20 "= 20 "{ 0a 09 $1 &c "}; 0a 00