diff options
Diffstat (limited to 'src-z80')
| -rw-r--r-- | src-z80/core/bgm.z80 | 18 | ||||
| -rw-r--r-- | src-z80/core/main.z80 | 1 | ||||
| -rw-r--r-- | src-z80/core/vars.z80 | 2 | ||||
| -rw-r--r-- | src-z80/player/fm.z80 | 40 | ||||
| -rw-r--r-- | src-z80/player/pcm.z80 | 5 |
5 files changed, 62 insertions, 4 deletions
diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80 index cb8439a..ddb9f74 100644 --- a/src-z80/core/bgm.z80 +++ b/src-z80/core/bgm.z80 @@ -45,6 +45,14 @@ PlayBGM: ld hl, ProcessBGM ; Tell Echo to process BGM ld (DoTick_BGM+1), hl + ld b, 8 ; Force BGM volume of all FM channels to $00 + ld c, 0 ; (default value for older Echo versions) + ld hl, RAM_BGMFMVol +.playunmute: + ld (hl), c + inc l + djnz .playunmute + jp EndOfCommand ; End of subroutine ;**************************************************************************** @@ -311,7 +319,15 @@ StopBGM: ld (RAM_BGMPlaying), a ld hl, DoTick_BGMSkip ld (DoTick_BGM+1), hl - + + ld b, 8 ; Force BGM volume of all FM channels to $7F + ld c, $7F + ld hl, RAM_BGMFMVol +.stopmute: + ld (hl), c + inc l + djnz .stopmute + ret ; End of subroutine ;**************************************************************************** diff --git a/src-z80/core/main.z80 b/src-z80/core/main.z80 index 28758eb..383a0be 100644 --- a/src-z80/core/main.z80 +++ b/src-z80/core/main.z80 @@ -178,6 +178,7 @@ DoTick: ld (ix+0), $27 ; Retrigger the timer ld (ix+1), $2F +DoTick_Tick: PollPCM diff --git a/src-z80/core/vars.z80 b/src-z80/core/vars.z80 index 321d552..23b15b5 100644 --- a/src-z80/core/vars.z80 +++ b/src-z80/core/vars.z80 @@ -14,7 +14,7 @@ RAM_PSGData: ds 4*16 ; PSG envelope data ; ds 1 ... BGM channel volume RAM_BGMFMInstr: ds 8 ; FM instruments used by BGM -RAM_BGMFMVol: ds 8 ; FM volumes used by BGM +RAM_BGMFMVol: ds 8, $7F ; FM volumes used by BGM RAM_BGMFMPan: ds 8, $C0 ; FM panning used by BGM RAM_FMVol: ds 8 ; FM volume of each channel diff --git a/src-z80/player/fm.z80 b/src-z80/player/fm.z80 index 8afd0e7..130948f 100644 --- a/src-z80/player/fm.z80 +++ b/src-z80/player/fm.z80 @@ -798,6 +798,9 @@ SetFMReg: PollPCM ; Get parameters call GetParam + ld a, b + cp $27 + jr z, .setch3 push bc PollPCM call GetParam @@ -810,6 +813,43 @@ SetFMReg: ret ; End of subroutine +;---------------------------------------------------------------------------- + +.setch3: + ; Register $27 is the timer triggers, but also holds ch3 mode + ; It's handled separately in order to only modify the ch3 mode bits + ; and modify the register writes to keep them + + PollPCM ; Get new ch3 mode + call GetParam + PollPCM + + ld a, b ; Set ch3 mode now, without touching + and $C0 ; either timer + or $0F + ld b, a + ld a, $27 + ld (iy+0), a + ld (iy+0), b + + PollPCM + + ld a, b ; Update timer writes (so they don't undo + and $C0 ; the ch3 mode change) + + ld a, (UpdatePCM_Tick-1) ; (timer A) + and $3F + or a, b + ld (UpdatePCM_Tick-1), a + + ld a, (DoTick_Tick-1) ; (timer B) + and $3F + or a, b + ld (DoTick_Tick-1), a + + PollPCM + ret ; End of subroutine + ;**************************************************************************** ; LockChannelFM [events $E0-$E7] ; Locks a FM channel diff --git a/src-z80/player/pcm.z80 b/src-z80/player/pcm.z80 index 2b7bcc4..688683a 100644 --- a/src-z80/player/pcm.z80 +++ b/src-z80/player/pcm.z80 @@ -9,9 +9,10 @@ UpdatePCM: exx ; Switch to PCM registers -.doagain: +UpdatePCM_Again: ld (ix+0), $27 ; Acknowledge timer ld (ix+1), $1F +UpdatePCM_Tick: ;push hl ;ld hl, $1F27 ;ld ($4000), hl @@ -129,7 +130,7 @@ UpdatePCM: .nobankchg: ld l, RAM_PCMBuffer&$FF ; Go back to the beginning of the buffer - jp .doagain ; We took so long we should play the next + jp UpdatePCM_Again ; We took so long we should play the next ; sample already ._.' ;**************************************************************************** |
