Sona 0.50 Source

Sona 0.50/src-z80/fm_lfo.z80

;****************************************************************************
; SetFmLfo [SONAOP_LFO]
; Handles the stream event for changing the FM LFO setting.
;----------------------------------------------------------------------------
; 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'
;****************************************************************************

SetFmLfo:
    ReadArgByte                         ; Get new LFO setting
    
    ld      (ix+0), YMREG_LFO           ; Write the value to the LFO
    ld      (ix+1), b                   ; register (there's not much else
                                        ; to do, really)
    
    ret                                 ; End of subroutine

;****************************************************************************
; SetPmsAms [SONAOP_PMSAMS_FM1..FM6]
; Handles the stream event for changing PMS/AMS settings for a FM channel.
;----------------------------------------------------------------------------
; input b ..... channel ID (bits 2-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'
;****************************************************************************

SetPmsAms:
    ld      a, PMSAMS_MASK^$FF          ; PMS/AMS opcode doesn't overwrite
                                        ; the panning bits so set up the mask
                                        ; to exclude those
    
    jr      SetPanCommon                ; Jump to the panning code. Since
                                        ; both are in the same register and
                                        ; don't need much processing they
                                        ; share most of the code (differing
                                        ; only in the mask)
                                        ;
                                        ; This jump assumes that SetPanCommon
                                        ; is close enough that a short jump
                                        ; will work, beware of file include
                                        ; order in buildme.z80!