refactor SetPath slightly

This commit is contained in:
4am 2019-09-09 14:11:49 -04:00
parent 9bfa1d853b
commit 1d7e3bd1b9
2 changed files with 9 additions and 6 deletions

View File

@ -60,28 +60,31 @@ kFXDirectory
; in: A contains low byte of address of length-prefixed string to append ; in: A contains low byte of address of length-prefixed string to append
; Y contains high byte of address of length-prefixed string to append ; Y contains high byte of address of length-prefixed string to append
; out: all registers and flags clobbered ; out: all registers and flags clobbered
; $00/$01 clobbered ; $02/$03 (PTR/PTR+1) clobbered
; gPathname updated with concatenated length-prefixed string ; gPathname updated with concatenated length-prefixed string
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
SetPath SetPath
kRootDirectory=*+1
ldx #0 ldx #0
stx gPathname stx gPathname
; execution falls through here ; execution falls through here
AddToPath AddToPath
+STAY $00 +STAY PTR
ldx gPathname ; current pathname length ldx gPathname ; current pathname length
ldy #0 ldy #0
lda ($00),y ; length of this segment lda (PTR),y ; length of this segment
beq @done
tay tay
iny iny
sty @len sty @len
ldy #$01 ldy #$01
- lda ($00),y - lda (PTR),y
sta gPathname+1,x sta gPathname+1,x
inx inx
iny iny
@len=*+1 @len=*+1
cpy #$FD ; SMC cpy #$FD ; SMC
bcc - bcc -
@done
stx gPathname stx gPathname
rts rts

View File

@ -68,7 +68,7 @@ kSFXFizzleFile
; $2000..$5FFF/aux clobbered ; $2000..$5FFF/aux clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
.SHRArtworkCallback .SHRArtworkCallback
+STAY PTR +STAY SAVE
lda KBD lda KBD
bpl + bpl +
@ -81,7 +81,7 @@ kSFXFizzleFile
; load SHR artwork at $2000/main (not aux) ; load SHR artwork at $2000/main (not aux)
+LDADDR kSHRArtworkDirectory +LDADDR kSHRArtworkDirectory
jsr SetPath jsr SetPath
+LDAY PTR +LDAY SAVE
jsr AddToPath jsr AddToPath
jsr LoadFile jsr LoadFile