thayers: Fixed keyboard scanning. [Curt Coder]

This commit is contained in:
Curt Coder 2017-01-26 10:34:53 +02:00
parent 2e5d1c6cb3
commit 99b8b9cda1

View File

@ -321,7 +321,9 @@ WRITE_LINE_MEMBER(thayers_state::kbclk_w)
if (!m_kbclk && state) { if (!m_kbclk && state) {
m_rx_bit++; m_rx_bit++;
if (m_rx_bit == 10) { switch (m_rx_bit)
{
case 10:
m_rx_bit = 0; m_rx_bit = 0;
m_keylatch++; m_keylatch++;
@ -331,18 +333,20 @@ WRITE_LINE_MEMBER(thayers_state::kbclk_w)
} }
if (LOG) logerror("keylatch %u\n",m_keylatch); if (LOG) logerror("keylatch %u\n",m_keylatch);
} break;
if (LOG) logerror("rx bit %u\n",m_rx_bit); case 9:
// 1, 0, 1, Q9, P3, P2, P1, P0, 0, 1
m_keydata = 0xa0 | (m_keylatch == 9) << 4 | m_row[m_keylatch]->read();
if (BIT(m_rx_bit, 3)) {
// 1, 0, 1, Q9, P3, P2, P1, P0, 1, 1
bool q9 = (m_keylatch == 9);
m_keydata = 0xa0 | q9 << 4 | m_row[m_keylatch]->read();
if (LOG) logerror("keydata %02x keylatch %u\n",m_keydata,m_keylatch); if (LOG) logerror("keydata %02x keylatch %u\n",m_keydata,m_keylatch);
} else if (m_rx_bit) { break;
default:
m_keydata <<= 1; m_keydata <<= 1;
if (LOG) logerror("keydata %02x shift\n",m_keydata); if (LOG) logerror("keydata %02x shift\n",m_keydata);
break;
} }
} }