From 2902fc7a532edff250460bfbd8e7a31eedaa980b Mon Sep 17 00:00:00 2001 From: Javier Degirolmo Date: Sun, 29 Apr 2012 15:57:47 -0300 Subject: FM loader code optimized (Oerg's work), also some FM-related bugfixes around --- src-z80/core/sfx.z80 | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src-z80/core/sfx.z80') diff --git a/src-z80/core/sfx.z80 b/src-z80/core/sfx.z80 index 6eb844d..0e140e8 100644 --- a/src-z80/core/sfx.z80 +++ b/src-z80/core/sfx.z80 @@ -262,21 +262,9 @@ ClearSFX: xor a ld (de), a - dec b ; Mute FM channel - ld (ix+0), $28 - ld (ix+1), b - PollPCM - ld a, b - and $04 ; Determine which port to write - rrca - ld iyl, a - - ld a, b ; Kill ADSR - call KillFM - - PollPCM + dec b ld a, b ; Restore BGM FM instrument ld h, RAM_BGMFMInstr>>8 @@ -292,31 +280,23 @@ ClearSFX: PollPCM push bc - ld a, b ; Restore BGM FM volume - add RAM_BGMFMVol&$FF + ld a, l ; Restore BGM FM volume + add 8 ld l, a ld a, b ld b, (hl) call SetFMVolLoad pop bc - ld a, b - and $04 - rrca - ld iyl, a - - push bc ; Restore BGM FM panning - ld a, b - ld h, RAM_BGMFMPan>>8 - add RAM_BGMFMPan&$FF + ld a, l ; Restore BGM FM panning + add 8 ld l, a ld a, b - ld b, (hl) and $03 add $B4 - ld (iy+0), b + ld (iy+0), a + ld a, (hl) ld (iy+1), a - pop bc PollPCM inc b -- cgit v1.2.3