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