diff options
Diffstat (limited to 'src/devices/bus/neogeo_ctrl/joystick.cpp')
-rw-r--r-- | src/devices/bus/neogeo_ctrl/joystick.cpp | 144 |
1 files changed, 115 insertions, 29 deletions
diff --git a/src/devices/bus/neogeo_ctrl/joystick.cpp b/src/devices/bus/neogeo_ctrl/joystick.cpp index 2c550d0652d..a2a95c7a7e0 100644 --- a/src/devices/bus/neogeo_ctrl/joystick.cpp +++ b/src/devices/bus/neogeo_ctrl/joystick.cpp @@ -8,15 +8,23 @@ #include "joystick.h" + + +/********************************************************************** + + Implementation through the 15-pin controller port (used by AES) + + **********************************************************************/ + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** -const device_type NEOGEO_JOY_AC = &device_creator<neogeo_joy_ac_device>; const device_type NEOGEO_JOY = &device_creator<neogeo_joystick_device>; -static INPUT_PORTS_START( neogeo_joy_ac ) +static INPUT_PORTS_START( neogeo_joy ) PORT_START("JOY") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) @@ -26,11 +34,6 @@ static INPUT_PORTS_START( neogeo_joy_ac ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) -INPUT_PORTS_END - - -static INPUT_PORTS_START( neogeo_joy ) - PORT_INCLUDE( neogeo_joy_ac ) PORT_START("START_SELECT") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START ) @@ -42,11 +45,6 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor neogeo_joy_ac_device::device_input_ports() const -{ - return INPUT_PORTS_NAME( neogeo_joy_ac ); -} - ioport_constructor neogeo_joystick_device::device_input_ports() const { return INPUT_PORTS_NAME( neogeo_joy ); @@ -58,30 +56,118 @@ ioport_constructor neogeo_joystick_device::device_input_ports() const //************************************************************************** //------------------------------------------------- -// neogeo_joy_ac_device / neogeo_joystick_device - constructor +// neogeo_joystick_device - constructor //------------------------------------------------- -neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source): - device_t(mconfig, type, name, tag, owner, clock, shortname, source), +neogeo_joystick_device::neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_JOY, "SNK Neo Geo Joystick", tag, owner, clock, "neogeo_joy", __FILE__), device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY") + m_joy(*this, "JOY"), + m_ss(*this, "START_SELECT") { } -neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, NEOGEO_JOY_AC, "SNK Neo Geo Arcade Joystick", tag, owner, clock, "neogeo_joyac", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY") + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_joystick_device::device_start() { } -neogeo_joystick_device::neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - neogeo_joy_ac_device(mconfig, NEOGEO_JOY, "SNK Neo Geo Joystick", tag, owner, clock, "neogeo_joy", __FILE__), - m_ss(*this, "START_SELECT") + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void neogeo_joystick_device::device_reset() +{ +} + + +//------------------------------------------------- +// read_ctrl +//------------------------------------------------- + +UINT8 neogeo_joystick_device::read_ctrl() +{ + return m_joy->read(); +} + +//------------------------------------------------- +// read_start_sel +//------------------------------------------------- + +UINT8 neogeo_joystick_device::read_start_sel() { + return m_ss->read(); } + +/********************************************************************** + + Implementation through the edge connector (used by MVS) and + connecting two controllers + + **********************************************************************/ + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NEOGEO_JOY_AC = &device_creator<neogeo_joy_ac_device>; + + +static INPUT_PORTS_START( neogeo_joy_ac ) + PORT_START("JOY1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) + + PORT_START("JOY2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor neogeo_joy_ac_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( neogeo_joy_ac ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// neogeo_joy_ac_device / neogeo_joystick_device - constructor +//------------------------------------------------- + +neogeo_joy_ac_device::neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_JOY_AC, "SNK Neo Geo Arcade Joystick", tag, owner, clock, "neogeo_joyac", __FILE__), + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2") +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -101,20 +187,20 @@ void neogeo_joy_ac_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_joy_ac_device::read_ctrl() +READ8_MEMBER(neogeo_joy_ac_device::in0_r) { - return m_joy->read(); + return m_joy1->read(); } //------------------------------------------------- -// read_start_sel +// in1_r //------------------------------------------------- -UINT8 neogeo_joystick_device::read_start_sel() +READ8_MEMBER(neogeo_joy_ac_device::in1_r) { - return m_ss->read(); + return m_joy2->read(); } |