diff --git a/src/devices/bus/a2gameio/gameio.h b/src/devices/bus/a2gameio/gameio.h index e160fc7aa1e..7ff1771b17b 100644 --- a/src/devices/bus/a2gameio/gameio.h +++ b/src/devices/bus/a2gameio/gameio.h @@ -67,6 +67,9 @@ public: // utility strobe (active low) DECLARE_WRITE_LINE_MEMBER(strobe_w); + // check if a device is connected + bool is_device_connected() { return (m_intf != nullptr); } + protected: // device-level overrides virtual void device_config_complete() override; diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp index b275a9b8c7c..a3866e85930 100644 --- a/src/mame/drivers/apple2.cpp +++ b/src/mame/drivers/apple2.cpp @@ -646,15 +646,19 @@ u8 apple2_state::flags_r(offs_t offset) return (m_gameio->sw2_r() ? 0x80 : 0) | (read_floatingbus() & 0x7f); case 4: // joy 1 X axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7; case 5: // joy 1 Y axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7; case 6: // joy 2 X axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7; case 7: // joy 2 Y axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7; } diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index d2f6a86cd13..52826b35be4 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -1999,18 +1999,22 @@ u8 apple2e_state::c000_r(offs_t offset) case 0x64: // joy 1 X axis case 0x6c: + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7; case 0x65: // joy 1 Y axis case 0x6d: + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7; case 0x66: // joy 2 X axis case 0x6e: + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7; case 0x67: // joy 2 Y axis case 0x6f: + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7; case 0x7e: // read IOUDIS diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 39cbfdaf7ae..61edd2ce1b0 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -2567,15 +2567,19 @@ u8 apple2gs_state::c000_r(offs_t offset) return ((m_gameio->sw2_r() || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | uFloatingBus7; case 0x64: // joy 1 X axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | uFloatingBus7; case 0x65: // joy 1 Y axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | uFloatingBus7; case 0x66: // joy 2 X axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | uFloatingBus7; case 0x67: // joy 2 Y axis + if (!m_gameio->is_device_connected()) return 0x80 | uFloatingBus7; return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | uFloatingBus7; case 0x68: // STATEREG, synthesizes all the IIe state regs