mirror of
https://github.com/a2-4am/pitch-dark.git
synced 2024-06-20 02:29:29 +00:00
make .sav file optional, warn if missing
This commit is contained in:
parent
6815c44182
commit
1487b28f50
|
@ -40,7 +40,7 @@ tmp = $8
|
||||||
;seeking with aligned_read=1 requires non-zero offset
|
;seeking with aligned_read=1 requires non-zero offset
|
||||||
check_chksum = 0 ;set to 1 to enforce checksum verification for floppies
|
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
|
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
|
;makes use of status to indicate success or failure
|
||||||
allow_aux = 0 ;set to 1 to allow read/write directly to/from aux memory
|
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
|
;requires load_high to be set for arbitrary memory access
|
||||||
|
@ -451,7 +451,17 @@ skipupper
|
||||||
sta hddsavetreelo
|
sta hddsavetreelo
|
||||||
lda hddgametreehi
|
lda hddgametreehi
|
||||||
sta hddsavetreehi
|
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
|
ldy $2006
|
||||||
lda #'4'
|
lda #'4'
|
||||||
sta $2006,y
|
sta $2006,y
|
||||||
|
@ -485,12 +495,28 @@ brand jsr $dbda
|
||||||
lda #>brandtext
|
lda #>brandtext
|
||||||
ldx #<brandtext
|
ldx #<brandtext
|
||||||
ldy #(brandtext_e-brandtext)
|
ldy #(brandtext_e-brandtext)
|
||||||
jmp $dbda
|
jsr $dbda
|
||||||
|
lda $300
|
||||||
|
cmp #$38
|
||||||
|
bne +
|
||||||
|
dec $25
|
||||||
|
lda #0
|
||||||
|
sta $24
|
||||||
|
sta $57b
|
||||||
|
jsr $8a9
|
||||||
|
lda #>nosave
|
||||||
|
ldx #<nosave
|
||||||
|
ldy #(nosave_e-nosave)
|
||||||
|
jsr $dbda
|
||||||
|
+ rts
|
||||||
|
|
||||||
brandtext !text "On Beyond Z-Machine! revision "
|
brandtext !text "On Beyond Z-Machine! revision "
|
||||||
+version
|
+version
|
||||||
brandtext_e
|
brandtext_e
|
||||||
|
|
||||||
|
nosave !text "No .sav file, saving disabled"
|
||||||
|
nosave_e
|
||||||
|
|
||||||
!if load_aux = 1 {
|
!if load_aux = 1 {
|
||||||
sta CLRAUXWR + (load_banked * 4) ;CLRAUXWR or CLRAUXZP
|
sta CLRAUXWR + (load_banked * 4) ;CLRAUXWR or CLRAUXZP
|
||||||
} ;load_aux
|
} ;load_aux
|
||||||
|
@ -518,6 +544,12 @@ hddreaddir1
|
||||||
;include volume directory header in count
|
;include volume directory header in count
|
||||||
|
|
||||||
hddreaddir
|
hddreaddir
|
||||||
|
!if might_exist = 1 {
|
||||||
|
ldx hdddirbuf + FILE_COUNT ;assuming only 256 files per subdirectory
|
||||||
|
inx
|
||||||
|
stx entries
|
||||||
|
} ;might_exist
|
||||||
|
|
||||||
hddfirstent lda #NAME_LENGTH
|
hddfirstent lda #NAME_LENGTH
|
||||||
sta bloklo
|
sta bloklo
|
||||||
lda #>(hdddirbuf - 1)
|
lda #>(hdddirbuf - 1)
|
||||||
|
@ -527,7 +559,16 @@ hddfirstent lda #NAME_LENGTH
|
||||||
|
|
||||||
hddnextent1 inc blokhi
|
hddnextent1 inc blokhi
|
||||||
hddnextent ldy #0
|
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
|
lda (bloklo), y
|
||||||
|
|
||||||
;remember type
|
;remember type
|
||||||
|
@ -542,7 +583,7 @@ hddnextent ldy #0
|
||||||
sta adrhi
|
sta adrhi
|
||||||
bit adrhi
|
bit adrhi
|
||||||
php
|
php
|
||||||
} ;allow_trees
|
} ;might_exist or allow_trees
|
||||||
|
|
||||||
;match name lengths before attempting to match names
|
;match name lengths before attempting to match names
|
||||||
|
|
||||||
|
@ -553,11 +594,19 @@ hddnextent ldy #0
|
||||||
- cmp $2006, y
|
- cmp $2006, y
|
||||||
beq hddfoundname
|
beq hddfoundname
|
||||||
|
|
||||||
|
;match failed, check if any directory entries remain
|
||||||
|
|
||||||
!if allow_trees = 1 {
|
!if allow_trees = 1 {
|
||||||
plp
|
plp
|
||||||
} ;allow_trees
|
} ;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
|
+ clc
|
||||||
lda bloklo
|
lda bloklo
|
||||||
|
|
|
@ -40,7 +40,7 @@ tmp = $8
|
||||||
;seeking with aligned_read=1 requires non-zero offset
|
;seeking with aligned_read=1 requires non-zero offset
|
||||||
check_chksum = 0 ;set to 1 to enforce checksum verification for floppies
|
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
|
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
|
;makes use of status to indicate success or failure
|
||||||
allow_aux = 0 ;set to 1 to allow read/write directly to/from aux memory
|
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
|
;requires load_high to be set for arbitrary memory access
|
||||||
|
@ -406,7 +406,6 @@ skipupper
|
||||||
sta $915
|
sta $915
|
||||||
|
|
||||||
+
|
+
|
||||||
|
|
||||||
ldy #quit_e-waitkey
|
ldy #quit_e-waitkey
|
||||||
- lda hookquit-1, y
|
- lda hookquit-1, y
|
||||||
sta waitkey-1, y
|
sta waitkey-1, y
|
||||||
|
@ -447,7 +446,17 @@ skipupper
|
||||||
sta hddsavetreelo
|
sta hddsavetreelo
|
||||||
lda hddgametreehi
|
lda hddgametreehi
|
||||||
sta hddsavetreehi
|
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
|
ldy $2006
|
||||||
lda #'5'
|
lda #'5'
|
||||||
sta $2006,y
|
sta $2006,y
|
||||||
|
@ -481,12 +490,28 @@ brand jsr $db5b
|
||||||
lda #>brandtext
|
lda #>brandtext
|
||||||
ldx #<brandtext
|
ldx #<brandtext
|
||||||
ldy #(brandtext_e-brandtext)
|
ldy #(brandtext_e-brandtext)
|
||||||
jmp $db5b
|
jsr $db5b
|
||||||
|
lda $300
|
||||||
|
cmp #$38
|
||||||
|
bne +
|
||||||
|
dec $25
|
||||||
|
lda #0
|
||||||
|
sta $24
|
||||||
|
sta $57b
|
||||||
|
jsr $8a9
|
||||||
|
lda #>nosave
|
||||||
|
ldx #<nosave
|
||||||
|
ldy #(nosave_e-nosave)
|
||||||
|
jsr $db5b
|
||||||
|
+ rts
|
||||||
|
|
||||||
brandtext !text "On Beyond Z-Machine! revision "
|
brandtext !text "On Beyond Z-Machine! revision "
|
||||||
+version
|
+version
|
||||||
brandtext_e
|
brandtext_e
|
||||||
|
|
||||||
|
nosave !text "No .sav file, saving disabled"
|
||||||
|
nosave_e
|
||||||
|
|
||||||
!if load_aux = 1 {
|
!if load_aux = 1 {
|
||||||
sta CLRAUXWR + (load_banked * 4) ;CLRAUXWR or CLRAUXZP
|
sta CLRAUXWR + (load_banked * 4) ;CLRAUXWR or CLRAUXZP
|
||||||
} ;load_aux
|
} ;load_aux
|
||||||
|
@ -514,6 +539,12 @@ hddreaddir1
|
||||||
;include volume directory header in count
|
;include volume directory header in count
|
||||||
|
|
||||||
hddreaddir
|
hddreaddir
|
||||||
|
!if might_exist = 1 {
|
||||||
|
ldx hdddirbuf + FILE_COUNT ;assuming only 256 files per subdirectory
|
||||||
|
inx
|
||||||
|
stx entries
|
||||||
|
} ;might_exist
|
||||||
|
|
||||||
hddfirstent lda #NAME_LENGTH
|
hddfirstent lda #NAME_LENGTH
|
||||||
sta bloklo
|
sta bloklo
|
||||||
lda #>(hdddirbuf - 1)
|
lda #>(hdddirbuf - 1)
|
||||||
|
@ -523,7 +554,16 @@ hddfirstent lda #NAME_LENGTH
|
||||||
|
|
||||||
hddnextent1 inc blokhi
|
hddnextent1 inc blokhi
|
||||||
hddnextent ldy #0
|
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
|
lda (bloklo), y
|
||||||
|
|
||||||
;remember type
|
;remember type
|
||||||
|
@ -538,7 +578,7 @@ hddnextent ldy #0
|
||||||
sta adrhi
|
sta adrhi
|
||||||
bit adrhi
|
bit adrhi
|
||||||
php
|
php
|
||||||
} ;allow_trees
|
} ;might_exist or allow_trees
|
||||||
|
|
||||||
;match name lengths before attempting to match names
|
;match name lengths before attempting to match names
|
||||||
|
|
||||||
|
@ -549,11 +589,19 @@ hddnextent ldy #0
|
||||||
- cmp $2006, y
|
- cmp $2006, y
|
||||||
beq hddfoundname
|
beq hddfoundname
|
||||||
|
|
||||||
|
;match failed, check if any directory entries remain
|
||||||
|
|
||||||
!if allow_trees = 1 {
|
!if allow_trees = 1 {
|
||||||
plp
|
plp
|
||||||
} ;allow_trees
|
} ;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
|
+ clc
|
||||||
lda bloklo
|
lda bloklo
|
||||||
|
|
Loading…
Reference in New Issue
Block a user