From b44b7ff81a07f35311af3c27a25b98d14ff53c30 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 4 Jul 2025 14:39:22 +0600 Subject: [PATCH] Backport https://github.com/aaronsgiles/ymfm/pull/67 --- src/sound/ymfm/ymfm_opn.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sound/ymfm/ymfm_opn.cpp b/src/sound/ymfm/ymfm_opn.cpp index 16ca3416c..60469e1c0 100644 --- a/src/sound/ymfm/ymfm_opn.cpp +++ b/src/sound/ymfm/ymfm_opn.cpp @@ -155,14 +155,13 @@ bool opn_registers_base::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; }