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

View File

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