summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/bw2exp.c
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2012-11-16 18:34:35 +0000
committer Curt Coder <curtcoder@mail.com>2012-11-16 18:34:35 +0000
commit954c61d7c84f1a88a4c01b9c531cc1544cc3fb6c (patch)
tree102b9ebe0a6c2534bb562f6ab257d83ebbd8bcb1 /src/mess/machine/bw2exp.c
parent51346049f6c64444a859460bbd5e49d37eec2ef6 (diff)
(MESS) bw2: Added expansion slot interface and RAMCARD expansion device. [Curt Coder]
Diffstat (limited to 'src/mess/machine/bw2exp.c')
-rw-r--r--src/mess/machine/bw2exp.c188
1 files changed, 188 insertions, 0 deletions
diff --git a/src/mess/machine/bw2exp.c b/src/mess/machine/bw2exp.c
new file mode 100644
index 00000000000..fa41befb470
--- /dev/null
+++ b/src/mess/machine/bw2exp.c
@@ -0,0 +1,188 @@
+/**********************************************************************
+
+ Bondwell 2 Expansion Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "machine/bw2exp.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type BW2_EXPANSION_SLOT = &device_creator<bw2_expansion_slot_device>;
+
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_bw2_expansion_slot_interface - constructor
+//-------------------------------------------------
+
+device_bw2_expansion_slot_interface::device_bw2_expansion_slot_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+ m_slot = dynamic_cast<bw2_expansion_slot_device *>(device.owner());
+}
+
+
+//-------------------------------------------------
+// ~device_bw2_expansion_slot_interface - destructor
+//-------------------------------------------------
+
+device_bw2_expansion_slot_interface::~device_bw2_expansion_slot_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// bw2_expansion_slot_device - constructor
+//-------------------------------------------------
+
+bw2_expansion_slot_device::bw2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, BW2_EXPANSION_SLOT, "Bondwell 2 expansion port", tag, owner, clock),
+ device_slot_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// bw2_expansion_slot_device - destructor
+//-------------------------------------------------
+
+bw2_expansion_slot_device::~bw2_expansion_slot_device()
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bw2_expansion_slot_device::device_start()
+{
+ m_cart = dynamic_cast<device_bw2_expansion_slot_interface *>(get_card_device());
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void bw2_expansion_slot_device::device_reset()
+{
+ if (m_cart != NULL)
+ {
+ m_cart->device().reset();
+ }
+}
+
+
+//-------------------------------------------------
+// cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 bw2_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
+{
+ if (m_cart != NULL)
+ {
+ data = m_cart->bw2_cd_r(space, offset, data, ram2, ram3, ram4, ram5, ram6);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// cd_w - cartridge data write
+//-------------------------------------------------
+
+void bw2_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
+{
+ if (m_cart != NULL)
+ {
+ m_cart->bw2_cd_w(space, offset, data, ram2, ram3, ram4, ram5, ram6);
+ }
+}
+
+
+//-------------------------------------------------
+// slot_r - slot read
+//-------------------------------------------------
+
+READ8_MEMBER( bw2_expansion_slot_device::slot_r )
+{
+ UINT8 data = 0xff;
+
+ if (m_cart != NULL)
+ {
+ data = m_cart->bw2_slot_r(space, offset);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// slot_w - slot write
+//-------------------------------------------------
+
+WRITE8_MEMBER( bw2_expansion_slot_device::slot_w )
+{
+ if (m_cart != NULL)
+ {
+ m_cart->bw2_slot_w(space, offset, data);
+ }
+}
+
+
+//-------------------------------------------------
+// modsel_r - modsel read
+//-------------------------------------------------
+
+READ8_MEMBER( bw2_expansion_slot_device::modsel_r )
+{
+ UINT8 data = 0xff;
+
+ if (m_cart != NULL)
+ {
+ data = m_cart->bw2_modsel_r(space, offset);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// modsel_w - modsel write
+//-------------------------------------------------
+
+WRITE8_MEMBER( bw2_expansion_slot_device::modsel_w )
+{
+ if (m_cart != NULL)
+ {
+ m_cart->bw2_modsel_w(space, offset, data);
+ }
+}
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( bw2_expansion_cards )
+//-------------------------------------------------
+
+SLOT_INTERFACE_START( bw2_expansion_cards )
+ SLOT_INTERFACE("ramcard", BW2_RAMCARD)
+SLOT_INTERFACE_END