aboutsummaryrefslogtreecommitdiff
path: root/src-z80/core/bgm.z80
diff options
context:
space:
mode:
authorJavier Degirolmo2012-04-29 15:57:47 -0300
committerJavier Degirolmo2012-04-29 15:57:47 -0300
commit2902fc7a532edff250460bfbd8e7a31eedaa980b (patch)
tree6b5251e29551271c633cad21c87dbfea666295ca /src-z80/core/bgm.z80
parent49bde702d51519e676389e9445b2acdde42c3841 (diff)
FM loader code optimized (Oerg's work), also some FM-related bugfixes around
Diffstat (limited to 'src-z80/core/bgm.z80')
-rw-r--r--src-z80/core/bgm.z8027
1 files changed, 23 insertions, 4 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80
index ea245a1..e5d9892 100644
--- a/src-z80/core/bgm.z80
+++ b/src-z80/core/bgm.z80
@@ -241,26 +241,45 @@ ClearBGM:
.resetfm:
PollPCM
- ;xor a ; Reset BGM volume
- ld a, $7F
+ ld a, $7F ; Reset BGM volume
ld (de), a
dec e
+ PollPCM
+
ld a, (hl) ; Kill FM channel if not locked
or a
jp nz, .nofmkill
+ dec b
+
+ ld a, b
+ call KillFM
PollPCM
+ ld a, b ; Reset panning
+ and $04
+ ld iyl, a
ld a, b
- dec a
- call KillFM
+ and $03
+ add $B4
+ ld (iy+0), a
+ ld (iy+1), $C0
+ inc b
.nofmkill:
dec l
djnz .resetfm
;----------------------------------------------------------------------------
+
+ ld hl, RAM_BGMFMPan ; Reset panning status (for restoring)
+ ld a, $C0
+ ld b, 8
+.initpanstat:
+ ld (hl), a
+ inc l
+ djnz .initpanstat
ret ; End of subroutine