diff --git a/src/mame/drivers/interpro.cpp b/src/mame/drivers/interpro.cpp index dedac2cf14d..e334103260b 100644 --- a/src/mame/drivers/interpro.cpp +++ b/src/mame/drivers/interpro.cpp @@ -594,6 +594,11 @@ MACHINE_CONFIG_START(interpro_state::interpro) // i/o gate array + // mouse + MCFG_DEVICE_ADD(INTERPRO_MOUSE_PORT_TAG, INTERPRO_MOUSE_PORT, 0) + MCFG_DEVICE_SLOT_INTERFACE(interpro_mouse_devices, "interpro_mouse", false) + MCFG_MOUSE_STATE_CB(WRITE32(INTERPRO_IOGA_TAG, interpro_ioga_device, mouse_status_w)) + // sr bus and slots MCFG_DEVICE_ADD(INTERPRO_SRBUS_TAG, SR, 0) MCFG_SR_OUT_IRQ0_CB(WRITELINE(INTERPRO_IOGA_TAG, interpro_ioga_device, ir6_w)) @@ -853,8 +858,8 @@ ROM_START(ip2800) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1990, ip2000, 0, 0, ip2000, interpro, turquoise_state,empty_init, "Intergraph", "InterPro 2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1992, ip2400, 0, 0, ip2400, interpro, sapphire_state, empty_init, "Intergraph", "InterPro 2400", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1993, ip2500, 0, 0, ip2500, interpro, sapphire_state, empty_init, "Intergraph", "InterPro 2500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1993, ip2700, 0, 0, ip2700, interpro, sapphire_state, empty_init, "Intergraph", "InterPro 2700", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) -COMP( 1994, ip2800, 0, 0, ip2800, interpro, sapphire_state, empty_init, "Intergraph", "InterPro 2800", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1990, ip2000, 0, 0, ip2000, interpro, turquoise_state,init_common,"Intergraph", "InterPro 2000", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1992, ip2400, 0, 0, ip2400, interpro, sapphire_state, init_common,"Intergraph", "InterPro 2400", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1993, ip2500, 0, 0, ip2500, interpro, sapphire_state, init_common,"Intergraph", "InterPro 2500", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1993, ip2700, 0, 0, ip2700, interpro, sapphire_state, init_common,"Intergraph", "InterPro 2700", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) +COMP( 1994, ip2800, 0, 0, ip2800, interpro, sapphire_state, init_common,"Intergraph", "InterPro 2800", MACHINE_NOT_WORKING | MACHINE_NO_SOUND) diff --git a/src/mame/includes/interpro.h b/src/mame/includes/interpro.h index 50e900124c8..9cf7e20f494 100644 --- a/src/mame/includes/interpro.h +++ b/src/mame/includes/interpro.h @@ -31,6 +31,7 @@ #include "bus/interpro/sr/sr.h" #include "bus/interpro/sr/sr_cards.h" #include "bus/interpro/keyboard/keyboard.h" +#include "bus/interpro/mouse/mouse.h" #include "formats/pc_dsk.h" #include "softlist.h" @@ -47,6 +48,7 @@ #define INTERPRO_SERIAL_PORT1_TAG "serial1" #define INTERPRO_SERIAL_PORT2_TAG "serial2" #define INTERPRO_KEYBOARD_PORT_TAG "kbd" +#define INTERPRO_MOUSE_PORT_TAG "mse" #define INTERPRO_RTC_TAG "rtc" #define INTERPRO_SCSI_TAG "scsi" #define INTERPRO_SCSI_ADAPTER_TAG "host" diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp index 25af9add1c1..ff07e71c64b 100644 --- a/src/mame/machine/interpro_ioga.cpp +++ b/src/mame/machine/interpro_ioga.cpp @@ -152,18 +152,6 @@ void sapphire_ioga_device::map(address_map &map) map(0x08, 0x0b).rw(this, FUNC(sapphire_ioga_device::eth_control_r), FUNC(sapphire_ioga_device::eth_control_w)); } -static INPUT_PORTS_START(interpro_mouse) - PORT_START("mouse_buttons") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1) PORT_CHANGED_MEMBER(DEVICE_SELF, interpro_ioga_device, mouse_button, nullptr) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3) PORT_CHANGED_MEMBER(DEVICE_SELF, interpro_ioga_device, mouse_button, nullptr) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2) PORT_CHANGED_MEMBER(DEVICE_SELF, interpro_ioga_device, mouse_button, nullptr) - - PORT_START("mouse_x") - PORT_BIT(0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, interpro_ioga_device, mouse_x, nullptr) - PORT_START("mouse_y") - PORT_BIT(0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_PLAYER(1) PORT_CHANGED_MEMBER(DEVICE_SELF, interpro_ioga_device, mouse_y, nullptr) -INPUT_PORTS_END - DEFINE_DEVICE_TYPE(TURQUOISE_IOGA, turquoise_ioga_device, "ioga_t", "I/O Gate Array (Turquoise)") DEFINE_DEVICE_TYPE(SAPPHIRE_IOGA, sapphire_ioga_device, "ioga_s", "I/O Gate Array (Sapphire)") @@ -284,11 +272,6 @@ void interpro_ioga_device::device_reset() m_prescaler = 0; } -ioport_constructor interpro_ioga_device::device_input_ports() const -{ - return INPUT_PORTS_NAME(interpro_mouse); -} - void interpro_ioga_device::set_nmi_line(int state) { LOGMASKED(LOG_NMI, "nmi: %s (%s)\n", state ? "asserted" : "cleared", machine().describe_context()); @@ -1100,6 +1083,9 @@ WRITE32_MEMBER(interpro_ioga_device::prescaler_w) /* * Mouse + * + * THEORY: mouse button state changes don't generate an interrupt, but are read + * when an interrupt is generated by movement or by the 60Hz timer. */ READ32_MEMBER(interpro_ioga_device::mouse_status_r) { @@ -1123,62 +1109,16 @@ WRITE32_MEMBER(interpro_ioga_device::mouse_status_w) { LOGMASKED(LOG_MOUSE, "mouse_status_w status 0x%08x mask 0x%08x (%s)\n", data, mem_mask, machine().describe_context()); - m_mouse_status |= (data & MOUSE_COUNTER); + COMBINE_DATA(&m_mouse_status); - // FIXME: diagnostic test fails with value >= 0x1000 - if (data & MOUSE_COUNTER) - m_mouse_timer->adjust(attotime::from_nsec(data & MOUSE_COUNTER)); -} - -INPUT_CHANGED_MEMBER(interpro_ioga_device::mouse_button) -{ - if (newval) - m_mouse_status |= (field.mask() << 16); - else - m_mouse_status &= ~(field.mask() << 16); - - // FIXME: this isn't right, but the rebuild code only - // reads the button status if the x/y status is non-zero? - m_mouse_status |= MOUSE_COUNTER; - - set_int_line(INT_HARD_IN, IRQ_MOUSE, ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER(interpro_ioga_device::mouse_x) -{ - // compute x delta - int delta = newval - oldval; - if (delta > 0x80) - delta -= 0x100; - else if (delta < -0x80) - delta += 0x100; - - // set new x delta - m_mouse_status &= ~MOUSE_XPOS; - m_mouse_status |= ((delta << 8) & MOUSE_XPOS); - - set_int_line(INT_HARD_IN, IRQ_MOUSE, ASSERT_LINE); -} - -INPUT_CHANGED_MEMBER(interpro_ioga_device::mouse_y) -{ - // compute y delta - int delta = newval - oldval; - if (delta > 0x80) - delta -= 0x100; - else if (delta < -0x80) - delta += 0x100; - - // set new y delta - m_mouse_status &= ~MOUSE_YPOS; - m_mouse_status |= ((delta << 0) & MOUSE_YPOS); - - set_int_line(INT_HARD_IN, IRQ_MOUSE, ASSERT_LINE); + if (data & (MOUSE_XPOS | MOUSE_YPOS)) + m_mouse_timer->adjust(attotime::zero); } TIMER_CALLBACK_MEMBER(interpro_ioga_device::mouse_timer) { - set_int_line(INT_HARD_IN, IRQ_MOUSE, ASSERT_LINE); + if (m_hwicr[IRQ_MOUSE] & IRQ_ENABLE_EXTERNAL) + set_int_line(INT_HARD_IN, IRQ_MOUSE, ASSERT_LINE); } /* diff --git a/src/mame/machine/interpro_ioga.h b/src/mame/machine/interpro_ioga.h index 2b9cc685d07..15c777a7ea0 100644 --- a/src/mame/machine/interpro_ioga.h +++ b/src/mame/machine/interpro_ioga.h @@ -308,20 +308,15 @@ public: MOUSE_MBUTTON = 0x00020000, MOUSE_RBUTTON = 0x00040000, - MOUSE_COUNTER = 0x0000ffff, MOUSE_BUTTONS = 0x00070000 }; DECLARE_READ32_MEMBER(mouse_status_r); DECLARE_WRITE32_MEMBER(mouse_status_w); - DECLARE_INPUT_CHANGED_MEMBER(mouse_button); - DECLARE_INPUT_CHANGED_MEMBER(mouse_x); - DECLARE_INPUT_CHANGED_MEMBER(mouse_y); protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual ioport_constructor device_input_ports() const override; const char *m_memory_tag; int m_memory_spacenum;