a2gameio: One fine point (nw)

This commit is contained in:
AJR 2019-06-10 20:21:51 -04:00
parent 5b1f9fd5ba
commit 88ae8ac335
3 changed files with 31 additions and 10 deletions

View File

@ -11,12 +11,15 @@
input signals (0-150 resistance) which are converted to input signals (0-150 resistance) which are converted to
digital pulses by a NE558 quad timer on the main board. The digital pulses by a NE558 quad timer on the main board. The
connector also provides several digital switch inputs and connector also provides several digital switch inputs and
"annunciator" outputs, all LS/TTL compatible. "annunciator" outputs, all LS/TTL compatible. Apple joysticks
provide active high switches (though at least one third-party
product treats them as active low) and Apple main boards have no
pullups on these inputs, which thus read 0 if disconnected.
While pins 9 and 16 are unconnected on the Apple II, they provide While pins 9 and 16 are unconnected on the Apple II, they provide
additional digital output and input pins respectively on the Sanyo additional digital output and input pins respectively on the Sanyo
MBC-550/555 (which uses 74LS123 monostables instead of a NE558). MBC-550/555 (which uses 74LS123 monostables instead of a NE558).
The Apple //gs also recognizes a switch input 3, though this is The Apple IIgs also recognizes a switch input 3, though this is
placed on pin 9 of the internal connector rather than 16. placed on pin 9 of the internal connector rather than 16.
The Apple IIe, IIc and IIgs also have an external DE-9 connector The Apple IIe, IIc and IIgs also have an external DE-9 connector
@ -73,6 +76,12 @@ void apple2_gameio_device::device_config_complete()
m_intf = dynamic_cast<device_a2gameio_interface *>(get_card_device()); m_intf = dynamic_cast<device_a2gameio_interface *>(get_card_device());
} }
void apple2_gameio_device::device_resolve_objects()
{
if (m_intf != nullptr)
m_intf->m_connector = this;
}
void apple2_gameio_device::device_start() void apple2_gameio_device::device_start()
{ {
} }
@ -119,7 +128,7 @@ READ_LINE_MEMBER(apple2_gameio_device::sw0_r)
if (m_intf != nullptr) if (m_intf != nullptr)
return m_intf->sw0_r(); return m_intf->sw0_r();
return 0; return m_sw_pullups ? 1 : 0;
} }
READ_LINE_MEMBER(apple2_gameio_device::sw1_r) READ_LINE_MEMBER(apple2_gameio_device::sw1_r)
@ -127,7 +136,7 @@ READ_LINE_MEMBER(apple2_gameio_device::sw1_r)
if (m_intf != nullptr) if (m_intf != nullptr)
return m_intf->sw1_r(); return m_intf->sw1_r();
return 0; return m_sw_pullups ? 1 : 0;
} }
READ_LINE_MEMBER(apple2_gameio_device::sw2_r) READ_LINE_MEMBER(apple2_gameio_device::sw2_r)
@ -135,7 +144,7 @@ READ_LINE_MEMBER(apple2_gameio_device::sw2_r)
if (m_intf != nullptr) if (m_intf != nullptr)
return m_intf->sw2_r(); return m_intf->sw2_r();
return 0; return m_sw_pullups ? 1 : 0;
} }
READ_LINE_MEMBER(apple2_gameio_device::sw3_r) READ_LINE_MEMBER(apple2_gameio_device::sw3_r)
@ -143,7 +152,7 @@ READ_LINE_MEMBER(apple2_gameio_device::sw3_r)
if (m_intf != nullptr) if (m_intf != nullptr)
return m_intf->sw3_r(); return m_intf->sw3_r();
return 0; return m_sw_pullups ? 1 : 0;
} }
WRITE_LINE_MEMBER(apple2_gameio_device::an0_w) WRITE_LINE_MEMBER(apple2_gameio_device::an0_w)
@ -189,6 +198,7 @@ WRITE_LINE_MEMBER(apple2_gameio_device::strobe_w)
device_a2gameio_interface::device_a2gameio_interface(const machine_config &mconfig, device_t &device) device_a2gameio_interface::device_a2gameio_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device) : device_slot_card_interface(mconfig, device)
, m_connector(nullptr)
{ {
} }

View File

@ -37,6 +37,10 @@ public:
set_fixed(false); set_fixed(false);
} }
// configuration
void set_sw_pullups(bool enabled) { m_sw_pullups = enabled; }
bool has_sw_pullups() const { return m_sw_pullups; }
// standard options // standard options
static void default_options(device_slot_interface &slot); static void default_options(device_slot_interface &slot);
@ -65,11 +69,14 @@ public:
protected: protected:
// device-level overrides // device-level overrides
virtual void device_config_complete() override; virtual void device_config_complete() override;
virtual void device_resolve_objects() override;
virtual void device_start() override; virtual void device_start() override;
private: private:
// selected device // selected device
device_a2gameio_interface *m_intf; device_a2gameio_interface *m_intf;
bool m_sw_pullups;
}; };
// ======================> device_a2gameio_interface // ======================> device_a2gameio_interface
@ -88,10 +95,10 @@ protected:
virtual u8 pdl1_r() { return 0; } virtual u8 pdl1_r() { return 0; }
virtual u8 pdl2_r() { return 0; } virtual u8 pdl2_r() { return 0; }
virtual u8 pdl3_r() { return 0; } virtual u8 pdl3_r() { return 0; }
virtual DECLARE_READ_LINE_MEMBER(sw0_r) { return 0; } virtual DECLARE_READ_LINE_MEMBER(sw0_r) { return m_connector->has_sw_pullups() ? 1 : 0; }
virtual DECLARE_READ_LINE_MEMBER(sw1_r) { return 0; } virtual DECLARE_READ_LINE_MEMBER(sw1_r) { return m_connector->has_sw_pullups() ? 1 : 0; }
virtual DECLARE_READ_LINE_MEMBER(sw2_r) { return 0; } virtual DECLARE_READ_LINE_MEMBER(sw2_r) { return m_connector->has_sw_pullups() ? 1 : 0; }
virtual DECLARE_READ_LINE_MEMBER(sw3_r) { return 0; } virtual DECLARE_READ_LINE_MEMBER(sw3_r) { return m_connector->has_sw_pullups() ? 1 : 0; }
// optional output overrides // optional output overrides
virtual DECLARE_WRITE_LINE_MEMBER(an0_w) { } virtual DECLARE_WRITE_LINE_MEMBER(an0_w) { }
@ -100,6 +107,9 @@ protected:
virtual DECLARE_WRITE_LINE_MEMBER(an3_w) { } virtual DECLARE_WRITE_LINE_MEMBER(an3_w) { }
virtual DECLARE_WRITE_LINE_MEMBER(an4_w) { } virtual DECLARE_WRITE_LINE_MEMBER(an4_w) { }
virtual DECLARE_WRITE_LINE_MEMBER(strobe_w) { } virtual DECLARE_WRITE_LINE_MEMBER(strobe_w) { }
private:
apple2_gameio_device *m_connector;
}; };
// device type declaration // device type declaration

View File

@ -362,6 +362,7 @@ void mbc55x_state::mbc55x(machine_config &config)
INPUT_MERGER_ANY_HIGH(config, "sioint").output_handler().set(m_pic, FUNC(pic8259_device::ir2_w)); INPUT_MERGER_ANY_HIGH(config, "sioint").output_handler().set(m_pic, FUNC(pic8259_device::ir2_w));
APPLE2_GAMEIO(config, m_gameio, apple2_gameio_device::default_options, nullptr); APPLE2_GAMEIO(config, m_gameio, apple2_gameio_device::default_options, nullptr);
m_gameio->set_sw_pullups(true); // 3300 ohm pullups to 5.0V on pins 2-4 and 16
CENTRONICS(config, m_printer, centronics_devices, nullptr); CENTRONICS(config, m_printer, centronics_devices, nullptr);
m_printer->busy_handler().set(FUNC(mbc55x_state::printer_busy_w)).invert(); // LS14 Schmitt trigger m_printer->busy_handler().set(FUNC(mbc55x_state::printer_busy_w)).invert(); // LS14 Schmitt trigger