From a9f751387c483032fac3b3708d81ffc6be461b6e Mon Sep 17 00:00:00 2001 From: Ryan Holtz Date: Mon, 11 Feb 2019 07:46:45 +0100 Subject: [PATCH] -8042kbdc: Added timer to periodically check mouse. Fixes mouse in IRIX. [Ryan Holtz] --- src/devices/machine/8042kbdc.cpp | 14 +++++++++++++- src/devices/machine/8042kbdc.h | 5 +++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/devices/machine/8042kbdc.cpp b/src/devices/machine/8042kbdc.cpp index 602435369ab..5a7815f3ccd 100644 --- a/src/devices/machine/8042kbdc.cpp +++ b/src/devices/machine/8042kbdc.cpp @@ -69,6 +69,9 @@ void kbdc8042_device::device_start() m_sending = 0; m_last_write_to_control = 0; m_status_read_mode = 0; + + m_update_timer = timer_alloc(TIMER_UPDATE); + m_update_timer->adjust(attotime::never); } /*------------------------------------------------- @@ -86,6 +89,8 @@ void kbdc8042_device::device_reset() m_mouse_x = 0; m_mouse_y = 0; m_mouse_btn = 0; + + m_update_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); } void kbdc8042_device::at_8042_set_outport(uint8_t data, int initial) @@ -195,7 +200,14 @@ void kbdc8042_device::at_8042_clear_keyboard_received() m_mouse.received = 0; } - +void kbdc8042_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + if (id == TIMER_UPDATE) + { + at_8042_check_keyboard(); + at_8042_check_mouse(); + } +} /* ************************************************************************** * Port 0x60 Input and Output Buffer (keyboard and mouse data) diff --git a/src/devices/machine/8042kbdc.h b/src/devices/machine/8042kbdc.h index f2e7fdfbf04..41ea07e71ba 100644 --- a/src/devices/machine/8042kbdc.h +++ b/src/devices/machine/8042kbdc.h @@ -58,8 +58,11 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual ioport_constructor device_input_ports() const override; + static const device_timer_id TIMER_UPDATE = 0; + private: uint8_t m_inport; uint8_t m_outport; @@ -112,6 +115,8 @@ private: uint16_t m_mouse_y; uint8_t m_mouse_btn; + emu_timer * m_update_timer; + DECLARE_WRITE_LINE_MEMBER( keyboard_w ); };