(format-c) Use file name

This commit is contained in:
neauoire 2023-11-30 20:22:49 -08:00
parent 251c2bf6a0
commit c08a44ae0f
1 changed files with 22 additions and 4 deletions

View File

@ -22,7 +22,9 @@
@<print-program> ( src* -- )
;src .File/name DEO2
#0001 .File/length DEO2
;dict/header <pstr>
;dict/a <pstr>
;src <print-name>
;dict/b <pstr>
[ LIT2r 0000 ]
&stream ( -- )
;&buf feof ?&end
@ -37,7 +39,15 @@
#0918 DEO }
!&stream
&end POP2r #0a18 DEO
;dict/footer !<pstr>
;dict/c !<pstr>
@<print-name> ( src* -- )
scap/ [ LIT "/ ] srew
&w ( -- )
LDAk [ LIT ". ] EQU ?&end
LDAk #18 DEO
INC2 LDAk ?&w
&end POP2 JMP2r
(
@|stdlib )
@ -48,6 +58,13 @@
#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
@ -71,6 +88,7 @@
INC2 & LDAk ?&w
POP2 JMP2r
@dict &header "unsigned 20 "char 20 "rom[] 20 "= 20 "{ 0a 09 $1
&footer "}; 0a 00
@dict &a "unsigned 20 "char 20 $1
&b "[] 20 "= 20 "{ 0a 09 $1
&c "}; 0a 00