summaryrefslogtreecommitdiffstatshomepage
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
parent51346049f6c64444a859460bbd5e49d37eec2ef6 (diff)
(MESS) bw2: Added expansion slot interface and RAMCARD expansion device. [Curt Coder]
-rw-r--r--.gitattributes4
-rw-r--r--src/mess/machine/bw2_ramcard.c129
-rw-r--r--src/mess/machine/bw2_ramcard.h61
-rw-r--r--src/mess/machine/bw2exp.c188
-rw-r--r--src/mess/machine/bw2exp.h135
-rw-r--r--src/mess/mess.mak2
6 files changed, 519 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index 82a4729bfab..9c9ab10e1b6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6641,6 +6641,10 @@ src/mess/machine/bebox.c svneol=native#text/plain
src/mess/machine/beta.c svneol=native#text/plain
src/mess/machine/beta.h svneol=native#text/plain
src/mess/machine/bk.c svneol=native#text/plain
+src/mess/machine/bw2_ramcard.c svneol=native#text/plain
+src/mess/machine/bw2_ramcard.h svneol=native#text/plain
+src/mess/machine/bw2exp.c svneol=native#text/plain
+src/mess/machine/bw2exp.h svneol=native#text/plain
src/mess/machine/c128_comal80.c svneol=native#text/plain
src/mess/machine/c128_comal80.h svneol=native#text/plain
src/mess/machine/c1541.c svneol=native#text/plain
diff --git a/src/mess/machine/bw2_ramcard.c b/src/mess/machine/bw2_ramcard.c
new file mode 100644
index 00000000000..ace56abcd95
--- /dev/null
+++ b/src/mess/machine/bw2_ramcard.c
@@ -0,0 +1,129 @@
+/**********************************************************************
+
+ Bondwell 2 RAMCARD emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "bw2_ramcard.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type BW2_RAMCARD = &device_creator<bw2_ramcard_device>;
+
+
+//-------------------------------------------------
+// ROM( bw2_ramcard )
+//-------------------------------------------------
+
+ROM_START( bw2_ramcard )
+ ROM_REGION( 0x4000, "ramcard", 0 )
+ ROM_LOAD( "ramcard-10.ic10", 0x0000, 0x4000, CRC(68cde1ba) SHA1(a776a27d64f7b857565594beb63aa2cd692dcf04) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *bw2_ramcard_device::device_rom_region() const
+{
+ return ROM_NAME( bw2_ramcard );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// bw2_ramcard_device - constructor
+//-------------------------------------------------
+
+bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, BW2_RAMCARD, "RAMCARD", tag, owner, clock),
+ device_bw2_expansion_slot_interface(mconfig, *this),
+ m_ram(*this, "ram"),
+ m_en(0),
+ m_bank(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void bw2_ramcard_device::device_start()
+{
+ // find memory regions
+ m_rom = memregion("ramcard")->base();
+
+ // allocate memory
+ m_ram.allocate(512 * 1024);
+
+ // state saving
+ save_item(NAME(m_en));
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void bw2_ramcard_device::device_reset()
+{
+ m_en = 0;
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// bw2_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 bw2_ramcard_device::bw2_cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
+{
+ if (!ram2)
+ {
+ data = m_rom[offset & 0x3fff];
+ }
+ else if (m_en && !ram5)
+ {
+ data = m_ram[(m_bank << 15) | offset];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// bw2_cd_r - cartridge data write
+//-------------------------------------------------
+
+void bw2_ramcard_device::bw2_cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6)
+{
+ if (m_en && !ram5)
+ {
+ m_ram[(m_bank << 15) | offset] = data;
+ }
+}
+
+
+//-------------------------------------------------
+// bw2_slot_w - slot write
+//-------------------------------------------------
+
+void bw2_ramcard_device::bw2_slot_w(address_space &space, offs_t offset, UINT8 data)
+{
+ m_en = 1;
+ m_bank = data & 0x0f;
+}
diff --git a/src/mess/machine/bw2_ramcard.h b/src/mess/machine/bw2_ramcard.h
new file mode 100644
index 00000000000..c905cfbcd7f
--- /dev/null
+++ b/src/mess/machine/bw2_ramcard.h
@@ -0,0 +1,61 @@
+/**********************************************************************
+
+ Bondwell 2 RAMCARD emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __BW2_RAMCARD__
+#define __BW2_RAMCARD__
+
+#include "emu.h"
+#include "machine/bw2exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> bw2_ramcard_device
+
+class bw2_ramcard_device : public device_t,
+ public device_bw2_expansion_slot_interface
+{
+public:
+ // construction/destruction
+ bw2_ramcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+
+protected:
+ // device-level overrides
+ virtual void device_config_complete() { m_shortname = "bw2_ramcard"; }
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_bw2_expansion_slot_interface overrides
+ virtual UINT8 bw2_cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6);
+ virtual void bw2_cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6);
+ virtual void bw2_slot_w(address_space &space, offs_t offset, UINT8 data);
+
+private:
+ optional_shared_ptr<UINT8> m_ram;
+ const UINT8 *m_rom;
+
+ int m_en;
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type BW2_RAMCARD;
+
+
+
+#endif
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
diff --git a/src/mess/machine/bw2exp.h b/src/mess/machine/bw2exp.h
new file mode 100644
index 00000000000..8b46cabffbe
--- /dev/null
+++ b/src/mess/machine/bw2exp.h
@@ -0,0 +1,135 @@
+/**********************************************************************
+
+ Bondwell 2 Expansion Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************
+
+ 5V 1 26 12V
+ D3 2 27 12V
+ A1 3 28 A3
+ A2 4 29 A4
+ _CTSB 5 30 A5
+ _RST 6 31 A6
+ _MODSEL 7 32 A7
+ 16MHZ 8 33 A8
+ _IORQ 9 34 A9
+ _RD 10 35 A10
+ D0 11 36 A11
+ D1 12 37 A12
+ D2 13 38 A13
+ A0 14 39 A14
+ D4 15 40 _RAM6
+ D5 16 41 _RAM5
+ D6 17 42 _RFSH
+ D7 18 43 _WR
+ DCDB 19 44 SELECT
+ _DTRB 20 45 _RAM2
+ _RTSB 21 46 _RAM3
+ _DSRB 22 47 _RAM4
+ TXDB 23 48 _SLOT
+ RXDB 24 49 GND
+ GND 25 50 5V
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __BW2_EXPANSION_SLOT__
+#define __BW2_EXPANSION_SLOT__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+
+#define BW2_EXPANSION_SLOT_TAG "exp"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_BW2_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp) \
+ MCFG_DEVICE_ADD(_tag, BW2_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> bw2_expansion_slot_device
+
+class device_bw2_expansion_slot_interface;
+
+class bw2_expansion_slot_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ bw2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ virtual ~bw2_expansion_slot_device();
+
+ // computer interface
+ UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6);
+ void cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6);
+
+ DECLARE_READ8_MEMBER( slot_r );
+ DECLARE_WRITE8_MEMBER( slot_w );
+
+ DECLARE_READ8_MEMBER( modsel_r );
+ DECLARE_WRITE8_MEMBER( modsel_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ device_bw2_expansion_slot_interface *m_cart;
+};
+
+
+// ======================> device_bw2_expansion_slot_interface
+
+// class representing interface-specific live bw2_expansion card
+class device_bw2_expansion_slot_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_bw2_expansion_slot_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_bw2_expansion_slot_interface();
+
+ virtual UINT8 bw2_cd_r(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6) { return data; };
+ virtual void bw2_cd_w(address_space &space, offs_t offset, UINT8 data, int ram2, int ram3, int ram4, int ram5, int ram6) { };
+
+ virtual UINT8 bw2_slot_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void bw2_slot_w(address_space &space, offs_t offset, UINT8 data) { }
+
+ virtual UINT8 bw2_modsel_r(address_space &space, offs_t offset) { return 0xff; }
+ virtual void bw2_modsel_w(address_space &space, offs_t offset, UINT8 data) { }
+
+protected:
+ bw2_expansion_slot_device *m_slot;
+};
+
+
+// device type definition
+extern const device_type BW2_EXPANSION_SLOT;
+
+
+// slot devices
+#include "machine/bw2_ramcard.h"
+
+SLOT_INTERFACE_EXTERN( bw2_expansion_cards );
+
+
+
+#endif
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index 60cb9fc5763..6025b766410 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -778,6 +778,8 @@ $(MESSOBJ)/bnpo.a: \
$(MESSOBJ)/bondwell.a: \
$(MESS_DRIVERS)/bw2.o \
+ $(MESS_MACHINE)/bw2exp.o \
+ $(MESS_MACHINE)/bw2_ramcard.o \
$(MESS_DRIVERS)/bw12.o \
$(MESSOBJ)/booth.a: \