Artificial delay when in-game music is off

This commit is contained in:
StewBC 2021-04-30 14:13:01 -07:00
parent fffac7219e
commit 68e9db4f51

View File

@ -95,22 +95,26 @@ reset:
lda audioMask ; see if the music is on
and #AUDIO_MUSIC
bne :+
rts ; if not, return
bne play
ldx #0 ; kill approx 6800 cycles (average cycles for playNote when on)
:
lda #$FF ; calculate a delay
sec ; based on how many tiles were rendered
sbc tilesRendered ; this lets the music sound
cmp #80 ; better, esp. when a level is
bcc :+ ; very sparse (SkyLab for example)
lsr
lsr
lsr
lsr
tay
jsr uiDelay::ySet
:
nop ; 2 cycles
nop ; 4
nop ; 6
nop ; 8
nop ; 10
nop ; 12
nop ; 14
nop ; 16
nop ; 18
nop ; 20
nop ; 22
dex ; 24 cycles
bne :- ; 26 cycles * 256 = 6656 cycles - close enough
rts
play:
ldx musicL ; get the index into the in-game music
inc musicL ; and advance that index
lda inGameMusic, x ; get the note at the index