summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/neogeo_ctrl/ctrl.cpp
diff options
context:
space:
mode:
author etabeta78 <doge.fabio@gmail.com>2016-04-21 09:29:33 +0200
committer etabeta78 <doge.fabio@gmail.com>2016-04-21 09:29:33 +0200
commit057eefd060af60932c338a145df801ebd3c762d1 (patch)
tree1b935dc6adb752e1ad8d4125becbab55f8249414 /src/devices/bus/neogeo_ctrl/ctrl.cpp
parentb1c06acb61c741fc9bcb1bd7428728e291510a39 (diff)
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]
Diffstat (limited to 'src/devices/bus/neogeo_ctrl/ctrl.cpp')
-rw-r--r--src/devices/bus/neogeo_ctrl/ctrl.cpp115
1 files changed, 107 insertions, 8 deletions
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<neogeo_control_port_device>;
+const device_type NEOGEO_CTRL_EDGE_CONNECTOR = &device_creator<neogeo_ctrl_edge_port_device>;
//**************************************************************************
@@ -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<neogeo_ctrl_edge_port_device *>(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;
}
@@ -104,6 +135,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<device_neogeo_ctrl_edge_interface *>(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_END
+
+SLOT_INTERFACE_START( neogeo_arc_edge_fixed )
SLOT_INTERFACE("joy", NEOGEO_JOY_AC)
- SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL_AC)
SLOT_INTERFACE("dial", NEOGEO_DIAL)
+ SLOT_INTERFACE("irrmaze", NEOGEO_IRRMAZE)
+ SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P)
SLOT_INTERFACE_END
-SLOT_INTERFACE_START( neogeo_kiz4p )
- SLOT_INTERFACE("kiz4p", NEOGEO_KIZ4P)
+SLOT_INTERFACE_START( neogeo_arc_pin15 )
+ SLOT_INTERFACE("mahjong", NEOGEO_MJCTRL)
SLOT_INTERFACE_END
+