aboutsummaryrefslogtreecommitdiff
path: root/src-z80/player/misc.z80
diff options
context:
space:
mode:
authorsik2017-03-05 20:57:11 -0300
committersik2017-03-05 20:57:11 -0300
commita679ba38190bfed6ae150a12e819ad7527c495d1 (patch)
treeea4b189bce2732032998027f5dbcb75a1c0eea1d /src-z80/player/misc.z80
parent2ad500e6d8a24ca09cbfc6618aea9c1cd3cc0e93 (diff)
Upgrade!
Diffstat (limited to 'src-z80/player/misc.z80')
-rw-r--r--src-z80/player/misc.z8044
1 files changed, 44 insertions, 0 deletions
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