mirror of
https://github.com/a2stuff/prodos-path.git
synced 2025-02-10 18:30:30 +00:00
PATH: Shave 9 bytes
This commit is contained in:
parent
af1c8f1865
commit
0c01446574
@ -36,6 +36,9 @@ Example:
|
|||||||
Notes:
|
Notes:
|
||||||
* `PATH` can be invoked as lower case (e.g. `path /hd/cmd`)
|
* `PATH` can be invoked as lower case (e.g. `path /hd/cmd`)
|
||||||
* Commands can be invoked as lower case (e.g. `hello`)
|
* Commands can be invoked as lower case (e.g. `hello`)
|
||||||
|
* A relative `PATH` (e.g. `path bin`) only works if an explicit prefix is set.
|
||||||
|
* Note that if no prefix has been set, or if you run `prefix /`, BASIC.SYSTEM will use the last accessed slot and drive and the `PREFIX` command will report that volume as a prefix even though it is empty.
|
||||||
|
|
||||||
|
|
||||||
Sample commands included:
|
Sample commands included:
|
||||||
* `HELLO` - shows a short message, for testing purposes
|
* `HELLO` - shows a short message, for testing purposes
|
||||||
|
45
path.s
45
path.s
@ -330,7 +330,7 @@ notok: dey
|
|||||||
|
|
||||||
;; Indicate end of command string for BI's parser (if command uses it)
|
;; Indicate end of command string for BI's parser (if command uses it)
|
||||||
dex
|
dex
|
||||||
stx XLEN
|
stx xlen ; assigned to `XLEN` later
|
||||||
|
|
||||||
;; Check to see if path exists.
|
;; Check to see if path exists.
|
||||||
lda #$A ; param length
|
lda #$A ; param length
|
||||||
@ -345,14 +345,11 @@ notok: dey
|
|||||||
bne compose ; wrong type - try next path directory
|
bne compose ; wrong type - try next path directory
|
||||||
|
|
||||||
;; Tell BASIC.SYSTEM it was handled.
|
;; Tell BASIC.SYSTEM it was handled.
|
||||||
lda #0
|
ldx #xtrnaddr_len - 1
|
||||||
sta XCNUM
|
: lda xtrnaddr,x
|
||||||
sta PBITS
|
sta XTRNADDR,x
|
||||||
sta PBITS+1
|
dex
|
||||||
lda #<XRETURN
|
bpl :-
|
||||||
sta XTRNADDR
|
|
||||||
lda #>XRETURN
|
|
||||||
sta XTRNADDR+1
|
|
||||||
|
|
||||||
;; MLI/BI trashes part of INBUF (clock driver?), so stash it in upper half.
|
;; MLI/BI trashes part of INBUF (clock driver?), so stash it in upper half.
|
||||||
ldx #$7F
|
ldx #$7F
|
||||||
@ -374,14 +371,12 @@ notok: dey
|
|||||||
sta RWREFNUM
|
sta RWREFNUM
|
||||||
sta CFREFNUM
|
sta CFREFNUM
|
||||||
|
|
||||||
lda #<cmd_load_addr
|
;; Assign `RWDATA` and `RWCOUNT`
|
||||||
sta RWDATA
|
ldx #rwdata_len - 1
|
||||||
lda #>cmd_load_addr
|
: lda rwdata,x
|
||||||
sta RWDATA+1
|
sta RWDATA,x
|
||||||
lda #<max_cmd_size
|
dex
|
||||||
sta RWCOUNT
|
bpl :-
|
||||||
lda #>max_cmd_size
|
|
||||||
sta RWCOUNT+1
|
|
||||||
|
|
||||||
lda #READ
|
lda #READ
|
||||||
jsr GOSYSTEM
|
jsr GOSYSTEM
|
||||||
@ -407,6 +402,22 @@ notok: dey
|
|||||||
fail_load:
|
fail_load:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;; Assigned to `XTRNADDR`, `XLEN`, `XCNUM`, and `PBITS`
|
||||||
|
xtrnaddr:
|
||||||
|
.addr XRETURN ; assigned to `XTRNADDR`
|
||||||
|
xlen: .byte 0 ; assigned to `XLEN`
|
||||||
|
.byte 0 ; assigned to `XCNUM`
|
||||||
|
.word 0 ; assigned to `PBITS`
|
||||||
|
xtrnaddr_len = * - xtrnaddr
|
||||||
|
|
||||||
|
|
||||||
|
;;; Assigned to `RWDATA` and `RWCOUNT`
|
||||||
|
rwdata:
|
||||||
|
.addr cmd_load_addr ; assigned to `RWDATA`
|
||||||
|
.word max_cmd_size ; assigned to `RWCOUNT`
|
||||||
|
rwdata_len = * - rwdata
|
||||||
|
|
||||||
;;; ============================================================
|
;;; ============================================================
|
||||||
|
|
||||||
execute:
|
execute:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user