aboutsummaryrefslogtreecommitdiff
path: root/src-z80/core/bgm.z80
diff options
context:
space:
mode:
Diffstat (limited to 'src-z80/core/bgm.z80')
-rw-r--r--src-z80/core/bgm.z8044
1 files changed, 27 insertions, 17 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80
index eac10d9..c1650f1 100644
--- a/src-z80/core/bgm.z80
+++ b/src-z80/core/bgm.z80
@@ -73,7 +73,6 @@ ProcessBGM:
ld d, (hl)
ex de, hl
-ProcessBGMSkip:
ProcessBGMRun:
PollPCM ; Fetch next event
call GetParam
@@ -164,7 +163,9 @@ ProcessBGMSkip1: ; This is where we land after a locked event
inc c
.nobankskip1:
- PollPCM
+ProcessBGMSkip: ; This is where we land after a locked event
+ PollPCM ; without parameters
+
jp ProcessBGMRun ; Keep processing
;****************************************************************************
@@ -211,46 +212,55 @@ ClearBGM:
;----------------------------------------------------------------------------
- ld b, 4 ; Mute all non-locked PSG channels
- ld de, RAM_PSGData+48
+ ld b, 4 ; Reset all PSG channels
+ ld de, RAM_PSGData+48+15
ld hl, RAM_Locked+11
.mutepsg:
PollPCM
- ld a, (hl)
+ ld (hl), $00 ; Reset BGM volume
+
+ ld a, e
+ sub 15
+ ld e, a
+
+ ld a, (hl) ; Mute PSG channel if it isn't locked
or a
- jp nz, .nopsgmute
+ jr nz, .nopsgmute
xor a
ld (de), a
+
.nopsgmute:
PollPCM
- ld a, e
- sub 16
- ld e, a
-
+ dec e
dec l
djnz .mutepsg
;----------------------------------------------------------------------------
- ld b, 8 ; Mute all non-locked FM channels
-.mutefm:
+ ld b, 8 ; Reset all FM channels
+ ld de, RAM_BGMFMVol+7
+.resetfm:
PollPCM
- ld a, (hl) ; Check if channel is locked
+ xor a ; Reset BGM volume
+ ld (de), a
+ dec e
+
+ ld a, (hl) ; Kill FM channel if not locked
or a
- jp nz, .nofmmute
+ jp nz, .nofmkill
PollPCM
- ld a, b ; Kill FM channel
+ ld a, b
dec a
call KillFM
-.nofmmute: ; Go for next channel
+.nofmkill:
dec l
- djnz .mutefm
+ djnz .resetfm
;----------------------------------------------------------------------------