From 4468e3e7ccb771d15f7cb9f86b6dc622a3a47f9d Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Wed, 11 Apr 2012 03:40:16 +0000 Subject: [PATCH] uPD1990AC: Only latch CSx bits when STB is high. [R. Belmont] --- src/emu/machine/upd1990a.c | 12 +++++++++--- src/emu/machine/upd1990a.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/emu/machine/upd1990a.c b/src/emu/machine/upd1990a.c index 51b60011107..30d3e13ae2f 100644 --- a/src/emu/machine/upd1990a.c +++ b/src/emu/machine/upd1990a.c @@ -193,6 +193,7 @@ void upd1990a_device::device_start() save_item(NAME(m_c)); save_item(NAME(m_clk)); save_item(NAME(m_tp)); + save_item(NAME(m_c_unlatched)); } @@ -298,6 +299,8 @@ WRITE_LINE_MEMBER( upd1990a_device::stb_w ) if (m_cs && m_stb && !m_clk) { + m_c = m_c_unlatched; // if STB = 1, latch in the command bits + switch (m_c) { case MODE_REGISTER_HOLD: @@ -426,8 +429,10 @@ WRITE_LINE_MEMBER( upd1990a_device::clk_w ) if (!m_clk && state) // rising edge { + logerror("Rising edge\n"); if (m_c == MODE_SHIFT) { + logerror("MODE_SHIFT\n"); m_shift_reg[0] >>= 1; m_shift_reg[0] |= (BIT(m_shift_reg[1], 0) << 7); @@ -445,6 +450,7 @@ WRITE_LINE_MEMBER( upd1990a_device::clk_w ) if (m_oe) { + logerror("OE\n"); m_data_out = BIT(m_shift_reg[0], 0); if (LOG) logerror("uPD1990A '%s' DATA OUT %u\n", tag(), m_data_out); @@ -466,7 +472,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c0_w ) { if (LOG) logerror("uPD1990A '%s' C0 %u\n", tag(), state); - m_c = (m_c & 0x06) | state; + m_c_unlatched = (m_c_unlatched & 0x06) | state; } @@ -478,7 +484,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c1_w ) { if (LOG) logerror("uPD1990A '%s' C1 %u\n", tag(), state); - m_c = (m_c & 0x05) | (state << 1); + m_c_unlatched = (m_c_unlatched & 0x05) | (state << 1); } @@ -490,7 +496,7 @@ WRITE_LINE_MEMBER( upd1990a_device::c2_w ) { if (LOG) logerror("uPD1990A '%s' C2 %u\n", tag(), state); - m_c = (m_c & 0x03) | (state << 2); + m_c_unlatched = (m_c_unlatched & 0x03) | (state << 2); } diff --git a/src/emu/machine/upd1990a.h b/src/emu/machine/upd1990a.h index 2a6654424bc..c596fbed98b 100644 --- a/src/emu/machine/upd1990a.h +++ b/src/emu/machine/upd1990a.h @@ -115,6 +115,7 @@ private: int m_c; // command int m_clk; // shift clock int m_tp; // time pulse + int m_c_unlatched; // command waiting for STB // timers emu_timer *m_timer_clock;