summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes_ctrl/ctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes_ctrl/ctrl.cpp')
-rw-r--r--src/devices/bus/nes_ctrl/ctrl.cpp77
1 files changed, 57 insertions, 20 deletions
diff --git a/src/devices/bus/nes_ctrl/ctrl.cpp b/src/devices/bus/nes_ctrl/ctrl.cpp
index 1f4f0274687..4f508cac556 100644
--- a/src/devices/bus/nes_ctrl/ctrl.cpp
+++ b/src/devices/bus/nes_ctrl/ctrl.cpp
@@ -6,18 +6,18 @@
and Family Computer expansion port emulation
Here we emulate in fact 3 different kind of ports, which are
- connected to different bis of memory locations $4016 and $4017:
+ connected to different bits of memory locations $4016 and $4017:
- NES controller ports: these are hooked to bit 0,3,4 of the
corresponding address ($4016 for port1, $4017 for port2)
- FC controller ports: these are only hooked to bit 0 of the
corresponding address (so that e.g. a NES Zapper could not
be connected to a later FC AV model, because its inputs
would not be detected)
- - FC expansion port: this is hooked to bits 0-4 of both addresses
- To make things a little bit more complex, old FC models have the
- controller hardwired to the unit, and the P2 controllers are
- directly hooked also to one of the expansion port lines (namely,
- microphone inputs from P2 go to $4016 bit 2)
+ - FC expansion port: this is hooked to bit 1 of memory location
+ $4016 and bits 0-4 of $4017
+ To make things a little bit more complex, old FC models have
+ controllers hardwired to the unit, and the P2 controllers are
+ directly hooked to bit 2 of $4016 (for microphone inputs).
Even if the controller port and the expansion port are
physically different (the FC expansion is a 15pin port, while
@@ -35,16 +35,18 @@
handlers they have hooks for: Basic usage is that the expansion
port calls read_exp, FC ctrl ports call read_bit0, and NES ctrl
ports call both read_bit0 and read_bit34. However, to cope with
- the original FC microphone, we will have the second controller
- port calling read_exp too.
+ the original FC microphone, we have a one-off read_bit2 handler
+ called by the second controller.
**********************************************************************/
#include "emu.h"
#include "ctrl.h"
+
// slot devices
#include "4score.h"
#include "arkpaddle.h"
+#include "bandaihs.h"
#include "bcbattle.h"
#include "dorepiano.h"
#include "fckeybrd.h"
@@ -58,7 +60,11 @@
#include "pachinko.h"
#include "partytap.h"
#include "powerpad.h"
+#include "rob.h"
+#include "sharpcass.h"
+#include "snesadapter.h"
#include "suborkey.h"
+#include "turbofile.h"
#include "zapper.h"
@@ -78,8 +84,9 @@ DEFINE_DEVICE_TYPE(NES_CONTROL_PORT, nes_control_port_device, "nes_control_port"
// device_nes_control_port_interface - constructor
//-------------------------------------------------
-device_nes_control_port_interface::device_nes_control_port_interface(const machine_config &mconfig, device_t &device) :
- device_interface(device, "nesctrl")
+device_nes_control_port_interface::device_nes_control_port_interface(const machine_config &mconfig, device_t &device)
+ : device_interface(device, "nesctrl")
+ , m_strobe(0)
{
m_port = dynamic_cast<nes_control_port_device *>(device.owner());
}
@@ -103,7 +110,7 @@ device_nes_control_port_interface::~device_nes_control_port_interface()
// nes_control_port_device - constructor
//-------------------------------------------------
-nes_control_port_device::nes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+nes_control_port_device::nes_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, NES_CONTROL_PORT, tag, owner, clock),
device_single_card_slot_interface<device_nes_control_port_interface>(mconfig, *this),
m_screen(*this, finder_base::DUMMY_TAG),
@@ -131,31 +138,39 @@ void nes_control_port_device::device_start()
}
-uint8_t nes_control_port_device::read_bit0()
+u8 nes_control_port_device::read_bit0()
{
- uint8_t data = 0;
+ u8 data = 0;
if (m_device)
data = m_device->read_bit0();
return data;
}
-uint8_t nes_control_port_device::read_bit34()
+u8 nes_control_port_device::read_bit2()
+{
+ u8 data = 0;
+ if (m_device)
+ data = m_device->read_bit2();
+ return data;
+}
+
+u8 nes_control_port_device::read_bit34()
{
- uint8_t data = 0;
+ u8 data = 0;
if (m_device)
data = m_device->read_bit34();
return data;
}
-uint8_t nes_control_port_device::read_exp(offs_t offset)
+u8 nes_control_port_device::read_exp(offs_t offset)
{
- uint8_t data = 0;
+ u8 data = 0;
if (m_device)
data = m_device->read_exp(offset);
return data;
}
-void nes_control_port_device::write(uint8_t data)
+void nes_control_port_device::write(u8 data)
{
if (m_device)
m_device->write(data);
@@ -173,6 +188,8 @@ 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);
+ device.option_add("vboy", NES_VBOYCTRL);
}
void nes_control_port2_devices(device_slot_interface &device)
@@ -182,6 +199,13 @@ 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);
+ device.option_add("vboy", NES_VBOYCTRL);
+}
+
+void nes_control_special_devices(device_slot_interface &device)
+{
+ device.option_add("rob", NES_ROB);
}
void fc_control_port1_devices(device_slot_interface &device)
@@ -199,9 +223,10 @@ void fc_control_port2_devices(device_slot_interface &device)
void fc_expansion_devices(device_slot_interface &device)
{
- device.option_add("joypad", NES_JOYPAD);
+ device.option_add("joypad", NES_FCPAD_EXP);
device.option_add("arcstick", NES_ARCSTICK);
device.option_add("fc_keyboard", NES_FCKEYBOARD);
+ device.option_add("sharp_cassette", NES_SHARPCASS);
device.option_add("zapper", NES_ZAPPER);
device.option_add("bandaihs", NES_BANDAIHS);
device.option_add("vaus", NES_ARKPADDLE_FC);
@@ -209,7 +234,7 @@ void fc_expansion_devices(device_slot_interface &device)
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);
+ device.option_add("mahjong", NES_MJPANEL);
device.option_add("pachinko", NES_PACHINKO);
device.option_add("partytap", NES_PARTYTAP);
device.option_add("hori_twin", NES_HORITWIN);
@@ -217,4 +242,16 @@ void fc_expansion_devices(device_slot_interface &device)
device.option_add("barcode_battler", NES_BARCODE_BATTLER);
device.option_add("subor_keyboard", NES_SUBORKEYBOARD);
device.option_add("taptapmat", NES_TAPTAPMAT);
+ device.option_add("turbofile", NES_TURBOFILE);
+}
+
+void famibox_control_port12_devices(device_slot_interface &device)
+{
+ device.option_add("joypad", NES_JOYPAD);
+ device.option_add("zapper", NES_ZAPPER);
+}
+
+void famibox_control_port3_devices(device_slot_interface &device)
+{
+ device.option_add("zapper", NES_ZAPPER);
}