From a679ba38190bfed6ae150a12e819ad7527c495d1 Mon Sep 17 00:00:00 2001 From: sik Date: Sun, 5 Mar 2017 20:57:11 -0300 Subject: Upgrade! --- src-z80/player/misc.z80 | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src-z80/player/misc.z80') diff --git a/src-z80/player/misc.z80 b/src-z80/player/misc.z80 index 36be250..dee980e 100644 --- a/src-z80/player/misc.z80 +++ b/src-z80/player/misc.z80 @@ -44,3 +44,47 @@ SetDelayShort: ld (hl), b ret ; End of subroutine + +;**************************************************************************** +; RefreshVolume +; Reloads the volume for all channels. +;---------------------------------------------------------------------------- +; breaks: all +;**************************************************************************** + +RefreshVolume: + ld hl, $1FF0 ; Update FM volume + ld de, RAM_FMVol + ld c, 8 +.fixfmvol: + ld a, (de) + ld b, (hl) + add b + jp p, .fixfmvolok + ld a, $7F +.fixfmvolok: + ld b, a + ld a, l + call SetFMVolLoad + inc l + inc e + dec c + jr nz, .fixfmvol + + ld hl, $1FE8 ; Update PSG volume + ld de, RAM_PSGData+1 + ld bc, $0410 +.fixpsgvol: + ld a, (hl) + ld (de), a + inc l + ld a, e + add a, c + ld e, a + PollPCM + djnz .fixpsgvol + + xor a ; Mark that volume was refreshed + ld ($1FF1), a + + ret ; End of subroutine -- cgit v1.2.3