;****************************************************************************
; ShortDelayOp [SONAOP_QDELAY_1..16]
; Handles a delay event in short form (single byte).
;----------------------------------------------------------------------------
; input b ..... number of ticks - 1 (bits 3-0 only)
; input c ..... current stream bank
; input hl .... current stream address
;----------------------------------------------------------------------------
; output c .... new stream bank
; output hl ... new stream address
;----------------------------------------------------------------------------
; modifies .... a,bc,de,hl,a'
;----------------------------------------------------------------------------
; notes: it won't return back to the caller, but to the caller's caller (this
; is meant to be called from the stream update routine which never returns on
; its own, so we're acting as a return point instead)
;****************************************************************************
ShortDelayOp:
PollPcm
ld a, b ; Retrieve amount of ticks to wait
and $0F ; which is stored in the bottom four
inc a ; bits of the opcode
ld de, (StreamPtr) ; Store wait duration
inc e
ld (de), a
pop de ; Quit the processing loop
ret ; End of subroutine
;****************************************************************************
; LongDelayOp [SONAOP_DELAY]
; Handles a delay event in long form (two bytes).
;----------------------------------------------------------------------------
; input c ..... current stream bank
; input hl .... current stream address
;----------------------------------------------------------------------------
; output c .... new stream bank
; output hl ... new stream address
;----------------------------------------------------------------------------
; modifies .... a,bc,de,hl,a'
;----------------------------------------------------------------------------
; notes: it won't return back to the caller, but to the caller's caller (this
; is meant to be called from the stream update routine which never returns on
; its own, so we're acting as a return point instead)
;****************************************************************************
LongDelayOp:
ReadArgByte ; Retrieve amount of ticks to wait
ld de, (StreamPtr) ; Store wait duration
inc e
ld a, b
ld (de), a
pop de ; Quit the processing loop
ret ; End of subroutine