2024-06-09 19:27:36 -04:00
|
|
|
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
2024-06-09 20:29:26 -04:00
|
|
|
|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|
2024-06-09 19:27:36 -04:00
|
|
|
|000
|
|
|
|
|
|
|
|
@src $40
|
|
|
|
|
|
|
|
|100
|
|
|
|
|
|
|
|
@on-reset ( -> )
|
|
|
|
;meta #06 DEO2
|
|
|
|
;await-src .Console/vector DEO2
|
|
|
|
.Console/type DEI ?{ ;dict/usage <pstr>
|
|
|
|
#000f DEO }
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@meta $1
|
|
|
|
( name ) "Uxndis 0a
|
|
|
|
( desc ) "Uxntal 20 "Disassembler 0a
|
|
|
|
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
|
|
|
( date ) "9 20 "Jun 20 "2024 $2
|
|
|
|
|
|
|
|
@await-src ( -> )
|
|
|
|
[ LIT2 04 -Console/type ] DEI NEQ ?{ <dis>
|
|
|
|
#800f DEO
|
|
|
|
BRK }
|
|
|
|
.Console/read DEI [ LIT &ptr -src ] INCk ,&ptr STR
|
|
|
|
STZ
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@<dis> ( -- )
|
2024-06-09 20:29:26 -04:00
|
|
|
( | load )
|
|
|
|
;src .File/name DEO2
|
|
|
|
#0001 .File/length DEO2
|
|
|
|
&>stream ( -- )
|
|
|
|
;&b .File/read DEO2
|
|
|
|
[ LIT2 00 -File/success-lb ] DEI EQU ?{
|
|
|
|
[ LIT &b $1 ] [ LIT2 &ptr =rom ] INC2k ,&ptr STR2
|
|
|
|
STA
|
|
|
|
!&>stream }
|
|
|
|
( | print )
|
|
|
|
,&ptr LDR2 ;rom
|
|
|
|
&>l ( -- )
|
|
|
|
<print-line>
|
|
|
|
INC2 GTH2k ?&>l
|
|
|
|
POP2 POP2 JMP2r
|
|
|
|
|
|
|
|
@<print-line> ( addr* -- addr* )
|
|
|
|
DUP2 ;rom SUB2 <print-address>
|
|
|
|
<print-opcode>
|
|
|
|
#0a18 DEO
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@<print-address> ( addr* -- )
|
|
|
|
<phex>
|
|
|
|
[ LIT2 ": 18 ] DEO
|
|
|
|
#03 !<print-pad>
|
|
|
|
|
|
|
|
@<print-1-byte> ( addr* -- addr* )
|
|
|
|
LDAk <phex>/b
|
|
|
|
#09 !<print-pad>
|
|
|
|
|
|
|
|
@<print-2-byte> ( addr* -- addr* )
|
|
|
|
LDAk <print-byte>
|
|
|
|
INC2k LDA <print-byte>
|
|
|
|
#05 !<print-pad>
|
|
|
|
|
|
|
|
@<print-3-byte> ( addr* -- addr* )
|
|
|
|
LDAk <print-byte>
|
|
|
|
INC2k LDA <print-byte>
|
|
|
|
INC2k INC2 LDA <print-byte>
|
|
|
|
#02 !<print-pad>
|
|
|
|
|
|
|
|
@<print-byte> ( byte -- )
|
|
|
|
<phex>/b
|
|
|
|
#2018 DEO
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@<print-opcode> ( addr* -- addr* )
|
|
|
|
( | print hex )
|
|
|
|
LDAk ?{ <print-1-byte>
|
|
|
|
;opcodes/brk !<pstr> }
|
|
|
|
LDAk #20 NEQ ?{
|
|
|
|
<print-3-byte>
|
|
|
|
;opcodes/jci <pstr>
|
|
|
|
#2018 DEO
|
|
|
|
INC2 LDA2k <print-rel>
|
|
|
|
INC2 JMP2r }
|
|
|
|
LDAk #40 NEQ ?{
|
|
|
|
<print-3-byte>
|
2024-06-09 20:37:58 -04:00
|
|
|
;opcodes/jmi <pstr>
|
2024-06-09 20:29:26 -04:00
|
|
|
#2018 DEO
|
|
|
|
INC2 LDA2k <print-rel>
|
|
|
|
INC2 JMP2r }
|
|
|
|
LDAk #60 NEQ ?{
|
|
|
|
<print-3-byte>
|
2024-06-09 20:37:58 -04:00
|
|
|
;opcodes/jsi <pstr>
|
2024-06-09 20:29:26 -04:00
|
|
|
#2018 DEO
|
|
|
|
INC2 LDA2k <print-rel>
|
|
|
|
INC2 JMP2r }
|
|
|
|
LDAk DUP #80 NEQ SWP #c0 NEQ AND ?{
|
|
|
|
<print-2-byte>
|
|
|
|
;opcodes <pstr>
|
|
|
|
#2018 DEO
|
|
|
|
INC2 LDAk !<phex>/b }
|
|
|
|
LDAk DUP #a0 NEQ SWP #e0 NEQ AND ?{
|
|
|
|
<print-3-byte>
|
|
|
|
;opcodes <pstr>
|
|
|
|
#2018 DEO
|
|
|
|
INC2 LDA2k <phex>
|
|
|
|
INC2 JMP2r }
|
|
|
|
<print-1-byte>
|
|
|
|
LDAk #1f AND #00 SWP #20 SFT2 ;opcodes ADD2 <pstr>
|
|
|
|
( >> )
|
|
|
|
|
|
|
|
@<print-mode> ( addr* -- )
|
|
|
|
LDAk #20 AND #00 EQU ?{
|
|
|
|
[ LIT2 "2 18 ] DEO }
|
|
|
|
LDAk #80 AND #00 EQU ?{
|
|
|
|
[ LIT2 "k 18 ] DEO }
|
|
|
|
LDAk #40 AND #00 EQU ?{
|
|
|
|
[ LIT2 "r 18 ] DEO }
|
2024-06-09 19:27:36 -04:00
|
|
|
JMP2r
|
|
|
|
|
2024-06-09 20:29:26 -04:00
|
|
|
@<print-rel> ( value* -- )
|
|
|
|
OVR #80 AND ?<pdec>
|
|
|
|
[ LIT2 "+ 18 ] DEO
|
|
|
|
!<pdec>
|
|
|
|
|
|
|
|
@<print-pad> ( count -- )
|
|
|
|
#00
|
|
|
|
&>l ( -- )
|
|
|
|
#2018 DEO
|
|
|
|
INC GTHk ?&>l
|
|
|
|
POP2 JMP2r
|
|
|
|
|
2024-06-09 19:27:36 -04:00
|
|
|
(
|
|
|
|
@|stdlib )
|
|
|
|
|
2024-06-09 20:29:26 -04:00
|
|
|
@<pdec> ( short* -- )
|
|
|
|
( | sign )
|
|
|
|
DUP2 #8000 AND2 #0000 EQU2 ?{
|
|
|
|
[ LIT2 "- 18 ] DEO
|
|
|
|
#8000 SWP2 SUB2 #7fff AND2 }
|
|
|
|
[ LIT2 00 _&z ] STR
|
|
|
|
#2710 /parse #03e8 /parse #0064 /parse #000a /parse NIP #30 ADD #18 DEO
|
|
|
|
JMP2r
|
|
|
|
&parse ( -- )
|
|
|
|
DIV2k DUPk [ LIT &z $1 ] EQU ?{
|
|
|
|
DUP #30 ADD #18 DEO
|
|
|
|
[ LIT2 ff _&z ] STR }
|
|
|
|
POP MUL2 SUB2 JMP2r
|
|
|
|
|
2024-06-09 19:27:36 -04:00
|
|
|
@<phex> ( short* -: )
|
|
|
|
SWP /b
|
|
|
|
&b ( byte -: )
|
|
|
|
DUP #04 SFT /c
|
|
|
|
&c ( byte -: )
|
|
|
|
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@<pstr> ( str* -- )
|
|
|
|
LDAk #18 DEO
|
|
|
|
INC2 LDAk ?<pstr>
|
|
|
|
POP2 JMP2r
|
|
|
|
|
|
|
|
@opcodes [
|
2024-06-09 20:29:26 -04:00
|
|
|
"LIT 00 "INC 00 "POP 00 "NIP 00
|
|
|
|
"SWP 00 "ROT 00 "DUP 00 "OVR 00
|
|
|
|
"EQU 00 "NEQ 00 "GTH 00 "LTH 00
|
|
|
|
"JMP 00 "JCN 00 "JSR 00 "STH 00
|
|
|
|
"LDZ 00 "STZ 00 "LDR 00 "STR 00
|
|
|
|
"LDA 00 "STA 00 "DEI 00 "DEO 00
|
|
|
|
"ADD 00 "SUB 00 "MUL 00 "DIV 00
|
|
|
|
"AND 00 "ORA 00 "EOR 00 "SFT 00
|
|
|
|
&brk "BRK 00 &jci "JCI 00 &jsi "JSI
|
|
|
|
00 &jmi "JMI 00 ]
|
2024-06-09 19:27:36 -04:00
|
|
|
|
|
|
|
@dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1
|
|
|
|
|
2024-06-09 20:29:26 -04:00
|
|
|
@rom
|
|
|
|
|