summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/sms_exp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/bus/sms_exp')
-rw-r--r--src/emu/bus/sms_exp/gender.c105
-rw-r--r--src/emu/bus/sms_exp/gender.h57
-rw-r--r--src/emu/bus/sms_exp/smsexp.c139
-rw-r--r--src/emu/bus/sms_exp/smsexp.h96
4 files changed, 397 insertions, 0 deletions
diff --git a/src/emu/bus/sms_exp/gender.c b/src/emu/bus/sms_exp/gender.c
new file mode 100644
index 00000000000..0b80deb7c68
--- /dev/null
+++ b/src/emu/bus/sms_exp/gender.c
@@ -0,0 +1,105 @@
+/**********************************************************************
+
+ Sega Master System "Gender Adapter" emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "gender.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type SMS_GENDER_ADAPTER = &device_creator<sms_gender_adapter_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// sms_gender_adapter_device - constructor
+//-------------------------------------------------
+
+sms_gender_adapter_device::sms_gender_adapter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, SMS_GENDER_ADAPTER, "Gender Adapter", tag, owner, clock, "sms_gender_adapter", __FILE__),
+ device_sms_expansion_slot_interface(mconfig, *this),
+ m_subslot(*this, "subslot")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sms_gender_adapter_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// read
+//-------------------------------------------------
+
+READ8_MEMBER(sms_gender_adapter_device::read)
+{
+ return m_subslot->read_cart(space, offset);
+}
+
+READ8_MEMBER(sms_gender_adapter_device::read_ram)
+{
+ return m_subslot->read_ram(space, offset);
+}
+
+
+//-------------------------------------------------
+// write
+//-------------------------------------------------
+
+WRITE8_MEMBER(sms_gender_adapter_device::write_mapper)
+{
+ m_subslot->write_mapper(space, offset, data);
+}
+
+WRITE8_MEMBER(sms_gender_adapter_device::write)
+{
+ m_subslot->write_cart(space, offset, data);
+}
+
+WRITE8_MEMBER(sms_gender_adapter_device::write_ram)
+{
+ m_subslot->write_ram(space, offset, data);
+}
+
+static SLOT_INTERFACE_START(sms_cart)
+ SLOT_INTERFACE_INTERNAL("rom", SEGA8_ROM_STD)
+ SLOT_INTERFACE_INTERNAL("codemasters", SEGA8_ROM_CODEMASTERS)
+ SLOT_INTERFACE_INTERNAL("4pak", SEGA8_ROM_4PAK)
+ SLOT_INTERFACE_INTERNAL("zemina", SEGA8_ROM_ZEMINA)
+ SLOT_INTERFACE_INTERNAL("nemesis", SEGA8_ROM_NEMESIS)
+ SLOT_INTERFACE_INTERNAL("janggun", SEGA8_ROM_JANGGUN)
+ SLOT_INTERFACE_INTERNAL("korean", SEGA8_ROM_KOREAN)
+ SLOT_INTERFACE_INTERNAL("korean_nb", SEGA8_ROM_KOREAN_NB)
+SLOT_INTERFACE_END
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( genderadp_slot )
+ MCFG_SMS_CARTRIDGE_ADD("subslot", sms_cart, NULL)
+MACHINE_CONFIG_END
+
+
+machine_config_constructor sms_gender_adapter_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( genderadp_slot );
+}
diff --git a/src/emu/bus/sms_exp/gender.h b/src/emu/bus/sms_exp/gender.h
new file mode 100644
index 00000000000..4458e880688
--- /dev/null
+++ b/src/emu/bus/sms_exp/gender.h
@@ -0,0 +1,57 @@
+/**********************************************************************
+
+ Sega Master System "Gender Adapter" emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SMS_GENDER_ADAPTER__
+#define __SMS_GENDER_ADAPTER__
+
+
+#include "emu.h"
+#include "smsexp.h"
+#include "bus/sega8/sega8_slot.h"
+#include "bus/sega8/rom.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sms_gender_adapter_device
+
+class sms_gender_adapter_device : public device_t,
+ public device_sms_expansion_slot_interface
+{
+public:
+ // construction/destruction
+ sms_gender_adapter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // device_sms_expansion_slot_interface overrides
+ virtual DECLARE_READ8_MEMBER(read);
+ virtual DECLARE_WRITE8_MEMBER(write);
+ virtual DECLARE_WRITE8_MEMBER(write_mapper);
+ virtual DECLARE_READ8_MEMBER(read_ram);
+ virtual DECLARE_WRITE8_MEMBER(write_ram);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+private:
+ required_device<sega8_cart_slot_device> m_subslot;
+};
+
+
+// device type definition
+extern const device_type SMS_GENDER_ADAPTER;
+
+
+#endif
diff --git a/src/emu/bus/sms_exp/smsexp.c b/src/emu/bus/sms_exp/smsexp.c
new file mode 100644
index 00000000000..e1ddb4969f0
--- /dev/null
+++ b/src/emu/bus/sms_exp/smsexp.c
@@ -0,0 +1,139 @@
+/**********************************************************************
+
+ Sega Master System expansion slot emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "smsexp.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type SMS_EXPANSION_SLOT = &device_creator<sms_expansion_slot_device>;
+
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_sms_expansion_slot_interface - constructor
+//-------------------------------------------------
+
+device_sms_expansion_slot_interface::device_sms_expansion_slot_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+}
+
+
+//-------------------------------------------------
+// ~device_sms_expansion_slot_interface - destructor
+//-------------------------------------------------
+
+device_sms_expansion_slot_interface::~device_sms_expansion_slot_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// sms_expansion_slot_device - constructor
+//-------------------------------------------------
+
+sms_expansion_slot_device::sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, SMS_EXPANSION_SLOT, "Sega SMS expansion slot", tag, owner, clock, "sms_expansion_slot", __FILE__),
+ device_slot_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// sms_expansion_slot_device - destructor
+//-------------------------------------------------
+
+sms_expansion_slot_device::~sms_expansion_slot_device()
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void sms_expansion_slot_device::device_start()
+{
+ m_device = dynamic_cast<device_sms_expansion_slot_interface *>(get_card_device());
+}
+
+
+//-------------------------------------------------
+// read
+//-------------------------------------------------
+
+READ8_MEMBER(sms_expansion_slot_device::read)
+{
+ if (m_device)
+ return m_device->read(space, offset);
+ else
+ return 0xff;
+}
+
+READ8_MEMBER(sms_expansion_slot_device::read_ram)
+{
+ if (m_device)
+ return m_device->read_ram(space, offset);
+ else
+ return 0xff;
+}
+
+
+//-------------------------------------------------
+// write
+//-------------------------------------------------
+
+WRITE8_MEMBER(sms_expansion_slot_device::write_mapper)
+{
+ if (m_device)
+ m_device->write_mapper(space, offset, data);
+}
+
+WRITE8_MEMBER(sms_expansion_slot_device::write)
+{
+ if (m_device)
+ m_device->write(space, offset, data);
+}
+
+WRITE8_MEMBER(sms_expansion_slot_device::write_ram)
+{
+ if (m_device)
+ m_device->write_ram(space, offset, data);
+}
+
+int sms_expansion_slot_device::get_lphaser_xoffs()
+{
+ if (m_device)
+ return m_device->get_lphaser_xoffs();
+ else
+ return 0;
+}
+
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( sms_expansion_devices )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( sms_expansion_devices )
+ SLOT_INTERFACE("genderadp", SMS_GENDER_ADAPTER)
+SLOT_INTERFACE_END
diff --git a/src/emu/bus/sms_exp/smsexp.h b/src/emu/bus/sms_exp/smsexp.h
new file mode 100644
index 00000000000..871424aa856
--- /dev/null
+++ b/src/emu/bus/sms_exp/smsexp.h
@@ -0,0 +1,96 @@
+/**********************************************************************
+
+ Sega Master System expansion slot emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************
+
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SMS_EXPANSION_SLOT__
+#define __SMS_EXPANSION_SLOT__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_SMS_EXPANSION_ADD(_tag, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, SMS_EXPANSION_SLOT, 0) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> sms_expansion_slot_device
+
+class device_sms_expansion_slot_interface;
+
+class sms_expansion_slot_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ sms_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~sms_expansion_slot_device();
+
+ // reading and writing
+ DECLARE_READ8_MEMBER(read);
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_WRITE8_MEMBER(write_mapper);
+ DECLARE_READ8_MEMBER(read_ram);
+ DECLARE_WRITE8_MEMBER(write_ram);
+
+ int get_lphaser_xoffs();
+
+ device_sms_expansion_slot_interface *m_device;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+};
+
+
+// ======================> device_sms_expansion_slot_interface
+
+// class representing interface-specific live sms_expansion card
+class device_sms_expansion_slot_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_sms_expansion_slot_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_sms_expansion_slot_interface();
+
+ // reading and writing
+ virtual DECLARE_READ8_MEMBER(read) { return 0xff; };
+ virtual DECLARE_WRITE8_MEMBER(write) { };
+ virtual DECLARE_WRITE8_MEMBER(write_mapper) {};
+ virtual DECLARE_READ8_MEMBER(read_ram) { return 0xff; };
+ virtual DECLARE_WRITE8_MEMBER(write_ram) { };
+
+ virtual int get_lphaser_xoffs() { return 0; };
+};
+
+
+// device type definition
+extern const device_type SMS_EXPANSION_SLOT;
+
+
+// slot devices
+#include "gender.h"
+
+SLOT_INTERFACE_EXTERN( sms_expansion_devices );
+
+
+#endif