(uxndis) Can ingest sym file

This commit is contained in:
Devine Lu Linvega 2024-06-10 08:21:11 -08:00
parent bdeff219e2
commit 7657ae08be
1 changed files with 50 additions and 14 deletions

View File

@ -14,16 +14,31 @@
BRK BRK
@await-src ( -> ) @await-src ( -> )
[ LIT2 04 -Console/type ] DEI NEQ ?{ <dis> [ LIT2 04 -Console/type ] DEI NEQ ?{
;src <load-rom>
[ LIT ". ] src/<append>
[ LIT "s ] src/<append>
[ LIT "y ] src/<append>
[ LIT "m ] src/<append>
;src <load-sym>
( | print result )
,<load-rom>/ptr LDR2 ;rom
&>l ( -- )
<print-line>
INC2 GTH2k ?&>l
POP2 POP2 #010e DEO
#800f DEO #800f DEO
BRK } BRK }
.Console/read DEI [ LIT &ptr -src ] INCk ,&ptr STR .Console/read DEI src/<append>
STZ
BRK BRK
@<dis> ( -- ) @src/<append> ( char -- )
( | load ) [ LIT &ptr -src ] INCk ,&ptr STR
;src .File/name DEO2 STZ
JMP2r
@<load-rom> ( src* -- )
.File/name DEO2
#0001 .File/length DEO2 #0001 .File/length DEO2
&>stream ( -- ) &>stream ( -- )
;&b .File/read DEO2 ;&b .File/read DEO2
@ -31,15 +46,22 @@
[ LIT &b $1 ] [ LIT2 &ptr =rom ] INC2k ,&ptr STR2 [ LIT &b $1 ] [ LIT2 &ptr =rom ] INC2k ,&ptr STR2
STA STA
!&>stream } !&>stream }
( | print ) JMP2r
,&ptr LDR2 ;rom
&>l ( -- ) @<load-sym> ( src* -- )
<print-line> .File/name DEO2
INC2 GTH2k ?&>l #4000 .File/length DEO2
POP2 POP2 JMP2r ;sym .File/read DEO2
JMP2r
@<print-line> ( addr* -- addr* ) @<print-line> ( addr* -- addr* )
DUP2 ;rom SUB2 <print-address> ( ) DUP2 ;rom SUB2
( ) DUP2 #0100 ADD2 find-sym DUP2 #ffff EQU2 ?{
[ LIT2 "@ 18 ] DEO
DUP2 <pstr>
#0a18 DEO }
POP2
( ) <print-address>
<print-opcode> <print-opcode>
#0a18 DEO #0a18 DEO
JMP2r JMP2r
@ -115,6 +137,14 @@
INC GTHk ?&>l INC GTHk ?&>l
POP2 JMP2r POP2 JMP2r
@find-sym ( addr* -- sym* )
,&t STR2
;sym
&>w ( -- )
LDA2k [ LIT2 &t $2 ] NEQ2 ?{ INC2 INC2 JMP2r }
INC2 INC2 scap/ INC2 INC2k INC2 LDA ?&>w
POP2 #ffff JMP2r
( (
@|stdlib ) @|stdlib )
@ -148,6 +178,10 @@
INC2 LDAk ?<pstr> INC2 LDAk ?<pstr>
POP2 JMP2r POP2 JMP2r
@scap ( str* -: end* )
INC2 & LDAk ?scap
JMP2r
( (
@|assets ) @|assets )
@ -171,5 +205,7 @@
@dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1 @dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1
@rom @rom $8000
@sym