mirror of
https://github.com/StewBC/mminer-apple2.git
synced 2024-06-07 12:29:27 +00:00
Artificial delay when in-game music is off
This commit is contained in:
parent
fffac7219e
commit
68e9db4f51
|
@ -9,7 +9,7 @@
|
||||||
.segment "CODE"
|
.segment "CODE"
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.proc audioPlayTitleNote
|
.proc audioPlayTitleNote
|
||||||
|
|
||||||
fixedDuration = srcPtrL
|
fixedDuration = srcPtrL
|
||||||
noteDuration = srcPtrH
|
noteDuration = srcPtrH
|
||||||
|
@ -48,7 +48,7 @@ play:
|
||||||
sta freqTimer1
|
sta freqTimer1
|
||||||
ldx #11 ; delay about 20 clock cycles
|
ldx #11 ; delay about 20 clock cycles
|
||||||
:
|
:
|
||||||
dex
|
dex
|
||||||
bne :-
|
bne :-
|
||||||
:
|
:
|
||||||
dec freqTimer2 ; dec timer 2
|
dec freqTimer2 ; dec timer 2
|
||||||
|
@ -58,7 +58,7 @@ play:
|
||||||
sta freqTimer2
|
sta freqTimer2
|
||||||
ldx #11 ; and waste 20 clock cycles
|
ldx #11 ; and waste 20 clock cycles
|
||||||
:
|
:
|
||||||
dex
|
dex
|
||||||
bne :-
|
bne :-
|
||||||
:
|
:
|
||||||
dec fixedDuration ; dec the fixed repeat count
|
dec fixedDuration ; dec the fixed repeat count
|
||||||
|
@ -75,7 +75,7 @@ leave:
|
||||||
inc musicH
|
inc musicH
|
||||||
clc ; leave with carry clear
|
clc ; leave with carry clear
|
||||||
:
|
:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
lda #<titleMusic ; played the whole tune
|
lda #<titleMusic ; played the whole tune
|
||||||
|
@ -84,9 +84,9 @@ reset:
|
||||||
sta musicH
|
sta musicH
|
||||||
|
|
||||||
sec ; and leave with carry set
|
sec ; and leave with carry set
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
.proc audioPlayNote
|
.proc audioPlayNote
|
||||||
|
@ -95,22 +95,26 @@ reset:
|
||||||
|
|
||||||
lda audioMask ; see if the music is on
|
lda audioMask ; see if the music is on
|
||||||
and #AUDIO_MUSIC
|
and #AUDIO_MUSIC
|
||||||
bne :+
|
bne play
|
||||||
rts ; if not, return
|
|
||||||
|
ldx #0 ; kill approx 6800 cycles (average cycles for playNote when on)
|
||||||
|
:
|
||||||
|
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:
|
||||||
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
|
|
||||||
:
|
|
||||||
ldx musicL ; get the index into the in-game music
|
ldx musicL ; get the index into the in-game music
|
||||||
inc musicL ; and advance that index
|
inc musicL ; and advance that index
|
||||||
lda inGameMusic, x ; get the note at the index
|
lda inGameMusic, x ; get the note at the index
|
||||||
|
@ -138,4 +142,4 @@ loop:
|
||||||
|
|
||||||
rts ; and return
|
rts ; and return
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Reference in New Issue
Block a user