2023-11-25 18:34:59 -05:00
|
|
|
( uxncli format-c.rom file.bin )
|
|
|
|
|
2023-11-25 18:51:04 -05:00
|
|
|
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|
2023-11-25 18:34:59 -05:00
|
|
|
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1
|
|
|
|
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|
|
|
|
|
|
|
|
|0000
|
|
|
|
|
|
|
|
@src $40
|
|
|
|
|
|
|
|
|0100
|
|
|
|
|
|
|
|
@on-reset ( -> )
|
|
|
|
;on-console .Console/vector DEO2
|
|
|
|
BRK
|
|
|
|
|
|
|
|
@on-console ( -> )
|
|
|
|
[ LIT2r =src ]
|
|
|
|
( read input ) .Console/read DEI DUP #20 LTH OVR #7f GTH ORA ?&>end
|
|
|
|
STH2kr slen #003f GTH2 ?&>end
|
|
|
|
STH2kr scap STA
|
|
|
|
POP2r BRK &>end
|
|
|
|
POP
|
|
|
|
( | read )
|
|
|
|
STH2r .File/name DEO2
|
|
|
|
#0800 .File/length DEO2
|
|
|
|
;icn .File/read DEO2
|
2023-11-25 18:51:04 -05:00
|
|
|
( | write )
|
2023-11-25 18:34:59 -05:00
|
|
|
<convert>
|
2023-11-25 18:51:04 -05:00
|
|
|
;src .File/name DEO2
|
|
|
|
;uf1 .File/write DEO2
|
|
|
|
#0800 .File/length DEO2
|
2023-11-25 18:34:59 -05:00
|
|
|
#800f DEO
|
|
|
|
BRK
|
|
|
|
|
2023-11-25 18:51:04 -05:00
|
|
|
@get-addr ( a -- addr* )
|
|
|
|
STHk
|
|
|
|
( y ) #04 SFT #00 SWP #0080 MUL2
|
|
|
|
( x ) STHr #0f AND #00 SWP #0008 MUL2 ADD2 JMP2r
|
|
|
|
|
2023-11-25 18:34:59 -05:00
|
|
|
@<copy-tiles> ( a b -- )
|
|
|
|
OVR phex/b #2018 DEO
|
2023-11-25 18:51:04 -05:00
|
|
|
DUP phex/b #2018 DEO
|
|
|
|
( a -> a* ) OVR get-addr phex #2018 DEO
|
|
|
|
( b -> b* ) DUP get-addr phex #0a18 DEO
|
|
|
|
SWP get-addr ;icn ADD2 ,&src STR2
|
|
|
|
get-addr ;uf1 ADD2 ,&dst STR2
|
|
|
|
;&cmd .System/expansion DEO2
|
|
|
|
JMP2r
|
|
|
|
&cmd [ 01 0008 0000 &src $2 0000 &dst $2 ]
|
2023-11-25 18:34:59 -05:00
|
|
|
|
|
|
|
@<convert> ( -- )
|
|
|
|
#0000
|
|
|
|
&l ( -- )
|
|
|
|
( y ) DUP #15 SFT OVR #01 AND ADD #40 SFT STH
|
|
|
|
( x ) DUP #01 SFT #0f AND
|
2023-11-25 18:51:04 -05:00
|
|
|
( merge ) STHr ORA OVR <copy-tiles>
|
2023-11-25 18:34:59 -05:00
|
|
|
INC DUP ?&l
|
2023-11-25 18:51:04 -05:00
|
|
|
POP2 JMP2r
|
2023-11-25 18:34:59 -05:00
|
|
|
|
|
|
|
@blank [ ffff ffff ffff ffff ]
|
|
|
|
|
|
|
|
(
|
|
|
|
@|stdlib )
|
|
|
|
|
|
|
|
@slen ( str* -- len* )
|
|
|
|
DUP2 scap SWP2 SUB2 JMP2r
|
|
|
|
|
|
|
|
@scap ( str* -- end* )
|
|
|
|
LDAk #00 NEQ [ JMP JMP2r ]
|
|
|
|
&w ( -- )
|
|
|
|
INC2 LDAk ?&w
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@phex ( short* -- )
|
|
|
|
SWP phex/b
|
|
|
|
&b ( -- )
|
|
|
|
DUP #04 SFT phex/c
|
|
|
|
&c ( -- )
|
|
|
|
#0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO
|
|
|
|
JMP2r
|
|
|
|
|
|
|
|
@pstr ( str* -- )
|
|
|
|
&while ( -- )
|
|
|
|
LDAk #18 DEO
|
|
|
|
INC2 LDAk ?&while
|
|
|
|
POP2 JMP2r
|
|
|
|
|
|
|
|
@icn $800
|
|
|
|
|
|
|
|
@uf1 $800
|
|
|
|
|