mist: fix bugs with save games on real hardware

didn't trigger on cffa3k or emulator

first was I was accidentally forcing slot 6

the other was the timing-sensitive write routine was straddling
a page boundary, leading to the cycle-counted write code taking
the wrong number of cycles
This commit is contained in:
Vince Weaver 2020-09-06 17:17:12 -04:00
parent 526985249d
commit b1baf474aa
6 changed files with 38 additions and 34 deletions

View File

@ -10,7 +10,8 @@ For release 1.0
-- MIST_ROCKET_PATH_PAD probably missing ship-raised background
+ OCTAGON
-- load "red page" sound into LC and play it?
-- animation on the fireplace opening/closing
-- load "red page" sound clip into LC and play it?
-- show "burnt" books if click on non-avail book
-- adjust grabbing of actual books
-- longer speeches from brothers, most notably the

View File

@ -2,50 +2,50 @@
; external routines
; linking_noise.s
play_link_noise =$158b
play_link_noise =$1463
; decompress_fast_v2.s
decompress_lzsa2_fast =$15a7
getsrc_smc =$169d
decompress_lzsa2_fast =$147f
getsrc_smc =$1575
; draw_pointer.s
draw_pointer =$16aa
draw_pointer =$1582
; end_level.s
end_level =$181c
end_level =$16f4
; gr_copy.s
gr_copy_to_current =$183e
gr_copy_to_current =$1716
; gr_fast_clear.s
clear_bottom =$1964
clear_all =$19a2
clear_all_color =$19c7
clear_bottom =$183c
clear_all =$187a
clear_all_color =$189f
; gr_offsets.s
gr_offsets =$19e5
gr_offsets =$18bd
; gr_page_flip.s
page_flip =$1a15
page_flip =$18ed
; gr_putsprite_crop.s
put_sprite_crop =$1a2f
psc_smc1 =$1a52
psc_smc2 =$1ac4
put_sprite_crop =$1907
psc_smc1 =$192a
psc_smc2 =$199c
; keyboard.s
handle_keypress =$1ac4
change_direction =$1bcf
change_location =$1c02
handle_keypress =$199c
change_direction =$1aa7
change_location =$1ada
; text_print.s
move_and_print =$1c9a
ps_smc1 =$1cc7
move_and_print =$1b72
ps_smc1 =$1b9f
; page_sprites.inc
blue_page_sprite =$1e16
red_page_sprite =$1e2c
white_page_sprite =$1e42
blue_page_small_sprite =$1e58
red_page_small_sprite =$1e60
blue_page_sprite =$1cee
red_page_sprite =$1d04
white_page_sprite =$1d1a
blue_page_small_sprite =$1d30
red_page_small_sprite =$1d38

View File

@ -22,6 +22,7 @@
znibble = $fe ; only during init
zmask = $ff ; only during init
WHICH_SLOT = $DA
; $26/$27 sector read location (ROM)
; $3D sector number (ROM)
@ -61,6 +62,7 @@ boot_entry:
; this routine reads sector in $3D on track in $41
; to address in $26/$27
; when it's done it jumps back to $801
stx WHICH_SLOT ; save for later
txa ; x is slot# << 4
lsr

View File

@ -24,15 +24,12 @@ try_for_d5:
jsr readnib
rts
;================================
; set up the self-modifying code
; to point to the proper slot
;================================
; slot number is in high nibble of A
popwr_init:
lda #$60
and #$70 ; the slot number is in the top here
sta slotpatchw1+1 ; self modify the code
sta slotpatchw2+1
@ -41,7 +38,6 @@ popwr_init:
rts
;================================
; write a sector
;================================
@ -70,6 +66,10 @@ frombuff_smc:
tya
bne aa
jmp cmpsecwr
.align $100
; look for the proper sector to write
cmpsecwr:

View File

@ -9,7 +9,7 @@
qload_start:
; init the write code
lda WHICH_SLOT
jsr popwr_init
; first time entry
@ -131,12 +131,12 @@ fnf_keypress:
; first sector now in $c00
; offset 59
; disk1 = $d0
; disk1 = $0a
; disk2 = $32 ('2')
; disk3 = $33 ('3')
lda $c59
cmp #$d0
cmp #$0a
beq is_disk1
cmp #$32
beq is_disk2
@ -221,8 +221,6 @@ length_array:
.byte 1,1,1,1,1 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte 1 ; FIRST_SECTOR
.include "qkumba_popwr.s"
.include "audio.s"
.include "linking_noise.s"
.include "decompress_fast_v2.s"
@ -241,6 +239,8 @@ length_array:
.include "page_sprites.inc"
.include "common_sprites.inc"
.include "qkumba_popwr.s"
qload_end:
.assert (>qload_end - >qload_start) < $e , error, "loader too big"

View File

@ -285,6 +285,7 @@ END_OF_SAVE = $D9
; done game puzzle state
WHICH_SLOT = $DA
JS_BUTTON_STATE = $DB
CURRENT_DISK = $DC
JOYSTICK_ENABLED= $DD