aboutsummaryrefslogtreecommitdiff
path: root/src-z80/core
diff options
context:
space:
mode:
authorJavier Degirolmo2012-04-07 20:28:18 -0300
committerJavier Degirolmo2012-04-07 20:28:18 -0300
commitda98253489b1334f9d23f477ec8fa2a76e664aa6 (patch)
tree4187354505c4c3314db8d5b414cd698c501be1a4 /src-z80/core
parentefd1677ed70a4e0acbae05ae3bc0d9b14b8c1405 (diff)
Bugfixes (especially killing FM channels), panning is restored, version bumped up to 0.9 - going to look mainly for bugs now...
Diffstat (limited to 'src-z80/core')
-rw-r--r--src-z80/core/bgm.z8010
-rw-r--r--src-z80/core/sfx.z8018
-rw-r--r--src-z80/core/vars.z807
3 files changed, 22 insertions, 13 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80
index 27cb89c..ea245a1 100644
--- a/src-z80/core/bgm.z80
+++ b/src-z80/core/bgm.z80
@@ -42,16 +42,6 @@ PlayBGM:
ld hl, ProcessBGM ; Tell Echo to process BGM
ld (DoTick_BGM+1), hl
-; ld b, 8 ; Kill all FM channels explicitly
-;.resetallfm:
-; ld a, b
-; and $04
-; rrca
-; ld iyl, a
-; ld a, b
-; call KillFM
-; djnz .resetallfm
-
jp IdleLoop ; End of subroutine
;****************************************************************************
diff --git a/src-z80/core/sfx.z80 b/src-z80/core/sfx.z80
index d008f0b..6eb844d 100644
--- a/src-z80/core/sfx.z80
+++ b/src-z80/core/sfx.z80
@@ -299,6 +299,24 @@ ClearSFX:
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 l, a
+ ld a, b
+ ld b, (hl)
+ and $03
+ add $B4
+ ld (iy+0), b
+ ld (iy+1), a
+ pop bc
PollPCM
inc b
diff --git a/src-z80/core/vars.z80 b/src-z80/core/vars.z80
index 8b6593a..c1dc8b5 100644
--- a/src-z80/core/vars.z80
+++ b/src-z80/core/vars.z80
@@ -15,7 +15,8 @@ RAM_PSGData: ds 4*16 ; PSG envelope data
RAM_BGMFMInstr: ds 8 ; FM instruments used by BGM
RAM_BGMFMVol: ds 8 ; FM volumes used by BGM
-;RAM_FMVolume: ds 8 ; Volume of each FM channel
+RAM_BGMFMPan: ds 8 ; FM panning used by BGM
+
RAM_FMData: ds 8*5 ; FM info (for volume handling)
; ds 8*1 ... Register $B0
; ds 8*1 ... Register $40
@@ -23,6 +24,8 @@ RAM_FMData: ds 8*5 ; FM info (for volume handling)
; ds 8*1 ... Register $48
; ds 8*1 ... Register $4C
+RAM_Locked: ds 12 ; Locked channels
+
RAM_LastBank: ds 1 ; Last accessed bank
RAM_BGMData: ; Where BGM data starts
@@ -38,8 +41,6 @@ RAM_SFXDelay: ds 1 ; How many ticks to wait
RAM_SFXBank: ds 1 ; Current SFX bank
RAM_SFXAddress: ds 2 ; Current SFX address
-RAM_Locked: ds 12 ; Locked channels
-
RAM_Scratch: ds 32 ; Scratch bytes, may be useful when
; buffering to speed up to avoid bank
; switching conflicts