summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author 0kmg <9137159+0kmg@users.noreply.github.com>2021-11-19 05:27:39 -0900
committer GitHub <noreply@github.com>2021-11-20 01:27:39 +1100
commit2b3337f90b00cdf86b5db4ff35ebae531090ed36 (patch)
tree5ed813be811a093c933d70d55330066ecf9445e7
parenteac8c16a58f77e85fa9d92aaa7ef1058eba46533 (diff)
bus/nes_ctrl: Added support for Exciting Boxing air bag controller. (#8817)
Software list items promoted to working (nes.xml) --------------------------------------- Exciting Boxing (Japan)
-rw-r--r--hash/nes.xml4
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/nes_ctrl/ctrl.cpp2
-rw-r--r--src/devices/bus/nes_ctrl/konamibag.cpp88
-rw-r--r--src/devices/bus/nes_ctrl/konamibag.h52
5 files changed, 146 insertions, 2 deletions
diff --git a/hash/nes.xml b/hash/nes.xml
index 682367fd6eb..35c0e8c32c8 100644
--- a/hash/nes.xml
+++ b/hash/nes.xml
@@ -11312,8 +11312,7 @@ license:CC0
</part>
</software>
-<!-- This game uses an unemulated punching bag controller -->
- <software name="exboxing" supported="no">
+ <software name="exboxing" supported="partial">
<description>Exciting Boxing (Japan)</description>
<year>1987</year>
<publisher>Konami</publisher>
@@ -11323,6 +11322,7 @@ license:CC0
<part name="cart" interface="nes_cart">
<feature name="slot" value="vrc1" />
<feature name="pcb" value="KONAMI-VRC-1" />
+ <feature name="peripheral" value="konami_airbag" />
<dataarea name="prg" size="131072">
<rom name="rc250j0p" size="131072" crc="786148b6" sha1="20cba7316cb907d7a6245c598640ce7aca56f30a" offset="00000" />
</dataarea>
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 09d5be58091..faec58fef07 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -2998,6 +2998,8 @@ if (BUSES["NES_CTRL"]~=null) then
MAME_DIR .. "src/devices/bus/nes_ctrl/fcmat.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/hori.cpp",
MAME_DIR .. "src/devices/bus/nes_ctrl/hori.h",
+ MAME_DIR .. "src/devices/bus/nes_ctrl/konamibag.cpp",
+ MAME_DIR .. "src/devices/bus/nes_ctrl/konamibag.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamihs.cpp",
MAME_DIR .. "src/devices/bus/nes_ctrl/konamihs.h",
MAME_DIR .. "src/devices/bus/nes_ctrl/miracle.cpp",
diff --git a/src/devices/bus/nes_ctrl/ctrl.cpp b/src/devices/bus/nes_ctrl/ctrl.cpp
index 91c0f3376d0..1f4f0274687 100644
--- a/src/devices/bus/nes_ctrl/ctrl.cpp
+++ b/src/devices/bus/nes_ctrl/ctrl.cpp
@@ -51,6 +51,7 @@
#include "fcmat.h"
#include "hori.h"
#include "joypad.h"
+#include "konamibag.h"
#include "konamihs.h"
#include "miracle.h"
#include "mjpanel.h"
@@ -205,6 +206,7 @@ void fc_expansion_devices(device_slot_interface &device)
device.option_add("bandaihs", NES_BANDAIHS);
device.option_add("vaus", NES_ARKPADDLE_FC);
device.option_add("family_trainer", NES_FTRAINER);
+ device.option_add("konamibag", NES_KONAMIBAG);
device.option_add("konamihs", NES_KONAMIHS);
device.option_add("konami_piano", NES_DOREPIANO);
device.option_add("mj_panel", NES_MJPANEL);
diff --git a/src/devices/bus/nes_ctrl/konamibag.cpp b/src/devices/bus/nes_ctrl/konamibag.cpp
new file mode 100644
index 00000000000..26620dfe5ce
--- /dev/null
+++ b/src/devices/bus/nes_ctrl/konamibag.cpp
@@ -0,0 +1,88 @@
+// license:BSD-3-Clause
+// copyright-holders:kmg, Fabio Priuli
+/**********************************************************************
+
+ Nintendo Family Computer - Konami Exciting Boxing Air Bag
+
+**********************************************************************/
+
+#include "emu.h"
+#include "konamibag.h"
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+DEFINE_DEVICE_TYPE(NES_KONAMIBAG, nes_konamibag_device, "nes_konamibag", "Konami Exciting Boxing Air Bag")
+
+
+static INPUT_PORTS_START( nes_konamibag )
+ PORT_START("BAG.0")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Left Hook")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) // opponent dodges right, unclear how this is triggered
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // opponent dodges left, unclear how this is triggered
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Right Hook")
+
+ PORT_START("BAG.1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Left Jab")
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Body")
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Right Jab")
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Straight")
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor nes_konamibag_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( nes_konamibag );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// nes_konamibag_device - constructor
+//-------------------------------------------------
+
+nes_konamibag_device::nes_konamibag_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : device_t(mconfig, NES_KONAMIBAG, tag, owner, clock)
+ , device_nes_control_port_interface(mconfig, *this)
+ , m_sensor(*this, "BAG.%u", 0)
+ , m_cur_sensor(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start
+//-------------------------------------------------
+
+void nes_konamibag_device::device_start()
+{
+ save_item(NAME(m_cur_sensor));
+}
+
+
+//-------------------------------------------------
+// read
+//-------------------------------------------------
+
+u8 nes_konamibag_device::read_exp(offs_t offset)
+{
+ return (offset == 1) ? m_sensor[m_cur_sensor]->read() << 1 : 0;
+}
+
+//-------------------------------------------------
+// write
+//-------------------------------------------------
+
+void nes_konamibag_device::write(u8 data)
+{
+ m_cur_sensor = BIT(data, 1);
+}
diff --git a/src/devices/bus/nes_ctrl/konamibag.h b/src/devices/bus/nes_ctrl/konamibag.h
new file mode 100644
index 00000000000..ed5f11a764b
--- /dev/null
+++ b/src/devices/bus/nes_ctrl/konamibag.h
@@ -0,0 +1,52 @@
+// license:BSD-3-Clause
+// copyright-holders:kmg, Fabio Priuli
+/**********************************************************************
+
+ Nintendo Family Computer - Konami Exciting Boxing Air Bag
+
+**********************************************************************/
+
+#ifndef MAME_BUS_NES_CTRL_KONAMIBAG_H
+#define MAME_BUS_NES_CTRL_KONAMIBAG_H
+
+#pragma once
+
+#include "ctrl.h"
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> nes_konamibag_device
+
+class nes_konamibag_device :
+ public device_t,
+ public device_nes_control_port_interface
+{
+public:
+ static constexpr feature_type imperfect_features() { return feature::CONTROLS; }
+
+ // construction/destruction
+ nes_konamibag_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ virtual ioport_constructor device_input_ports() const override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+
+ virtual u8 read_exp(offs_t offset) override;
+ virtual void write(u8 data) override;
+
+private:
+ required_ioport_array<2> m_sensor;
+ u8 m_cur_sensor;
+};
+
+
+// device type definition
+DECLARE_DEVICE_TYPE(NES_KONAMIBAG, nes_konamibag_device)
+
+
+#endif // MAME_BUS_NES_CTRL_KONAMIBAG_H