peasant: make sure timing loops don't cross pages

This commit is contained in:
Vince Weaver 2022-01-13 13:14:26 -05:00
parent 9c80711607
commit 4fdcc726ca
4 changed files with 16 additions and 7 deletions

View File

@ -122,6 +122,7 @@ done_check:
done_check_failed:
jsr driveoff
jsr wait_1s

View File

@ -161,10 +161,10 @@ done_beep:
;.include "score.s"
.include "wait.s"
.include "wait_a_bit.s"
;.include "loadsave_menu.s"
.include "wait.s"
.include "graphics_over/game_over_graphics.inc"

View File

@ -335,7 +335,7 @@ seek_delay:
seek_delay_outer:
; inner delay
; delay 2+(19*5)+1 = 98 cycles = ~100us
; delay 2+(19*5)+1 = 98 cycles, + 6+2 = 106 cycles = ~100us
ldx #$13 ; 2
seek_delay_inner:
@ -343,11 +343,13 @@ seek_delay_inner:
bne seek_delay_inner ; 2/3
dec sector_smc+1 ; why?
bne seek_delay_outer
dec sector_smc+1 ; 6 holds the on/off delay time
bne seek_delay_outer ; 2/3
lsr ; what is A here?
; looks like it's the carry bit
seek_delay_end:
lsr ; bottom bit of A here
; is the carry bit
; from phase on/off
bcs do_phase_off ; repeat, this time off
@ -448,3 +450,5 @@ load_length:
code_end:
.assert (>seek_delay_end - >seek_delay) < 1 , error, "seek delay spans page"

View File

@ -1,6 +1,7 @@
; copy of ROM wait
; because we might disable ROM
wait:
sec
wait2:
@ -12,3 +13,6 @@ wait3:
sbc #$01
bne wait2
rts
wait_end:
.assert (>wait_end - >wait) < 1 , error, "wait crosses page boundary"