Merge pull request #5746 from Cacodemon345/ymfm-backports

Backports from YMFM pull requests/MAME
This commit is contained in:
Miran Grča
2025-07-04 11:12:27 +02:00
committed by GitHub
2 changed files with 6 additions and 7 deletions

View File

@@ -52,7 +52,7 @@ namespace ymfm
//
// System-wide registers:
// 01 xxxxxxxx Test register
// --x----- Enable OPL compatibility mode [OPL2 only] (1 = enable)
// --x----- Enable OPL compatibility mode [OPL2 only] (0 = enable)
// 02 xxxxxxxx Timer A value (4 * OPN)
// 03 xxxxxxxx Timer B value
// 04 x------- RST
@@ -243,7 +243,7 @@ public:
uint32_t op_decay_rate(uint32_t opoffs) const { return byte(0x60, 0, 4, opoffs); }
uint32_t op_sustain_level(uint32_t opoffs) const { return byte(0x80, 4, 4, opoffs); }
uint32_t op_release_rate(uint32_t opoffs) const { return byte(0x80, 0, 4, opoffs); }
uint32_t op_waveform(uint32_t opoffs) const { return IsOpl2Plus ? byte(0xe0, 0, newflag() ? 3 : 2, opoffs) : 0; }
uint32_t op_waveform(uint32_t opoffs) const { return waveform_enable() ? byte(0xe0, 0, newflag() ? 3 : 2, opoffs) : 0; }
protected:
// return a bitfield extracted from a byte

View File

@@ -155,14 +155,13 @@ bool opn_registers_base<IsOpnA>::write(uint16_t index, uint8_t data, uint32_t &c
// writes to the upper half just latch (only low 6 bits matter)
if (bitfield(index, 2))
m_regdata[latchindex] = data | 0x80;
m_regdata[latchindex] = data & 0x3f;
// writes to the lower half only commit if the latch is there
else if (bitfield(m_regdata[latchindex], 7))
// writes to the lower half also apply said latch
else
{
m_regdata[index] = data;
m_regdata[index | 4] = m_regdata[latchindex] & 0x3f;
m_regdata[latchindex] = 0;
m_regdata[index | 4] = m_regdata[latchindex];
}
return false;
}