diff --git a/src/mame/atari/stkbd.cpp b/src/mame/atari/stkbd.cpp index 84dc8a1beed..25ece09815b 100644 --- a/src/mame/atari/stkbd.cpp +++ b/src/mame/atari/stkbd.cpp @@ -49,6 +49,7 @@ st_kbd_device::st_kbd_device(const machine_config &mconfig, const char *tag, dev m_joy(*this, "JOY%u", 0U), m_mousex(*this, "MOUSEX"), m_mousey(*this, "MOUSEY"), + m_mouseb(*this, "MOUSEB"), m_config(*this, "config"), m_keylatch(0), m_mouse(0), @@ -147,11 +148,18 @@ uint8_t st_kbd_device::port2_r() { // bit description // 0 JOY 1-5 - // 1 JOY 0-6 - // 2 JOY 1-6 + // 1 JOY 0-6 / mouse button 1 + // 2 JOY 1-6 / mouse button 2 // 3 serial from cpu - return (m_joy[1]->read() & 0x06) | (m_tx << 3); + uint8_t data; + + if ((m_config->read() & 0x01) == 0) + data = m_mouseb->read(); + else + data = m_joy[0]->read(); + + return (data & 0x06) | (m_tx << 3); } void st_kbd_device::port2_w(uint8_t data) @@ -358,6 +366,10 @@ static INPUT_PORTS_START(stkbd) PORT_START("MOUSEY") PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1) + + PORT_START("MOUSEB") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2) INPUT_PORTS_END ioport_constructor st_kbd_device::device_input_ports() const diff --git a/src/mame/atari/stkbd.h b/src/mame/atari/stkbd.h index 052a47f0860..6a3c59c4c07 100644 --- a/src/mame/atari/stkbd.h +++ b/src/mame/atari/stkbd.h @@ -42,6 +42,7 @@ private: required_ioport_array<2> m_joy; required_ioport m_mousex; required_ioport m_mousey; + required_ioport m_mouseb; required_ioport m_config; uint16_t m_keylatch;