Sona 0.50 Source

Sona 0.50/src-z80/fm_ssgeg.z80

;****************************************************************************
; SetSsgEgModeCmd [CMD_SETSSGEG]
;
; Toggles whether SSG-EG data is written to the YM2612 or not, in case you
; want to support systems/emulators where it's broken.
;----------------------------------------------------------------------------
; input CmdArg1 ... 0 to disable SSG-EG, otherwise to enable it
;----------------------------------------------------------------------------
; continues in EndOfCommand
;****************************************************************************

SetSsgEgModeCmd:
    ld      a, (CmdArg1)                ; Check how many bytes we have to
    or      a                           ; write to the YM2612 (whether to
    jr      z, DisableSsgEg             ; skip SSG-EG registers or not) and
    ld      a, 4                        ; adjust the FM instrument loading
DisableSsgEg:                           ; code accordingly.
    add     a, SIZEOF_FMINSTR-5         ;
    ld      (LoadFmInstr_LoadCount), a  ; Note that the loop doesn't include
                                        ; algorithm/feedback, hence why it's
                                        ; -5 instead of -4
    
    jp      EndOfCommand                ; End of subroutine