uPD1990AC: Only latch CSx bits when STB is high. [R. Belmont]

This commit is contained in:
R. Belmont 2012-04-11 03:40:16 +00:00
parent 3bdeec4ad3
commit 4468e3e7cc
2 changed files with 10 additions and 3 deletions

View File

@ -193,6 +193,7 @@ void upd1990a_device::device_start()
save_item(NAME(m_c)); save_item(NAME(m_c));
save_item(NAME(m_clk)); save_item(NAME(m_clk));
save_item(NAME(m_tp)); 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) if (m_cs && m_stb && !m_clk)
{ {
m_c = m_c_unlatched; // if STB = 1, latch in the command bits
switch (m_c) switch (m_c)
{ {
case MODE_REGISTER_HOLD: case MODE_REGISTER_HOLD:
@ -426,8 +429,10 @@ WRITE_LINE_MEMBER( upd1990a_device::clk_w )
if (!m_clk && state) // rising edge if (!m_clk && state) // rising edge
{ {
logerror("Rising edge\n");
if (m_c == MODE_SHIFT) if (m_c == MODE_SHIFT)
{ {
logerror("MODE_SHIFT\n");
m_shift_reg[0] >>= 1; m_shift_reg[0] >>= 1;
m_shift_reg[0] |= (BIT(m_shift_reg[1], 0) << 7); 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) if (m_oe)
{ {
logerror("OE\n");
m_data_out = BIT(m_shift_reg[0], 0); m_data_out = BIT(m_shift_reg[0], 0);
if (LOG) logerror("uPD1990A '%s' DATA OUT %u\n", tag(), m_data_out); 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); 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); 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); 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);
} }

View File

@ -115,6 +115,7 @@ private:
int m_c; // command int m_c; // command
int m_clk; // shift clock int m_clk; // shift clock
int m_tp; // time pulse int m_tp; // time pulse
int m_c_unlatched; // command waiting for STB
// timers // timers
emu_timer *m_timer_clock; emu_timer *m_timer_clock;