mirror of https://git.sr.ht/~rabbits/uxn-utils
(uxndis)Added 0x100 offset to address
This commit is contained in:
parent
61ff230941
commit
c825444f24
|
@ -1,5 +1,8 @@
|
|||
( uxncli uxndis.rom input.rom )
|
||||
|
||||
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|
||||
|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|
||||
|
||||
|000
|
||||
|
||||
@src $40
|
||||
|
@ -43,8 +46,7 @@
|
|||
;&b .File/read DEO2
|
||||
[ LIT2 00 -File/success-lb ] DEI EQU ?{
|
||||
[ LIT &b $1 ] [ LIT2 &ptr =rom ] INC2k ,&ptr STR2
|
||||
STA
|
||||
!&>stream }
|
||||
STA !&>stream }
|
||||
JMP2r
|
||||
|
||||
@<load-sym> ( src* -- )
|
||||
|
@ -68,7 +70,7 @@
|
|||
JMP2r
|
||||
|
||||
@<print-address> ( addr* -- )
|
||||
<phex>
|
||||
#0100 ADD2 <phex>
|
||||
[ LIT2 ": 18 ] DEO
|
||||
#03 !<print-pad>
|
||||
|
||||
|
@ -135,8 +137,7 @@
|
|||
SWP2 ;rom SUB2 #0103 ADD2 OVR2 ADD2 find-sym
|
||||
( ) INC2k ORA ?{
|
||||
POP2 OVR #80 AND ?<pdec>
|
||||
[ LIT2 "+ 18 ] DEO
|
||||
!<pdec> }
|
||||
[ LIT2 "+ 18 ] DEO !<pdec> }
|
||||
NIP2 !<pstr>
|
||||
|
||||
@<print-pad> ( count -- )
|
||||
|
@ -165,6 +166,7 @@
|
|||
#8000 SWP2 SUB2 #7fff AND2 }
|
||||
[ LIT2 00 _&z ] STR
|
||||
#2710 /p #03e8 /p #0064 /p #000a /p NIP !<pnum>
|
||||
|
||||
&p ( -- )
|
||||
DIV2k DUPk [ LIT &z $1 ] EQU ?{
|
||||
DUP <pnum>
|
||||
|
@ -199,7 +201,7 @@
|
|||
( name ) "Uxndis 0a
|
||||
( desc ) "Uxntal 20 "Disassembler 0a
|
||||
( auth ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
||||
( date ) "11 20 "Jun 20 "2024 $2
|
||||
( date ) "21 20 "Jul 20 "2024 $2
|
||||
|
||||
@opcodes [
|
||||
"LIT 00 "INC 00 "POP 00 "NIP 00
|
||||
|
@ -213,7 +215,8 @@
|
|||
&brk "BRK 00 &jci "JCI 00 &jmi "JMI
|
||||
00 &jsi "JSI 00 ]
|
||||
|
||||
@dict &usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1
|
||||
@dict
|
||||
&usage "usage: 20 "uxndis.rom 20 "input.rom 0a $1
|
||||
|
||||
@rom $8000
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|80 @Controller &vector $2 &button $1 &key $1
|
||||
|90 @Mouse &vector $2 &x $1 &lx $1 &y $1 &ly $1 &state $1 &chord $1
|
||||
|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|
||||
|
||||
|000
|
||||
|
||||
@page $1
|
||||
|
@ -37,7 +38,7 @@
|
|||
( name ) "Note 20 "Pad 0a
|
||||
( details ) "Original 20 "by 20 "Donn 20 "Denman 0a
|
||||
( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
|
||||
( date ) "12 20 "Jun, 20 "2024 $1
|
||||
( date ) "21 20 "Jul 20 "2024 $1
|
||||
( fields ) 01
|
||||
( > icon ) 83 =appicon
|
||||
|
||||
|
@ -101,8 +102,7 @@
|
|||
<draw-header>
|
||||
( release on close button ) .Mouse/state DEI ?&unchanged
|
||||
.Mouse/x DEI2 #0008 SUB2 #000a GTH2 ?&unchanged
|
||||
( exit ) #800f DEO
|
||||
&unchanged BRK
|
||||
( exit ) #800f DEO &unchanged BRK
|
||||
|
||||
@on-mouse-body ( -> )
|
||||
<trap-mouse>
|
||||
|
@ -130,8 +130,7 @@
|
|||
#01 <set-pixel>
|
||||
<draw-sketch> }
|
||||
DUP #01 NEQ ?{
|
||||
( release/drag mouse1 )
|
||||
( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ]
|
||||
( release/drag mouse1 ) ( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ]
|
||||
( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2
|
||||
.Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2
|
||||
( paint ) #01 <paint-line>
|
||||
|
@ -148,10 +147,12 @@
|
|||
( | continue )
|
||||
[ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&down
|
||||
BRK
|
||||
|
||||
&down ( -> )
|
||||
[ LIT2 00 -Mouse/state ] DEO
|
||||
.Mouse/y DEI2 #00da SUB2 NIP [ LIT2 18 -Mouse/lx ] DEI SUB ADD #18 LTH ?&go-next
|
||||
prev-page BRK &go-next next-page BRK
|
||||
prev-page BRK
|
||||
&go-next next-page BRK
|
||||
|
||||
@on-frame ( -> )
|
||||
[ LIT2 &last $1 &f $1 ] INCk ,&f STR
|
||||
|
@ -170,25 +171,21 @@
|
|||
DUP #0d EQU #03 MUL SUB .selection/length LDZ2 #0000 EQU2 ?{ erase-selection }
|
||||
get-from STH2k #0001 SUB2 get-eof #0001 <msfr>
|
||||
STH2kr STA
|
||||
STH2r INC2 <select-from>
|
||||
!file-save
|
||||
STH2r INC2 <select-from> !file-save
|
||||
|
||||
@erase ( -- )
|
||||
#00 ;on-frame/f STA
|
||||
.selection/length LDZ2 #0000 EQU2 ?{ erase-selection !<select-reset> }
|
||||
get-from get-page NEQ2 [ JMP JMP2r ] get-from #0001 SUB2 DUP2 cut-char <select-from>
|
||||
!file-save
|
||||
get-from get-page NEQ2 [ JMP JMP2r ] get-from #0001 SUB2 DUP2 cut-char <select-from> !file-save
|
||||
|
||||
@erase-selection ( -- )
|
||||
get-from get-eof .selection/length LDZ2 <msfl>
|
||||
!file-save
|
||||
get-from get-eof .selection/length LDZ2 <msfl> !file-save
|
||||
|
||||
@delete ( -- )
|
||||
#00 ;on-frame/f STA
|
||||
.selection/length LDZ2 ORA ?{
|
||||
get-from INC2k get-eof NEQ2 ?{ POP2 JMP2r }
|
||||
cut-char <redraw>
|
||||
!file-save }
|
||||
cut-char <redraw> !file-save }
|
||||
erase-selection !<select-reset>
|
||||
|
||||
@get-eof ( -- addr* )
|
||||
|
@ -206,8 +203,8 @@
|
|||
POP2 !<update-cursor>
|
||||
|
||||
@erase-sketch ( -- )
|
||||
;&mcpy .System/expansion DEO2
|
||||
!<redraw>
|
||||
;&mcpy .System/expansion DEO2 !<redraw>
|
||||
|
||||
&mcpy [ 00 1500 0000 =sketch 00 ]
|
||||
|
||||
@get-row ( x* y* -- row* )
|
||||
|
@ -289,13 +286,11 @@
|
|||
|
||||
@<select-from> ( addr* -- )
|
||||
clamp-selection DUP2 .selection/a STZ2
|
||||
.selection/b STZ2
|
||||
!select
|
||||
.selection/b STZ2 !select
|
||||
|
||||
@<select-to> ( addr* -- )
|
||||
clamp-selection DUP2 .selection/b LDZ2 NEQ2 ?{ POP2 JMP2r }
|
||||
.selection/b STZ2
|
||||
!select
|
||||
.selection/b STZ2 !select
|
||||
|
||||
@<select-word> ( addr* -- )
|
||||
DUP2
|
||||
|
@ -306,15 +301,13 @@
|
|||
INC2 LDAk #20 GTH ?&>next
|
||||
OVR2 OVR2 is-selection ?{
|
||||
.selection/b STZ2
|
||||
.selection/a STZ2
|
||||
!select }
|
||||
.selection/a STZ2 !select }
|
||||
POP2
|
||||
( >> )
|
||||
|
||||
@<select-line> ( addr* -- )
|
||||
DUP2 find-line-start .selection/a STZ2
|
||||
find-line-end .selection/b STZ2
|
||||
!select
|
||||
find-line-end .selection/b STZ2 !select
|
||||
|
||||
@<select-all> ( -- )
|
||||
get-page DUP2 .selection/a STZ2
|
||||
|
@ -323,8 +316,7 @@
|
|||
|
||||
@select ( -- )
|
||||
get-to get-from SUB2 .selection/length STZ2
|
||||
#00 ;on-frame/f STA
|
||||
!<redraw>
|
||||
#00 ;on-frame/f STA !<redraw>
|
||||
|
||||
@<select-left> ( -- )
|
||||
.selection/length LDZ2 #0000 EQU2 [ LIT2 04 -Controller/button ] DEI AND #00 NEQ ORA ?{ get-from !<select-from> }
|
||||
|
@ -373,6 +365,7 @@
|
|||
#20 STH2r STA
|
||||
INC GTHk ?&>l
|
||||
POP2 JMP2r
|
||||
|
||||
&mcpy [ 01 0100 0000 =placeholder 0000 =mem ]
|
||||
|
||||
@file-save ( -- )
|
||||
|
@ -405,8 +398,7 @@
|
|||
get-from STH2r ADD2 !<select-from>
|
||||
|
||||
@edit-cut ( -- )
|
||||
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] edit-copy erase-selection <select-reset>
|
||||
!file-save
|
||||
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] edit-copy erase-selection <select-reset> !file-save
|
||||
|
||||
@edit-copy ( -- )
|
||||
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ] ;snarf-path .File/name DEO2
|
||||
|
@ -466,8 +458,7 @@
|
|||
&>walk-char ( -- )
|
||||
.Screen/x DEI2 [ LIT2 &x $2 ] GTH2 ?&end-char
|
||||
walk-char ?&end-char
|
||||
INC2 LDAk ?&>walk-char
|
||||
&end-char JMP2r
|
||||
INC2 LDAk ?&>walk-char &end-char JMP2r
|
||||
|
||||
@walk-char ( addr* -- addr* lb )
|
||||
( | wrap )
|
||||
|
@ -481,6 +472,7 @@
|
|||
( lb line ) DUP2 #013e NEQ2 ?{ POP2 #01 #0011 !<draw-linebreak> }
|
||||
( lb caret ) DUP2 #012d NEQ2 ?{ POP2 #01 #0012 !<draw-linebreak> }
|
||||
POP2 #01 #0008 !<draw-linebreak>
|
||||
|
||||
&no-wrap ( char )
|
||||
LDAk char-width .Screen/x DEI2 ADD2 .Screen/x DEO2
|
||||
( | tab )
|
||||
|
@ -520,30 +512,26 @@
|
|||
;mem #0001 SUB2 SWP2
|
||||
&>l ( -- )
|
||||
#0001 SUB2 LDAk DUP #0a EQU SWP #00 EQU ORA ?&end
|
||||
LTH2k ?&>l
|
||||
&end NIP2 INC2 JMP2r
|
||||
LTH2k ?&>l &end NIP2 INC2 JMP2r
|
||||
|
||||
@find-line-end ( addr* -- addr* )
|
||||
get-eof SWP2
|
||||
&>l ( -- )
|
||||
LDAk #0a EQU ?&end
|
||||
LDAk #00 EQU ?&end
|
||||
INC2 GTH2k ?&>l
|
||||
&end NIP2 JMP2r
|
||||
INC2 GTH2k ?&>l &end NIP2 JMP2r
|
||||
|
||||
@find-word-start ( addr* -- addr* )
|
||||
;mem SWP2
|
||||
&>l ( -- )
|
||||
#0001 SUB2 LDAk #21 LTH ?&end
|
||||
LTH2k ?&>l
|
||||
&end NIP2 INC2 JMP2r
|
||||
LTH2k ?&>l &end NIP2 INC2 JMP2r
|
||||
|
||||
@find-word-end ( addr* -- addr* )
|
||||
get-eof SWP2
|
||||
&>l ( -- )
|
||||
LDAk #21 LTH ?&end
|
||||
INC2 GTH2k ?&>l
|
||||
&end NIP2 JMP2r
|
||||
INC2 GTH2k ?&>l &end NIP2 JMP2r
|
||||
|
||||
(
|
||||
@|drawing )
|
||||
|
@ -586,8 +574,7 @@
|
|||
#0000 .Screen/x DEO2
|
||||
#0018 .Screen/y DEO2
|
||||
[ LIT2 80 -Screen/pixel ] DEO
|
||||
<draw-note>
|
||||
!<draw-footer>
|
||||
<draw-note> !<draw-footer>
|
||||
|
||||
@<draw-note> ( -- )
|
||||
[ LIT2 00 -collapsed ] LDZ EQU ?{ JMP2r }
|
||||
|
@ -612,8 +599,7 @@
|
|||
;on-frame/last LDA #01 AND ?&block
|
||||
;blink-icn .Screen/addr DEO2
|
||||
[ LIT2 05 -Screen/sprite ] DEO
|
||||
.Screen/x DEI2k #0008 SUB2 ROT DEO2
|
||||
&block walk-char POP INC2 LDAk ?&>w
|
||||
.Screen/x DEI2k #0008 SUB2 ROT DEO2 &block walk-char POP INC2 LDAk ?&>w
|
||||
POP2
|
||||
( >> )
|
||||
|
||||
|
@ -701,8 +687,7 @@
|
|||
@|stdlib )
|
||||
|
||||
@scap ( str* -- end* )
|
||||
&>w ( -- )
|
||||
INC2 & LDAk ?&>w
|
||||
INC2 & LDAk ?scap
|
||||
JMP2r
|
||||
|
||||
@<phex> ( short* -: )
|
||||
|
|
Loading…
Reference in New Issue