cat lookup - previous node was reset at every next block which is incorrect.

This commit is contained in:
Kelvin Sherlock 2021-07-18 11:21:20 -04:00
parent 97997a48dc
commit e1f5635e6f
1 changed files with 36 additions and 22 deletions

View File

@ -545,6 +545,8 @@ read_cat_block proc
cat_lookup proc cat_lookup proc
import name_check, match
with data with data
bnum equ dp.r0 bnum equ dp.r0
@ -556,10 +558,12 @@ count equ dp.r2
lda cat_root lda cat_root
sta bnum sta bnum
ix
descend
ldx #-1 ldx #-1
stx prev stx prev
next_index
lda bnum lda bnum
jsr read_cat_block jsr read_cat_block
bcc @ok bcc @ok
@ -592,12 +596,12 @@ eloop
; if this is an index node, ; if this is an index node,
; we overshot, so follow the tree via prev ; we overshot, so follow the tree via prev
; to the next level. ; to the next level.
lda buffer+BTNodeDescriptor.kind-1
bmi nope ; index map
lda prev lda prev
bmi nope
sta bnum sta bnum
bra ix ; index map is 0xff so ora / bmi works.
ora buffer+BTNodeDescriptor.kind-1
bmi fnf ; index map
bra descend
; now do a name check.... ; now do a name check....
; target_name is UPPER CASE ; target_name is UPPER CASE
@ -617,7 +621,7 @@ eloop
lda buffer+38+2,y lda buffer+38+2,y
xba xba
sta bnum sta bnum
bra ix bra descend
@leaf jmp match @leaf jmp match
@ -636,20 +640,29 @@ eloop
advance advance
lda buffer+BTNodeDescriptor.fLink lda buffer+BTNodeDescriptor.fLink
beq nope beq @last
xba xba
sta bnum sta bnum
bra ix bra next_index
@last ; if there was a prev node, descend into it
lda prev
bmi fnf
sta bnum
bra descend
nope fnf
lda #fileNotFound lda #fileNotFound
sec sec
rts rts
endp
name_check proc
name_check
; copy into catstr and upper case it. ; copy into catstr and upper case it.
; save x and y.
with data
phx phx
phy ; save phy ; save
@ -692,7 +705,7 @@ copy
cmp cmp
lda target_str_len lda target_str_len
ora cat_str_len ora cat_str_len
beq match ; folder thread - no name. beq eq ; folder thread - no name.
ldx target_str_len ldx target_str_len
cpx cat_str_len cpx cat_str_len
@ -712,7 +725,7 @@ cmp
dex dex
bne @loop bne @loop
long m eq long m
lda #0 lda #0
bra exit bra exit
@ -728,12 +741,13 @@ exit
plx plx
rts rts
match ; a match! endp
; store the file type, aux type, eof, and extent pointers.
match proc
; a match! ; a match!
; store the file type, aux type, eof, and extent pointers.
with dp, data
with dp
lda buffer+HFSCatalogKey.keyLength,y lda buffer+HFSCatalogKey.keyLength,y
; and #$ff ; and #$ff
@ -749,7 +763,7 @@ match ; a match!
tay tay
lda buffer+HFSCatalogFile.recordType,y lda buffer+HFSCatalogFile.recordType,y
xba and #$ff
cmp #kHFSFolderRecord cmp #kHFSFolderRecord
beq folder beq folder
cmp #kHFSFileRecord cmp #kHFSFileRecord
@ -976,7 +990,7 @@ sloop
bpl sloop bpl sloop
jsr cat_lookup jsr cat_lookup
ifc_fail 'Unable to locate System folder. Error=$' ifc_fail 'Missing System folder. Error=$'
; also check if dir? ; also check if dir?
@ -998,7 +1012,7 @@ floop
bpl floop bpl floop
jsr cat_lookup jsr cat_lookup
ifc_fail 'Unable to locate System:FSTs folder. Error=$' ifc_fail 'Missing System:FSTs folder. Error=$'
; also check if dir? ; also check if dir?
@ -1018,7 +1032,7 @@ dloop
bpl dloop bpl dloop
jsr cat_lookup jsr cat_lookup
ifc_fail 'Unable to locate System:Drivers folder. Error=$' ifc_fail 'Missing System:Drivers folder. Error=$'
; also check if dir? ; also check if dir?
@ -1038,7 +1052,7 @@ dloop
bpl @gloop bpl @gloop
jsr cat_lookup jsr cat_lookup
ifc_fail 'Unable to locate System:Start.GS.OS. Error=$' ifc_fail 'Missing System:Start.GS.OS. Error=$'