From e2fef83146ac76c0bc4ea29571cb091d117052df Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sat, 6 Jul 2013 20:39:31 +0000 Subject: [PATCH] (MESS) Fixed PC/XT keyboard interface. (nw) --- src/mess/machine/genpc.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/src/mess/machine/genpc.c b/src/mess/machine/genpc.c index cab98efc357..b0d9debb9cd 100644 --- a/src/mess/machine/genpc.c +++ b/src/mess/machine/genpc.c @@ -296,29 +296,15 @@ const struct pit8253_interface pc_pit8253_config = **********************************************************/ WRITE_LINE_MEMBER( ibm5160_mb_device::keyboard_clock_w ) { - if ( m_ppi_clock_signal != state ) + if (!m_ppi_keyboard_clear && !state && !m_ppi_shift_enable) { - if ( m_ppi_keyb_clock && m_ppi_shift_enable ) - { - m_ppi_clock_signal = state; - if ( ! m_ppi_keyboard_clear ) - { - /* Data is clocked in on a high->low transition */ - if ( ! state ) - { - UINT8 trigger_irq = m_ppi_shift_register & 0x01; + m_ppi_shift_enable = m_ppi_shift_register & 0x01; - m_ppi_shift_register = ( m_ppi_shift_register >> 1 ) | ( m_ppi_data_signal << 7 ); - if ( trigger_irq ) - { - m_pic8259->ir1_w(1); - m_ppi_shift_enable = 0; - m_ppi_clock_signal = 0; - m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); - } - } - } - } + m_ppi_shift_register >>= 1; + m_ppi_shift_register |= m_ppi_data_signal << 7; + + m_pic8259->ir1_w(m_ppi_shift_enable); + m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); } } @@ -395,16 +381,17 @@ WRITE8_MEMBER( ibm5160_mb_device::pc_ppi_portb_w ) m_pit8253->gate2_w(BIT(data, 0)); pc_speaker_set_spkrdata( data & 0x02 ); - m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; - m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); - /* If PB7 is set clear the shift register and reset the IRQ line */ if ( m_ppi_keyboard_clear ) { - m_pic8259->ir1_w(0); m_ppi_shift_register = 0; - m_ppi_shift_enable = 1; + m_ppi_shift_enable = 0; + m_pic8259->ir1_w(m_ppi_shift_enable); } + + m_pc_kbdc->data_write_from_mb(!BIT(m_ppi_portb, 2) && !m_ppi_shift_enable); + m_ppi_clock_signal = ( m_ppi_keyb_clock ) ? 1 : 0; + m_pc_kbdc->clock_write_from_mb(m_ppi_clock_signal); }