summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/sms_ctrl/smsctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/sms_ctrl/smsctrl.cpp')
-rw-r--r--src/devices/bus/sms_ctrl/smsctrl.cpp106
1 files changed, 23 insertions, 83 deletions
diff --git a/src/devices/bus/sms_ctrl/smsctrl.cpp b/src/devices/bus/sms_ctrl/smsctrl.cpp
index a2c117dcb74..7323a77bec9 100644
--- a/src/devices/bus/sms_ctrl/smsctrl.cpp
+++ b/src/devices/bus/sms_ctrl/smsctrl.cpp
@@ -1,132 +1,72 @@
// license:BSD-3-Clause
-// copyright-holders:Fabio Priuli
+// copyright-holders:Vas Crabb
/**********************************************************************
- Sega Master System controller port emulation
+ Sega 7-bit I/O port emulation
**********************************************************************/
#include "emu.h"
-#include "screen.h"
#include "smsctrl.h"
-// slot devices
-#include "joypad.h"
-#include "lphaser.h"
-#include "paddle.h"
-#include "sports.h"
-#include "sportsjp.h"
-#include "rfu.h"
-#include "multitap.h"
-#include "graphic.h"
-
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
-DEFINE_DEVICE_TYPE(SMS_CONTROL_PORT, sms_control_port_device, "sms_control_port", "Sega SMS controller port")
+DEFINE_DEVICE_TYPE(SMS_CONTROL_PORT, sms_control_port_device, "sms_control_port", "Sega 9-pin I/O port")
//**************************************************************************
-// CARD INTERFACE
+// CONTROLLER INTERFACE
//**************************************************************************
-//-------------------------------------------------
-// device_sms_control_port_interface - constructor
-//-------------------------------------------------
-
-device_sms_control_port_interface::device_sms_control_port_interface(const machine_config &mconfig, device_t &device)
- : device_slot_card_interface(mconfig,device)
+device_sms_control_interface::device_sms_control_interface(machine_config const &mconfig, device_t &device) :
+ device_interface(device, "smsctrl"),
+ m_port(dynamic_cast<sms_control_port_device *>(device.owner()))
{
- m_port = dynamic_cast<sms_control_port_device *>(device.owner());
}
-//-------------------------------------------------
-// ~device_sms_control_port_interface - destructor
-//-------------------------------------------------
-
-device_sms_control_port_interface::~device_sms_control_port_interface()
+device_sms_control_interface::~device_sms_control_interface()
{
}
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// sms_control_port_device - constructor
-//-------------------------------------------------
-
-sms_control_port_device::sms_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, SMS_CONTROL_PORT, tag, owner, clock),
- device_slot_interface(mconfig, *this),
- m_screen(*this, finder_base::DUMMY_TAG),
- m_device(nullptr),
- m_th_pin_handler(*this)
+u8 device_sms_control_interface::in_r()
{
+ return 0xff;
}
-//-------------------------------------------------
-// sms_control_port_device - destructor
-//-------------------------------------------------
-
-sms_control_port_device::~sms_control_port_device()
+void device_sms_control_interface::out_w(u8 data, u8 mem_mask)
{
}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
-void sms_control_port_device::device_start()
-{
- m_device = dynamic_cast<device_sms_control_port_interface *>(get_card_device());
-
- m_th_pin_handler.resolve_safe();
-}
-
-
-uint8_t sms_control_port_device::port_r()
-{
- uint8_t data = 0xff;
- if (m_device)
- data = m_device->peripheral_r();
- return data;
-}
+//**************************************************************************
+// SLOT DEVICE
+//**************************************************************************
-void sms_control_port_device::port_w( uint8_t data )
+sms_control_port_device::sms_control_port_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock) :
+ device_t(mconfig, SMS_CONTROL_PORT, tag, owner, clock),
+ device_single_card_slot_interface<device_sms_control_interface>(mconfig, *this),
+ m_screen(*this, finder_base::DUMMY_TAG),
+ m_th_handler(*this),
+ m_controller(nullptr)
{
- if (m_device)
- m_device->peripheral_w(data);
}
-void sms_control_port_device::th_pin_w(int state)
+sms_control_port_device::~sms_control_port_device()
{
- m_th_pin_handler(state);
}
-//-------------------------------------------------
-// SLOT_INTERFACE( sms_control_port_devices )
-//-------------------------------------------------
-
-void sms_control_port_devices(device_slot_interface &device)
+void sms_control_port_device::device_start()
{
- device.option_add("joypad", SMS_JOYPAD);
- device.option_add("lphaser", SMS_LIGHT_PHASER);
- device.option_add("paddle", SMS_PADDLE);
- device.option_add("sportspad", SMS_SPORTS_PAD);
- device.option_add("sportspadjp", SMS_SPORTS_PAD_JP);
- device.option_add("rapidfire", SMS_RAPID_FIRE);
- device.option_add("multitap", SMS_MULTITAP);
- device.option_add("graphic", SMS_GRAPHIC);
+ m_controller = get_card_device();
}