update z5u to match z5

This commit is contained in:
Peter Ferrie 2018-04-04 05:42:09 -07:00
parent 77a14fecc4
commit b04c9a843d
1 changed files with 109 additions and 18 deletions

View File

@ -40,7 +40,7 @@ tmp = $8
;seeking with aligned_read=1 requires non-zero offset
check_chksum = 0 ;set to 1 to enforce checksum verification for floppies
allow_subdir = 0 ;set to 1 to allow opening subdirectories to access files
might_exist = 0 ;set to 1 if file is not known to always exist already
might_exist = 1 ;set to 1 if file is not known to always exist already
;makes use of status to indicate success or failure
allow_aux = 0 ;set to 1 to allow read/write directly to/from aux memory
;requires load_high to be set for arbitrary memory access
@ -366,8 +366,10 @@ slot lda $cfff
bne okay80
skip80
lda #$2c
sta call80
lda #$93
sta call80+1
lda #$fe
sta call80+2
lda #$df
sta inversemask+1
lda #7
@ -395,8 +397,7 @@ skipupper
dey
bne -
txa
clc
adc #$af
ora #$b0
sta callback3+1
lda $914
sta loadcall1+1
@ -408,6 +409,21 @@ skipupper
sta $915
+
ldy #quit_e-waitkey
- lda hookquit-1, y
sta waitkey-1, y
dey
bne -
lda #<waitkey
sta $f652
lda #>waitkey
sta $f653
lda #<quit
sta $f661
lda #>quit
sta $f662
ldy #save_end-saveme
- lda saveme-1, y
@ -415,12 +431,23 @@ skipupper
dey
bne -
ldy #slot_end-saveslot
- lda saveslot-1, y
sta $d7f2, y
dey
bne -
lda #<brand
sta $ddae
lda #>brand
sta $ddaf
;skip suffix handling if not present
ldy $2006
lda $2006-2,y
cmp '.'
bne ++
inc $2006
lda #'V'
sta $2006+1,y
@ -433,13 +460,23 @@ skipupper
sta hddsavetreelo
lda hddgametreehi
sta hddsavetreehi
dec $2006
;disable save if no .sav file exists
lda status
beq +
lda #$38 ;sec
sta $300
lda #$60 ;rts
sta $301
+ dec $2006
ldy $2006
lda #'5'
sta $2006,y
lda #'Z'
sta $2006-1,y
jsr hddopendir
++ jsr hddopendir
jmp entry
call80 jsr $c300
@ -453,7 +490,21 @@ call80 jsr $c300
sta $37
rts
saveslot lda #'P'
sta $50
lda #'D'
sta $51
lda $e7
ora #$30
sta $52
rts
slot_end
brand jsr $db53
lda #$53
sta $ddae
lda #$db
sta $ddaf
lda #$17
sta $25
lda #0
@ -507,13 +558,17 @@ hddreaddir1
} else { ;ver_02 = 0
stz adrlo
} ;ver_02
ldy #>hdddirbuf
sty adrhi
jsr hddseekrd
jsr hddreaddirsec
;include volume directory header in count
hddreaddir
!if might_exist = 1 {
ldx hdddirbuf + FILE_COUNT ;assuming only 256 files per subdirectory
inx
stx entries
} ;might_exist
hddfirstent lda #NAME_LENGTH
sta bloklo
lda #>(hdddirbuf - 1)
@ -523,7 +578,16 @@ hddfirstent lda #NAME_LENGTH
hddnextent1 inc blokhi
hddnextent ldy #0
!if allow_trees = 1 {
!if (might_exist + allow_trees) > 0 {
lda (bloklo), y
!if might_exist = 1 {
sty status
;skip deleted entries without counting
and #MASK_ALL
beq +
} ;might_exist
lda (bloklo), y
;remember type
@ -538,7 +602,7 @@ hddnextent ldy #0
sta adrhi
bit adrhi
php
} ;allow_trees
} ;might_exist or allow_trees
;match name lengths before attempting to match names
@ -549,11 +613,19 @@ hddnextent ldy #0
- cmp $2006, y
beq hddfoundname
;match failed, check if any directory entries remain
!if allow_trees = 1 {
plp
} ;allow_trees
!if might_exist = 1 {
dec entries
bne +
inc status
rts
} ;might_exist
;match failed, move to next directory in this block, if possible
;move to next directory in this block, if possible
+ clc
lda bloklo
@ -567,7 +639,12 @@ hddnextent ldy #0
ldx hdddirbuf + NEXT_BLOCK_LO
lda hdddirbuf + NEXT_BLOCK_HI
!if might_exist = 1 {
jsr hddreaddirsec
bcc hddfirstent
} else { ;might_exist
bcs hddreaddir1
} ;might_exist
hddfoundname iny
lda (bloklo), y
@ -1468,16 +1545,16 @@ hddreaddirsel
asl reqcmd
lsr reqcmd
} ;allow_multi
} ;rwts_mode
hddreaddirsec
!if allow_trees = 0 {
!if allow_trees = 0 {
hddreaddirsect ldy #>hdddirbuf
} else { ;allow_trees = 1
} else { ;allow_trees = 1
ldy #>hdddirbuf
hddreaddirsect
} ;allow_trees
} ;allow_trees
sty adrhi
} ;rwts_mode
hddseekrd ldy #cmdread
!if (aligned_read + enable_write) > 1 {
hddseekrdwr sty command
@ -1818,8 +1895,22 @@ xrestore
!byte $d2,$c5,$d3,$d4,$cf,$d2,$c5,$8d
callback_e
}
hookquit
!pseudopc $2d9 {;;-(quit_e-waitkey) {
waitkey
lda $c010
- lda $c000
bpl -
quit lda $c081
jmp $faa6
quit_e
}
!if verbose_info = 1 {
!warn "base=",casemap-(callback_e-callback1)
!warn "base=",casemap-((quit_e-waitkey)+(callback_e-callback1))
!warn "quit=",casemap-(quit_e-waitkey)
}
unpack ;unpacker entrypoint