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/core/bgm.z80 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src-z80/core/bgm.z80') diff --git a/src-z80/core/bgm.z80 b/src-z80/core/bgm.z80 index e5d9892..2ef3aad 100644 --- a/src-z80/core/bgm.z80 +++ b/src-z80/core/bgm.z80 @@ -1,6 +1,8 @@ ;**************************************************************************** ; PlayBGM [command $04] ; Plays a BGM +;---------------------------------------------------------------------------- +; breaks: all ;**************************************************************************** PlayBGM: @@ -44,6 +46,54 @@ PlayBGM: jp IdleLoop ; End of subroutine +;**************************************************************************** +; ResumeBGM [command $06] +; Resumes a stopped BGM +;---------------------------------------------------------------------------- +; breaks: all +;**************************************************************************** + +ResumeBGM: + xor a ; Command parsed + ld (RAM_Command), a + +;---------------------------------------------------------------------------- + + ld b, 8 ; Restore all FM channels + ld de, RAM_Locked+7 +.restorefm: + + PollPCM + + ld a, (de) ; Check if this channel is locked + or a + jp nz, .fmlocked + + PollPCM + + dec b ; Restore FM channel + call RestoreFM + inc b + +.fmlocked: + dec e ; Go for next channel to restore + dec b + jp nz, .restorefm + +;---------------------------------------------------------------------------- + + ld a, (RAM_Status) ; Show BGM playback in Echo's status + or $02 + ld (RAM_Status), a + + ld hl, RAM_BGMData ; Set BGM as playing + ld (hl), $01 + + ld hl, ProcessBGM ; Tell Echo to process BGM + ld (DoTick_BGM+1), hl + + jp IdleLoop ; End of subroutine + ;**************************************************************************** ; ProcessBGM ; Processes a tick for a BGM -- cgit v1.2.3