summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/apricot/keyboard/hle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/apricot/keyboard/hle.cpp')
-rw-r--r--src/devices/bus/apricot/keyboard/hle.cpp85
1 files changed, 5 insertions, 80 deletions
diff --git a/src/devices/bus/apricot/keyboard/hle.cpp b/src/devices/bus/apricot/keyboard/hle.cpp
index 28e98b9fb50..c8df35cd0cb 100644
--- a/src/devices/bus/apricot/keyboard/hle.cpp
+++ b/src/devices/bus/apricot/keyboard/hle.cpp
@@ -6,6 +6,7 @@
TODO:
- MicroScreen emulation
+ - Mouse emulation
- LEDs
Keyboard to System:
@@ -187,17 +188,6 @@ static INPUT_PORTS_START( keyboard )
PORT_START("row_c")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
-
- PORT_START("mouse_b")
- PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Right Button")
- PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button")
- PORT_BIT(0x0c, IP_ACTIVE_HIGH, IPT_UNUSED)
-
- PORT_START("mouse_x")
- PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(75) PORT_KEYDELTA(5)
-
- PORT_START("mouse_y")
- PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(5)
INPUT_PORTS_END
ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
@@ -205,12 +195,9 @@ ioport_constructor apricot_keyboard_hle_device::device_input_ports() const
return INPUT_PORTS_NAME( keyboard );
}
-void apricot_keyboard_hle_device::device_add_mconfig(machine_config &config)
-{
- MSM5832(config, m_rtc, 32.768_kHz_XTAL);
-
- TIMER(config, "timer").configure_periodic(FUNC(apricot_keyboard_hle_device::mouse_callback), attotime::from_hz(60));
-}
+MACHINE_CONFIG_START(apricot_keyboard_hle_device::device_add_mconfig)
+ MCFG_DEVICE_ADD("rtc", MSM5832, 32.768_kHz_XTAL)
+MACHINE_CONFIG_END
//**************************************************************************
@@ -227,12 +214,7 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
device_buffered_serial_interface(mconfig, *this),
device_matrix_keyboard_interface(mconfig, *this, "row_0", "row_1", "row_2", "row_3", "row_4", "row_5", "row_6", "row_7", "row_8", "row_9", "row_a", "row_b", "row_c"),
m_rtc(*this, "rtc"),
- m_mouse_b(*this, "mouse_b"),
- m_mouse_x(*this, "mouse_x"),
- m_mouse_y(*this, "mouse_y"),
- m_rtc_index(0),
- m_mouse_enabled(false),
- m_mouse_last_b(0), m_mouse_last_x(0), m_mouse_last_y(0)
+ m_rtc_index(0)
{
}
@@ -242,12 +224,6 @@ apricot_keyboard_hle_device::apricot_keyboard_hle_device(const machine_config &m
void apricot_keyboard_hle_device::device_start()
{
- // register for save states
- save_item(NAME(m_rtc_index));
- save_item(NAME(m_mouse_enabled));
- save_item(NAME(m_mouse_last_b));
- save_item(NAME(m_mouse_last_x));
- save_item(NAME(m_mouse_last_y));
}
//-------------------------------------------------
@@ -332,16 +308,6 @@ void apricot_keyboard_hle_device::received_byte(uint8_t byte)
break;
- case CMD_ENABLE_MOUSE:
- logerror("System enables mouse\n");
- m_mouse_enabled = true;
- break;
-
- case CMD_DISABLE_MOUSE:
- logerror("System disables mouse\n");
- m_mouse_enabled = false;
- break;
-
case CMD_KEYBOARD_RESET:
logerror("System requests keyboard reset\n");
transmit_byte(ACK_DIAGNOSTICS);
@@ -381,44 +347,3 @@ void apricot_keyboard_hle_device::out_w(int state)
{
device_buffered_serial_interface::rx_w(state);
}
-
-//-------------------------------------------------
-// mouse_callback - check for new mouse events
-//-------------------------------------------------
-
-TIMER_DEVICE_CALLBACK_MEMBER( apricot_keyboard_hle_device::mouse_callback )
-{
- if (m_mouse_enabled)
- {
- // get mouse state
- uint8_t buttons = m_mouse_b->read();
- uint8_t x = m_mouse_x->read();
- uint8_t y = m_mouse_y->read();
-
- // anything changed since last time?
- if (buttons != m_mouse_last_b || x != m_mouse_last_x || y != m_mouse_last_y)
- {
- // mouse header
- transmit_byte(0xef);
-
- // button state
- transmit_byte(0x70 | buttons);
-
- int8_t dx = x - m_mouse_last_x;
- int8_t dy = y - m_mouse_last_y;
-
- // y direction change
- transmit_byte(0x70 | ((dy >> 4) & 0x0f));
- transmit_byte(0x70 | ((dy >> 0) & 0x0f));
-
- // x direction change
- transmit_byte(0x70 | ((dx >> 4) & 0x0f));
- transmit_byte(0x70 | ((dx >> 0) & 0x0f));
-
- // save mouse state for next run
- m_mouse_last_b = buttons;
- m_mouse_last_x = x;
- m_mouse_last_y = y;
- }
- }
-}