Fix incorrect masking of register writes on ay-3-8914, fixes wrong envelope amplitude on games which use hardware enveloping on Intellivision (Thunder Castle, etc) [Huygens]
This commit is contained in:
parent
e7b2968892
commit
c9eae4329c
@ -142,7 +142,7 @@ has twice the steps, happening twice as fast.
|
|||||||
#define TONE_PERIOD(_psg, _chan) ( (_psg)->regs[(_chan) << 1] | (((_psg)->regs[((_chan) << 1) | 1] & 0x0f) << 8) )
|
#define TONE_PERIOD(_psg, _chan) ( (_psg)->regs[(_chan) << 1] | (((_psg)->regs[((_chan) << 1) | 1] & 0x0f) << 8) )
|
||||||
#define NOISE_PERIOD(_psg) ( (_psg)->regs[AY_NOISEPER] & 0x1f)
|
#define NOISE_PERIOD(_psg) ( (_psg)->regs[AY_NOISEPER] & 0x1f)
|
||||||
#define TONE_VOLUME(_psg, _chan) ( (_psg)->regs[AY_AVOL + (_chan)] & 0x0f)
|
#define TONE_VOLUME(_psg, _chan) ( (_psg)->regs[AY_AVOL + (_chan)] & 0x0f)
|
||||||
#define TONE_ENVELOPE(_psg, _chan) (((_psg)->regs[AY_AVOL + (_chan)] >> 4) & (_psg)->env_enabled_mask)
|
#define TONE_ENVELOPE(_psg, _chan) (((_psg)->regs[AY_AVOL + (_chan)] >> 4) & (((_psg)->device->type() == AY8914) ? 3 : 1))
|
||||||
#define ENVELOPE_PERIOD(_psg) (((_psg)->regs[AY_EFINE] | ((_psg)->regs[AY_ECOARSE]<<8)))
|
#define ENVELOPE_PERIOD(_psg) (((_psg)->regs[AY_EFINE] | ((_psg)->regs[AY_ECOARSE]<<8)))
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
@ -184,7 +184,6 @@ struct _ay8910_context
|
|||||||
/* init parameters ... */
|
/* init parameters ... */
|
||||||
int step;
|
int step;
|
||||||
int zero_is_off;
|
int zero_is_off;
|
||||||
int env_enabled_mask;
|
|
||||||
UINT8 vol_enabled[NUM_CHANNELS];
|
UINT8 vol_enabled[NUM_CHANNELS];
|
||||||
const ay_ym_param *par;
|
const ay_ym_param *par;
|
||||||
const ay_ym_param *par_env;
|
const ay_ym_param *par_env;
|
||||||
@ -438,7 +437,7 @@ INLINE UINT16 mix_3D(ay8910_context *psg)
|
|||||||
int indx = 0, chan;
|
int indx = 0, chan;
|
||||||
|
|
||||||
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
||||||
if (TONE_ENVELOPE(psg, chan))
|
if (TONE_ENVELOPE(psg, chan) != 0)
|
||||||
{
|
{
|
||||||
if (psg->device->type() == AY8914) // AY8914 Has a two bit tone_envelope field
|
if (psg->device->type() == AY8914) // AY8914 Has a two bit tone_envelope field
|
||||||
{
|
{
|
||||||
@ -665,7 +664,7 @@ static STREAM_UPDATE( ay8910_update )
|
|||||||
if (psg->streams == 3)
|
if (psg->streams == 3)
|
||||||
{
|
{
|
||||||
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
for (chan = 0; chan < NUM_CHANNELS; chan++)
|
||||||
if (TONE_ENVELOPE(psg,chan))
|
if (TONE_ENVELOPE(psg,chan) != 0)
|
||||||
{
|
{
|
||||||
if (psg->device->type() == AY8914) // AY8914 Has a two bit tone_envelope field
|
if (psg->device->type() == AY8914) // AY8914 Has a two bit tone_envelope field
|
||||||
{
|
{
|
||||||
@ -770,7 +769,6 @@ void *ay8910_start_ym(void *infoptr, device_type chip_type, device_t *device, in
|
|||||||
else
|
else
|
||||||
info->streams = 3;
|
info->streams = 3;
|
||||||
|
|
||||||
info->env_enabled_mask = (chip_type == AY8914) ? 3 : 1; // AY8914 Has a two bit tone_envelope field
|
|
||||||
|
|
||||||
if (chip_type == AY8910 || chip_type == AY8914 || chip_type == AY8930)
|
if (chip_type == AY8910 || chip_type == AY8914 || chip_type == AY8930)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user