(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
@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
BRK }
.Console/read DEI [ LIT &ptr -src ] INCk ,&ptr STR
STZ
.Console/read DEI src/<append>
BRK
@<dis> ( -- )
( | load )
;src .File/name DEO2
@src/<append> ( char -- )
[ LIT &ptr -src ] INCk ,&ptr STR
STZ
JMP2r
@<load-rom> ( src* -- )
.File/name DEO2
#0001 .File/length DEO2
&>stream ( -- )
;&b .File/read DEO2
@ -31,15 +46,22 @@
[ LIT &b $1 ] [ LIT2 &ptr =rom ] INC2k ,&ptr STR2
STA
!&>stream }
( | print )
,&ptr LDR2 ;rom
&>l ( -- )
<print-line>
INC2 GTH2k ?&>l
POP2 POP2 JMP2r
JMP2r
@<load-sym> ( src* -- )
.File/name DEO2
#4000 .File/length DEO2
;sym .File/read DEO2
JMP2r
@<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>
#0a18 DEO
JMP2r
@ -115,6 +137,14 @@
INC GTHk ?&>l
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 )
@ -148,6 +178,10 @@
INC2 LDAk ?<pstr>
POP2 JMP2r
@scap ( str* -: end* )
INC2 & LDAk ?scap
JMP2r
(
@|assets )
@ -171,5 +205,7 @@
@dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1
@rom
@rom $8000
@sym