aboutsummaryrefslogtreecommitdiff
path: root/src-z80/core
diff options
context:
space:
mode:
Diffstat (limited to 'src-z80/core')
-rw-r--r--src-z80/core/bgm.z8033
-rw-r--r--src-z80/core/sfx.z8034
-rw-r--r--src-z80/core/vars.z803
3 files changed, 41 insertions, 29 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80
index f69235d..eac10d9 100644
--- a/src-z80/core/bgm.z80
+++ b/src-z80/core/bgm.z80
@@ -73,6 +73,7 @@ ProcessBGM:
ld d, (hl)
ex de, hl
+ProcessBGMSkip:
ProcessBGMRun:
PollPCM ; Fetch next event
call GetParam
@@ -163,9 +164,7 @@ ProcessBGMSkip1: ; This is where we land after a locked event
inc c
.nobankskip1:
-ProcessBGMSkip: ; This is where we land after a locked event
- PollPCM ; without parameters
-
+ PollPCM
jp ProcessBGMRun ; Keep processing
;****************************************************************************
@@ -210,39 +209,51 @@ ClearBGM:
or a
call z, StopPCM
+;----------------------------------------------------------------------------
+
ld b, 4 ; Mute all non-locked PSG channels
ld de, RAM_PSGData+48
ld hl, RAM_Locked+11
.mutepsg:
PollPCM
+
ld a, (hl)
or a
- jr nz, .nopsgmute
+ jp nz, .nopsgmute
xor a
ld (de), a
.nopsgmute:
PollPCM
+
ld a, e
sub 16
ld e, a
+
dec l
djnz .mutepsg
+;----------------------------------------------------------------------------
+
ld b, 8 ; Mute all non-locked FM channels
.mutefm:
PollPCM
- ld a, (hl)
+
+ ld a, (hl) ; Check if channel is locked
or a
- jr nz, .nofmmute
+ jp nz, .nofmmute
+
PollPCM
- dec b
- ld (ix+0), $28
- ld (ix+1), b
- inc b
-.nofmmute:
+
+ ld a, b ; Kill FM channel
+ dec a
+ call KillFM
+
+.nofmmute: ; Go for next channel
dec l
djnz .mutefm
+;----------------------------------------------------------------------------
+
ret ; End of subroutine
;****************************************************************************
diff --git a/src-z80/core/sfx.z80 b/src-z80/core/sfx.z80
index c778776..0a7d1e8 100644
--- a/src-z80/core/sfx.z80
+++ b/src-z80/core/sfx.z80
@@ -276,25 +276,9 @@ ClearSFX:
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 l, a
-
- ld hl, RAM_BGMFMInstr
+ ld hl, RAM_BGMFMInstr ; Restore BGM FM instrument
ld a, b
add l
ld l, a
@@ -309,6 +293,22 @@ ClearSFX:
pop de
pop bc
+ ;PollPCM
+
+ ;ld a, l
+ ;add 8
+ ;ld l, a
+
+ ;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
inc b
.fmfree:
diff --git a/src-z80/core/vars.z80 b/src-z80/core/vars.z80
index 3496845..64a1dde 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_FMVolume: ds 8 ; Volume of each FM channel
RAM_FMData: ds 8*5 ; FM info (for volume handling)
; ds 8*1 ... Register $B0