diff options
author | 2016-04-13 23:31:07 +0200 | |
---|---|---|
committer | 2016-04-13 23:31:07 +0200 | |
commit | af570db2d03fcdddcae52a7aa637e1f5c9b37b5d (patch) | |
tree | 50b889a40a2d5938ad708c2e332055008e0628fa /src/devices/bus/neogeo_ctrl/joystick.cpp | |
parent | 1c80bbd4352e4a4e0e55aad292e9e7d30e80147e (diff) |
ng_aes.cpp: converted AES controllers to work through slot devices.
Also, separated more clearly the CD component by the base unit. [Fabio Priuli]
Diffstat (limited to 'src/devices/bus/neogeo_ctrl/joystick.cpp')
-rw-r--r-- | src/devices/bus/neogeo_ctrl/joystick.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/devices/bus/neogeo_ctrl/joystick.cpp b/src/devices/bus/neogeo_ctrl/joystick.cpp new file mode 100644 index 00000000000..dc884138413 --- /dev/null +++ b/src/devices/bus/neogeo_ctrl/joystick.cpp @@ -0,0 +1,99 @@ +// license:BSD-3-Clause +// copyright-holders:Fabio Priuli +/********************************************************************** + + SNK Neo Geo Joystick emulation + +**********************************************************************/ + +#include "joystick.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type NEOGEO_JOYSTICK = &device_creator<neogeo_joystick_device>; + + +static INPUT_PORTS_START( neogeo_joy ) + PORT_START("JOY") + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) + + PORT_START("START_SELECT") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SELECT ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor neogeo_joystick_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( neogeo_joy ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// neogeo_joystick_device - constructor +//------------------------------------------------- + +neogeo_joystick_device::neogeo_joystick_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, NEOGEO_JOYSTICK, "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 +//------------------------------------------------- + +UINT16 neogeo_joystick_device::read_ctrl() +{ + return m_joy->read(); +} + +//------------------------------------------------- +// read_start_sel +//------------------------------------------------- + +UINT8 neogeo_joystick_device::read_start_sel() +{ + return m_ss->read(); +} + |