aboutsummaryrefslogtreecommitdiff
path: root/src-z80/core/direct.z80
blob: 570175f493ef350d9171349539f0e79afa4ae02c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
;****************************************************************************
; ProcessDirect
; Processes the direct event stream.
;----------------------------------------------------------------------------
; breaks: all
;****************************************************************************

ProcessDirect:
    ld a, ($1F00)                       ; Are there even events to process?
    inc a
    ret z
    
    ld a, $FF                           ; Put bogus length for direct stream
    ld (RAM_DirectLen), a               ; so 68000 knows to wait
    
    PollPCM
    
    ld hl, ProcessDirectEnd             ; Override $FF event
    ld (ProcessBGMEventFF+1), hl
    
    ld hl, $1F00                        ; Where event data is stored
    ld a, (RAM_LastBank)                ; To avoid wasting time with bank
    ld c, a                               ; switching
    
    jp ProcessBGMRun                    ; Start processing the event

ProcessDirectEnd:
    ld hl, StopBGMEvent                 ; Restore $FF event
    ld (ProcessBGMEventFF+1), hl
    
    ld a, $FF                           ; Reset the stream
    ld ($1F00), a
    inc a
    ld (RAM_DirectLen), a
    
    ret                                 ; Return to the main loop