diff options
| author | Javier Degirolmo | 2012-07-15 21:02:54 -0300 |
|---|---|---|
| committer | Javier Degirolmo | 2012-07-15 21:02:54 -0300 |
| commit | c7cf8a2eb4178f59a5dfe2c3ad6bf1a39eeca523 (patch) | |
| tree | ddaf8602e1d089644753d6e0a52421f35b730b10 /src-z80/core/bgm.z80 | |
| parent | 84ce0220dd5449587467c37d7afbd99fb1fbe69e (diff) | |
Added BGM pausing support (stop BGM to pause, resume BGM to unpause)
Diffstat (limited to 'src-z80/core/bgm.z80')
| -rw-r--r-- | src-z80/core/bgm.z80 | 50 |
1 files changed, 50 insertions, 0 deletions
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: @@ -45,6 +47,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 ;**************************************************************************** |
