From 057eefd060af60932c338a145df801ebd3c762d1 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Thu, 21 Apr 2016 09:29:33 +0200 Subject: [PATCH] neogeo.cpp: more accurate implementation of contollers through slot devices. If you want to launch janshin in the multislot driver (neogeo) you shall now prescribe -edge "" -ctrl1 mahjong and set accordingly the dipswitch. The janshin driver already comes pre-configured in the proper way, instead. [Fabio Priuli] --- scripts/src/bus.lua | 2 + src/devices/bus/neogeo_ctrl/ctrl.cpp | 117 +++++++++++++++-- src/devices/bus/neogeo_ctrl/ctrl.h | 52 +++++++- src/devices/bus/neogeo_ctrl/dial.cpp | 63 +++++++--- src/devices/bus/neogeo_ctrl/dial.h | 11 +- src/devices/bus/neogeo_ctrl/irrmaze.cpp | 114 +++++++++++++++++ src/devices/bus/neogeo_ctrl/irrmaze.h | 57 +++++++++ src/devices/bus/neogeo_ctrl/joystick.cpp | 154 ++++++++++++++++++----- src/devices/bus/neogeo_ctrl/joystick.h | 64 +++++----- src/devices/bus/neogeo_ctrl/kizuna4p.cpp | 94 ++++++++++---- src/devices/bus/neogeo_ctrl/kizuna4p.h | 10 +- src/mame/drivers/neogeo.cpp | 20 +-- src/mame/drivers/neogeo_noslot.cpp | 71 +++++------ src/mame/drivers/ng_aes.cpp | 1 - src/mame/includes/neogeo.h | 5 +- 15 files changed, 659 insertions(+), 176 deletions(-) create mode 100644 src/devices/bus/neogeo_ctrl/irrmaze.cpp create mode 100644 src/devices/bus/neogeo_ctrl/irrmaze.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 78032cabff0..cd9923ea1fc 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1964,6 +1964,8 @@ if (BUSES["NEOGEO_CTRL"]~=null) then MAME_DIR .. "src/devices/bus/neogeo_ctrl/mahjong.h", MAME_DIR .. "src/devices/bus/neogeo_ctrl/dial.cpp", MAME_DIR .. "src/devices/bus/neogeo_ctrl/dial.h", + MAME_DIR .. "src/devices/bus/neogeo_ctrl/irrmaze.cpp", + MAME_DIR .. "src/devices/bus/neogeo_ctrl/irrmaze.h", MAME_DIR .. "src/devices/bus/neogeo_ctrl/kizuna4p.cpp", MAME_DIR .. "src/devices/bus/neogeo_ctrl/kizuna4p.h", } diff --git a/src/devices/bus/neogeo_ctrl/ctrl.cpp b/src/devices/bus/neogeo_ctrl/ctrl.cpp index 74d0c10586f..bdfeb657065 100644 --- a/src/devices/bus/neogeo_ctrl/ctrl.cpp +++ b/src/devices/bus/neogeo_ctrl/ctrl.cpp @@ -3,6 +3,16 @@ /********************************************************************** SNK Neo Geo Controller Port emulation + + This actually covers two separate piece of hardware of Neo Geo system: + - The 15-pin controller ports that are used for controllers in the + AES home system and for mahjong controllers in the MVS arcade PCB + - The controller part of the main edge connector that is used for + joystick inputs in the MVS arcade PCB + + Technically, the latter is not a configurable slot, because it's not + a component that arcade operators could simply change with a different + controller, but this implementation allows for simpler code. **********************************************************************/ @@ -11,6 +21,7 @@ #include "joystick.h" #include "mahjong.h" #include "dial.h" +#include "irrmaze.h" #include "kizuna4p.h" @@ -19,6 +30,7 @@ //************************************************************************** const device_type NEOGEO_CONTROL_PORT = &device_creator; +const device_type NEOGEO_CTRL_EDGE_CONNECTOR = &device_creator; //************************************************************************** @@ -44,6 +56,25 @@ device_neogeo_control_port_interface::~device_neogeo_control_port_interface() { } +//------------------------------------------------- +// device_neogeo_ctrl_edge_interface - constructor +//------------------------------------------------- + +device_neogeo_ctrl_edge_interface::device_neogeo_ctrl_edge_interface(const machine_config &mconfig, device_t &device) + : device_slot_card_interface(mconfig,device) +{ + m_port = dynamic_cast(device.owner()); +} + + +//------------------------------------------------- +// ~device_neogeo_ctrl_edge_interface - destructor +//------------------------------------------------- + +device_neogeo_ctrl_edge_interface::~device_neogeo_ctrl_edge_interface() +{ +} + //************************************************************************** // LIVE DEVICE @@ -81,17 +112,17 @@ void neogeo_control_port_device::device_start() UINT8 neogeo_control_port_device::read_ctrl() { - UINT8 data = 0; + UINT8 data = 0xff; if (m_device) - data |= m_device->read_ctrl(); + data &= m_device->read_ctrl(); return data; } UINT8 neogeo_control_port_device::read_start_sel() { - UINT8 data = 0; + UINT8 data = 0xff; if (m_device) - data |= m_device->read_start_sel(); + data &= m_device->read_start_sel(); return data; } @@ -103,6 +134,68 @@ void neogeo_control_port_device::write_ctrlsel(UINT8 data) } +//------------------------------------------------- +// neogeo_ctrl_edge_port_device - constructor +//------------------------------------------------- + +neogeo_ctrl_edge_port_device::neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_CTRL_EDGE_CONNECTOR, "SNK Neo Geo Edge Connector (Controller)", tag, owner, clock, "neogeo_ctrl_edge", __FILE__), + device_slot_interface(mconfig, *this), m_device(nullptr) +{ +} + + +//------------------------------------------------- +// ~neogeo_ctrl_edge_port_device - destructor +//------------------------------------------------- + +neogeo_ctrl_edge_port_device::~neogeo_ctrl_edge_port_device() +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_ctrl_edge_port_device::device_start() +{ + m_device = dynamic_cast(get_card_device()); +} + + +READ8_MEMBER(neogeo_ctrl_edge_port_device::in0_r) +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->in0_r(space, offset, mem_mask); + return data; +} + +READ8_MEMBER(neogeo_ctrl_edge_port_device::in1_r) +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->in1_r(space, offset, mem_mask); + return data; +} + +UINT8 neogeo_ctrl_edge_port_device::read_start_sel() +{ + UINT8 data = 0xff; + if (m_device) + data &= m_device->read_start_sel(); + return data; +} + +void neogeo_ctrl_edge_port_device::write_ctrlsel(UINT8 data) +{ + if (m_device) + m_device->write_ctrlsel(data); +} + + + //------------------------------------------------- // SLOT_INTERFACE( neogeo_control_port_devices ) //------------------------------------------------- @@ -112,12 +205,18 @@ SLOT_INTERFACE_START( neogeo_controls ) SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL) SLOT_INTERFACE_END -SLOT_INTERFACE_START( neogeo_arc_ctrls ) +SLOT_INTERFACE_START( neogeo_arc_edge ) SLOT_INTERFACE("joy", NEOGEO_JOY_AC) - SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL_AC) - SLOT_INTERFACE("dial", NEOGEO_DIAL) SLOT_INTERFACE_END -SLOT_INTERFACE_START( neogeo_kiz4p ) - SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P) +SLOT_INTERFACE_START( neogeo_arc_edge_fixed ) + SLOT_INTERFACE("joy", NEOGEO_JOY_AC) + SLOT_INTERFACE("dial", NEOGEO_DIAL) + SLOT_INTERFACE("irrmaze", NEOGEO_IRRMAZE) + SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P) SLOT_INTERFACE_END + +SLOT_INTERFACE_START( neogeo_arc_pin15 ) + SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL) +SLOT_INTERFACE_END + diff --git a/src/devices/bus/neogeo_ctrl/ctrl.h b/src/devices/bus/neogeo_ctrl/ctrl.h index 0505d35d3eb..437dc8addd3 100644 --- a/src/devices/bus/neogeo_ctrl/ctrl.h +++ b/src/devices/bus/neogeo_ctrl/ctrl.h @@ -19,6 +19,7 @@ //************************************************************************** class neogeo_control_port_device; +class neogeo_ctrl_edge_port_device; // ======================> device_neogeo_control_port_interface @@ -60,8 +61,50 @@ protected: }; +// ======================> device_neogeo_ctrl_edge_interface + +class device_neogeo_ctrl_edge_interface : public device_slot_card_interface +{ +public: + // construction/destruction + device_neogeo_ctrl_edge_interface(const machine_config &mconfig, device_t &device); + virtual ~device_neogeo_ctrl_edge_interface(); + + virtual UINT8 read_start_sel() { return 0xff; } + virtual DECLARE_READ8_MEMBER( in0_r ) { return 0xff; } + virtual DECLARE_READ8_MEMBER( in1_r ) { return 0xff; } + virtual void write_ctrlsel(UINT8 data) { } + +protected: + neogeo_ctrl_edge_port_device *m_port; +}; + +// ======================> neogeo_ctrl_edge_port_device + +class neogeo_ctrl_edge_port_device : public device_t, + public device_slot_interface +{ +public: + // construction/destruction + neogeo_ctrl_edge_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~neogeo_ctrl_edge_port_device(); + + UINT8 read_start_sel(); + DECLARE_READ8_MEMBER( in0_r ); + DECLARE_READ8_MEMBER( in1_r ); + void write_ctrlsel(UINT8 data); + +protected: + // device-level overrides + virtual void device_start() override; + + device_neogeo_ctrl_edge_interface *m_device; +}; + + // device type definition extern const device_type NEOGEO_CONTROL_PORT; +extern const device_type NEOGEO_CTRL_EDGE_CONNECTOR; //************************************************************************** @@ -72,11 +115,16 @@ extern const device_type NEOGEO_CONTROL_PORT; MCFG_DEVICE_ADD(_tag, NEOGEO_CONTROL_PORT, 0) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) +#define MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD(_tag, _slot_intf, _def_slot, _fixed) \ + MCFG_DEVICE_ADD(_tag, NEOGEO_CTRL_EDGE_CONNECTOR, 0) \ + MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) + SLOT_INTERFACE_EXTERN( neogeo_controls ); -SLOT_INTERFACE_EXTERN( neogeo_arc_ctrls ); -SLOT_INTERFACE_EXTERN( neogeo_kiz4p ); +SLOT_INTERFACE_EXTERN( neogeo_arc_edge ); +SLOT_INTERFACE_EXTERN( neogeo_arc_edge_fixed ); +SLOT_INTERFACE_EXTERN( neogeo_arc_pin15 ); #endif diff --git a/src/devices/bus/neogeo_ctrl/dial.cpp b/src/devices/bus/neogeo_ctrl/dial.cpp index 8276ecdc8ac..046ff1ccd06 100644 --- a/src/devices/bus/neogeo_ctrl/dial.cpp +++ b/src/devices/bus/neogeo_ctrl/dial.cpp @@ -16,17 +16,29 @@ const device_type NEOGEO_DIAL = &device_creator; static INPUT_PORTS_START( neogeo_dial ) - PORT_START("JOY") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) /* note it needs it from 0x80 when using paddle */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) + 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( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* note it needs it from 0x80 when using paddle */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) - PORT_START("DIAL") - PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) + 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( 0x90, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* note it needs it from 0x80 when using paddle */ + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) + + PORT_START("DIAL1") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_PLAYER(1) + + PORT_START("DIAL2") + PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) PORT_PLAYER(2) INPUT_PORTS_END @@ -50,9 +62,11 @@ ioport_constructor neogeo_dial_device::device_input_ports() const neogeo_dial_device::neogeo_dial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NEOGEO_DIAL, "SNK Neo Geo Dial Controller", tag, owner, clock, "neogeo_dial", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY"), - m_dial(*this, "DIAL") + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_joy1(*this, "JOY1"), + m_joy2(*this, "JOY2"), + m_dial1(*this, "DIAL1"), + m_dial2(*this, "DIAL2") { } @@ -78,16 +92,31 @@ void neogeo_dial_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_dial_device::read_ctrl() +READ8_MEMBER(neogeo_dial_device::in0_r) { UINT8 res = 0; if (m_ctrl_sel & 0x01) - res = m_joy->read(); + res = m_joy1->read(); else - res = m_dial->read(); + res = m_dial1->read(); + + return res; +} + +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_dial_device::in1_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_joy2->read(); + else + res = m_dial2->read(); return res; } diff --git a/src/devices/bus/neogeo_ctrl/dial.h b/src/devices/bus/neogeo_ctrl/dial.h index ac968ea1136..0c0e07c474d 100644 --- a/src/devices/bus/neogeo_ctrl/dial.h +++ b/src/devices/bus/neogeo_ctrl/dial.h @@ -22,7 +22,7 @@ // ======================> neogeo_dial_device class neogeo_dial_device : public device_t, - public device_neogeo_control_port_interface + public device_neogeo_ctrl_edge_interface { public: // construction/destruction @@ -37,12 +37,15 @@ protected: virtual void device_reset() override; // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; virtual void write_ctrlsel(UINT8 data) override; private: - required_ioport m_joy; - required_ioport m_dial; + required_ioport m_joy1; + required_ioport m_joy2; + required_ioport m_dial1; + required_ioport m_dial2; UINT8 m_ctrl_sel; }; diff --git a/src/devices/bus/neogeo_ctrl/irrmaze.cpp b/src/devices/bus/neogeo_ctrl/irrmaze.cpp new file mode 100644 index 00000000000..0172d6f86d4 --- /dev/null +++ b/src/devices/bus/neogeo_ctrl/irrmaze.cpp @@ -0,0 +1,114 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/********************************************************************** + + SNK Neo Geo Irritation Maze Analog Controller emulation + +**********************************************************************/ + +#include "irrmaze.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NEOGEO_IRRMAZE = &device_creator; + + +static INPUT_PORTS_START( neogeo_irrmaze ) + PORT_START("BUTTONS") + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) + 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_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + + PORT_START("TRACK_X") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE + + PORT_START("TRACK_Y") + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor neogeo_irrmaze_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( neogeo_irrmaze ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// neogeo_irrmaze_device - constructor +//------------------------------------------------- + +neogeo_irrmaze_device::neogeo_irrmaze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_IRRMAZE, "SNK Neo Geo Irritating Maze Analog Controller", tag, owner, clock, "neogeo_irrmaze", __FILE__), + device_neogeo_ctrl_edge_interface(mconfig, *this), + m_tx(*this, "TRACK_X"), + m_ty(*this, "TRACK_Y"), + m_buttons(*this, "BUTTONS") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_irrmaze_device::device_start() +{ + save_item(NAME(m_ctrl_sel)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void neogeo_irrmaze_device::device_reset() +{ + m_ctrl_sel = 0; +} + + +//------------------------------------------------- +// in0_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_irrmaze_device::in0_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_ty->read(); + else + res = m_tx->read(); + + return res; +} + +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_irrmaze_device::in1_r) +{ + return m_buttons->read(); +} + +//------------------------------------------------- +// write_ctrlsel +//------------------------------------------------- + +void neogeo_irrmaze_device::write_ctrlsel(UINT8 data) +{ + m_ctrl_sel = data; +} + diff --git a/src/devices/bus/neogeo_ctrl/irrmaze.h b/src/devices/bus/neogeo_ctrl/irrmaze.h new file mode 100644 index 00000000000..9ec4da5761b --- /dev/null +++ b/src/devices/bus/neogeo_ctrl/irrmaze.h @@ -0,0 +1,57 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/********************************************************************** + + SNK Neo Geo Dial controller emulation + +**********************************************************************/ + +#pragma once + +#ifndef __NEOGEO_IRRMAZE__ +#define __NEOGEO_IRRMAZE__ + + +#include "emu.h" +#include "ctrl.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> neogeo_dial_device + +class neogeo_irrmaze_device : public device_t, + public device_neogeo_ctrl_edge_interface +{ +public: + // construction/destruction + neogeo_irrmaze_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_neogeo_control_port_interface overrides + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; + virtual void write_ctrlsel(UINT8 data) override; + +private: + required_ioport m_tx; + required_ioport m_ty; + required_ioport m_buttons; + UINT8 m_ctrl_sel; +}; + + + +// device type definition +extern const device_type NEOGEO_IRRMAZE; + + +#endif 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; const device_type NEOGEO_JOY = &device_creator; -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), - device_neogeo_control_port_interface(mconfig, *this), - m_joy(*this, "JOY") -{ -} - -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") -{ -} - 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__), + 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_ss(*this, "START_SELECT") { } +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void neogeo_joystick_device::device_start() +{ +} + + +//------------------------------------------------- +// 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; + + +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(); } diff --git a/src/devices/bus/neogeo_ctrl/joystick.h b/src/devices/bus/neogeo_ctrl/joystick.h index ff084dd7207..4f8ce2a91da 100644 --- a/src/devices/bus/neogeo_ctrl/joystick.h +++ b/src/devices/bus/neogeo_ctrl/joystick.h @@ -19,14 +19,40 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> neogeo_joy_ac_device +// ======================> neogeo_joystick_device -class neogeo_joy_ac_device : public device_t, - public device_neogeo_control_port_interface +class neogeo_joystick_device : public device_t, + public device_neogeo_control_port_interface +{ +public: + // construction/destruction + neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // device_neogeo_control_port_interface overrides + virtual UINT8 read_ctrl() override; + virtual UINT8 read_start_sel() override; + +private: + required_ioport m_joy; + required_ioport m_ss; +}; + + +// ======================> neogeo_joy_ac_device + +class neogeo_joy_ac_device : public device_t, + public device_neogeo_ctrl_edge_interface { public: // construction/destruction - 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); neogeo_joy_ac_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); // optional information overrides @@ -37,37 +63,19 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; - -private: - required_ioport m_joy; -}; - -// ======================> neogeo_joystick_device - -class neogeo_joystick_device : public neogeo_joy_ac_device -{ -public: - // construction/destruction - neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - - // optional information overrides - virtual ioport_constructor device_input_ports() const override; - -protected: - // device_neogeo_control_port_interface overrides - virtual UINT8 read_start_sel() override; + // device_neogeo_ctrl_edge_interface overrides + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; private: - required_ioport m_ss; + required_ioport m_joy1; + required_ioport m_joy2; }; - // device type definition -extern const device_type NEOGEO_JOY_AC; extern const device_type NEOGEO_JOY; +extern const device_type NEOGEO_JOY_AC; #endif diff --git a/src/devices/bus/neogeo_ctrl/kizuna4p.cpp b/src/devices/bus/neogeo_ctrl/kizuna4p.cpp index 097345c8e2e..9a3ef190154 100644 --- a/src/devices/bus/neogeo_ctrl/kizuna4p.cpp +++ b/src/devices/bus/neogeo_ctrl/kizuna4p.cpp @@ -17,28 +17,52 @@ const device_type NEOGEO_KIZ4P = &device_creator; static INPUT_PORTS_START( neogeo_kiz4p ) PORT_START("JOY1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Joy A - Up") PORT_PLAYER(1) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Joy A - Down") PORT_PLAYER(1) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Joy A - Left") PORT_PLAYER(1) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Joy A - Right") PORT_PLAYER(1) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Joy A - Button A") PORT_PLAYER(1) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Joy A - Button B") PORT_PLAYER(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Joy A - Button C") PORT_PLAYER(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Joy A - Button D") PORT_PLAYER(1) + 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_NAME("Joy B - Up") PORT_PLAYER(2) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Joy B - Down") PORT_PLAYER(2) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Joy B - Left") PORT_PLAYER(2) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Joy B - Right") PORT_PLAYER(2) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Joy B - Button A") PORT_PLAYER(2) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Joy B - Button B") PORT_PLAYER(2) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Joy B - Button C") PORT_PLAYER(2) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Joy B - Button D") PORT_PLAYER(2) + 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) - PORT_START("START") + PORT_START("JOY3") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3) + + PORT_START("JOY4") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4) + + PORT_START("START13") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START3 ) + + PORT_START("START24") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 ) INPUT_PORTS_END @@ -62,10 +86,13 @@ ioport_constructor neogeo_kizuna4p_device::device_input_ports() const neogeo_kizuna4p_device::neogeo_kizuna4p_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NEOGEO_KIZ4P, "SNK Neo Geo Kizuna 4P Controller", tag, owner, clock, "neogeo_kiz4p", __FILE__), - device_neogeo_control_port_interface(mconfig, *this), + device_neogeo_ctrl_edge_interface(mconfig, *this), m_joy1(*this, "JOY1"), m_joy2(*this, "JOY2"), - m_ss(*this, "START") + m_joy3(*this, "JOY3"), + m_joy4(*this, "JOY4"), + m_ss1(*this, "START13"), + m_ss2(*this, "START24") { } @@ -91,23 +118,38 @@ void neogeo_kizuna4p_device::device_reset() //------------------------------------------------- -// read_ctrl +// in0_r //------------------------------------------------- -UINT8 neogeo_kizuna4p_device::read_ctrl() +READ8_MEMBER(neogeo_kizuna4p_device::in0_r) { UINT8 res = 0; - if (m_ctrl_sel & 0x01) - res = m_joy2->read(); + res = m_joy3->read(); else res = m_joy1->read(); if (m_ctrl_sel & 0x04) res &= ((m_ctrl_sel & 0x01) ? ~0x20 : ~0x10); - + return res; } +//------------------------------------------------- +// in1_r +//------------------------------------------------- + +READ8_MEMBER(neogeo_kizuna4p_device::in1_r) +{ + UINT8 res = 0; + if (m_ctrl_sel & 0x01) + res = m_joy4->read(); + else + res = m_joy2->read(); + + if (m_ctrl_sel & 0x04) res &= ((m_ctrl_sel & 0x01) ? ~0x20 : ~0x10); + + return res; +} //------------------------------------------------- // read_start_sel @@ -115,7 +157,7 @@ UINT8 neogeo_kizuna4p_device::read_ctrl() UINT8 neogeo_kizuna4p_device::read_start_sel() { - return BIT(m_ss->read(), m_ctrl_sel & 0x01); + return (BIT(m_ss1->read(), m_ctrl_sel & 0x01)) | (BIT(m_ss2->read(), m_ctrl_sel & 0x01) << 2); } diff --git a/src/devices/bus/neogeo_ctrl/kizuna4p.h b/src/devices/bus/neogeo_ctrl/kizuna4p.h index 36cdbcf1de9..ef4aa1bad36 100644 --- a/src/devices/bus/neogeo_ctrl/kizuna4p.h +++ b/src/devices/bus/neogeo_ctrl/kizuna4p.h @@ -22,7 +22,7 @@ // ======================> neogeo_kizuna4p_device class neogeo_kizuna4p_device : public device_t, - public device_neogeo_control_port_interface + public device_neogeo_ctrl_edge_interface { public: // construction/destruction @@ -37,14 +37,18 @@ protected: virtual void device_reset() override; // device_neogeo_control_port_interface overrides - virtual UINT8 read_ctrl() override; + virtual DECLARE_READ8_MEMBER( in0_r ) override; + virtual DECLARE_READ8_MEMBER( in1_r ) override; virtual UINT8 read_start_sel() override; virtual void write_ctrlsel(UINT8 data) override; private: required_ioport m_joy1; required_ioport m_joy2; - required_ioport m_ss; + required_ioport m_joy3; + required_ioport m_joy4; + required_ioport m_ss1; + required_ioport m_ss2; UINT8 m_ctrl_sel; }; diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 8b420a91ec2..dbf8ab1947e 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -633,18 +633,17 @@ WRITE8_MEMBER(neogeo_state::audio_cpu_enable_nmi_w) READ16_MEMBER(neogeo_state::in0_r) { - return (m_ctrl1->ctrl_r(space, offset) << 8) | m_dsw->read(); + return ((m_edge->in0_r(space, offset) & m_ctrl1->ctrl_r(space, offset)) << 8) | m_dsw->read(); } -READ16_MEMBER(neogeo_state::irrmaze_in0_r) +READ16_MEMBER(neogeo_state::in1_r) { - UINT8 track_ipt = (m_controller_select & 0x01) ? m_tracky->read() : m_trackx->read(); - return (track_ipt << 8) | m_dsw->read(); + return ((m_edge->in1_r(space, offset) & m_ctrl2->ctrl_r(space, offset)) << 8) | 0xff; } CUSTOM_INPUT_MEMBER(neogeo_state::kizuna4p_start_r) { - return (m_ctrl1->read_start_sel()) | (m_ctrl2->read_start_sel() << 2) | ~0x05; + return (m_edge->read_start_sel() & 0x05) | ~0x05; } WRITE8_MEMBER(neogeo_state::io_control_w) @@ -652,9 +651,9 @@ WRITE8_MEMBER(neogeo_state::io_control_w) switch (offset) { case 0x00: - m_controller_select = data; if (m_ctrl1) m_ctrl1->write_ctrlsel(data); if (m_ctrl2) m_ctrl2->write_ctrlsel(data); + if (m_edge) m_edge->write_ctrlsel(data); break; case 0x10: @@ -1025,7 +1024,7 @@ DRIVER_INIT_MEMBER(neogeo_state,neogeo) // install controllers m_maincpu->space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, 0, 0x01ff7e, read16_delegate(FUNC(neogeo_state::in0_r), this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x340000, 0x340001, 0, 0x01fffe, read8_delegate(FUNC(neogeo_control_port_device::ctrl_r),(neogeo_control_port_device*)m_ctrl2), 0xff00); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x340000, 0x340001, 0, 0x01fffe, read16_delegate(FUNC(neogeo_state::in1_r), this)); } @@ -1072,7 +1071,6 @@ void neogeo_state::machine_start() save_item(NAME(m_irq3_pending)); save_item(NAME(m_audio_cpu_nmi_enabled)); save_item(NAME(m_audio_cpu_nmi_pending)); - save_item(NAME(m_controller_select)); save_item(NAME(m_save_ram_unlocked)); save_item(NAME(m_output_data)); save_item(NAME(m_output_latch)); @@ -1423,8 +1421,10 @@ static MACHINE_CONFIG_DERIVED( mvs, neogeo_arcade ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_slot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", false) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", false) + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge, "joy", false) + + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", false) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", false) MCFG_NEOGEO_CARTRIDGE_ADD("cartslot1", neogeo_cart, nullptr) MCFG_NEOGEO_CARTRIDGE_ADD("cartslot2", neogeo_cart, nullptr) diff --git a/src/mame/drivers/neogeo_noslot.cpp b/src/mame/drivers/neogeo_noslot.cpp index e80ce2ef086..1fe7d6c8203 100644 --- a/src/mame/drivers/neogeo_noslot.cpp +++ b/src/mame/drivers/neogeo_noslot.cpp @@ -23,8 +23,12 @@ static MACHINE_CONFIG_DERIVED_CLASS( neogeo_noslot, neogeo_arcade, neogeo_noslot MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_noslot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", true) + //joystick controller + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "joy", true) + + //no mahjong controller + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MCFG_MSLUGX_PROT_ADD("mslugx_prot") MCFG_SMA_PROT_ADD("sma_prot") @@ -42,8 +46,12 @@ static MACHINE_CONFIG_DERIVED_CLASS( neogeo_kog, neogeo_arcade, neogeo_noslot_ko MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_noslot) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "joy", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "joy", true) + //joystick controller + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "joy", true) + + //no mahjong controller + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot") MCFG_KOG_PROT_ADD("kog_prot") @@ -52,27 +60,34 @@ MACHINE_CONFIG_END // these basically correspond to the cabinets which were available in arcades: // with mahjong panel, with dial for Pop'n Bounce and with 4 controls for Kizuna... static MACHINE_CONFIG_DERIVED( neogeo_mj, neogeo_noslot ) + + //no joystick panel + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "", true) + + //P1 mahjong controller MCFG_DEVICE_REMOVE("ctrl1") MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "mahjong", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_pin15, "mahjong", true) + MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_pin15, "", true) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( neogeo_dial, neogeo_noslot ) - MCFG_DEVICE_REMOVE("ctrl1") - MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_arc_ctrls, "dial", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_arc_ctrls, "dial", true) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "dial", true) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( neogeo_imaze, neogeo_noslot ) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "irrmaze", true) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( neogeo_kiz4p, neogeo_noslot ) - MCFG_DEVICE_REMOVE("ctrl1") - MCFG_DEVICE_REMOVE("ctrl2") - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_kiz4p, "kiz4p", true) - MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_kiz4p, "kiz4p", true) + MCFG_DEVICE_REMOVE("edge") + MCFG_NEOGEO_CONTROL_EDGE_CONNECTOR_ADD("edge", neogeo_arc_edge_fixed, "kiz4p", true) MACHINE_CONFIG_END -// this is used by V-Liner and Irritating Maze, which handle differently inputs... +// this is used by V-Liner, which handles differently inputs... static MACHINE_CONFIG_DERIVED( neogeo_noctrl, neogeo_noslot ) MCFG_DEVICE_REMOVE("ctrl1") MCFG_DEVICE_REMOVE("ctrl2") @@ -224,19 +239,6 @@ static INPUT_PORTS_START( irrmaze ) PORT_MODIFY("SYSTEM") PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("BUTTONS") - PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - - PORT_START("TRACK_X") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE - - PORT_START("TRACK_Y") - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(10) PORT_KEYDELTA(20) PORT_REVERSE INPUT_PORTS_END static INPUT_PORTS_START( vliner ) @@ -8861,17 +8863,6 @@ DRIVER_INIT_MEMBER(neogeo_noslot_state,jockeygp) // m_maincpu->space(AS_PROGRAM).install_read_port(0x2c0000, 0x2c0001, "IN6"); } - -DRIVER_INIT_MEMBER(neogeo_noslot_state,irrmaze) -{ - if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); - - m_sprgen->m_fixed_layer_bank_type = 0; - - m_maincpu->space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, 0, 0x01ff7e, read16_delegate(FUNC(neogeo_state::irrmaze_in0_r), this)); - m_maincpu->space(AS_PROGRAM).install_read_port(0x340000, 0x340001, 0, 0x01fffe, "BUTTONS"); -} - DRIVER_INIT_MEMBER(neogeo_noslot_state,vliner) { if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes()); @@ -9676,7 +9667,7 @@ GAME( 1997, kog, kof97, neogeo_kog, neogeo, neogeo_noslot_kog_sta GAME( 1997, lastblad, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGM-2340)", MACHINE_SUPPORTS_SAVE ) GAME( 1997, lastbladh, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGH-2340)", MACHINE_SUPPORTS_SAVE ) GAME( 1997, lastsold, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Soldier (Korean release of The Last Blade)", MACHINE_SUPPORTS_SAVE ) -GAME( 1997, irrmaze, neogeo, neogeo_noctrl, irrmaze, neogeo_noslot_state, irrmaze, ROT0, "SNK / Saurus", "The Irritating Maze / Ultra Denryu Iraira Bou", MACHINE_SUPPORTS_SAVE ) +GAME( 1997, irrmaze, neogeo, neogeo_imaze, irrmaze, neogeo_state, neogeo, ROT0, "SNK / Saurus", "The Irritating Maze / Ultra Denryu Iraira Bou", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers / Real Bout Garou Densetsu 2 - the newcomers (NGM-2400)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2h, rbff2, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers / Real Bout Garou Densetsu 2 - the newcomers (NGH-2400)", MACHINE_SUPPORTS_SAVE ) GAME( 1998, rbff2k, rbff2, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "Real Bout Fatal Fury 2 - The Newcomers (Korean release)", MACHINE_SUPPORTS_SAVE ) // no Japanese title / mode diff --git a/src/mame/drivers/ng_aes.cpp b/src/mame/drivers/ng_aes.cpp index 7d9c822a893..dacd14c15fb 100644 --- a/src/mame/drivers/ng_aes.cpp +++ b/src/mame/drivers/ng_aes.cpp @@ -140,7 +140,6 @@ void ng_aes_state::common_machine_start() save_item(NAME(m_irq3_pending)); save_item(NAME(m_audio_cpu_nmi_enabled)); save_item(NAME(m_audio_cpu_nmi_pending)); - save_item(NAME(m_controller_select)); save_item(NAME(m_use_cart_vectors)); save_item(NAME(m_use_cart_audio)); //save_item(NAME(m_main_cpu_bank_address)); diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index a57731436cc..3994a818796 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -52,6 +52,7 @@ public: m_dsw(*this, "DSW"), m_trackx(*this, "TRACK_X"), m_tracky(*this, "TRACK_Y"), + m_edge(*this, "edge"), m_ctrl1(*this, "ctrl1"), m_ctrl2(*this, "ctrl2"), m_sprgen(*this, "spritegen"), @@ -81,7 +82,7 @@ public: DECLARE_WRITE16_MEMBER(neogeo_video_register_w); READ16_MEMBER(banked_vectors_r); DECLARE_READ16_MEMBER(in0_r); - DECLARE_READ16_MEMBER(irrmaze_in0_r); + DECLARE_READ16_MEMBER(in1_r); void set_slot_number(int slot); @@ -161,7 +162,6 @@ protected: enum {NEOGEO_MVS, NEOGEO_AES, NEOGEO_CD} m_type; // internal state - UINT8 m_controller_select; bool m_recurse; bool m_audio_cpu_nmi_enabled; bool m_audio_cpu_nmi_pending; @@ -177,6 +177,7 @@ protected: optional_ioport m_dsw; optional_ioport m_trackx; optional_ioport m_tracky; + optional_device m_edge; optional_device m_ctrl1; optional_device m_ctrl2;