From c7cf8a2eb4178f59a5dfe2c3ad6bf1a39eeca523 Mon Sep 17 00:00:00 2001 From: Javier Degirolmo Date: Sun, 15 Jul 2012 21:02:54 -0300 Subject: Added BGM pausing support (stop BGM to pause, resume BGM to unpause) --- src-z80/player/fm.z80 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src-z80/player') diff --git a/src-z80/player/fm.z80 b/src-z80/player/fm.z80 index ddfef66..65a6c55 100644 --- a/src-z80/player/fm.z80 +++ b/src-z80/player/fm.z80 @@ -755,3 +755,48 @@ KillFM: PollPCM ret ; End of subroutine + +;**************************************************************************** +; RestoreFM +; Restores a FM channel (from BGM information) +;---------------------------------------------------------------------------- +; input b ... FM channel (0..7) +;---------------------------------------------------------------------------- +; breaks: af, hl +;**************************************************************************** + +RestoreFM: + ld a, b ; Restore BGM FM instrument + ld h, RAM_BGMFMInstr>>8 + add RAM_BGMFMInstr&$FF + ld l, a + + push bc + ld a, b + ld b, (hl) + call LoadFMDirect + pop bc + + PollPCM + + push bc + ld a, l ; Restore BGM FM volume + add 8 + ld l, a + ld a, b + ld b, (hl) + call SetFMVolLoad + pop bc + + ld a, l ; Restore BGM FM panning + add 8 + ld l, a + ld a, b + and $03 + add $B4 + ld (iy+0), a + ld a, (hl) + ld (iy+1), a + + PollPCM + ret ; End of subroutine -- cgit v1.2.3