From e74812eb87574c625a28c1fe8e35cd6708ec6c88 Mon Sep 17 00:00:00 2001 From: Javier Degirolmo Date: Tue, 8 Nov 2011 20:42:48 -0300 Subject: Cleanup and bugfixes. SFXs now restore BGM volume when unlocking, but seems still buggy. --- src-z80/core/sfx.z80 | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src-z80/core/sfx.z80') diff --git a/src-z80/core/sfx.z80 b/src-z80/core/sfx.z80 index b7e26aa..f32a8f0 100644 --- a/src-z80/core/sfx.z80 +++ b/src-z80/core/sfx.z80 @@ -273,26 +273,16 @@ ClearSFX: rrca ld iyl, a - ld a, b ; Kill ADSR + ld a, b ; Kill ADSR call KillFM PollPCM - - ld hl, RAM_BGMFMVol ; Restore BGM FM volume - ld a, b - add l - ld l, a - ld c, (hl) - ld a, l - add 8 - ld l, a - ld (hl), c - - PollPCM - - ld a, l ; Restore BGM FM instrument - sub 8*2 + + ld a, b ; Restore BGM FM instrument + ld h, RAM_BGMFMInstr>>8 + add RAM_BGMFMInstr&$FF ld l, a + push bc push de push hl @@ -302,6 +292,14 @@ ClearSFX: pop hl pop de pop bc + + PollPCM + + ld a, b ; Restore BGM FM volume + add RAM_BGMFMVol&$FF + ld l, a + ld b, (hl) + call SetFMVolLoad PollPCM inc b -- cgit v1.2.3