Sona 0.50 Source

Sona 0.50/src-z80/stream_tempo.z80

;****************************************************************************
; SetBgmSpeed [SONAOP_SETSPEED]
; Changes the playback speed for BGM.
;----------------------------------------------------------------------------
; 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'
;****************************************************************************

SetBgmSpeed:
    ReadArgByte                         ; Retrieve new speed
    
    xor     a                           ; Convert the argument into our
    sla     b                           ; internal format
    rla
    sla     b
    rla
    
    ld      d, a                        ; Store new BGM speed
    ld      e, b
    ld      (BgmTempo), de
    
    ret                                 ; End of subroutine