diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/bus/nes_ctrl/ctrl.cpp | 3 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/joypad.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/snesadapter.cpp | 72 | ||||
-rw-r--r-- | src/devices/bus/nes_ctrl/snesadapter.h | 46 | ||||
-rw-r--r-- | src/devices/bus/snes_ctrl/joypad.cpp | 16 | ||||
-rw-r--r-- | src/devices/bus/snes_ctrl/mouse.cpp | 4 |
6 files changed, 132 insertions, 11 deletions
diff --git a/src/devices/bus/nes_ctrl/ctrl.cpp b/src/devices/bus/nes_ctrl/ctrl.cpp index 5fe4d386b1a..345a0ba0e34 100644 --- a/src/devices/bus/nes_ctrl/ctrl.cpp +++ b/src/devices/bus/nes_ctrl/ctrl.cpp @@ -58,6 +58,7 @@ #include "pachinko.h" #include "partytap.h" #include "powerpad.h" +#include "snesadapter.h" #include "suborkey.h" #include "zapper.h" @@ -182,6 +183,7 @@ void nes_control_port1_devices(device_slot_interface &device) device.option_add("zapper", NES_ZAPPER); device.option_add("4score_p1p3", NES_4SCORE_P1P3); device.option_add("miracle_piano", NES_MIRACLE); + device.option_add("snes_adapter", NES_SNESADAPTER); } void nes_control_port2_devices(device_slot_interface &device) @@ -191,6 +193,7 @@ void nes_control_port2_devices(device_slot_interface &device) device.option_add("vaus", NES_ARKPADDLE); device.option_add("powerpad", NES_POWERPAD); device.option_add("4score_p2p4", NES_4SCORE_P2P4); + device.option_add("snes_adapter", NES_SNESADAPTER); } void fc_control_port1_devices(device_slot_interface &device) diff --git a/src/devices/bus/nes_ctrl/joypad.cpp b/src/devices/bus/nes_ctrl/joypad.cpp index be4d1b9d02f..4bc2c9e38e1 100644 --- a/src/devices/bus/nes_ctrl/joypad.cpp +++ b/src/devices/bus/nes_ctrl/joypad.cpp @@ -70,7 +70,7 @@ static INPUT_PORTS_START( nes_fcpad_p2 ) PORT_START("MIC") PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Microphone") PORT_CODE(KEYCODE_M) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("%p Microphone") INPUT_PORTS_END static INPUT_PORTS_START( nes_ccpad_left ) diff --git a/src/devices/bus/nes_ctrl/snesadapter.cpp b/src/devices/bus/nes_ctrl/snesadapter.cpp new file mode 100644 index 00000000000..8b26824a80d --- /dev/null +++ b/src/devices/bus/nes_ctrl/snesadapter.cpp @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:kmg +/********************************************************************** + + Nintendo Family Computer & Entertainment System SNES controller port adapter + +**********************************************************************/ + +#include "emu.h" +#include "snesadapter.h" +// slot devices +#include "bus/snes_ctrl/joypad.h" +#include "bus/snes_ctrl/mouse.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(NES_SNESADAPTER, nes_snesadapter_device, "nes_snesadapter", "SNES Controller Port Adapter") + + +static void snes_controllers(device_slot_interface &device) +{ + device.option_add("snes_joypad", SNES_JOYPAD); + device.option_add("snes_mouse", SNES_MOUSE); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void nes_snesadapter_device::device_add_mconfig(machine_config &config) +{ + SNES_CONTROL_PORT(config, m_snesctrl, snes_controllers, nullptr); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// nes_snesadapter_device - constructor +//------------------------------------------------- + +nes_snesadapter_device::nes_snesadapter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, NES_SNESADAPTER, tag, owner, clock) + , device_nes_control_port_interface(mconfig, *this) + , m_snesctrl(*this, "port") +{ +} + + +//------------------------------------------------- +// read +//------------------------------------------------- + +u8 nes_snesadapter_device::read_bit0() +{ + return m_snesctrl->read_pin4(); +} + +//------------------------------------------------- +// write +//------------------------------------------------- + +void nes_snesadapter_device::write(u8 data) +{ + m_snesctrl->write_strobe(data); +} diff --git a/src/devices/bus/nes_ctrl/snesadapter.h b/src/devices/bus/nes_ctrl/snesadapter.h new file mode 100644 index 00000000000..777b7881206 --- /dev/null +++ b/src/devices/bus/nes_ctrl/snesadapter.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:kmg +/********************************************************************** + + Nintendo Family Computer & Entertainment System SNES controller port adapter + +**********************************************************************/ + +#ifndef MAME_BUS_NES_CTRL_SNESADAPTER_H +#define MAME_BUS_NES_CTRL_SNESADAPTER_H + +#pragma once + +#include "ctrl.h" +#include "bus/snes_ctrl/ctrl.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> nes_snesadapter_device + +class nes_snesadapter_device : public device_t, public device_nes_control_port_interface +{ +public: + // construction/destruction + nes_snesadapter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + // device-level overrides + virtual void device_start() override { } + virtual void device_add_mconfig(machine_config &config) override; + + virtual u8 read_bit0() override; + virtual void write(u8 data) override; + +private: + required_device<snes_control_port_device> m_snesctrl; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(NES_SNESADAPTER, nes_snesadapter_device) + +#endif // MAME_BUS_NES_CTRL_SNESADAPTER_H diff --git a/src/devices/bus/snes_ctrl/joypad.cpp b/src/devices/bus/snes_ctrl/joypad.cpp index 359cb4cec53..b421ba1de11 100644 --- a/src/devices/bus/snes_ctrl/joypad.cpp +++ b/src/devices/bus/snes_ctrl/joypad.cpp @@ -18,18 +18,18 @@ DEFINE_DEVICE_TYPE(SNES_JOYPAD, snes_joypad_device, "snes_joypad", "Nintendo SNE static INPUT_PORTS_START( snes_joypad ) PORT_START("JOYPAD") - PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("B") - PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Y") - PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SELECT ) PORT_NAME("Select") - PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START ) PORT_NAME("Start") + PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("%p B") + PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("%p Y") + PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SELECT ) + PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START ) PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("A") - PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("X") - PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("L") - PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("R") + PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("%p A") + PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("%p X") + PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("%p L") + PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("%p R") PORT_BIT( 0xf000, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END diff --git a/src/devices/bus/snes_ctrl/mouse.cpp b/src/devices/bus/snes_ctrl/mouse.cpp index 636a4f3f640..24e3e13ba23 100644 --- a/src/devices/bus/snes_ctrl/mouse.cpp +++ b/src/devices/bus/snes_ctrl/mouse.cpp @@ -31,11 +31,11 @@ static INPUT_PORTS_START( snes_mouse ) // due to the relative nature of movement detection in SNES mouse, when we wrap the system would // detect a sudden jump in the wrong direction, making the usage unfriendly... PORT_START("MOUSE_X") - PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_NAME("Superscope X Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5) + PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_NAME("Mouse X Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5) // PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(30) PORT_KEYDELTA(5) PORT_START("MOUSE_Y") - PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_Y) PORT_NAME("Superscope Y Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5) + PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_Y) PORT_NAME("Mouse Y Axis") PORT_SENSITIVITY(30) PORT_KEYDELTA(5) // PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(30) PORT_KEYDELTA(5) INPUT_PORTS_END |