NUM_STREAMS: equ 16 ; Number of streams supported by Sona
FIRST_SFXSTREAM: equ 13 ; ID of first SFX stream
NUM_BGMSTREAMS: equ FIRST_SFXSTREAM ; How many BGM streams?
NUM_SFXSTREAMS: equ NUM_STREAMS-FIRST_SFXSTREAM ; How many SFX streams?
PCM_BUFSIZE: equ 32 ; PCM buffer size (in samples)
SIZEOF_FMINSTR: equ 29 ; Size of a FM instrument
TIMERA_DEFAULT: equ $400-5 ; Default timer A frequency (~10650Hz)
TIMERB_DEFAULT: equ $100-28 ; Default timer B frequency (~120Hz)
BGMTEMPO_DEFAULT: equ $80 ; Default tempo for BGMs ($100 = 120Hz)
SFXTEMPO_DEFAULT: equ 2 ; Default tempo for SFXs (in 1/120")
;****************************************************************************
; Hardware port addresses
;****************************************************************************
YmAddr1: equ $4000 ; YM2612 address port (bank 0)
YmData1: equ $4001 ; YM2612 data port (bank 0)
YmAddr2: equ $4002 ; YM2612 address port (bank 1)
YmData2: equ $4003 ; YM2612 data port (bank 1)
PsgPort: equ $7F11 ; PSG port
BankPort: equ $6001 ; Bank switching port
; It can be any of $60xx, we choose
; this value so when loaded into hl
; the LSB of h will be 0 and the LSB
; of l will be 1
VdpData: equ $7F00 ; VDP data port
VdpDataHi: equ VdpData+0 ; High byte
VdpDataLo: equ VdpData+1 ; Low byte
VdpCtrl: equ $7F04 ; VDP control port
VdpCtrlHi: equ VdpCtrl+0 ; High byte
VdpCtrlLo: equ VdpCtrl+1 ; Low byte
HvCounter: equ $7F08 ; VDP H/V counter
VCounter: equ HvCounter+0 ; V counter
HCounter: equ HvCounter+1 ; H counter
;****************************************************************************
; Global YM2612 registers
; They're all in bank 0 and they affect everything.
;****************************************************************************
YMREG_LFO: equ $22 ; LFO setting
YMREG_TIMERA_HI: equ $24 ; Timer A frequency (bits 9-2)
YMREG_TIMERA_LO: equ $25 ; Timer A frequency (bits 1-0)
YMREG_TIMERB: equ $26 ; Timer B frequency
YMREG_MODE: equ $27 ; Timer ack. and ch3 special mode
YMREG_KEY: equ $28 ; Key-on/off
YMREG_DAC: equ $2A ; PCM data to output
YMREG_DACON: equ $2B ; Toggles DAC output
;****************************************************************************
; Per-operator YM2612 registers
;
; These registers are repeated per operator. Operators for channels 1-3 are
; in bank 0, operators for channels 4-6 are in bank 1. These constants are
; the base number, to get the actual register number you need to add:
;
; +$00 for channel 1/4 +$00 for S1 Yes, S2 and S3 are swapped...
; +$01 for channel 2/5 +$08 for S2 Blame Yamaha for that one :|
; +$02 for channel 3/6 +$04 for S3
; +$0C for S4
;****************************************************************************
YMREG_MULDT: equ $30 ; Multiplier and detune
YMREG_TL: equ $40 ; Total level
YMREG_AR: equ $50 ; Attack rate and rate scaling
YMREG_DR: equ $60 ; Decay rate and AM enable
YMREG_SR: equ $70 ; Sustain rate
YMREG_RR: equ $80 ; Release rate and sustain level
YMREG_SSGEG: equ $90 ; SSG-EG
;****************************************************************************
; Per-channel YM2612 registers.
;
; These registers are repeated per channel. Channels 1-3 are in bank 0,
; channels 4-6 are in bank 1. These constants are the base number, to get
; the actual register number you need to add:
;
; +$00 for channel 1/4
; +$01 for channel 2/5
; +$02 for channel 3/6
;****************************************************************************
YMREG_FREQ_HI: equ $A4 ; Frequency (high byte)
YMREG_FREQ_LO: equ $A0 ; Frequency (low byte)
YMREG_ALGO: equ $B0 ; Algorithm and feedback
YMREG_PAN: equ $B4 ; Panning, FMS and AMS
;****************************************************************************
; Registers to set the ch3 frequency in ch3 special mode
; Yes, the operator order is even more absurd than with the other registers
;****************************************************************************
YMREG_SPFREQ_S1HI: equ $AD ; ch3 special S1 frequency (high)
YMREG_SPFREQ_S2HI: equ $AE ; ch3 special S2 frequency (high)
YMREG_SPFREQ_S3HI: equ $AC ; ch3 special S3 frequency (high)
YMREG_SPFREQ_S4HI: equ $A6 ; ch3 special S4 frequency (high)
YMREG_SPFREQ_S1LO: equ $A9 ; ch3 special S1 frequency (low)
YMREG_SPFREQ_S2LO: equ $AA ; ch3 special S2 frequency (low)
YMREG_SPFREQ_S3LO: equ $A8 ; ch3 special S3 frequency (low)
YMREG_SPFREQ_S4LO: equ $A2 ; ch3 special S4 frequency (low)
;****************************************************************************
; The following values may be written to YMREG_MODE.
; You can OR one from each group.
;****************************************************************************
YMACK_NONE: equ $0F ; No timer acknowledge
YMACK_TIMERA: equ $1F ; Acknowledge timer A
YMACK_TIMERB: equ $2F ; Acknowledge timer B
YMACK_TIMERAB: equ $3F ; Acknowledge both timers
YMCH3_NORMAL: equ $00 ; Normal ch3 mode
YMCH3_SPECIAL: equ $40 ; Special ch3 mode
;****************************************************************************
; 68000 commands (must match SONA_CMD_* in the API)
;****************************************************************************
CMD_PLAYPCM1: equ 1 ; Directly play over PCM ch1
CMD_PLAYPCM2: equ 2 ; Directly play over PCM ch2
CMD_STOPPCM1: equ 3 ; Directly stop PCM ch1
CMD_STOPPCM2: equ 4 ; Directly stop PCM ch2
CMD_PLAYBGM: equ 5 ; Play BGM
CMD_PLAYSFX: equ 6 ; Play SFX
CMD_STOPALL: equ 7 ; Stop all sound
CMD_PAUSE: equ 8 ; Pause playback
CMD_UNPAUSE: equ 9 ; Resume playback
CMD_SETSTEREO: equ 10 ; Set stereo/mono
CMD_SETSSGEG: equ 11 ; Toggle SSG-EG
;****************************************************************************
; Possible pan values for YMREG_PAN and SONAOP_PAN_FM*
;****************************************************************************
PAN_NONE: equ $00 ; Muted
PAN_LEFT: equ $80 ; Left speaker
PAN_RIGHT: equ $40 ; Right speaker
PAN_BOTH: equ $C0 ; Both speakers
PAN_MASK: equ $C0 ; Pan bits in YMREG_PAN
PMS_MASK: equ $07 ; PMS bits in YMREG_PAN
AMS_MASK: equ $30 ; AMS bits in YMREG_PAN
PMSAMS_MASK: equ PMS_MASK|AMS_MASK