summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/c64
diff options
context:
space:
mode:
Diffstat (limited to 'src/mess/machine/c64')
-rw-r--r--src/mess/machine/c64/16kb.c148
-rw-r--r--src/mess/machine/c64/16kb.h58
-rw-r--r--src/mess/machine/c64/4cga.c115
-rw-r--r--src/mess/machine/c64/4cga.h58
-rw-r--r--src/mess/machine/c64/4dxh.c110
-rw-r--r--src/mess/machine/c64/4dxh.h56
-rw-r--r--src/mess/machine/c64/4ksa.c110
-rw-r--r--src/mess/machine/c64/4ksa.h56
-rw-r--r--src/mess/machine/c64/4tba.c110
-rw-r--r--src/mess/machine/c64/4tba.h56
-rw-r--r--src/mess/machine/c64/bn1541.c160
-rw-r--r--src/mess/machine/c64/bn1541.h73
-rw-r--r--src/mess/machine/c64/comal80.c87
-rw-r--r--src/mess/machine/c64/comal80.h52
-rw-r--r--src/mess/machine/c64/cpm.c231
-rw-r--r--src/mess/machine/c64/cpm.h68
-rw-r--r--src/mess/machine/c64/currah_speech.c269
-rw-r--r--src/mess/machine/c64/currah_speech.h59
-rw-r--r--src/mess/machine/c64/dela_ep256.c176
-rw-r--r--src/mess/machine/c64/dela_ep256.h61
-rw-r--r--src/mess/machine/c64/dela_ep64.c167
-rw-r--r--src/mess/machine/c64/dela_ep64.h64
-rw-r--r--src/mess/machine/c64/dela_ep7x8.c154
-rw-r--r--src/mess/machine/c64/dela_ep7x8.h60
-rw-r--r--src/mess/machine/c64/dinamic.c75
-rw-r--r--src/mess/machine/c64/dinamic.h51
-rw-r--r--src/mess/machine/c64/dqbb.c122
-rw-r--r--src/mess/machine/c64/dqbb.h60
-rw-r--r--src/mess/machine/c64/easy_calc_result.c108
-rw-r--r--src/mess/machine/c64/easy_calc_result.h52
-rw-r--r--src/mess/machine/c64/easyflash.c228
-rw-r--r--src/mess/machine/c64/easyflash.h64
-rw-r--r--src/mess/machine/c64/epyx_fast_load.c117
-rw-r--r--src/mess/machine/c64/epyx_fast_load.h53
-rw-r--r--src/mess/machine/c64/exos.c68
-rw-r--r--src/mess/machine/c64/exos.h48
-rw-r--r--src/mess/machine/c64/exp.c377
-rw-r--r--src/mess/machine/c64/exp.h202
-rw-r--r--src/mess/machine/c64/fcc.c256
-rw-r--r--src/mess/machine/c64/fcc.h70
-rw-r--r--src/mess/machine/c64/final.c135
-rw-r--r--src/mess/machine/c64/final.h54
-rw-r--r--src/mess/machine/c64/final3.c151
-rw-r--r--src/mess/machine/c64/final3.h58
-rw-r--r--src/mess/machine/c64/fun_play.c99
-rw-r--r--src/mess/machine/c64/fun_play.h52
-rw-r--r--src/mess/machine/c64/geocable.c109
-rw-r--r--src/mess/machine/c64/geocable.h58
-rw-r--r--src/mess/machine/c64/georam.c99
-rw-r--r--src/mess/machine/c64/georam.h52
-rw-r--r--src/mess/machine/c64/ide64.c357
-rw-r--r--src/mess/machine/c64/ide64.h70
-rw-r--r--src/mess/machine/c64/ieee488.c258
-rw-r--r--src/mess/machine/c64/ieee488.h71
-rw-r--r--src/mess/machine/c64/kingsoft.c99
-rw-r--r--src/mess/machine/c64/kingsoft.h50
-rw-r--r--src/mess/machine/c64/mach5.c119
-rw-r--r--src/mess/machine/c64/mach5.h56
-rw-r--r--src/mess/machine/c64/magic_desk.c86
-rw-r--r--src/mess/machine/c64/magic_desk.h52
-rw-r--r--src/mess/machine/c64/magic_formel.c280
-rw-r--r--src/mess/machine/c64/magic_formel.h73
-rw-r--r--src/mess/machine/c64/magic_voice.c162
-rw-r--r--src/mess/machine/c64/magic_voice.h62
-rw-r--r--src/mess/machine/c64/midi_maplin.c207
-rw-r--r--src/mess/machine/c64/midi_maplin.h66
-rw-r--r--src/mess/machine/c64/midi_namesoft.c206
-rw-r--r--src/mess/machine/c64/midi_namesoft.h66
-rw-r--r--src/mess/machine/c64/midi_passport.c255
-rw-r--r--src/mess/machine/c64/midi_passport.h71
-rw-r--r--src/mess/machine/c64/midi_sci.c206
-rw-r--r--src/mess/machine/c64/midi_sci.h66
-rw-r--r--src/mess/machine/c64/midi_siel.c207
-rw-r--r--src/mess/machine/c64/midi_siel.h66
-rw-r--r--src/mess/machine/c64/mikro_assembler.c58
-rw-r--r--src/mess/machine/c64/mikro_assembler.h47
-rw-r--r--src/mess/machine/c64/multiscreen.c269
-rw-r--r--src/mess/machine/c64/multiscreen.h58
-rw-r--r--src/mess/machine/c64/neoram.c100
-rw-r--r--src/mess/machine/c64/neoram.h58
-rw-r--r--src/mess/machine/c64/ocean.c116
-rw-r--r--src/mess/machine/c64/ocean.h52
-rw-r--r--src/mess/machine/c64/pagefox.c134
-rw-r--r--src/mess/machine/c64/pagefox.h52
-rw-r--r--src/mess/machine/c64/prophet64.c87
-rw-r--r--src/mess/machine/c64/prophet64.h52
-rw-r--r--src/mess/machine/c64/ps64.c158
-rw-r--r--src/mess/machine/c64/ps64.h53
-rw-r--r--src/mess/machine/c64/reu.c160
-rw-r--r--src/mess/machine/c64/reu.h100
-rw-r--r--src/mess/machine/c64/rex.c79
-rw-r--r--src/mess/machine/c64/rex.h48
-rw-r--r--src/mess/machine/c64/rex_ep256.c185
-rw-r--r--src/mess/machine/c64/rex_ep256.h61
-rw-r--r--src/mess/machine/c64/ross.c93
-rw-r--r--src/mess/machine/c64/ross.h54
-rw-r--r--src/mess/machine/c64/sfx_sound_expander.c288
-rw-r--r--src/mess/machine/c64/sfx_sound_expander.h73
-rw-r--r--src/mess/machine/c64/silverrock.c133
-rw-r--r--src/mess/machine/c64/silverrock.h52
-rw-r--r--src/mess/machine/c64/simons_basic.c85
-rw-r--r--src/mess/machine/c64/simons_basic.h49
-rw-r--r--src/mess/machine/c64/stardos.c195
-rw-r--r--src/mess/machine/c64/stardos.h61
-rw-r--r--src/mess/machine/c64/std.c69
-rw-r--r--src/mess/machine/c64/std.h48
-rw-r--r--src/mess/machine/c64/structured_basic.c104
-rw-r--r--src/mess/machine/c64/structured_basic.h54
-rw-r--r--src/mess/machine/c64/super_explode.c126
-rw-r--r--src/mess/machine/c64/super_explode.h55
-rw-r--r--src/mess/machine/c64/super_games.c103
-rw-r--r--src/mess/machine/c64/super_games.h52
-rw-r--r--src/mess/machine/c64/supercpu.c307
-rw-r--r--src/mess/machine/c64/supercpu.h65
-rw-r--r--src/mess/machine/c64/sw8k.c115
-rw-r--r--src/mess/machine/c64/sw8k.h56
-rw-r--r--src/mess/machine/c64/swiftlink.c183
-rw-r--r--src/mess/machine/c64/swiftlink.h79
-rw-r--r--src/mess/machine/c64/system3.c91
-rw-r--r--src/mess/machine/c64/system3.h52
-rw-r--r--src/mess/machine/c64/tdos.c192
-rw-r--r--src/mess/machine/c64/tdos.h59
-rw-r--r--src/mess/machine/c64/turbo232.c228
-rw-r--r--src/mess/machine/c64/turbo232.h93
-rw-r--r--src/mess/machine/c64/user.c108
-rw-r--r--src/mess/machine/c64/user.h156
-rw-r--r--src/mess/machine/c64/vic1011.c164
-rw-r--r--src/mess/machine/c64/vic1011.h58
-rw-r--r--src/mess/machine/c64/vizastar.c90
-rw-r--r--src/mess/machine/c64/vizastar.h47
-rw-r--r--src/mess/machine/c64/vw64.c128
-rw-r--r--src/mess/machine/c64/vw64.h53
-rw-r--r--src/mess/machine/c64/warp_speed.c148
-rw-r--r--src/mess/machine/c64/warp_speed.h55
-rw-r--r--src/mess/machine/c64/westermann.c83
-rw-r--r--src/mess/machine/c64/westermann.h48
-rw-r--r--src/mess/machine/c64/xl80.c255
-rw-r--r--src/mess/machine/c64/xl80.h63
-rw-r--r--src/mess/machine/c64/zaxxon.c67
-rw-r--r--src/mess/machine/c64/zaxxon.h50
140 files changed, 15301 insertions, 0 deletions
diff --git a/src/mess/machine/c64/16kb.c b/src/mess/machine/c64/16kb.c
new file mode 100644
index 00000000000..17dd3f1eb02
--- /dev/null
+++ b/src/mess/machine/c64/16kb.c
@@ -0,0 +1,148 @@
+/**********************************************************************
+
+ Commodore 64 16KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "16kb.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_16KB = &device_creator<c64_16kb_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_16kb )
+//-------------------------------------------------
+
+ROM_START( c64_16kb )
+ ROM_REGION( 0x2000, "roml", 0 )
+ ROM_CART_LOAD( "roml", 0x0000, 0x2000, ROM_MIRROR )
+
+ ROM_REGION( 0x2000, "romh", 0 )
+ ROM_CART_LOAD( "romh", 0x0000, 0x2000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_16kb_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_16kb );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_16kb )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_16kb )
+ MCFG_CARTSLOT_ADD("roml")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin,80")
+
+ MCFG_CARTSLOT_ADD("romh")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin,a0,e0")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_16kb_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_16kb );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_16kb )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_16kb )
+ PORT_START("SW1")
+ PORT_DIPNAME( 0x03, 0x00, "Mode" )
+ PORT_DIPSETTING( 0x03, "Off" )
+ PORT_DIPSETTING( 0x02, "8 KB" )
+ PORT_DIPSETTING( 0x00, "16 KB" )
+ PORT_DIPSETTING( 0x01, "Ultimax" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_16kb_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_16kb );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_16kb_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_16kb_cartridge_device::c64_16kb_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_16KB, "C64 16KB EPROM cartridge", tag, owner, clock, "c64_16kb", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_sw1(*this, "SW1")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_16kb_cartridge_device::device_start()
+{
+ m_roml = memregion("roml")->base();
+ m_romh = memregion("romh")->base();
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_16kb_cartridge_device::device_reset()
+{
+ UINT8 mode = m_sw1->read();
+
+ m_exrom = BIT(mode, 0);
+ m_game = BIT(mode, 1);
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_16kb_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/16kb.h b/src/mess/machine/c64/16kb.h
new file mode 100644
index 00000000000..50bf81bbd17
--- /dev/null
+++ b/src/mess/machine/c64/16kb.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Commodore 64 16KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_16KB__
+#define __C64_16KB__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_16kb_cartridge_device
+
+class c64_16kb_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_16kb_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_ioport m_sw1;
+};
+
+
+// device type definition
+extern const device_type C64_16KB;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/4cga.c b/src/mess/machine/c64/4cga.c
new file mode 100644
index 00000000000..ecbcc25a2f8
--- /dev/null
+++ b/src/mess/machine/c64/4cga.c
@@ -0,0 +1,115 @@
+/**********************************************************************
+
+ Classical Games/Protovision 4 Player Interface emulation
+
+ http://www.protovision-online.com/hardw/4_player.htm
+ http://hitmen.c02.at/html/hardware.html
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "4cga.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_4CGA = &device_creator<c64_4cga_device>;
+
+
+static INPUT_PORTS_START( c64_4player )
+ PORT_START("JOY3")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("JOY4")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("FIRE")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+ PORT_BIT( 0xcf, IP_ACTIVE_LOW, IPT_UNUSED )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_4cga_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_4player );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_4cga_device - constructor
+//-------------------------------------------------
+
+c64_4cga_device::c64_4cga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_4CGA, "C64 Protovision 4 Player Interface", tag, owner, clock, "c64_4cga", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_fire(*this, "FIRE"),
+ m_joy3(*this, "JOY3"),
+ m_joy4(*this, "JOY4"),
+ m_port(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_4cga_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_port));
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_4cga_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ UINT8 data = m_fire->read();
+
+ if (m_port)
+ {
+ data &= m_joy3->read();
+ }
+ else
+ {
+ data &= m_joy4->read();
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+void c64_4cga_device::c64_pb_w(address_space &space, offs_t offset, UINT8 data)
+{
+ m_port = BIT(data, 7);
+}
diff --git a/src/mess/machine/c64/4cga.h b/src/mess/machine/c64/4cga.h
new file mode 100644
index 00000000000..d2e3e97e7b4
--- /dev/null
+++ b/src/mess/machine/c64/4cga.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Classical Games/Protovision 4 Player Interface emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_4CGA__
+#define __C64_4CGA__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_4cga_device
+
+class c64_4cga_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_4cga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data);
+
+private:
+ required_ioport m_fire;
+ required_ioport m_joy3;
+ required_ioport m_joy4;
+
+ int m_port;
+};
+
+
+// device type definition
+extern const device_type C64_4CGA;
+
+
+#endif
diff --git a/src/mess/machine/c64/4dxh.c b/src/mess/machine/c64/4dxh.c
new file mode 100644
index 00000000000..ff53143a161
--- /dev/null
+++ b/src/mess/machine/c64/4dxh.c
@@ -0,0 +1,110 @@
+/**********************************************************************
+
+ The Digital Excess & Hitmen 4-Player Joystick adapter emulation
+
+ http://hitmen.c02.at/html/hardware.html
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "4dxh.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_4DXH = &device_creator<c64_4dxh_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_4dxh )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_4dxh )
+ PORT_START("SP2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
+
+ PORT_START("PB")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
+
+ PORT_START("PA2")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_4dxh_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_4dxh );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_4dxh_device - constructor
+//-------------------------------------------------
+
+c64_4dxh_device::c64_4dxh_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_4DXH, "C64 DXH 4-Player Adapter", tag, owner, clock, "c64_4dxh", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_pb(*this, "PB"),
+ m_pa2(*this, "PA2")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_4dxh_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_4dxh_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ return m_pb->read();
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+int c64_4dxh_device::c64_pa2_r()
+{
+ return BIT(m_pa2->read(), 0);
+}
+
+
+//-------------------------------------------------
+// c64_cnt1_w - CNT 1 write
+//-------------------------------------------------
+
+void c64_4dxh_device::c64_cnt1_w(int level)
+{
+ m_slot->cia_cnt2_w(level);
+}
diff --git a/src/mess/machine/c64/4dxh.h b/src/mess/machine/c64/4dxh.h
new file mode 100644
index 00000000000..a02ccad3987
--- /dev/null
+++ b/src/mess/machine/c64/4dxh.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ The Digital Excess & Hitmen 4-Player Joystick adapter emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_4DXH__
+#define __C64_4DXH__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_4dxh_device
+
+class c64_4dxh_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_4dxh_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual int c64_pa2_r();
+ virtual void c64_cnt1_w(int level);
+
+private:
+ required_ioport m_pb;
+ required_ioport m_pa2;
+};
+
+
+// device type definition
+extern const device_type C64_4DXH;
+
+
+#endif
diff --git a/src/mess/machine/c64/4ksa.c b/src/mess/machine/c64/4ksa.c
new file mode 100644
index 00000000000..190e16105d7
--- /dev/null
+++ b/src/mess/machine/c64/4ksa.c
@@ -0,0 +1,110 @@
+/**********************************************************************
+
+ Kingsoft 4-Player Adapter emulation
+
+ http://hitmen.c02.at/html/hardware.html
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "4ksa.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_4KSA = &device_creator<c64_4ksa_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_4ksa )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_4ksa )
+ PORT_START("SP2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
+
+ PORT_START("PB")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
+
+ PORT_START("PA2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_4ksa_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_4ksa );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_4ksa_device - constructor
+//-------------------------------------------------
+
+c64_4ksa_device::c64_4ksa_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_4KSA, "C64 Kingsoft 4-Player Adapter", tag, owner, clock, "c64_4ksa", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_pb(*this, "PB"),
+ m_pa2(*this, "PA2")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_4ksa_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_4ksa_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ return m_pb->read();
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+int c64_4ksa_device::c64_pa2_r()
+{
+ return BIT(m_pa2->read(), 0);
+}
+
+
+//-------------------------------------------------
+// c64_cnt1_w - CNT 1 write
+//-------------------------------------------------
+
+void c64_4ksa_device::c64_cnt1_w(int level)
+{
+ m_slot->cia_cnt2_w(level);
+}
diff --git a/src/mess/machine/c64/4ksa.h b/src/mess/machine/c64/4ksa.h
new file mode 100644
index 00000000000..fe09480afdf
--- /dev/null
+++ b/src/mess/machine/c64/4ksa.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ Kingsoft 4-Player Adapter emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_4KSA__
+#define __C64_4KSA__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_4ksa_device
+
+class c64_4ksa_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_4ksa_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual int c64_pa2_r();
+ virtual void c64_cnt1_w(int level);
+
+private:
+ required_ioport m_pb;
+ required_ioport m_pa2;
+};
+
+
+// device type definition
+extern const device_type C64_4KSA;
+
+
+#endif
diff --git a/src/mess/machine/c64/4tba.c b/src/mess/machine/c64/4tba.c
new file mode 100644
index 00000000000..26ff6db03fb
--- /dev/null
+++ b/src/mess/machine/c64/4tba.c
@@ -0,0 +1,110 @@
+/**********************************************************************
+
+ Starbyte Software Tie Break Adaptor emulation
+
+ http://hitmen.c02.at/html/hardware.html
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "4tba.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_4TBA = &device_creator<c64_4tba_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_4tba )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_4tba )
+ PORT_START("SP2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
+
+ PORT_START("PB")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
+
+ PORT_START("PA2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_4tba_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_4tba );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_4tba_device - constructor
+//-------------------------------------------------
+
+c64_4tba_device::c64_4tba_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_4TBA, "C64 Tie Break Adapter", tag, owner, clock, "c64_4tba", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_pb(*this, "PB"),
+ m_pa2(*this, "PA2")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_4tba_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_4tba_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ return m_pb->read();
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+int c64_4tba_device::c64_pa2_r()
+{
+ return BIT(m_pa2->read(), 0);
+}
+
+
+//-------------------------------------------------
+// c64_cnt1_w - CNT 1 write
+//-------------------------------------------------
+
+void c64_4tba_device::c64_cnt1_w(int level)
+{
+ m_slot->cia_cnt2_w(level);
+}
diff --git a/src/mess/machine/c64/4tba.h b/src/mess/machine/c64/4tba.h
new file mode 100644
index 00000000000..3dc3da5ca3a
--- /dev/null
+++ b/src/mess/machine/c64/4tba.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ Starbyte Software Tie Break Adaptor emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_4TBA__
+#define __C64_4TBA__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_4tba_device
+
+class c64_4tba_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_4tba_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual int c64_pa2_r();
+ virtual void c64_cnt1_w(int level);
+
+private:
+ required_ioport m_pb;
+ required_ioport m_pa2;
+};
+
+
+// device type definition
+extern const device_type C64_4TBA;
+
+
+#endif
diff --git a/src/mess/machine/c64/bn1541.c b/src/mess/machine/c64/bn1541.c
new file mode 100644
index 00000000000..2395779ba21
--- /dev/null
+++ b/src/mess/machine/c64/bn1541.c
@@ -0,0 +1,160 @@
+/**********************************************************************
+
+ SpeedDOS / Burst Nibbler 1541/1571 Parallel Cable emulation
+
+ http://sta.c64.org/cbmparc2.html
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "bn1541.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define LOG 0
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_BN1541 = &device_creator<c64_bn1541_device>;
+
+
+
+//**************************************************************************
+// FLOPPY DRIVE INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_c64_floppy_parallel_interface - constructor
+//-------------------------------------------------
+
+device_c64_floppy_parallel_interface::device_c64_floppy_parallel_interface(const machine_config &mconfig, device_t &device) :
+ m_other(NULL)
+{
+}
+
+
+//-------------------------------------------------
+// ~device_c64_floppy_parallel_interface - destructor
+//-------------------------------------------------
+
+device_c64_floppy_parallel_interface::~device_c64_floppy_parallel_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_bn1541_device - constructor
+//-------------------------------------------------
+
+c64_bn1541_device::c64_bn1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_BN1541, "C64 Burst Nibbler 1541/1571 Parallel Cable", tag, owner, clock, "c64_bn1541", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ device_c64_floppy_parallel_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_bn1541_device::device_start()
+{
+ device_iterator iter(machine().root_device());
+
+ for (device_t *device = iter.first(); device != NULL; device = iter.next())
+ {
+ device_iterator subiter(*device);
+
+ for (device_t *subdevice = subiter.first(); subdevice != NULL; subdevice = iter.next())
+ {
+ if (subdevice->interface(m_other) && subdevice != this)
+ {
+ if (LOG) logerror("Parallel device %s\n", subdevice->tag());
+
+ // grab the first 1541/1571 and run to the hills
+ m_other->m_other = this;
+ return;
+ }
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// parallel_data_w -
+//-------------------------------------------------
+
+void c64_bn1541_device::parallel_data_w(UINT8 data)
+{
+ if (LOG) logerror("1541 parallel data %02x\n", data);
+
+ m_parallel_data = data;
+}
+
+
+//-------------------------------------------------
+// parallel_strobe_w -
+//-------------------------------------------------
+
+void c64_bn1541_device::parallel_strobe_w(int state)
+{
+ if (LOG) logerror("1541 parallel strobe %u\n", state);
+
+ m_slot->cia_flag2_w(state);
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_bn1541_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ return m_parallel_data;
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+void c64_bn1541_device::c64_pb_w(address_space &space, offs_t offset, UINT8 data)
+{
+ if (LOG) logerror("C64 parallel data %02x\n", data);
+
+ if (m_other != NULL)
+ {
+ m_other->parallel_data_w(data);
+ }
+}
+
+
+//-------------------------------------------------
+// c64_pc2_w - CIA2 PC write
+//-------------------------------------------------
+
+void c64_bn1541_device::c64_pc2_w(int state)
+{
+ if (LOG) logerror("C64 parallel strobe %u\n", state);
+
+ if (m_other != NULL)
+ {
+ m_other->parallel_strobe_w(state);
+ }
+}
diff --git a/src/mess/machine/c64/bn1541.h b/src/mess/machine/c64/bn1541.h
new file mode 100644
index 00000000000..4e08cf45694
--- /dev/null
+++ b/src/mess/machine/c64/bn1541.h
@@ -0,0 +1,73 @@
+/**********************************************************************
+
+ SpeedDOS / Burst Nibbler 1541/1571 Parallel Cable emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_BN1541__
+#define __C64_BN1541__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> device_c64_floppy_parallel_interface
+
+class device_c64_floppy_parallel_interface
+{
+public:
+ // construction/destruction
+ device_c64_floppy_parallel_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_c64_floppy_parallel_interface();
+
+ virtual void parallel_data_w(UINT8 data) = 0;
+ virtual void parallel_strobe_w(int state) = 0;
+
+ device_c64_floppy_parallel_interface *m_other;
+
+protected:
+ UINT8 m_parallel_data;
+};
+
+
+// ======================> c64_bn1541_device
+
+class c64_bn1541_device : public device_t,
+ public device_c64_user_port_interface,
+ public device_c64_floppy_parallel_interface
+{
+public:
+ // construction/destruction
+ c64_bn1541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data);
+ virtual void c64_pc2_w(int level);
+
+ // device_c64_floppy_parallel_interface overrides
+ virtual void parallel_data_w(UINT8 data);
+ virtual void parallel_strobe_w(int state);
+};
+
+
+// device type definition
+extern const device_type C64_BN1541;
+
+
+#endif
diff --git a/src/mess/machine/c64/comal80.c b/src/mess/machine/c64/comal80.c
new file mode 100644
index 00000000000..7b89245793e
--- /dev/null
+++ b/src/mess/machine/c64/comal80.c
@@ -0,0 +1,87 @@
+/**********************************************************************
+
+ COMAL 80 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "comal80.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_COMAL80 = &device_creator<c64_comal80_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_comal80_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_comal80_cartridge_device::c64_comal80_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_COMAL80, "C64 COMAL 80 cartridge", tag, owner, clock, "c64_comal80", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_comal80_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_comal80_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_comal80_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_comal80_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ if (BIT(data, 7))
+ {
+ m_bank = data & 0x03;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/comal80.h b/src/mess/machine/c64/comal80.h
new file mode 100644
index 00000000000..7d4e50a8dde
--- /dev/null
+++ b/src/mess/machine/c64/comal80.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ COMAL 80 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __COMAL80__
+#define __COMAL80__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_comal80_cartridge_device
+
+class c64_comal80_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_comal80_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_COMAL80;
+
+
+#endif
diff --git a/src/mess/machine/c64/cpm.c b/src/mess/machine/c64/cpm.c
new file mode 100644
index 00000000000..131b359da01
--- /dev/null
+++ b/src/mess/machine/c64/cpm.c
@@ -0,0 +1,231 @@
+/**********************************************************************
+
+ Commodore 64 CP/M cartridge emulation
+
+ http://www.baltissen.org/newhtm/c64_cpm.htm
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ TODO:
+
+ - Z80 clock speed
+
+*/
+
+#include "cpm.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define Z80_TAG "z80"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_CPM = &device_creator<c64_cpm_cartridge_device>;
+
+
+//-------------------------------------------------
+// ADDRESS_MAP( z80_mem )
+//-------------------------------------------------
+
+static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, c64_cpm_cartridge_device )
+ AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w)
+ADDRESS_MAP_END
+
+
+//-------------------------------------------------
+// ADDRESS_MAP( z80_io )
+//-------------------------------------------------
+
+static ADDRESS_MAP_START( z80_io, AS_IO, 8, c64_cpm_cartridge_device )
+ AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w)
+ADDRESS_MAP_END
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_cpm )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_cpm )
+ MCFG_CPU_ADD(Z80_TAG, Z80, 3000000)
+ MCFG_CPU_PROGRAM_MAP(z80_mem)
+ MCFG_CPU_IO_MAP(z80_io)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_cpm_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_cpm );
+}
+
+
+
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
+
+//-------------------------------------------------
+// update_signals -
+//-------------------------------------------------
+
+inline void c64_cpm_cartridge_device::update_signals()
+{
+ if (m_enabled)
+ {
+ m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ m_slot->dma_w(ASSERT_LINE);
+
+ if (m_reset)
+ {
+ m_maincpu->reset();
+ m_maincpu->set_state_int(Z80_PC, 0);
+ m_reset = 0;
+ }
+ }
+ else
+ {
+ m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ m_slot->dma_w(CLEAR_LINE);
+ }
+
+/*
+ // NOTE: the following is how it actually works once the Z80 core has been rewritten
+
+ // C64 DMA
+ m_slot->dma_w(m_enabled ? ASSERT_LINE : CLEAR_LINE);
+
+ // Z80 BUSRQ
+ int busrq = !(m_enabled & !m_ba) ? CLEAR_LINE : ASSERT_LINE;
+ m_maincpu->set_input_line(Z80_INPUT_LINE_BUSRQ, busrq);
+
+ // Z80 WAIT
+ m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, m_enabled ? CLEAR_LINE : ASSERT_LINE);
+*/
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_cpm_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_cpm_cartridge_device::c64_cpm_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_CPM, "C64 CP/M cartridge", tag, owner, clock, "c64_cpm", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_maincpu(*this, Z80_TAG),
+ m_enabled(0),
+ m_ba(1)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_cpm_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_enabled));
+ save_item(NAME(m_ba));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_cpm_cartridge_device::device_reset()
+{
+ m_enabled = 0;
+ m_reset = 1;
+
+ update_signals();
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_cpm_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_enabled = !BIT(data, 0);
+
+ update_signals();
+ }
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_cpm_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ if (m_ba != ba)
+ {
+ m_ba = ba;
+
+ update_signals();
+ }
+
+ return 1;
+}
+
+
+//-------------------------------------------------
+// dma_r -
+//-------------------------------------------------
+
+READ8_MEMBER( c64_cpm_cartridge_device::dma_r )
+{
+ UINT8 data = 0xff;
+
+ if (m_enabled)
+ {
+ offs_t addr = (offset + 0x1000) & 0xffff;
+
+ data = m_slot->dma_cd_r(space, addr);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// dma_w -
+//-------------------------------------------------
+
+WRITE8_MEMBER( c64_cpm_cartridge_device::dma_w )
+{
+ if (m_enabled)
+ {
+ offs_t addr = (offset + 0x1000) & 0xffff;
+
+ m_slot->dma_cd_w(space, addr, data);
+ }
+}
diff --git a/src/mess/machine/c64/cpm.h b/src/mess/machine/c64/cpm.h
new file mode 100644
index 00000000000..447af110f3b
--- /dev/null
+++ b/src/mess/machine/c64/cpm.h
@@ -0,0 +1,68 @@
+/**********************************************************************
+
+ Commodore 64 CP/M cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __CPM__
+#define __CPM__
+
+#define ADDRESS_MAP_MODERN
+
+#include "emu.h"
+#include "cpu/z80/z80.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_cpm_cartridge_device
+
+class c64_cpm_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_cpm_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ // not really public
+ DECLARE_READ8_MEMBER( dma_r );
+ DECLARE_WRITE8_MEMBER( dma_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ inline void update_signals();
+
+ required_device<cpu_device> m_maincpu;
+
+ int m_enabled;
+ int m_ba;
+
+ int m_reset;
+};
+
+
+// device type definition
+extern const device_type C64_CPM;
+
+
+#endif
diff --git a/src/mess/machine/c64/currah_speech.c b/src/mess/machine/c64/currah_speech.c
new file mode 100644
index 00000000000..1ca75a03331
--- /dev/null
+++ b/src/mess/machine/c64/currah_speech.c
@@ -0,0 +1,269 @@
+/**********************************************************************
+
+ Currah Speech 64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+PCB Layout
+----------
+
+|===========================|
+|=| |
+|=| VLSI |
+|=| |
+|=| |
+|=| ROM |
+|=| |
+|=| |
+|=| SP0256 |
+|===========================|
+
+Notes:
+ All IC's shown.
+
+ VLSI - General Instruments LA05-164 custom
+ ROM - General Instruments R09864CS-2030 8Kx8 ROM "778R01"
+ SP0256 - General Instruments SP0256A-AL2 Speech Synthesizer
+
+
+LA05-164 Pinout
+---------------
+ _____ _____
+DOTCLK 1 |* \_/ | 28 +5V
+ CA7 2 | | 27 CD7
+ CA6 3 | | 26 CA8
+ CA5 4 | | 25 CA9
+ CA4 5 | | 24 CA11
+ CA3 6 | | 23 BA
+ CA2 7 | LA05-164 | 22 CA10
+ CA1 8 | | 21 SP0256 _ALD
+ CA0 9 | | 20 SP0256 OSC1
+ 10 | | 19 SP0256 SBY
+_GA+EX 11 | | 18 CA15
+ I/O1 12 | | 17 CA12
+ _CR/W 13 | | 16 CA13
+ GND 14 |_____________| 15 CA14
+
+Notes:
+ _GA+EX - _GAME and _EXROM tied together
+
+*/
+
+/*
+
+ BASIC Commands
+ --------------
+
+ INIT Initialize the cartridge
+ BYE Disable the cartridge
+ KON 0 Enable keyvoices, low voice
+ KON 1 Enable keyvoices, high voice
+ KOFF Disable keyvoices
+ SAY 0/1 "" Say words
+
+*/
+
+#include "currah_speech.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define SP0256_TAG "sp0256"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_CURRAH_SPEECH = &device_creator<c64_currah_speech_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_currah_speech )
+//-------------------------------------------------
+
+ROM_START( c64_currah_speech )
+ ROM_REGION( 0x10000, SP0256_TAG, 0 )
+ ROM_LOAD( "sp0256a-al2", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_currah_speech_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_currah_speech );
+}
+
+
+//-------------------------------------------------
+// sp0256_interface sp0256_intf
+//-------------------------------------------------
+
+static sp0256_interface sp0256_intf =
+{
+ DEVCB_NULL,
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_currah_speech )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_currah_speech )
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD(SP0256_TAG, SP0256, 4000000) // ???
+ MCFG_SOUND_CONFIG(sp0256_intf)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_currah_speech_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_currah_speech );
+}
+
+
+
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
+
+//-------------------------------------------------
+// set_osc1 -
+//-------------------------------------------------
+
+void c64_currah_speech_cartridge_device::set_osc1(int voice, int intonation)
+{
+ int dotclock = m_slot->dotclock();
+
+ // TODO intonation and correct dividers
+ m_nsp->set_clock(dotclock / (2 << voice));
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_currah_speech_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_currah_speech_cartridge_device::c64_currah_speech_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_CURRAH_SPEECH, "C64 Currah Speech", tag, owner, clock, "c64_cs", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_nsp(*this, SP0256_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_currah_speech_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_currah_speech_cartridge_device::device_reset()
+{
+ m_game = 1;
+ m_exrom = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_currah_speech_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!romh)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+ else if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7 SBY
+
+ */
+
+ data = m_nsp->sby_r() << 7;
+ }
+
+ if (!space.debugger_access() && (offset == 0xa7f0))
+ {
+ m_game = !m_game;
+ m_exrom = !m_exrom;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_currah_speech_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0 A1
+ 1 A2
+ 2 A3
+ 3 A4
+ 4 A5
+ 5 A6
+ 6
+ 7 intonation
+
+ */
+
+ int voice = BIT(offset, 0);
+ int intonation = BIT(data, 7);
+
+ set_osc1(voice, intonation);
+
+ m_nsp->ald_w(space, 0, data & 0x3f);
+ }
+}
diff --git a/src/mess/machine/c64/currah_speech.h b/src/mess/machine/c64/currah_speech.h
new file mode 100644
index 00000000000..f89a221ec40
--- /dev/null
+++ b/src/mess/machine/c64/currah_speech.h
@@ -0,0 +1,59 @@
+/**********************************************************************
+
+ Currah Speech 64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __CURRAH_SPEECH_64__
+#define __CURRAH_SPEECH_64__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "sound/sp0256.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_currah_speech_cartridge_device
+
+class c64_currah_speech_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_currah_speech_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ inline void set_osc1(int voice, int intonation);
+
+ required_device<sp0256_device> m_nsp;
+};
+
+
+// device type definition
+extern const device_type C64_CURRAH_SPEECH;
+
+
+#endif
diff --git a/src/mess/machine/c64/dela_ep256.c b/src/mess/machine/c64/dela_ep256.c
new file mode 100644
index 00000000000..2bddac5b03c
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep256.c
@@ -0,0 +1,176 @@
+/**********************************************************************
+
+ Dela 256KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "dela_ep256.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_DELA_EP256 = &device_creator<c64_dela_ep256_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_dela_ep256 )
+//-------------------------------------------------
+
+ROM_START( c64_dela_ep256 )
+ ROM_REGION( 0x40000, "eprom", 0 )
+ ROM_CART_LOAD( "rom1", 0x00000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom2", 0x08000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom3", 0x10000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom4", 0x18000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom5", 0x20000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom6", 0x28000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom7", 0x30000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom8", 0x38000, 0x08000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_dela_ep256_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_dela_ep256 );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_dela_ep256 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_dela_ep256 )
+ MCFG_CARTSLOT_ADD("rom1")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom2")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom3")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom4")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom5")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom6")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom7")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom8")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_dela_ep256_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_dela_ep256 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_dela_ep256_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_dela_ep256_cartridge_device::c64_dela_ep256_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_DELA_EP256, "C64 Dela 256KB EPROM cartridge", tag, owner, clock, "delep256", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_eprom(*this, "eprom")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_dela_ep256_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_reset));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_dela_ep256_cartridge_device::device_reset()
+{
+ m_reset = 1;
+ m_bank = 0;
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_dela_ep256_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ if (m_reset)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_eprom->base()[addr];
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_dela_ep256_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2 && ((offset & 0xf0) == 0xa0))
+ {
+ /*
+
+ bit description
+
+ 0 socket selection bit 0
+ 1 socket selection bit 1
+ 2 socket selection bit 2
+ 3
+ 4 bank selection bit 0
+ 5 bank selection bit 1
+ 6
+ 7 EXROM
+
+ */
+
+ m_reset = 0;
+
+ m_bank = ((data & 0x07) << 2) | ((data >> 4) & 0x03);
+
+ m_exrom = BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/dela_ep256.h b/src/mess/machine/c64/dela_ep256.h
new file mode 100644
index 00000000000..59e33a654db
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep256.h
@@ -0,0 +1,61 @@
+/**********************************************************************
+
+ Dela 256KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __DELA_EP256__
+#define __DELA_EP256__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_dela_ep256_cartridge_device
+
+class c64_dela_ep256_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_dela_ep256_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_memory_region m_eprom;
+
+ UINT8 m_bank;
+ int m_reset;
+};
+
+
+// device type definition
+extern const device_type C64_DELA_EP256;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/dela_ep64.c b/src/mess/machine/c64/dela_ep64.c
new file mode 100644
index 00000000000..275ce0c0a59
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep64.c
@@ -0,0 +1,167 @@
+/**********************************************************************
+
+ Dela 64KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "dela_ep64.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_DELA_EP64 = &device_creator<c64_dela_ep64_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_dela_ep64 )
+//-------------------------------------------------
+
+ROM_START( c64_dela_ep64 )
+ ROM_REGION( 0x10000, "eprom", 0 )
+ ROM_CART_LOAD( "rom1", 0x0000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom2", 0x8000, 0x08000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_dela_ep64_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_dela_ep64 );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_dela_ep64 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_dela_ep64 )
+ MCFG_CARTSLOT_ADD("rom1")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom2")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_dela_ep64_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_dela_ep64 );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_dela_ep64_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_dela_ep64_cartridge_device::c64_dela_ep64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_DELA_EP64, "C64 Rex 64KB EPROM cartridge", tag, owner, clock, "c64_dela_ep64", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_eprom(*this, "eprom")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_dela_ep64_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_reset));
+ save_item(NAME(m_rom0_ce));
+ save_item(NAME(m_rom1_ce));
+ save_item(NAME(m_rom2_ce));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_dela_ep64_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+
+ m_reset = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_dela_ep64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ if (m_reset)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+
+ if (!m_rom0_ce) data |= m_roml[offset & 0x1fff];
+ if (!m_rom1_ce) data |= m_eprom->base()[0x0000 + addr];
+ if (!m_rom2_ce) data |= m_eprom->base()[0x8000 + addr];
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_dela_ep64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0 IC6 _CE
+ 1 IC5 _CE
+ 2
+ 3 IC4 _CE
+ 4 A13
+ 5 A14
+ 6
+ 7 EXROM
+
+ */
+
+ m_reset = 0;
+
+ m_rom0_ce = BIT(data, 3);
+ m_rom1_ce = BIT(data, 1);
+ m_rom2_ce = BIT(data, 0);
+
+ m_bank = (data >> 4) & 0x03;
+
+ m_exrom = BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/dela_ep64.h b/src/mess/machine/c64/dela_ep64.h
new file mode 100644
index 00000000000..cc1088e9cc9
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep64.h
@@ -0,0 +1,64 @@
+/**********************************************************************
+
+ Dela 64KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __DELA_EP64__
+#define __DELA_EP64__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_dela_ep64_cartridge_device
+
+class c64_dela_ep64_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_dela_ep64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_memory_region m_eprom;
+
+ UINT8 m_bank;
+ int m_reset;
+ int m_rom0_ce;
+ int m_rom1_ce;
+ int m_rom2_ce;
+};
+
+
+// device type definition
+extern const device_type C64_DELA_EP64;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/dela_ep7x8.c b/src/mess/machine/c64/dela_ep7x8.c
new file mode 100644
index 00000000000..08eb446d318
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep7x8.c
@@ -0,0 +1,154 @@
+/**********************************************************************
+
+ Dela 7x8K EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "dela_ep7x8.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_DELA_EP7X8 = &device_creator<c64_dela_ep7x8_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_dela_ep7x8 )
+//-------------------------------------------------
+
+ROM_START( c64_dela_ep7x8 )
+ ROM_REGION( 0x10000, "eprom", 0 )
+ ROM_CART_LOAD( "rom1", 0x2000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom2", 0x4000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom3", 0x6000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom4", 0x8000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom5", 0xa000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom6", 0xc000, 0x2000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom7", 0xe000, 0x2000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_dela_ep7x8_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_dela_ep7x8 );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_dela_ep7x8 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_dela_ep7x8 )
+ MCFG_CARTSLOT_ADD("rom1")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom2")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom3")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom4")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom5")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom6")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom7")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_dela_ep7x8_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_dela_ep7x8 );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_dela_ep7x8_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_dela_ep7x8_cartridge_device::c64_dela_ep7x8_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_DELA_EP7X8, "C64 Dela 7x8KB EPROM cartridge", tag, owner, clock, "ep7x8", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_eprom(*this, "eprom")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_dela_ep7x8_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_dela_ep7x8_cartridge_device::device_reset()
+{
+ m_bank = 0xfe;
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_dela_ep7x8_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = offset & 0x1fff;
+
+ if (!BIT(m_bank, 0)) data |= m_roml[addr];
+ if (!BIT(m_bank, 1)) data |= m_eprom->base()[0x2000 + addr];
+ if (!BIT(m_bank, 2)) data |= m_eprom->base()[0x4000 + addr];
+ if (!BIT(m_bank, 3)) data |= m_eprom->base()[0x6000 + addr];
+ if (!BIT(m_bank, 4)) data |= m_eprom->base()[0x8000 + addr];
+ if (!BIT(m_bank, 5)) data |= m_eprom->base()[0xa000 + addr];
+ if (!BIT(m_bank, 6)) data |= m_eprom->base()[0xc000 + addr];
+ if (!BIT(m_bank, 7)) data |= m_eprom->base()[0xe000 + addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_dela_ep7x8_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_bank = data;
+
+ m_exrom = (data == 0xff);
+ }
+}
diff --git a/src/mess/machine/c64/dela_ep7x8.h b/src/mess/machine/c64/dela_ep7x8.h
new file mode 100644
index 00000000000..404ae48887d
--- /dev/null
+++ b/src/mess/machine/c64/dela_ep7x8.h
@@ -0,0 +1,60 @@
+/**********************************************************************
+
+ Dela 7x8K EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __DELA_EP7X8__
+#define __DELA_EP7X8__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_dela_ep7x8_cartridge_device
+
+class c64_dela_ep7x8_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_dela_ep7x8_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_memory_region m_eprom;
+
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_DELA_EP7X8;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/dinamic.c b/src/mess/machine/c64/dinamic.c
new file mode 100644
index 00000000000..ce90ec17ff9
--- /dev/null
+++ b/src/mess/machine/c64/dinamic.c
@@ -0,0 +1,75 @@
+/**********************************************************************
+
+ Dinamic Software cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "dinamic.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_DINAMIC = &device_creator<c64_dinamic_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_dinamic_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_dinamic_cartridge_device::c64_dinamic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_DINAMIC, "C64 Dinamic cartridge", tag, owner, clock, "c64_dinamic", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_dinamic_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_dinamic_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_dinamic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+ else if (!io1)
+ {
+ m_bank = offset & 0x0f;
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/dinamic.h b/src/mess/machine/c64/dinamic.h
new file mode 100644
index 00000000000..ad6bf88cf0f
--- /dev/null
+++ b/src/mess/machine/c64/dinamic.h
@@ -0,0 +1,51 @@
+/**********************************************************************
+
+ Dinamic Software cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __DINAMIC__
+#define __DINAMIC__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_dinamic_cartridge_device
+
+class c64_dinamic_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_dinamic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_DINAMIC;
+
+
+#endif
diff --git a/src/mess/machine/c64/dqbb.c b/src/mess/machine/c64/dqbb.c
new file mode 100644
index 00000000000..1b27391231d
--- /dev/null
+++ b/src/mess/machine/c64/dqbb.c
@@ -0,0 +1,122 @@
+/**********************************************************************
+
+ Brown Boxes Double Quick Brown Box emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ TODO:
+
+ - 64/128 mode switch
+ - dump of the initial NVRAM contents
+
+*/
+
+#include "dqbb.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_DQBB = &device_creator<c64_dqbb_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_dqbb_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_dqbb_cartridge_device::c64_dqbb_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_DQBB, "C64 Double Quick Brown Box cartridge", tag, owner, clock, "c64_dqbb", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ device_nvram_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_dqbb_cartridge_device::device_start()
+{
+ // allocate memory
+ c64_nvram_pointer(machine(), 0x4000);
+
+ // state saving
+ save_item(NAME(m_cs));
+ save_item(NAME(m_we));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_dqbb_cartridge_device::device_reset()
+{
+ m_exrom = 0; // TODO 1 in 128 mode
+ m_game = 1;
+ m_cs = 0;
+ m_we = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_dqbb_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_cs && (!roml || !romh))
+ {
+ data = m_nvram[offset & 0x3fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_dqbb_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_cs && m_we && (offset >= 0x8000 && offset < 0xc000))
+ {
+ m_nvram[offset & 0x3fff] = data;
+ }
+ else if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0
+ 1
+ 2 GAME
+ 3
+ 4 WE
+ 5
+ 6 EXROM
+ 7 _CS
+
+ */
+
+ m_exrom = !BIT(data, 6);
+ m_game = !BIT(data, 2);
+ m_we = BIT(data, 4);
+ m_cs = BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/dqbb.h b/src/mess/machine/c64/dqbb.h
new file mode 100644
index 00000000000..0a4aa88738c
--- /dev/null
+++ b/src/mess/machine/c64/dqbb.h
@@ -0,0 +1,60 @@
+/**********************************************************************
+
+ Brown Boxes Double Quick Brown Box emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __DQBB__
+#define __DQBB__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/nvram.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_dqbb_cartridge_device
+
+class c64_dqbb_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface,
+ public device_nvram_interface
+{
+public:
+ // construction/destruction
+ c64_dqbb_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_nvram_interface overrides
+ virtual void nvram_default() { }
+ virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
+ virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ int m_cs;
+ int m_we;
+};
+
+
+// device type definition
+extern const device_type C64_DQBB;
+
+
+#endif
diff --git a/src/mess/machine/c64/easy_calc_result.c b/src/mess/machine/c64/easy_calc_result.c
new file mode 100644
index 00000000000..aa5507f9dfa
--- /dev/null
+++ b/src/mess/machine/c64/easy_calc_result.c
@@ -0,0 +1,108 @@
+/**********************************************************************
+
+ Easy Calc Result cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| |
+ |=| ROM0 LS73 |
+ |=| |
+ |=| |
+ |=| |
+ |=| |
+ |=| ROM1 LS00 |
+ |=| |
+ |===========================|
+
+ ROM0 - Hitachi HN61364P 8Kx8 EPROM "CR2001"
+ ROM1 - Hitachi HN613128P 16Kx8 EPROM "CR3001"
+
+*/
+
+#include "easy_calc_result.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_EASY_CALC_RESULT = &device_creator<c64_easy_calc_result_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_easy_calc_result_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_easy_calc_result_cartridge_device::c64_easy_calc_result_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_EASY_CALC_RESULT, "C64 Easy Calc Result cartridge", tag, owner, clock, "c64_easy_calc_result", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_easy_calc_result_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_easy_calc_result_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_easy_calc_result_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ data = m_romh[(m_bank << 13) | (offset & 0x1fff)];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_easy_calc_result_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_bank = !BIT(offset, 0);
+ }
+}
diff --git a/src/mess/machine/c64/easy_calc_result.h b/src/mess/machine/c64/easy_calc_result.h
new file mode 100644
index 00000000000..89ebc4c9a0f
--- /dev/null
+++ b/src/mess/machine/c64/easy_calc_result.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Easy Calc Result cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __EASY_CALC_RESULT__
+#define __EASY_CALC_RESULT__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_easy_calc_result_cartridge_device
+
+class c64_easy_calc_result_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_easy_calc_result_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ int m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_EASY_CALC_RESULT;
+
+
+#endif
diff --git a/src/mess/machine/c64/easyflash.c b/src/mess/machine/c64/easyflash.c
new file mode 100644
index 00000000000..b08643e3017
--- /dev/null
+++ b/src/mess/machine/c64/easyflash.c
@@ -0,0 +1,228 @@
+/**********************************************************************
+
+ EasyFlash cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "easyflash.h"
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define AM29F040_0_TAG "u3"
+#define AM29F040_1_TAG "u4"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_EASYFLASH = &device_creator<c64_easyflash_cartridge_device>;
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_easyflash )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_easyflash )
+ MCFG_AMD_29F040_ADD(AM29F040_0_TAG)
+ MCFG_AMD_29F040_ADD(AM29F040_1_TAG)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_easyflash_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_easyflash );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_easyflash )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_easyflash )
+ PORT_START("JP1")
+ PORT_DIPNAME( 0x01, 0x00, "Boot" )
+ PORT_DIPSETTING( 0x00, "Disable" )
+ PORT_DIPSETTING( 0x01, "Boot" )
+
+ PORT_START("RESET")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_easyflash_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_easyflash );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_easyflash_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_easyflash_cartridge_device::c64_easyflash_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_EASYFLASH, "C64 EasyFlash cartridge", tag, owner, clock, "c64_easyflash", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_flash_roml(*this, AM29F040_0_TAG),
+ m_flash_romh(*this, AM29F040_1_TAG),
+ m_jp1(*this, "JP1"),
+ m_bank(0),
+ m_mode(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_easyflash_cartridge_device::device_start()
+{
+ // allocate memory
+ c64_ram_pointer(machine(), 0x100);
+
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_mode));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_easyflash_cartridge_device::device_reset()
+{
+ m_bank = 0;
+ m_mode = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_easyflash_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_flash_roml->read(addr);
+ }
+ else if (!romh)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_flash_romh->read(addr);
+ }
+ else if (!io2)
+ {
+ data = m_ram[offset & 0xff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_easyflash_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ m_flash_roml->write(addr, data);
+ }
+ else if (!romh)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ m_flash_romh->write(addr, data);
+ }
+ else if (!io1)
+ {
+ if (!BIT(offset, 1))
+ {
+ /*
+
+ bit description
+
+ 0 BA13
+ 1 BA14
+ 2 BA15
+ 3 BA16
+ 4 BA17
+ 5 BA18
+ 6
+ 7
+
+ */
+
+ m_bank = data & 0x3f;
+ }
+ else
+ {
+ /*
+
+ bit description
+
+ 0 GAME
+ 1 EXROM
+ 2 MODE
+ 3
+ 4
+ 5
+ 6
+ 7 LED
+
+ */
+
+ m_mode = data;
+ }
+ }
+ else if (!io2)
+ {
+ m_ram[offset & 0xff] = data;
+ }
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_easyflash_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return !BIT(m_mode, 1);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_easyflash_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return !(BIT(m_mode, 0) | !(BIT(m_mode, 2) | m_jp1->read()));
+}
diff --git a/src/mess/machine/c64/easyflash.h b/src/mess/machine/c64/easyflash.h
new file mode 100644
index 00000000000..1115bc3523c
--- /dev/null
+++ b/src/mess/machine/c64/easyflash.h
@@ -0,0 +1,64 @@
+/**********************************************************************
+
+ EasyFlash cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __EASYFLASH__
+#define __EASYFLASH__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/intelfsh.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_easyflash_cartridge_device
+
+class c64_easyflash_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_easyflash_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<amd_29f040_device> m_flash_roml;
+ required_device<amd_29f040_device> m_flash_romh;
+ required_ioport m_jp1;
+
+ UINT8 m_bank;
+ UINT8 m_mode;
+};
+
+
+// device type definition
+extern const device_type C64_EASYFLASH;
+
+
+#endif
diff --git a/src/mess/machine/c64/epyx_fast_load.c b/src/mess/machine/c64/epyx_fast_load.c
new file mode 100644
index 00000000000..899056abce7
--- /dev/null
+++ b/src/mess/machine/c64/epyx_fast_load.c
@@ -0,0 +1,117 @@
+/**********************************************************************
+
+ Epyx Fast Load cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "epyx_fast_load.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+// t = R*C = 3.3K * 0.47uF * 40% Vtr = 792.2905424610516 usec
+// (3.3K pull-up on the EXROM line inside the C64, PLA Vih min = 2.0V = 40% of 5.0V)
+#define TIMER_PERIOD 792
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_EPYX_FAST_LOAD = &device_creator<c64_epyx_fast_load_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_epyx_fast_load_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_epyx_fast_load_cartridge_device::c64_epyx_fast_load_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_EPYX_FAST_LOAD, "C64 Epyx Fast Load cartridge", tag, owner, clock, "c64_epyx_fast_load", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_epyx_fast_load_cartridge_device::device_start()
+{
+ // allocate timer
+ m_exrom_timer = timer_alloc();
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_epyx_fast_load_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+}
+
+
+//-------------------------------------------------
+// device_timer - handler timer events
+//-------------------------------------------------
+
+void c64_epyx_fast_load_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ m_exrom = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_epyx_fast_load_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!io1)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+ }
+ else if (!io2)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_epyx_fast_load_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+ }
+}
diff --git a/src/mess/machine/c64/epyx_fast_load.h b/src/mess/machine/c64/epyx_fast_load.h
new file mode 100644
index 00000000000..89944cd44de
--- /dev/null
+++ b/src/mess/machine/c64/epyx_fast_load.h
@@ -0,0 +1,53 @@
+/**********************************************************************
+
+ Epyx Fast Load cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __EPYX_FAST_LOAD__
+#define __EPYX_FAST_LOAD__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_epyx_fast_load_cartridge_device
+
+class c64_epyx_fast_load_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_epyx_fast_load_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ emu_timer *m_exrom_timer;
+};
+
+
+// device type definition
+extern const device_type C64_EPYX_FAST_LOAD;
+
+
+#endif
diff --git a/src/mess/machine/c64/exos.c b/src/mess/machine/c64/exos.c
new file mode 100644
index 00000000000..8ebf01b90ca
--- /dev/null
+++ b/src/mess/machine/c64/exos.c
@@ -0,0 +1,68 @@
+/**********************************************************************
+
+ Rex ExOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "exos.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_EXOS = &device_creator<c64_exos_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_exos_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_exos_cartridge_device::c64_exos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_EXOS, "C64 ExOS cartridge", tag, owner, clock, "c64_exos", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_exos_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_exos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!romh)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_exos_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return !(ba & rw & ((offset & 0xe000) == 0xe000) & hiram);
+}
diff --git a/src/mess/machine/c64/exos.h b/src/mess/machine/c64/exos.h
new file mode 100644
index 00000000000..ab0f23497dc
--- /dev/null
+++ b/src/mess/machine/c64/exos.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+
+ Rex ExOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __EXOS__
+#define __EXOS__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_exos_cartridge_device
+
+class c64_exos_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_exos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+};
+
+
+// device type definition
+extern const device_type C64_EXOS;
+
+
+#endif
diff --git a/src/mess/machine/c64/exp.c b/src/mess/machine/c64/exp.c
new file mode 100644
index 00000000000..1014b4a707d
--- /dev/null
+++ b/src/mess/machine/c64/exp.c
@@ -0,0 +1,377 @@
+/**********************************************************************
+
+ Commodore 64 Expansion Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_EXPANSION_SLOT = &device_creator<c64_expansion_slot_device>;
+
+
+
+//**************************************************************************
+// DEVICE C64_EXPANSION CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_c64_expansion_card_interface - constructor
+//-------------------------------------------------
+
+device_c64_expansion_card_interface::device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig, device),
+ m_roml(NULL),
+ m_romh(NULL),
+ m_ram(NULL),
+ m_nvram(NULL),
+ m_nvram_size(0),
+ m_roml_mask(0),
+ m_romh_mask(0),
+ m_ram_mask(0),
+ m_game(1),
+ m_exrom(1)
+{
+ m_slot = dynamic_cast<c64_expansion_slot_device *>(device.owner());
+}
+
+
+//-------------------------------------------------
+// ~device_c64_expansion_card_interface - destructor
+//-------------------------------------------------
+
+device_c64_expansion_card_interface::~device_c64_expansion_card_interface()
+{
+}
+
+
+//-------------------------------------------------
+// c64_roml_pointer - get low ROM pointer
+//-------------------------------------------------
+
+UINT8* device_c64_expansion_card_interface::c64_roml_pointer(running_machine &machine, size_t size)
+{
+ if (m_roml == NULL)
+ {
+ m_roml = auto_alloc_array(machine, UINT8, size);
+
+ m_roml_mask = size - 1;
+ }
+
+ return m_roml;
+}
+
+
+//-------------------------------------------------
+// c64_romh_pointer - get high ROM pointer
+//-------------------------------------------------
+
+UINT8* device_c64_expansion_card_interface::c64_romh_pointer(running_machine &machine, size_t size)
+{
+ if (m_romh == NULL)
+ {
+ m_romh = auto_alloc_array(machine, UINT8, size);
+
+ m_romh_mask = size - 1;
+ }
+
+ return m_romh;
+}
+
+
+//-------------------------------------------------
+// c64_ram_pointer - get RAM pointer
+//-------------------------------------------------
+
+UINT8* device_c64_expansion_card_interface::c64_ram_pointer(running_machine &machine, size_t size)
+{
+ if (m_ram == NULL)
+ {
+ m_ram = auto_alloc_array(machine, UINT8, size);
+
+ m_ram_mask = size - 1;
+ }
+
+ return m_ram;
+}
+
+
+//-------------------------------------------------
+// c64_ram_pointer - get NVRAM pointer
+//-------------------------------------------------
+
+UINT8* device_c64_expansion_card_interface::c64_nvram_pointer(running_machine &machine, size_t size)
+{
+ if (m_nvram == NULL)
+ {
+ m_nvram = auto_alloc_array(machine, UINT8, size);
+
+ m_nvram_mask = size - 1;
+ m_nvram_size = size;
+ }
+
+ return m_nvram;
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_expansion_slot_device - constructor
+//-------------------------------------------------
+
+c64_expansion_slot_device::c64_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_EXPANSION_SLOT, "C64 expansion port", tag, owner, clock, "c64_expansion_slot", __FILE__),
+ device_slot_interface(mconfig, *this),
+ device_image_interface(mconfig, *this),
+ m_read_dma_cd(*this),
+ m_write_dma_cd(*this),
+ m_write_irq(*this),
+ m_write_nmi(*this),
+ m_write_dma(*this),
+ m_write_reset(*this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_expansion_slot_device::device_start()
+{
+ m_card = dynamic_cast<device_c64_expansion_card_interface *>(get_card_device());
+
+ // resolve callbacks
+ m_read_dma_cd.resolve_safe(0);
+ m_write_dma_cd.resolve_safe();
+ m_write_irq.resolve_safe();
+ m_write_nmi.resolve_safe();
+ m_write_dma.resolve_safe();
+ m_write_reset.resolve_safe();
+
+ // inherit bus clock
+ if (clock() == 0)
+ {
+ c64_expansion_slot_device *root = machine().device<c64_expansion_slot_device>(C64_EXPANSION_SLOT_TAG);
+ assert(root);
+ set_unscaled_clock(root->clock());
+ }
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_expansion_slot_device::device_reset()
+{
+ if (get_card_device())
+ {
+ get_card_device()->reset();
+ }
+}
+
+
+//-------------------------------------------------
+// call_load -
+//-------------------------------------------------
+
+bool c64_expansion_slot_device::call_load()
+{
+ if (m_card)
+ {
+ size_t size = 0;
+
+ if (software_entry() == NULL)
+ {
+ size = length();
+
+ if (!mame_stricmp(filetype(), "80"))
+ {
+ fread(m_card->c64_roml_pointer(machine(), size), size);
+ m_card->m_exrom = (0);
+
+ if (size == 0x4000)
+ {
+ m_card->m_game = 0;
+ }
+ }
+ else if (!mame_stricmp(filetype(), "a0"))
+ {
+ fread(m_card->c64_romh_pointer(machine(), 0x2000), 0x2000);
+
+ m_card->m_exrom = 0;
+ m_card->m_game = 0;
+ }
+ else if (!mame_stricmp(filetype(), "e0"))
+ {
+ fread(m_card->c64_romh_pointer(machine(), 0x2000), 0x2000);
+
+ m_card->m_game = 0;
+ }
+ else if (!mame_stricmp(filetype(), "crt"))
+ {
+ size_t roml_size = 0;
+ size_t romh_size = 0;
+ int exrom = 1;
+ int game = 1;
+
+ if (cbm_crt_read_header(m_file, &roml_size, &romh_size, &exrom, &game))
+ {
+ UINT8 *roml = NULL;
+ UINT8 *romh = NULL;
+
+ if (roml_size) roml = m_card->c64_roml_pointer(machine(), roml_size);
+ if (romh_size) romh = m_card->c64_romh_pointer(machine(), romh_size);
+
+ cbm_crt_read_data(m_file, roml, romh);
+ }
+
+ m_card->m_exrom = exrom;
+ m_card->m_game = game;
+ }
+ }
+ else
+ {
+ size = get_software_region_length("uprom");
+
+ if (size)
+ {
+ // Ultimax (VIC-10) cartridge
+ memcpy(m_card->c64_romh_pointer(machine(), size), get_software_region("uprom"), size);
+
+ size = get_software_region_length("lorom");
+ if (size) memcpy(m_card->c64_roml_pointer(machine(), size), get_software_region("lorom"), size);
+
+ m_card->m_exrom = 1;
+ m_card->m_game = 0;
+ }
+ else
+ {
+ // Commodore 64/128 cartridge
+ size = get_software_region_length("roml");
+ if (size) memcpy(m_card->c64_roml_pointer(machine(), size), get_software_region("roml"), size);
+
+ size = get_software_region_length("romh");
+ if (size) memcpy(m_card->c64_romh_pointer(machine(), size), get_software_region("romh"), size);
+
+ size = get_software_region_length("ram");
+ if (size) memset(m_card->c64_ram_pointer(machine(), size), 0, size);
+
+ size = get_software_region_length("nvram");
+ if (size) memset(m_card->c64_nvram_pointer(machine(), size), 0, size);
+
+ if (get_feature("exrom") != NULL) m_card->m_exrom = atol(get_feature("exrom"));
+ if (get_feature("game") != NULL) m_card->m_game = atol(get_feature("game"));
+ }
+ }
+ }
+
+ return IMAGE_INIT_PASS;
+}
+
+
+//-------------------------------------------------
+// call_softlist_load -
+//-------------------------------------------------
+
+bool c64_expansion_slot_device::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
+{
+ load_software_part_region(this, swlist, swname, start_entry);
+
+ return true;
+}
+
+
+//-------------------------------------------------
+// get_default_card_software -
+//-------------------------------------------------
+
+const char * c64_expansion_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
+{
+ if (open_image_file(options))
+ {
+ if (!mame_stricmp(filetype(), "crt"))
+ {
+ return cbm_crt_get_card(m_file);
+ }
+
+ clear();
+ }
+
+ return software_get_default_slot(config, options, this, "standard");
+}
+
+
+//-------------------------------------------------
+// cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_expansion_slot_device::cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (m_card != NULL)
+ {
+ data = m_card->c64_cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (m_card != NULL)
+ {
+ m_card->c64_cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+ }
+}
+
+
+//-------------------------------------------------
+// game_r - GAME read
+//-------------------------------------------------
+
+int c64_expansion_slot_device::game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ int state = 1;
+
+ if (m_card != NULL)
+ {
+ state = m_card->c64_game_r(offset, sphi2, ba, rw, hiram);
+ }
+
+ return state;
+}
+
+
+//-------------------------------------------------
+// exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_expansion_slot_device::exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ int state = 1;
+
+ if (m_card != NULL)
+ {
+ state = m_card->c64_exrom_r(offset, sphi2, ba, rw, hiram);
+ }
+
+ return state;
+}
diff --git a/src/mess/machine/c64/exp.h b/src/mess/machine/c64/exp.h
new file mode 100644
index 00000000000..1fa57cfd8b0
--- /dev/null
+++ b/src/mess/machine/c64/exp.h
@@ -0,0 +1,202 @@
+/**********************************************************************
+
+ Commodore 64 Expansion Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************
+
+ GND 1 A GND
+ +5V 2 B _ROMH
+ +5V 3 C _RESET
+ _IRQ 4 D _NMI
+ _CR/W 5 E Sphi2
+ DOTCLK 6 F CA15
+ _I/O1 7 H CA14
+ _GAME 8 J CA13
+ _EXROM 9 K CA12
+ _I/O2 10 L CA11
+ _ROML 11 M CA10
+ BA 12 N CA9
+ _DMA 13 P CA8
+ CD7 14 R CA7
+ CD6 15 S CA6
+ CD5 16 T CA5
+ CD4 17 U CA4
+ CD3 18 V CA3
+ CD2 19 W CA2
+ CD1 20 X CA1
+ CD0 21 Y CA0
+ GND 22 Z GND
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_EXPANSION_SLOT__
+#define __C64_EXPANSION_SLOT__
+
+#include "emu.h"
+#include "machine/cbm_crt.h"
+
+
+
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+
+#define C64_EXPANSION_SLOT_TAG "exp"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_C64_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
+ MCFG_DEVICE_ADD(_tag, C64_EXPANSION_SLOT, _clock) \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+#define MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD() \
+ MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, 0, c64_expansion_cards, NULL) \
+ MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, irq_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, nmi_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)) \
+ MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_cd_r), DEVWRITE8(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_cd_w), DEVWRITELINE(DEVICE_SELF_OWNER, c64_expansion_slot_device, dma_w))
+
+
+#define MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(_irq, _nmi, _reset) \
+ downcast<c64_expansion_slot_device *>(device)->set_irq_callbacks(DEVCB2_##_irq, DEVCB2_##_nmi, DEVCB2_##_reset);
+
+#define MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(_read, _write, _dma) \
+ downcast<c64_expansion_slot_device *>(device)->set_dma_callbacks(DEVCB2_##_read, DEVCB2_##_write, DEVCB2_##_dma);
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_expansion_slot_device
+
+class device_c64_expansion_card_interface;
+
+class c64_expansion_slot_device : public device_t,
+ public device_slot_interface,
+ public device_image_interface
+{
+public:
+ // construction/destruction
+ c64_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _irq, class _nmi, class _reset> void set_irq_callbacks(_irq irq, _nmi nmi, _reset reset) {
+ m_write_irq.set_callback(irq);
+ m_write_nmi.set_callback(nmi);
+ m_write_reset.set_callback(reset);
+ }
+
+ template<class _read, class _write, class _dma> void set_dma_callbacks(_read read, _write write, _dma dma) {
+ m_read_dma_cd.set_callback(read);
+ m_write_dma_cd.set_callback(write);
+ m_write_dma.set_callback(dma);
+ }
+
+ // computer interface
+ UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ void cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ int game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ int exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+ // cartridge interface
+ DECLARE_READ8_MEMBER( dma_cd_r ) { return m_read_dma_cd(offset); }
+ DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_write_dma_cd(offset, data); }
+ DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
+ DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
+ DECLARE_WRITE_LINE_MEMBER( dma_w ) { m_write_dma(state); }
+ DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_write_reset(state); }
+ int phi2() { return clock(); }
+ int dotclock() { return phi2() * 8; }
+
+protected:
+ // device-level overrides
+ virtual void device_config_complete() { update_names(); }
+ virtual void device_start();
+ virtual void device_reset();
+
+ // image-level overrides
+ virtual bool call_load();
+ virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
+
+ virtual iodevice_t image_type() const { return IO_CARTSLOT; }
+
+ virtual bool is_readable() const { return 1; }
+ virtual bool is_writeable() const { return 0; }
+ virtual bool is_creatable() const { return 0; }
+ virtual bool must_be_loaded() const { return 0; }
+ virtual bool is_reset_on_load() const { return 1; }
+ virtual const char *image_interface() const { return "c64_cart,vic10_cart"; }
+ virtual const char *file_extensions() const { return "80,a0,e0,crt"; }
+ virtual const option_guide *create_option_guide() const { return NULL; }
+
+ // slot interface overrides
+ virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
+
+ devcb2_read8 m_read_dma_cd;
+ devcb2_write8 m_write_dma_cd;
+ devcb2_write_line m_write_irq;
+ devcb2_write_line m_write_nmi;
+ devcb2_write_line m_write_dma;
+ devcb2_write_line m_write_reset;
+
+ device_c64_expansion_card_interface *m_card;
+};
+
+
+// ======================> device_c64_expansion_card_interface
+
+class device_c64_expansion_card_interface : public device_slot_card_interface
+{
+ friend class c64_expansion_slot_device;
+
+public:
+ // construction/destruction
+ device_c64_expansion_card_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_c64_expansion_card_interface();
+
+protected:
+ // initialization
+ virtual UINT8* c64_roml_pointer(running_machine &machine, size_t size);
+ virtual UINT8* c64_romh_pointer(running_machine &machine, size_t size);
+ virtual UINT8* c64_ram_pointer(running_machine &machine, size_t size);
+ virtual UINT8* c64_nvram_pointer(running_machine &machine, size_t size);
+
+ // runtime
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) { return data; };
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) { };
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return m_game; }
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return m_exrom; }
+
+ c64_expansion_slot_device *m_slot;
+
+ UINT8 *m_roml;
+ UINT8 *m_romh;
+ UINT8 *m_ram;
+ UINT8 *m_nvram;
+
+ size_t m_nvram_size;
+
+ size_t m_roml_mask;
+ size_t m_romh_mask;
+ size_t m_ram_mask;
+ size_t m_nvram_mask;
+
+ int m_game;
+ int m_exrom;
+};
+
+
+// device type definition
+extern const device_type C64_EXPANSION_SLOT;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/fcc.c b/src/mess/machine/c64/fcc.c
new file mode 100644
index 00000000000..b15b5b7fe40
--- /dev/null
+++ b/src/mess/machine/c64/fcc.c
@@ -0,0 +1,256 @@
+/**********************************************************************
+
+ Tasc Final ChessCard cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ TODO:
+
+ 629D ldx #$00
+ 629F stx $0e
+ 62A1 sta $df00
+ 62A4 inc $d020
+ 62A7 dec $d020
+ 62AA cpx $0e
+ 62AC beq $62a4 <-- eternal loop here
+ 62AE rts
+
+*/
+
+#include "fcc.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define G65SC02P4_TAG "g65sc02p4"
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_FCC = &device_creator<c64_final_chesscard_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_fcc )
+//-------------------------------------------------
+
+ROM_START( c64_fcc )
+ ROM_REGION( 0x8000, G65SC02P4_TAG, 0 )
+ ROM_LOAD( "fcc_rom1", 0x0000, 0x8000, CRC(2949836a) SHA1(9e6283095df9e3f4802ed0c654101f8e37168bf6) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_final_chesscard_device::device_rom_region() const
+{
+ return ROM_NAME( c64_fcc );
+}
+
+
+//-------------------------------------------------
+// ADDRESS_MAP( c64_fcc_map )
+//-------------------------------------------------
+
+static ADDRESS_MAP_START( c64_fcc_map, AS_PROGRAM, 8, c64_final_chesscard_device )
+ AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x6000) AM_READWRITE(nvram_r, nvram_w)
+ AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION(G65SC02P4_TAG, 0)
+ADDRESS_MAP_END
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_fcc )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_fcc )
+ MCFG_CPU_ADD(G65SC02P4_TAG, M65SC02, XTAL_5MHz)
+ MCFG_CPU_PROGRAM_MAP(c64_fcc_map)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_final_chesscard_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_fcc );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_fcc )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_fcc )
+ PORT_START("RESET")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_final_chesscard_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_fcc );
+}
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_final_chesscard_device - constructor
+//-------------------------------------------------
+
+c64_final_chesscard_device::c64_final_chesscard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_FCC, "Final ChessCard", tag, owner, clock, "c64_fcc", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ device_nvram_interface(mconfig, *this),
+ m_maincpu(*this, G65SC02P4_TAG),
+ m_bank(0),
+ m_ramen(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_final_chesscard_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_final_chesscard_device::device_reset()
+{
+ m_maincpu->reset();
+
+ m_bank = 0;
+ m_ramen = 0;
+ m_game = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_final_chesscard_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ if (m_ramen)
+ {
+ data = m_nvram[offset & 0x1fff];
+ }
+ else
+ {
+ data = m_roml[(m_bank << 14) | (offset & 0x3fff)];
+ }
+ }
+ else if (!romh)
+ {
+ data = m_roml[(m_bank << 14) | (offset & 0x3fff)];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_final_chesscard_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ if (m_ramen)
+ {
+ m_nvram[offset & 0x1fff] = data;
+ }
+ }
+ else if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0 ?
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+
+ */
+
+ printf("IO1 %04x %02x\n", offset, data);
+ m_bank = BIT(data, 0);
+ }
+ else if (!io2)
+ {
+ /*
+
+ bit description
+
+ 0 ?
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7 ?
+
+ */
+
+ printf("IO2 %04x %02x\n", offset, data);
+ m_ramen = BIT(data, 0);
+ m_game = BIT(data, 7);
+ }
+}
+
+
+//-------------------------------------------------
+// nvram_r - NVRAM read
+//-------------------------------------------------
+
+READ8_MEMBER( c64_final_chesscard_device::nvram_r )
+{
+ return m_nvram[offset & m_nvram_mask];
+}
+
+
+//-------------------------------------------------
+// nvram_w - NVRAM write
+//-------------------------------------------------
+
+WRITE8_MEMBER( c64_final_chesscard_device::nvram_w )
+{
+ m_nvram[offset & m_nvram_mask] = data;
+}
diff --git a/src/mess/machine/c64/fcc.h b/src/mess/machine/c64/fcc.h
new file mode 100644
index 00000000000..f3de27fe873
--- /dev/null
+++ b/src/mess/machine/c64/fcc.h
@@ -0,0 +1,70 @@
+/**********************************************************************
+
+ Tasc Final ChessCard cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __FCC__
+#define __FCC__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "cpu/m6502/m65sc02.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_final_chesscard_device
+
+class c64_final_chesscard_device : public device_t,
+ public device_c64_expansion_card_interface,
+ public device_nvram_interface
+{
+public:
+ // construction/destruction
+ c64_final_chesscard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_READ8_MEMBER( nvram_r );
+ DECLARE_WRITE8_MEMBER( nvram_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_nvram_interface overrides
+ virtual void nvram_default() { }
+ virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
+ virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<m65sc02_device> m_maincpu;
+
+ UINT8 m_bank;
+ int m_ramen;
+};
+
+
+// device type definition
+extern const device_type C64_FCC;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/final.c b/src/mess/machine/c64/final.c
new file mode 100644
index 00000000000..07bd03925eb
--- /dev/null
+++ b/src/mess/machine/c64/final.c
@@ -0,0 +1,135 @@
+/**********************************************************************
+
+ Final Cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "final.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_FINAL = &device_creator<c64_final_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_CHANGED_MEMBER( freeze )
+//-------------------------------------------------
+
+INPUT_CHANGED_MEMBER( c64_final_cartridge_device::freeze )
+{
+ if (newval)
+ {
+ m_game = 0;
+ }
+
+ m_slot->nmi_w(newval);
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_final )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_final )
+ PORT_START("SW")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_final_cartridge_device, freeze, 0)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_final_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_final );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_final_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_final_cartridge_device::c64_final_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_FINAL, "C64 Final cartridge", tag, owner, clock, "c64_final", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_final_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_final_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+ m_game = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_final_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh || !io1 || !io2)
+ {
+ data = m_roml[offset & 0x3fff];
+ }
+
+ if (!io1)
+ {
+ m_game = 1;
+ m_exrom = 1;
+ }
+ else if (!io2)
+ {
+ m_exrom = 0;
+ m_game = 0;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_final_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_game = 1;
+ m_exrom = 1;
+ }
+ else if (!io2)
+ {
+ m_exrom = 0;
+ m_game = 0;
+ }
+}
diff --git a/src/mess/machine/c64/final.h b/src/mess/machine/c64/final.h
new file mode 100644
index 00000000000..3acbb0515c3
--- /dev/null
+++ b/src/mess/machine/c64/final.h
@@ -0,0 +1,54 @@
+/**********************************************************************
+
+ Final Cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __FINAL__
+#define __FINAL__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_final_cartridge_device
+
+class c64_final_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_final_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_INPUT_CHANGED_MEMBER( freeze );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_FINAL;
+
+
+#endif
diff --git a/src/mess/machine/c64/final3.c b/src/mess/machine/c64/final3.c
new file mode 100644
index 00000000000..93721c1a122
--- /dev/null
+++ b/src/mess/machine/c64/final3.c
@@ -0,0 +1,151 @@
+/**********************************************************************
+
+ Final Cartridge III emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "final3.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_FINAL3 = &device_creator<c64_final3_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_CHANGED_MEMBER( freeze )
+//-------------------------------------------------
+
+INPUT_CHANGED_MEMBER( c64_final3_cartridge_device::freeze )
+{
+ if (newval)
+ {
+ m_game = 0;
+ m_hidden = 0;
+ }
+
+ m_slot->nmi_w(newval);
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_final3 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_final3 )
+ PORT_START("SW")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_final3_cartridge_device, freeze, 0)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_final3_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_final3 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_final3_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_final3_cartridge_device::c64_final3_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_FINAL3, "C64 Final Cartridge III", tag, owner, clock, "c64_final3", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_final3_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_hidden));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_final3_cartridge_device::device_reset()
+{
+ m_bank = 0;
+
+ m_exrom = 0;
+ m_game = 0;
+
+ m_slot->nmi_w(CLEAR_LINE);
+
+ m_hidden = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_final3_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh || !io1 || !io2)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_final3_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_hidden && !io2 && ((offset & 0xff) == 0xff))
+ {
+ /*
+
+ bit description
+
+ 0 A14
+ 1 A15
+ 2
+ 3
+ 4 EXROM
+ 5 GAME
+ 6 NMI
+ 7 hide register
+
+ */
+
+ m_bank = data & 0x03;
+
+ m_exrom = BIT(data, 4);
+ m_game = BIT(data, 5);
+
+ m_slot->nmi_w(BIT(data, 6) ? CLEAR_LINE : ASSERT_LINE);
+
+ m_hidden = BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/final3.h b/src/mess/machine/c64/final3.h
new file mode 100644
index 00000000000..bb125adc749
--- /dev/null
+++ b/src/mess/machine/c64/final3.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Final Cartridge III emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __FINAL3__
+#define __FINAL3__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_final3_cartridge_device
+
+class c64_final3_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_final3_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_INPUT_CHANGED_MEMBER( freeze );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+ int m_hidden;
+};
+
+
+// device type definition
+extern const device_type C64_FINAL3;
+
+
+#endif
diff --git a/src/mess/machine/c64/fun_play.c b/src/mess/machine/c64/fun_play.c
new file mode 100644
index 00000000000..30b1f1e6d86
--- /dev/null
+++ b/src/mess/machine/c64/fun_play.c
@@ -0,0 +1,99 @@
+/**********************************************************************
+
+ Fun Play / Power Play cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "fun_play.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_FUN_PLAY = &device_creator<c64_fun_play_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_fun_play_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_fun_play_cartridge_device::c64_fun_play_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_FUN_PLAY, "C64 Fun Play cartridge", tag, owner, clock, "c64_fun_play", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_fun_play_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_fun_play_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_fun_play_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_fun_play_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0 A16
+ 1
+ 2
+ 3 A13
+ 4 A14
+ 5 A15
+ 6
+ 7
+
+ */
+
+ m_bank = ((data & 0x01) << 3) | ((data >> 3) & 0x07);
+ }
+}
diff --git a/src/mess/machine/c64/fun_play.h b/src/mess/machine/c64/fun_play.h
new file mode 100644
index 00000000000..c21a7708cf7
--- /dev/null
+++ b/src/mess/machine/c64/fun_play.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Fun Play / Power Play cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __FUN_PLAY__
+#define __FUN_PLAY__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_fun_play_cartridge_device
+
+class c64_fun_play_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_fun_play_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_FUN_PLAY;
+
+
+#endif
diff --git a/src/mess/machine/c64/geocable.c b/src/mess/machine/c64/geocable.c
new file mode 100644
index 00000000000..19ac039274f
--- /dev/null
+++ b/src/mess/machine/c64/geocable.c
@@ -0,0 +1,109 @@
+/**********************************************************************
+
+ geoCable Centronics Cable emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "geocable.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define CENTRONICS_TAG "centronics"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_GEOCABLE = &device_creator<c64_geocable_device>;
+
+
+//-------------------------------------------------
+// centronics_interface centronics_intf
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_geocable_device::busy_w )
+{
+ m_slot->cia_flag2_w(state);
+}
+
+static const centronics_interface centronics_intf =
+{
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF, c64_geocable_device, busy_w),
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_geocable )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_geocable )
+ MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, centronics_intf)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_geocable_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_geocable );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_geocable_device - constructor
+//-------------------------------------------------
+
+c64_geocable_device::c64_geocable_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_GEOCABLE, "C64 geoCable", tag, owner, clock, "c64_geocable", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_centronics(*this, CENTRONICS_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_geocable_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+void c64_geocable_device::c64_pb_w(address_space &space, offs_t offset, UINT8 data)
+{
+ m_centronics->write(space, 0, data);
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+void c64_geocable_device::c64_pa2_w(int level)
+{
+ m_centronics->strobe_w(level);
+}
diff --git a/src/mess/machine/c64/geocable.h b/src/mess/machine/c64/geocable.h
new file mode 100644
index 00000000000..8a999203e94
--- /dev/null
+++ b/src/mess/machine/c64/geocable.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ geoCable Centronics Cable emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_GEOCABLE__
+#define __C64_GEOCABLE__
+
+
+#include "emu.h"
+#include "machine/c64/user.h"
+#include "machine/ctronics.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_geocable_device
+
+class c64_geocable_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_geocable_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ // not really public
+ DECLARE_WRITE_LINE_MEMBER( busy_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data);
+ virtual void c64_pa2_w(int level);
+
+private:
+ required_device<centronics_device> m_centronics;
+};
+
+
+// device type definition
+extern const device_type C64_GEOCABLE;
+
+
+#endif
diff --git a/src/mess/machine/c64/georam.c b/src/mess/machine/c64/georam.c
new file mode 100644
index 00000000000..5ca6c6e1b70
--- /dev/null
+++ b/src/mess/machine/c64/georam.c
@@ -0,0 +1,99 @@
+/**********************************************************************
+
+ Berkeley Softworks GeoRAM emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "georam.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_GEORAM = &device_creator<c64_georam_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_georam_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_georam_cartridge_device::c64_georam_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_GEORAM, "C64 GeoRAM cartridge", tag, owner, clock, "c64_georam", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_georam_cartridge_device::device_start()
+{
+ // allocate memory
+ c64_ram_pointer(machine(), 0x80000);
+
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_georam_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_georam_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ offs_t addr = (m_bank << 8) | (offset & 0xff);
+ data = m_ram[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_georam_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ offs_t addr = (m_bank << 8) | (offset & 0xff);
+ m_ram[addr] = data;
+ }
+ else if (!io2)
+ {
+ if (BIT(offset, 0))
+ {
+ m_bank = ((data & 0x1f) << 6) | (m_bank & 0x3f);
+ }
+ else
+ {
+ m_bank = (m_bank & 0x7c0) | (data & 0x3f);
+ }
+ }
+}
diff --git a/src/mess/machine/c64/georam.h b/src/mess/machine/c64/georam.h
new file mode 100644
index 00000000000..0f6a4751574
--- /dev/null
+++ b/src/mess/machine/c64/georam.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Berkeley Softworks GeoRAM emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __GEORAM__
+#define __GEORAM__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_georam_cartridge_device
+
+class c64_georam_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_georam_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT16 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_GEORAM;
+
+
+#endif
diff --git a/src/mess/machine/c64/ide64.c b/src/mess/machine/c64/ide64.c
new file mode 100644
index 00000000000..31890efe0c5
--- /dev/null
+++ b/src/mess/machine/c64/ide64.c
@@ -0,0 +1,357 @@
+/**********************************************************************
+
+ IDE64 v4.1 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ TODO:
+
+ - fast loader does not work with 1541
+ - IDE unknown command (E8)
+ - FT245 USB
+ - CompactFlash slot
+ - ShortBus (ETH64, DUART, DigiMAX, ETFE)
+ - clock port (ETH64 II, RR-Net, SilverSurfer, MP3@64)
+
+*/
+
+#include "ide64.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define AT29C010A_TAG "u3"
+#define DS1302_TAG "u4"
+#define FT245R_TAG "u21"
+#define ATA_TAG "ata"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_IDE64 = &device_creator<c64_ide64_cartridge_device>;
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_ide64 )
+//-------------------------------------------------
+static MACHINE_CONFIG_FRAGMENT( c64_ide64 )
+ MCFG_ATMEL_29C010_ADD(AT29C010A_TAG)
+ MCFG_DS1302_ADD(DS1302_TAG, XTAL_32_768kHz)
+
+ MCFG_ATA_INTERFACE_ADD(ATA_TAG, ata_devices, "hdd", NULL, false)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_ide64_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_ide64 );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_ide64 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_ide64 )
+ PORT_START("JP1")
+ PORT_DIPNAME( 0x01, 0x01, "Flash ROM Write Protect" )
+ PORT_DIPSETTING( 0x00, "Disabled" )
+ PORT_DIPSETTING( 0x01, "Enabled" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_ide64_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_ide64 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_ide64_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_ide64_cartridge_device::c64_ide64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_IDE64, "C64 IDE64 cartridge", tag, owner, clock, "c64_ide64", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_flash_rom(*this, AT29C010A_TAG),
+ m_rtc(*this, DS1302_TAG),
+ m_ata(*this, ATA_TAG),
+ m_jp1(*this, "JP1")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_ide64_cartridge_device::device_start()
+{
+ // allocate memory
+ c64_ram_pointer(machine(), 0x8000);
+
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_ata_data));
+ save_item(NAME(m_enable));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_ide64_cartridge_device::device_reset()
+{
+ m_bank = 0;
+
+ m_enable = 1;
+
+ m_wp = m_jp1->read();
+ m_game = !m_wp;
+ m_exrom = !m_wp;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_ide64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_enable) return data;
+
+ int rom_oe = 1, ram_oe = 1;
+
+ if (!m_game && m_exrom && sphi2 && ba)
+ {
+ if (offset >= 0x1000 && offset < 0x8000)
+ {
+ ram_oe = 0;
+ }
+ else if (offset >= 0x8000 && offset < 0xc000)
+ {
+ rom_oe = 0;
+ }
+ else if (offset >= 0xc000 && offset < 0xd000)
+ {
+ ram_oe = 0;
+ }
+ }
+
+ if (!roml || !romh)
+ {
+ rom_oe = 0;
+ }
+
+ if (!io1 && sphi2 && ba)
+ {
+ // 0x20-0x2f IDE
+ // 0x30-0x37 I/O
+ // 0x5d-0x5e FT245
+ // 0x5f-0x5f DS1302
+ // 0x60-0xff ROM
+
+ UINT8 io1_offset = offset & 0xff;
+
+ if (io1_offset >= 0x20 && io1_offset < 0x28)
+ {
+ m_ata_data = m_ata->read_cs0(space, offset & 0x07, 0xffff);
+
+ data = m_ata_data & 0xff;
+ }
+ else if (io1_offset >= 0x28 && io1_offset < 0x30)
+ {
+ m_ata_data = m_ata->read_cs1(space, offset & 0x07, 0xffff);
+
+ data = m_ata_data & 0xff;
+ }
+ else if (io1_offset == 0x31)
+ {
+ data = m_ata_data >> 8;
+ }
+ else if (io1_offset == 0x32)
+ {
+ /*
+
+ bit description
+
+ 0 EXROM
+ 1 GAME
+ 2 A14
+ 3 A15
+ 4 A16
+ 5 v4.x
+ 6
+ 7
+
+ */
+
+ data = 0x20 | (m_bank << 2) | (m_game << 1) | m_exrom;
+ }
+ else if (io1_offset == 0x5f)
+ {
+ m_rtc->sclk_w(0);
+
+ data &= ~0x01;
+ data |= m_rtc->io_r();
+
+ m_rtc->sclk_w(1);
+ }
+ else if (io1_offset >= 0x60)
+ {
+ rom_oe = 0;
+ }
+ }
+
+ if (!rom_oe)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+
+ data = m_flash_rom->read(addr);
+ }
+ else if (!ram_oe)
+ {
+ data = m_ram[offset & 0x7fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_ide64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_enable) return;
+
+ if (!m_game && m_exrom)
+ {
+ if (offset >= 0x1000 && offset < 0x8000)
+ {
+ m_ram[offset & 0x7fff] = data;
+ }
+ else if (offset >= 0xc000 && offset < 0xd000)
+ {
+ m_ram[offset & 0x7fff] = data;
+ }
+ }
+
+ if ((offset >= 0x8000 && offset < 0xc000) && !m_wp)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+ m_flash_rom->write(addr, data);
+ }
+
+ if (!io1)
+ {
+ // 0x20-0x2f IDE
+ // 0x30-0x37 I/O
+ // 0x5d-0x5e FT245
+ // 0x5f-0x5f DS1302
+ // 0x60-0xff ROM
+
+ UINT8 io1_offset = offset & 0xff;
+
+ if (io1_offset >= 0x20 && io1_offset < 0x28)
+ {
+ m_ata_data = (m_ata_data & 0xff00) | data;
+
+ m_ata->write_cs0(space, offset & 0x07, m_ata_data, 0xffff);
+ }
+ else if (io1_offset >= 0x28 && io1_offset < 0x30)
+ {
+ m_ata_data = (m_ata_data & 0xff00) | data;
+
+ m_ata->write_cs1(space, offset & 0x07, m_ata_data, 0xffff);
+ }
+ else if (io1_offset == 0x31)
+ {
+ m_ata_data = (data << 8) | (m_ata_data & 0xff);
+ }
+ else if (io1_offset == 0x5f)
+ {
+ m_rtc->sclk_w(0);
+
+ m_rtc->io_w(BIT(data, 0));
+
+ m_rtc->sclk_w(1);
+ }
+ else if (io1_offset >= 0x60 && io1_offset < 0x68)
+ {
+ m_bank = offset & 0x07;
+ }
+ else if (io1_offset == 0xfb)
+ {
+ /*
+
+ bit description
+
+ 0 disable cartridge
+ 1 RTC CE
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+
+ */
+
+ m_enable = !BIT(data, 0);
+ m_rtc->ce_w(BIT(data, 1));
+ }
+ else if (io1_offset >= 0xfc)
+ {
+ m_game = BIT(offset, 0);
+ m_exrom = BIT(offset, 1);
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_ide64_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return (sphi2 && ba) ? m_game : 1;
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_ide64_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return (sphi2 && ba) ? m_exrom : 1;
+}
diff --git a/src/mess/machine/c64/ide64.h b/src/mess/machine/c64/ide64.h
new file mode 100644
index 00000000000..fa1cdd4c859
--- /dev/null
+++ b/src/mess/machine/c64/ide64.h
@@ -0,0 +1,70 @@
+/**********************************************************************
+
+ IDE64 v4.1 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __IDE64__
+#define __IDE64__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/ds1302.h"
+#include "machine/ataintf.h"
+#include "machine/intelfsh.h"
+#include "imagedev/harddriv.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_ide64_cartridge_device
+
+class c64_ide64_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_ide64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<atmel_29c010_device> m_flash_rom;
+ required_device<ds1302_device> m_rtc;
+ required_device<ata_interface_device> m_ata;
+ required_ioport m_jp1;
+
+ UINT8 m_bank;
+ UINT16 m_ata_data;
+ int m_wp;
+ int m_enable;
+};
+
+
+// device type definition
+extern const device_type C64_IDE64;
+
+
+#endif
diff --git a/src/mess/machine/c64/ieee488.c b/src/mess/machine/c64/ieee488.c
new file mode 100644
index 00000000000..201faceade0
--- /dev/null
+++ b/src/mess/machine/c64/ieee488.c
@@ -0,0 +1,258 @@
+/**********************************************************************
+
+ Commodore IEEE-488 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "ieee488.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MOS6525_TAG "u3"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_IEEE488 = &device_creator<c64_ieee488_device>;
+
+
+//-------------------------------------------------
+// tpi6525_interface tpi_intf
+//-------------------------------------------------
+
+READ8_MEMBER( c64_ieee488_device::tpi_pa_r )
+{
+ /*
+
+ bit description
+
+ PA0
+ PA1
+ PA2 REN
+ PA3 ATN
+ PA4 DAV
+ PA5 EOI
+ PA6 NDAC
+ PA7 NRFD
+
+ */
+
+ UINT8 data = 0;
+
+ data |= m_bus->ren_r() << 2;
+ data |= m_bus->atn_r() << 3;
+ data |= m_bus->dav_r() << 4;
+ data |= m_bus->eoi_r() << 5;
+ data |= m_bus->ndac_r() << 6;
+ data |= m_bus->nrfd_r() << 7;
+
+ return data;
+}
+
+WRITE8_MEMBER( c64_ieee488_device::tpi_pa_w )
+{
+ /*
+
+ bit description
+
+ PA0 U4 DC
+ PA1 U4/U5 TE
+ PA2 REN
+ PA3 ATN
+ PA4 DAV
+ PA5 EOI
+ PA6 NDAC
+ PA7 NRFD
+
+ */
+
+ m_bus->ren_w(BIT(data, 2));
+ m_bus->atn_w(BIT(data, 3));
+ m_bus->dav_w(BIT(data, 4));
+ m_bus->eoi_w(BIT(data, 5));
+ m_bus->ndac_w(BIT(data, 6));
+ m_bus->nrfd_w(BIT(data, 7));
+}
+
+READ8_MEMBER( c64_ieee488_device::tpi_pc_r )
+{
+ /*
+
+ bit description
+
+ PC0 IFC
+ PC1 SRQ
+ PC2
+ PC3
+ PC4
+ PC5
+ PC6
+ PC7 slot _EXROM
+
+ */
+
+ UINT8 data = 0;
+
+ data |= m_bus->ifc_r();
+ data |= m_bus->srq_r() << 1;
+
+ data |= m_exp->exrom_r(offset, 1, 1, 1, 0) << 7;
+
+ return data;
+}
+
+WRITE8_MEMBER( c64_ieee488_device::tpi_pc_w )
+{
+ /*
+
+ bit description
+
+ PC0 IFC
+ PC1 SRQ
+ PC2
+ PC3 C64 _EXROM
+ PC4 _ROML select
+ PC5
+ PC6
+ PC7
+
+ */
+
+ m_bus->ifc_w(BIT(data, 0));
+ m_bus->srq_w(BIT(data, 1));
+
+ m_exrom = !BIT(data, 3);
+
+ m_roml_sel = BIT(data, 4);
+}
+
+static const tpi6525_interface tpi_intf =
+{
+ DEVCB_NULL,
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, tpi_pa_r),
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, tpi_pa_w),
+ DEVCB_DEVICE_MEMBER(IEEE488_TAG, ieee488_device, dio_r),
+ DEVCB_DEVICE_MEMBER(IEEE488_TAG, ieee488_device, dio_w),
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, tpi_pc_r),
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_ieee488_device, tpi_pc_w),
+ DEVCB_NULL,
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_ieee488 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_ieee488 )
+ MCFG_TPI6525_ADD(MOS6525_TAG, tpi_intf)
+
+ MCFG_CBM_IEEE488_ADD(NULL)
+ MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_ieee488_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_ieee488 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_ieee488_device - constructor
+//-------------------------------------------------
+
+c64_ieee488_device::c64_ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_IEEE488, "IEEE-488", tag, owner, clock, "c64_ieee488", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_tpi(*this, MOS6525_TAG),
+ m_bus(*this, IEEE488_TAG),
+ m_exp(*this, C64_EXPANSION_SLOT_TAG),
+ m_roml_sel(1)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_ieee488_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_ieee488_device::device_reset()
+{
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_ieee488_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+
+ if (!roml && m_roml_sel)
+ {
+ data = m_roml[offset & 0xfff];
+ }
+ else if (!io2)
+ {
+ data = tpi6525_r(m_tpi, space, offset & 0x07);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_ieee488_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ tpi6525_w(m_tpi, space, offset & 0x07, data);
+ }
+
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_ieee488_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->game_r(offset, sphi2, ba, rw, hiram);
+}
diff --git a/src/mess/machine/c64/ieee488.h b/src/mess/machine/c64/ieee488.h
new file mode 100644
index 00000000000..4f87cd48b73
--- /dev/null
+++ b/src/mess/machine/c64/ieee488.h
@@ -0,0 +1,71 @@
+/**********************************************************************
+
+ Commodore IEEE-488 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_IEEE488__
+#define __C64_IEEE488__
+
+
+#include "emu.h"
+#include "machine/6525tpi.h"
+#include "machine/c64/exp.h"
+#include "machine/cbmipt.h"
+#include "machine/ieee488.h"
+#include "video/mc6845.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_ieee488_device
+
+class c64_ieee488_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_ieee488_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ // not really public
+ DECLARE_READ8_MEMBER( tpi_pa_r );
+ DECLARE_WRITE8_MEMBER( tpi_pa_w );
+ DECLARE_READ8_MEMBER( tpi_pc_r );
+ DECLARE_WRITE8_MEMBER( tpi_pc_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<tpi6525_device> m_tpi;
+ required_device<ieee488_device> m_bus;
+ required_device<c64_expansion_slot_device> m_exp;
+
+ int m_roml_sel;
+};
+
+
+
+// device type definition
+extern const device_type C64_IEEE488;
+
+
+#endif
diff --git a/src/mess/machine/c64/kingsoft.c b/src/mess/machine/c64/kingsoft.c
new file mode 100644
index 00000000000..990e06153b8
--- /dev/null
+++ b/src/mess/machine/c64/kingsoft.c
@@ -0,0 +1,99 @@
+/**********************************************************************
+
+ Kingsoft cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "kingsoft.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_KINGSOFT = &device_creator<c64_kingsoft_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_kingsoft_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_kingsoft_cartridge_device::c64_kingsoft_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_KINGSOFT, "C64 Kingsoft cartridge", tag, owner, clock, "c64_kingsoft", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_kingsoft_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_kingsoft_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_kingsoft_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ data = m_romh[(m_exrom << 13) | (offset & 0x1fff)];
+ }
+ else if (!io1)
+ {
+ m_exrom = 0;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_kingsoft_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_exrom = 1;
+ }
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_kingsoft_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exrom & !(ba & rw & ((offset >= 0x8000 && offset < 0xc000) || (offset >= 0xe000)));
+}
diff --git a/src/mess/machine/c64/kingsoft.h b/src/mess/machine/c64/kingsoft.h
new file mode 100644
index 00000000000..22c2a33690e
--- /dev/null
+++ b/src/mess/machine/c64/kingsoft.h
@@ -0,0 +1,50 @@
+/**********************************************************************
+
+ Kingsoft cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __KINGSOFT__
+#define __KINGSOFT__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_kingsoft_cartridge_device
+
+class c64_kingsoft_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_kingsoft_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+};
+
+
+// device type definition
+extern const device_type C64_KINGSOFT;
+
+
+#endif
diff --git a/src/mess/machine/c64/mach5.c b/src/mess/machine/c64/mach5.c
new file mode 100644
index 00000000000..2aceae67990
--- /dev/null
+++ b/src/mess/machine/c64/mach5.c
@@ -0,0 +1,119 @@
+/**********************************************************************
+
+ Access Software MACH 5 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "mach5.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MACH5 = &device_creator<c64_mach5_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_mach5 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_mach5 )
+ PORT_START("S1")
+ PORT_DIPNAME( 0x01, 0x00, "Mode" )
+ PORT_DIPSETTING( 0x00, "C64" )
+ PORT_DIPSETTING( 0x01, "C128" )
+
+ PORT_START("S2")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_mach5_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_mach5 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_mach5_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_mach5_cartridge_device::c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MACH5, "C64 MACH5 cartridge", tag, owner, clock, "c64_mach5", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_s1(*this, "S1")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_mach5_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_mach5_cartridge_device::device_reset()
+{
+ m_c128 = m_s1->read();
+
+ if (!m_c128)
+ {
+ m_exrom = 0;
+ }
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_mach5_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh || !io1 || !io2)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_mach5_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_c128)
+ {
+ if (!io1)
+ {
+ m_exrom = 0;
+ }
+ else if (!io2)
+ {
+ m_exrom = 1;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/mach5.h b/src/mess/machine/c64/mach5.h
new file mode 100644
index 00000000000..f45b743174e
--- /dev/null
+++ b/src/mess/machine/c64/mach5.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ Access Software MACH 5 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MACH5__
+#define __MACH5__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_mach5_cartridge_device
+
+class c64_mach5_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_mach5_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_ioport m_s1;
+
+ bool m_c128;
+};
+
+
+// device type definition
+extern const device_type C64_MACH5;
+
+
+#endif
diff --git a/src/mess/machine/c64/magic_desk.c b/src/mess/machine/c64/magic_desk.c
new file mode 100644
index 00000000000..a0342949a10
--- /dev/null
+++ b/src/mess/machine/c64/magic_desk.c
@@ -0,0 +1,86 @@
+/**********************************************************************
+
+ Magic Desk cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "magic_desk.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MAGIC_DESK = &device_creator<c64_magic_desk_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_magic_desk_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_magic_desk_cartridge_device::c64_magic_desk_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MAGIC_DESK, "C64 Magic Desk cartridge", tag, owner, clock, "c64_magic_desk", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_magic_desk_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_magic_desk_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_magic_desk_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_magic_desk_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_exrom = BIT(data, 7);
+
+ m_bank = data & 0x3f;
+ }
+}
diff --git a/src/mess/machine/c64/magic_desk.h b/src/mess/machine/c64/magic_desk.h
new file mode 100644
index 00000000000..e22b25d558a
--- /dev/null
+++ b/src/mess/machine/c64/magic_desk.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Magic Desk cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MAGIC_DESK__
+#define __MAGIC_DESK__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_magic_desk_cartridge_device
+
+class c64_magic_desk_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_magic_desk_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_MAGIC_DESK;
+
+
+#endif
diff --git a/src/mess/machine/c64/magic_formel.c b/src/mess/machine/c64/magic_formel.c
new file mode 100644
index 00000000000..afd040c03d1
--- /dev/null
+++ b/src/mess/machine/c64/magic_formel.c
@@ -0,0 +1,280 @@
+/**********************************************************************
+
+ Magic Formel cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "magic_formel.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6821_TAG "mc6821"
+
+#define PA4 (m_pb7_ff ? m_ram_oe : 0)
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MAGIC_FORMEL = &device_creator<c64_magic_formel_cartridge_device>;
+
+
+//-------------------------------------------------
+// pia6821_interface pia_intf
+//-------------------------------------------------
+
+WRITE8_MEMBER( c64_magic_formel_cartridge_device::pia_pa_w )
+{
+ /*
+
+ bit description
+
+ PA0 ROM A13
+ PA1 ROM A14
+ PA2 ROM A15
+ PA3 ROM _OE
+ PA4 RAM _OE
+ PA5
+ PA6
+ PA7
+
+ */
+
+ logerror("PA %02x\n",data);
+ m_rom_bank = data & 0x0f;
+
+ m_rom_oe = BIT(data, 3);
+
+ m_ram_oe = BIT(data, 4);
+}
+
+WRITE8_MEMBER( c64_magic_formel_cartridge_device::pia_pb_w )
+{
+ /*
+
+ bit description
+
+ PB0 RAM A10
+ PB1 RAM A11
+ PB2 RAM A9
+ PB3 RAM A8
+ PB4 RAM A12
+ PB5
+ PB6
+ PB7 ROMH enable
+
+ */
+ logerror("PB %02x\n",data);
+ m_ram_bank = data & 0x1f;
+
+ m_pb7 = BIT(data, 7);
+
+ if (!m_pb7)
+ {
+ m_pb7_ff = 1;
+ }
+}
+
+WRITE_LINE_MEMBER( c64_magic_formel_cartridge_device::pia_cb2_w )
+{
+ if (!state)
+ {
+ m_cb2_ff = 1;
+ }
+}
+
+static const pia6821_interface pia_intf =
+{
+ DEVCB_NULL, // input A
+ DEVCB_NULL, // input B
+ DEVCB_NULL, // input CA1
+ DEVCB_NULL, // input CB1
+ DEVCB_NULL, // input CA2
+ DEVCB_NULL, // input CB2
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_magic_formel_cartridge_device, pia_pa_w), // output A
+ DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_magic_formel_cartridge_device, pia_pb_w), // output B
+ DEVCB_NULL, // output CA2
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_magic_formel_cartridge_device, pia_cb2_w), // output CB2
+ DEVCB_NULL, // irq A
+ DEVCB_NULL // irq B
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_magic_formel )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_magic_formel )
+ MCFG_PIA6821_ADD(MC6821_TAG, pia_intf)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_magic_formel_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_magic_formel );
+}
+
+
+//-------------------------------------------------
+// INPUT_CHANGED_MEMBER( freeze )
+//-------------------------------------------------
+
+INPUT_CHANGED_MEMBER( c64_magic_formel_cartridge_device::freeze )
+{
+ if (newval && (m_pb7_ff & m_cb2_ff))
+ {
+ m_cb2_ff = 0;
+
+ m_slot->nmi_w(ASSERT_LINE);
+ }
+ else
+ {
+ m_slot->nmi_w(CLEAR_LINE);
+ }
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_magic_formel )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_magic_formel )
+ PORT_START("FREEZE")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Freeze") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, c64_magic_formel_cartridge_device, freeze, 0)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_magic_formel_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_magic_formel );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_magic_formel_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_magic_formel_cartridge_device::c64_magic_formel_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MAGIC_FORMEL, "C64 Magic Formel cartridge", tag, owner, clock, "c64_magic_formel", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_pia(*this, MC6821_TAG),
+ m_rom_bank(0),
+ m_ram_bank(0),
+ m_pb7_ff(0),
+ m_cb2_ff(0),
+ m_rom_oe(0),
+ m_ram_oe(0),
+ m_pb7(1)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_magic_formel_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_rom_bank));
+ save_item(NAME(m_ram_bank));
+ save_item(NAME(m_pb7_ff));
+ save_item(NAME(m_cb2_ff));
+ save_item(NAME(m_rom_oe));
+ save_item(NAME(m_ram_oe));
+ save_item(NAME(m_pb7));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_magic_formel_cartridge_device::device_reset()
+{
+ m_rom_bank = 0;
+ m_ram_bank = 0;
+ m_pb7_ff = 0;
+ m_cb2_ff = 0;
+ m_rom_oe = 0;
+ m_ram_oe = 0;
+ m_pb7 = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_magic_formel_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!romh && !m_rom_oe)
+ {
+ UINT8 bank = m_pb7_ff ? m_rom_bank : 0;
+ offs_t addr = (bank << 13) | (offset & 0x1fff);
+ data = m_romh[addr];
+ }
+ else if (!io1 && !PA4)
+ {
+ offs_t addr = (m_ram_bank << 8) | (offset & 0xff);
+ data = m_ram[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_magic_formel_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ offs_t addr = (m_ram_bank << 8) | (offset & 0xff);
+ m_ram[addr] = data;
+ }
+ else if (!io2 && !(m_cb2_ff & PA4))
+ {
+ offs_t addr = (offset >> 6) & 0x03;
+ UINT8 new_data = (BIT(data, 1) << 7) | (offset & 0x3f);
+ m_pia->write(space, addr, new_data);
+ }
+ else if (offset == 0x0001)
+ {
+ m_pb7_ff = 0;
+ }
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_magic_formel_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return !(ba & rw & ((offset & 0xe000) == 0xe000) & !(m_pb7 & m_cb2_ff));
+}
diff --git a/src/mess/machine/c64/magic_formel.h b/src/mess/machine/c64/magic_formel.h
new file mode 100644
index 00000000000..548f743f611
--- /dev/null
+++ b/src/mess/machine/c64/magic_formel.h
@@ -0,0 +1,73 @@
+/**********************************************************************
+
+ Magic Formel cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MAGIC_FORMEL__
+#define __MAGIC_FORMEL__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6821pia.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_magic_formel_cartridge_device
+
+class c64_magic_formel_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_magic_formel_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_INPUT_CHANGED_MEMBER( freeze );
+
+ // not really public
+ DECLARE_WRITE8_MEMBER( pia_pa_w );
+ DECLARE_WRITE8_MEMBER( pia_pb_w );
+ DECLARE_WRITE_LINE_MEMBER( pia_cb2_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<pia6821_device> m_pia;
+
+ UINT8 m_rom_bank;
+ UINT8 m_ram_bank;
+ int m_pb7_ff;
+ int m_cb2_ff;
+ int m_rom_oe;
+ int m_ram_oe;
+ int m_pb7;
+};
+
+
+// device type definition
+extern const device_type C64_MAGIC_FORMEL;
+
+
+#endif
diff --git a/src/mess/machine/c64/magic_voice.c b/src/mess/machine/c64/magic_voice.c
new file mode 100644
index 00000000000..c9ca300def7
--- /dev/null
+++ b/src/mess/machine/c64/magic_voice.c
@@ -0,0 +1,162 @@
+/**********************************************************************
+
+ Commodore Magic Voice cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "magic_voice.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define T6721A_TAG "u5"
+#define MOS6525_TAG "u2"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MAGIC_VOICE = &device_creator<c64_magic_voice_cartridge_device>;
+
+
+//-------------------------------------------------
+// tpi6525_interface tpi_intf
+//-------------------------------------------------
+
+static const tpi6525_interface tpi_intf =
+{
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_magic_voice )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_magic_voice )
+ MCFG_TPI6525_ADD(MOS6525_TAG, tpi_intf)
+
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD(T6721A_TAG, T6721A, XTAL_640kHz)
+ MCFG_T6721A_EOS_HANDLER(DEVWRITELINE(MOS6525_TAG, tpi6525_device, i2_w))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+
+ MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_magic_voice_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_magic_voice );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_magic_voice_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_magic_voice_cartridge_device::c64_magic_voice_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MAGIC_VOICE, "C64 Magic Voice cartridge", tag, owner, clock, "c64_magic_voice", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_vslsi(*this, T6721A_TAG),
+ m_tpi(*this, MOS6525_TAG),
+ m_exp(*this, C64_EXPANSION_SLOT_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_magic_voice_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_magic_voice_cartridge_device::device_reset()
+{
+ m_tpi->reset();
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_magic_voice_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+
+ if (!io2 && BIT(offset, 7))
+ {
+ m_tpi->read(space, offset & 0x07);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_magic_voice_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2 && BIT(offset, 7))
+ {
+ m_tpi->write(space, offset & 0x07, data);
+ }
+
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_magic_voice_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->game_r(offset, sphi2, ba, rw, hiram);
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_magic_voice_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->exrom_r(offset, sphi2, ba, rw, hiram);
+}
diff --git a/src/mess/machine/c64/magic_voice.h b/src/mess/machine/c64/magic_voice.h
new file mode 100644
index 00000000000..a2526d38588
--- /dev/null
+++ b/src/mess/machine/c64/magic_voice.h
@@ -0,0 +1,62 @@
+/**********************************************************************
+
+ Commodore Magic Voice cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MAGIC_VOICE__
+#define __MAGIC_VOICE__
+
+#include "emu.h"
+#include "machine/6525tpi.h"
+#include "machine/c64/exp.h"
+#include "machine/cbmipt.h"
+#include "sound/t6721a.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_magic_voice_cartridge_device
+
+class c64_magic_voice_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_magic_voice_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<t6721a_device> m_vslsi;
+ required_device<tpi6525_device> m_tpi;
+ required_device<c64_expansion_slot_device> m_exp;
+};
+
+
+// device type definition
+extern const device_type C64_MAGIC_VOICE;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/midi_maplin.c b/src/mess/machine/c64/midi_maplin.c
new file mode 100644
index 00000000000..3b85e74b312
--- /dev/null
+++ b/src/mess/machine/c64/midi_maplin.c
@@ -0,0 +1,207 @@
+/**********************************************************************
+
+ Maplin MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "midi_maplin.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6850_TAG "mc6850"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIDI_MAPLIN = &device_creator<c64_maplin_midi_cartridge_device>;
+
+
+//-------------------------------------------------
+// ACIA6850_INTERFACE( acia_intf )
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_maplin_midi_cartridge_device::acia_irq_w )
+{
+ m_slot->irq_w(state);
+}
+
+READ_LINE_MEMBER( c64_maplin_midi_cartridge_device::rx_in )
+{
+ return m_rx_state;
+}
+
+WRITE_LINE_MEMBER( c64_maplin_midi_cartridge_device::tx_out )
+{
+ m_mdout->tx(state);
+}
+
+static ACIA6850_INTERFACE( acia_intf )
+{
+ 500000,
+ 0, // rx clock (we manually clock rx)
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_maplin_midi_cartridge_device, rx_in),
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_maplin_midi_cartridge_device, tx_out),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_maplin_midi_cartridge_device, acia_irq_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiin_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiin_slot )
+ SLOT_INTERFACE("midiin", MIDIIN_PORT)
+SLOT_INTERFACE_END
+
+WRITE_LINE_MEMBER( c64_maplin_midi_cartridge_device::midi_rx_w )
+{
+ m_rx_state = state;
+
+ for (int i = 0; i < 16; i++) // divider is set to 64
+ {
+ m_acia->rx_clock_in();
+ }
+}
+
+static const serial_port_interface midiin_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_maplin_midi_cartridge_device, midi_rx_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiout_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiout_slot )
+ SLOT_INTERFACE("midiout", MIDIOUT_PORT)
+SLOT_INTERFACE_END
+
+static const serial_port_interface midiout_intf =
+{
+ DEVCB_NULL // midi out ports don't transmit inward
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_maplin_midi )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_maplin_midi )
+ MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
+
+ MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin")
+ MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_maplin_midi_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_maplin_midi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_maplin_midi_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_maplin_midi_cartridge_device::c64_maplin_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIDI_MAPLIN, "C64 Maplin MIDI", tag, owner, clock, "c64_midimap", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MC6850_TAG),
+ m_mdout(*this, "mdout"),
+ m_rx_state(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_maplin_midi_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_rx_state));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_maplin_midi_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_rx_state = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_maplin_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ switch (offset & 0xff)
+ {
+ case 0:
+ data = m_acia->status_read(space, 0);
+ break;
+
+ case 1:
+ data = m_acia->data_read(space, 0);
+ break;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_maplin_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ switch (offset & 0xff)
+ {
+ case 0:
+ m_acia->control_write(space, 0, data);
+ break;
+
+ case 1:
+ m_acia->data_write(space, 0, data);
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/midi_maplin.h b/src/mess/machine/c64/midi_maplin.h
new file mode 100644
index 00000000000..813201954d8
--- /dev/null
+++ b/src/mess/machine/c64/midi_maplin.h
@@ -0,0 +1,66 @@
+/**********************************************************************
+
+ Maplin MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_MIDI_MAPLIN__
+#define __C64_MIDI_MAPLIN__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6850acia.h"
+#include "machine/serial.h"
+#include "machine/midiinport.h"
+#include "machine/midioutport.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_maplin_midi_cartridge_device
+
+class c64_maplin_midi_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_maplin_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
+ DECLARE_READ_LINE_MEMBER( rx_in );
+ DECLARE_WRITE_LINE_MEMBER( tx_out );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<acia6850_device> m_acia;
+ required_device<serial_port_device> m_mdout;
+
+ int m_rx_state;
+};
+
+
+// device type definition
+extern const device_type C64_MIDI_MAPLIN;
+
+
+#endif
diff --git a/src/mess/machine/c64/midi_namesoft.c b/src/mess/machine/c64/midi_namesoft.c
new file mode 100644
index 00000000000..672dfdea980
--- /dev/null
+++ b/src/mess/machine/c64/midi_namesoft.c
@@ -0,0 +1,206 @@
+/**********************************************************************
+
+ Namesoft MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "midi_namesoft.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6850_TAG "mc6850"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIDI_NAMESOFT = &device_creator<c64_namesoft_midi_cartridge_device>;
+
+
+//-------------------------------------------------
+// ACIA6850_INTERFACE( acia_intf )
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_namesoft_midi_cartridge_device::acia_irq_w )
+{
+ m_slot->nmi_w(state);
+}
+
+READ_LINE_MEMBER( c64_namesoft_midi_cartridge_device::rx_in )
+{
+ return m_rx_state;
+}
+
+WRITE_LINE_MEMBER( c64_namesoft_midi_cartridge_device::tx_out )
+{
+ m_mdout->tx(state);
+}
+
+static ACIA6850_INTERFACE( acia_intf )
+{
+ 500000,
+ 0, // rx clock (we manually clock rx)
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_namesoft_midi_cartridge_device, rx_in),
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_namesoft_midi_cartridge_device, tx_out),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_namesoft_midi_cartridge_device, acia_irq_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiin_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiin_slot )
+ SLOT_INTERFACE("midiin", MIDIIN_PORT)
+SLOT_INTERFACE_END
+
+WRITE_LINE_MEMBER( c64_namesoft_midi_cartridge_device::midi_rx_w )
+{
+ m_rx_state = state;
+
+ for (int i = 0; i < 16; i++) // divider is set to 16
+ {
+ m_acia->rx_clock_in();
+ }
+}
+
+static const serial_port_interface midiin_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_namesoft_midi_cartridge_device, midi_rx_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiout_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiout_slot )
+ SLOT_INTERFACE("midiout", MIDIOUT_PORT)
+SLOT_INTERFACE_END
+
+static const serial_port_interface midiout_intf =
+{
+ DEVCB_NULL // midi out ports don't transmit inward
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_passport_midi )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_passport_midi )
+ MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
+
+ MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin")
+ MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_namesoft_midi_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_passport_midi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_namesoft_midi_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_namesoft_midi_cartridge_device::c64_namesoft_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIDI_NAMESOFT, "C64 Namesoft MIDI", tag, owner, clock, "c64_midins", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MC6850_TAG),
+ m_mdout(*this, "mdout"),
+ m_rx_state(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_namesoft_midi_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_rx_state));
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_namesoft_midi_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_rx_state = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_namesoft_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 2:
+ data = m_acia->status_read(space, 0);
+ break;
+
+ case 3:
+ data = m_acia->data_read(space, 0);
+ break;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_namesoft_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 0:
+ m_acia->control_write(space, 0, data);
+ break;
+
+ case 1:
+ m_acia->data_write(space, 0, data);
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/midi_namesoft.h b/src/mess/machine/c64/midi_namesoft.h
new file mode 100644
index 00000000000..748fec9e373
--- /dev/null
+++ b/src/mess/machine/c64/midi_namesoft.h
@@ -0,0 +1,66 @@
+/**********************************************************************
+
+ Namesoft MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_MIDI_NAMESOFT__
+#define __C64_MIDI_NAMESOFT__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6850acia.h"
+#include "machine/serial.h"
+#include "machine/midiinport.h"
+#include "machine/midioutport.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_namesoft_midi_cartridge_device
+
+class c64_namesoft_midi_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_namesoft_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
+ DECLARE_READ_LINE_MEMBER( rx_in );
+ DECLARE_WRITE_LINE_MEMBER( tx_out );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<acia6850_device> m_acia;
+ required_device<serial_port_device> m_mdout;
+
+ int m_rx_state;
+};
+
+
+// device type definition
+extern const device_type C64_MIDI_NAMESOFT;
+
+
+#endif
diff --git a/src/mess/machine/c64/midi_passport.c b/src/mess/machine/c64/midi_passport.c
new file mode 100644
index 00000000000..a3074c1ae20
--- /dev/null
+++ b/src/mess/machine/c64/midi_passport.c
@@ -0,0 +1,255 @@
+/**********************************************************************
+
+ Passport/Syntech MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "midi_passport.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6840_TAG "mc6840"
+#define MC6850_TAG "mc6850"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIDI_PASSPORT = &device_creator<c64_passport_midi_cartridge_device>;
+
+
+//-------------------------------------------------
+// ptm6840_interface ptm_intf
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_passport_midi_cartridge_device::ptm_irq_w )
+{
+ m_ptm_irq = state;
+
+ m_slot->irq_w(m_ptm_irq || m_acia_irq);
+}
+
+static const ptm6840_interface ptm_intf =
+{
+ 1021800.0f,
+ { 1021800.0f, 1021800.0f, 1021800.0f },
+ { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL },
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_passport_midi_cartridge_device, ptm_irq_w)
+};
+
+
+//-------------------------------------------------
+// ACIA6850_INTERFACE( acia_intf )
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_passport_midi_cartridge_device::acia_irq_w )
+{
+ m_acia_irq = state;
+
+ m_slot->irq_w(m_ptm_irq || m_acia_irq);
+}
+
+READ_LINE_MEMBER( c64_passport_midi_cartridge_device::rx_in )
+{
+ return m_rx_state;
+}
+
+WRITE_LINE_MEMBER( c64_passport_midi_cartridge_device::tx_out )
+{
+ m_mdout->tx(state);
+}
+
+static ACIA6850_INTERFACE( acia_intf )
+{
+ 500000,
+ 0, // rx clock (we manually clock rx)
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_passport_midi_cartridge_device, rx_in),
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_passport_midi_cartridge_device, tx_out),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_passport_midi_cartridge_device, acia_irq_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiin_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiin_slot )
+ SLOT_INTERFACE("midiin", MIDIIN_PORT)
+SLOT_INTERFACE_END
+
+WRITE_LINE_MEMBER( c64_passport_midi_cartridge_device::midi_rx_w )
+{
+ m_rx_state = state;
+
+ for (int i = 0; i < 16; i++) // divider is set to 16
+ {
+ m_acia->rx_clock_in();
+ }
+}
+
+static const serial_port_interface midiin_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_passport_midi_cartridge_device, midi_rx_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiout_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiout_slot )
+ SLOT_INTERFACE("midiout", MIDIOUT_PORT)
+SLOT_INTERFACE_END
+
+static const serial_port_interface midiout_intf =
+{
+ DEVCB_NULL // midi out ports don't transmit inward
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_passport_midi )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_passport_midi )
+ MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
+ MCFG_PTM6840_ADD(MC6840_TAG, ptm_intf)
+
+ MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin")
+ MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_passport_midi_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_passport_midi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_passport_midi_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_passport_midi_cartridge_device::c64_passport_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIDI_PASSPORT, "C64 Passport MIDI", tag, owner, clock, "c64_midipp", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MC6850_TAG),
+ m_ptm(*this, MC6840_TAG),
+ m_mdout(*this, "mdout"),
+ m_ptm_irq(CLEAR_LINE),
+ m_acia_irq(CLEAR_LINE),
+ m_rx_state(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_passport_midi_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_ptm_irq));
+ save_item(NAME(m_acia_irq));
+ save_item(NAME(m_rx_state));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_passport_midi_cartridge_device::device_reset()
+{
+ m_acia->reset();
+ m_ptm->reset();
+
+ m_rx_state = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_passport_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 0: case 1: case 2: case 3:
+ case 4: case 5: case 6: case 7:
+ data = m_ptm->read(space, offset & 0x07);
+ break;
+
+ case 8:
+ data = m_acia->status_read(space, 0);
+ break;
+
+ case 9:
+ data = m_acia->data_read(space, 0);
+ break;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_passport_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 0: case 1: case 2: case 3:
+ case 4: case 5: case 6: case 7:
+ m_ptm->write(space, offset & 0x07, data);
+ break;
+
+ case 8:
+ m_acia->control_write(space, 0, data);
+ break;
+
+ case 9:
+ m_acia->data_write(space, 0, data);
+ break;
+
+ case 0x30:
+ // Drum sync SET
+ break;
+
+ case 0x38:
+ // Drum sync CLEAR
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/midi_passport.h b/src/mess/machine/c64/midi_passport.h
new file mode 100644
index 00000000000..14cd2ca35ff
--- /dev/null
+++ b/src/mess/machine/c64/midi_passport.h
@@ -0,0 +1,71 @@
+/**********************************************************************
+
+ Passport/Syntech MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_MIDI_PASSPORT__
+#define __C64_MIDI_PASSPORT__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6840ptm.h"
+#include "machine/6850acia.h"
+#include "machine/serial.h"
+#include "machine/midiinport.h"
+#include "machine/midioutport.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_passport_midi_cartridge_device
+
+class c64_passport_midi_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_passport_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( ptm_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
+ DECLARE_READ_LINE_MEMBER( rx_in );
+ DECLARE_WRITE_LINE_MEMBER( tx_out );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<acia6850_device> m_acia;
+ required_device<ptm6840_device> m_ptm;
+ required_device<serial_port_device> m_mdout;
+
+ int m_ptm_irq;
+ int m_acia_irq;
+ int m_rx_state;
+};
+
+
+// device type definition
+extern const device_type C64_MIDI_PASSPORT;
+
+
+#endif
diff --git a/src/mess/machine/c64/midi_sci.c b/src/mess/machine/c64/midi_sci.c
new file mode 100644
index 00000000000..4e0f4d6da37
--- /dev/null
+++ b/src/mess/machine/c64/midi_sci.c
@@ -0,0 +1,206 @@
+/**********************************************************************
+
+ Sequential Circuits MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "midi_sci.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6850_TAG "mc6850"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIDI_SCI = &device_creator<c64_sequential_midi_cartridge_device>;
+
+
+//-------------------------------------------------
+// ACIA6850_INTERFACE( acia_intf )
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_sequential_midi_cartridge_device::acia_irq_w )
+{
+ m_slot->irq_w(state);
+}
+
+READ_LINE_MEMBER( c64_sequential_midi_cartridge_device::rx_in )
+{
+ return m_rx_state;
+}
+
+WRITE_LINE_MEMBER( c64_sequential_midi_cartridge_device::tx_out )
+{
+ m_mdout->tx(state);
+}
+
+static ACIA6850_INTERFACE( acia_intf )
+{
+ 500000,
+ 0, // rx clock (we manually clock rx)
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sequential_midi_cartridge_device, rx_in),
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sequential_midi_cartridge_device, tx_out),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sequential_midi_cartridge_device, acia_irq_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiin_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiin_slot )
+ SLOT_INTERFACE("midiin", MIDIIN_PORT)
+SLOT_INTERFACE_END
+
+WRITE_LINE_MEMBER( c64_sequential_midi_cartridge_device::midi_rx_w )
+{
+ m_rx_state = state;
+
+ for (int i = 0; i < 16; i++) // divider is set to 16
+ {
+ m_acia->rx_clock_in();
+ }
+}
+
+static const serial_port_interface midiin_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_sequential_midi_cartridge_device, midi_rx_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiout_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiout_slot )
+ SLOT_INTERFACE("midiout", MIDIOUT_PORT)
+SLOT_INTERFACE_END
+
+static const serial_port_interface midiout_intf =
+{
+ DEVCB_NULL // midi out ports don't transmit inward
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_sequential_midi )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_sequential_midi )
+ MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
+
+ MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin")
+ MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_sequential_midi_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_sequential_midi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_sequential_midi_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_sequential_midi_cartridge_device::c64_sequential_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIDI_SCI, "C64 Sequential Circuits MIDI", tag, owner, clock, "c64_midisci", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MC6850_TAG),
+ m_mdout(*this, "mdout"),
+ m_rx_state(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_sequential_midi_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_rx_state));
+}
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_sequential_midi_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_rx_state = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_sequential_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 2:
+ data = m_acia->status_read(space, 0);
+ break;
+
+ case 3:
+ data = m_acia->data_read(space, 0);
+ break;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_sequential_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 0:
+ m_acia->control_write(space, 0, data);
+ break;
+
+ case 1:
+ m_acia->data_write(space, 0, data);
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/midi_sci.h b/src/mess/machine/c64/midi_sci.h
new file mode 100644
index 00000000000..3f7e10e99df
--- /dev/null
+++ b/src/mess/machine/c64/midi_sci.h
@@ -0,0 +1,66 @@
+/**********************************************************************
+
+ Sequential Circuits MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_MIDI_SCI__
+#define __C64_MIDI_SCI__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6850acia.h"
+#include "machine/serial.h"
+#include "machine/midiinport.h"
+#include "machine/midioutport.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_sequential_midi_cartridge_device
+
+class c64_sequential_midi_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_sequential_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
+ DECLARE_READ_LINE_MEMBER( rx_in );
+ DECLARE_WRITE_LINE_MEMBER( tx_out );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<acia6850_device> m_acia;
+ required_device<serial_port_device> m_mdout;
+
+ int m_rx_state;
+};
+
+
+// device type definition
+extern const device_type C64_MIDI_SCI;
+
+
+#endif
diff --git a/src/mess/machine/c64/midi_siel.c b/src/mess/machine/c64/midi_siel.c
new file mode 100644
index 00000000000..7b587b97570
--- /dev/null
+++ b/src/mess/machine/c64/midi_siel.c
@@ -0,0 +1,207 @@
+/**********************************************************************
+
+ Siel/JMS/DATEL MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "midi_siel.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6850_TAG "mc6850"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIDI_SIEL = &device_creator<c64_siel_midi_cartridge_device>;
+
+
+//-------------------------------------------------
+// ACIA6850_INTERFACE( acia_intf )
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_siel_midi_cartridge_device::acia_irq_w )
+{
+ m_slot->irq_w(state);
+}
+
+READ_LINE_MEMBER( c64_siel_midi_cartridge_device::rx_in )
+{
+ return m_rx_state;
+}
+
+WRITE_LINE_MEMBER( c64_siel_midi_cartridge_device::tx_out )
+{
+ m_mdout->tx(state);
+}
+
+static ACIA6850_INTERFACE( acia_intf )
+{
+ XTAL_2MHz,
+ 0, // rx clock (we manually clock rx)
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_siel_midi_cartridge_device, rx_in),
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_siel_midi_cartridge_device, tx_out),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_siel_midi_cartridge_device, acia_irq_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiin_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiin_slot )
+ SLOT_INTERFACE("midiin", MIDIIN_PORT)
+SLOT_INTERFACE_END
+
+WRITE_LINE_MEMBER( c64_siel_midi_cartridge_device::midi_rx_w )
+{
+ m_rx_state = state;
+
+ for (int i = 0; i < 64; i++) // divider is set to 64
+ {
+ m_acia->rx_clock_in();
+ }
+}
+
+static const serial_port_interface midiin_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_siel_midi_cartridge_device, midi_rx_w)
+};
+
+
+//-------------------------------------------------
+// SLOT_INTERFACE( midiout_slot )
+//-------------------------------------------------
+
+static SLOT_INTERFACE_START( midiout_slot )
+ SLOT_INTERFACE("midiout", MIDIOUT_PORT)
+SLOT_INTERFACE_END
+
+static const serial_port_interface midiout_intf =
+{
+ DEVCB_NULL // midi out ports don't transmit inward
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_siel_midi )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_siel_midi )
+ MCFG_ACIA6850_ADD(MC6850_TAG, acia_intf)
+
+ MCFG_SERIAL_PORT_ADD("mdin", midiin_intf, midiin_slot, "midiin")
+ MCFG_SERIAL_PORT_ADD("mdout", midiout_intf, midiout_slot, "midiout")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_siel_midi_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_siel_midi );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_siel_midi_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_siel_midi_cartridge_device::c64_siel_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIDI_SIEL, "C64 Siel MIDI", tag, owner, clock, "c64_midisiel", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MC6850_TAG),
+ m_mdout(*this, "mdout"),
+ m_rx_state(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_siel_midi_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_rx_state));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_siel_midi_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_rx_state = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_siel_midi_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 6:
+ data = m_acia->status_read(space, 0);
+ break;
+
+ case 7:
+ data = m_acia->data_read(space, 0);
+ break;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_siel_midi_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (offset & 0xff)
+ {
+ case 4:
+ m_acia->control_write(space, 0, data);
+ break;
+
+ case 5:
+ m_acia->data_write(space, 0, data);
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/midi_siel.h b/src/mess/machine/c64/midi_siel.h
new file mode 100644
index 00000000000..62e194ef495
--- /dev/null
+++ b/src/mess/machine/c64/midi_siel.h
@@ -0,0 +1,66 @@
+/**********************************************************************
+
+ Siel/JMS/DATEL MIDI Interface cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_MIDI_SIEL__
+#define __C64_MIDI_SIEL__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6850acia.h"
+#include "machine/serial.h"
+#include "machine/midiinport.h"
+#include "machine/midioutport.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_siel_midi_cartridge_device
+
+class c64_siel_midi_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_siel_midi_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+ DECLARE_WRITE_LINE_MEMBER( midi_rx_w );
+ DECLARE_READ_LINE_MEMBER( rx_in );
+ DECLARE_WRITE_LINE_MEMBER( tx_out );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<acia6850_device> m_acia;
+ required_device<serial_port_device> m_mdout;
+
+ int m_rx_state;
+};
+
+
+// device type definition
+extern const device_type C64_MIDI_SIEL;
+
+
+#endif
diff --git a/src/mess/machine/c64/mikro_assembler.c b/src/mess/machine/c64/mikro_assembler.c
new file mode 100644
index 00000000000..83433d42788
--- /dev/null
+++ b/src/mess/machine/c64/mikro_assembler.c
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Mikro Assembler cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "mikro_assembler.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MIKRO_ASSEMBLER = &device_creator<c64_mikro_assembler_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_mikro_assembler_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_mikro_assembler_cartridge_device::c64_mikro_assembler_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MIKRO_ASSEMBLER, "C64 Mikro Assembler cartridge", tag, owner, clock, "c64_mikro_assembler", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_mikro_assembler_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_mikro_assembler_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh || !io1 || !io2)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/mikro_assembler.h b/src/mess/machine/c64/mikro_assembler.h
new file mode 100644
index 00000000000..d9302c614ab
--- /dev/null
+++ b/src/mess/machine/c64/mikro_assembler.h
@@ -0,0 +1,47 @@
+/**********************************************************************
+
+ Mikro Assembler cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MIKRO_ASSEMBLER__
+#define __MIKRO_ASSEMBLER__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_mikro_assembler_cartridge_device
+
+class c64_mikro_assembler_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_mikro_assembler_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_MIKRO_ASSEMBLER;
+
+
+#endif
diff --git a/src/mess/machine/c64/multiscreen.c b/src/mess/machine/c64/multiscreen.c
new file mode 100644
index 00000000000..c75c7dd9501
--- /dev/null
+++ b/src/mess/machine/c64/multiscreen.c
@@ -0,0 +1,269 @@
+/**********************************************************************
+
+ Multiscreen cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===================|
+ | ROM6 |
+ | MC14066 |
+ | |
+ |===============| ROM5 |
+ |=| |
+ |=| |
+ |=| RAM BAT ROM4 |
+ |=| |
+ |=| |
+ |=| ROM0 ROM3 |
+ |=| |
+ |=| |
+ |===============| LS138 ROM2 |
+ | LS138 |
+ | LS174 |
+ | LS133 ROM1 |
+ |===================|
+
+ BAT - BR2325 lithium battery
+ RAM - ? 8Kx8 RAM
+ ROM0 - ? 16Kx8 EPROM
+ ROM1 - ? 32Kx8 EPROM
+ ROM2 - ? 32Kx8 EPROM
+ ROM3 - ? 32Kx8 EPROM
+ ROM4 - not populated
+ ROM5 - not populated
+ ROM6 - not populated
+
+*/
+
+/*
+
+ TODO:
+
+ - M6802 board
+ - crashes on boot
+
+ 805A: lda $01
+ 805C: and #$FE
+ 805E: sta $01
+ 8060: m6502_brk#$00 <-- BOOM!
+
+*/
+
+#include "multiscreen.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC6802P_TAG "m6802"
+#define MC6821P_0_TAG "m6821_0"
+#define MC6821P_1_TAG "m6821_1"
+
+
+#define BANK_RAM 0x0d
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_MULTISCREEN = &device_creator<c64_multiscreen_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_multiscreen )
+//-------------------------------------------------
+
+ROM_START( c64_multiscreen )
+ ROM_REGION( 0x2000, MC6802P_TAG, 0 )
+ ROM_LOAD( "1", 0x0000, 0x1000, CRC(35be02a8) SHA1(5912bc3d8e0c0949c1e66c19116d6b71c7574e46) )
+ ROM_LOAD( "2 cr", 0x1000, 0x1000, CRC(76a9ac6d) SHA1(87e7335e626bdb73498b46c28c7baab72df38d1f) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_multiscreen_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_multiscreen );
+}
+
+
+static ADDRESS_MAP_START( multiscreen_mem, AS_PROGRAM, 8, c64_multiscreen_cartridge_device )
+ AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION(MC6802P_TAG, 0)
+ADDRESS_MAP_END
+
+
+//-------------------------------------------------
+// pia6821_interface pia0_intf -
+//-------------------------------------------------
+
+static const pia6821_interface pia0_intf =
+{
+ DEVCB_NULL, // input A
+ DEVCB_NULL, // input B
+ DEVCB_NULL, // input CA1
+ DEVCB_NULL, // input CB1
+ DEVCB_NULL, // input CA2
+ DEVCB_NULL, // input CB2
+ DEVCB_NULL, // output A
+ DEVCB_NULL, // output B
+ DEVCB_NULL, // output CA2
+ DEVCB_NULL, // output CB2
+ DEVCB_NULL, // irq A
+ DEVCB_NULL // irq B
+};
+
+
+//-------------------------------------------------
+// pia6821_interface pia1_intf -
+//-------------------------------------------------
+
+static const pia6821_interface pia1_intf =
+{
+ DEVCB_NULL, // input A
+ DEVCB_NULL, // input B
+ DEVCB_NULL, // input CA1
+ DEVCB_NULL, // input CB1
+ DEVCB_NULL, // input CA2
+ DEVCB_NULL, // input CB2
+ DEVCB_NULL, // output A
+ DEVCB_NULL, // output B
+ DEVCB_NULL, // output CA2
+ DEVCB_NULL, // output CB2
+ DEVCB_NULL, // irq A
+ DEVCB_NULL // irq B
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_multiscreen )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_multiscreen )
+ MCFG_CPU_ADD(MC6802P_TAG, M6802, XTAL_4MHz)
+ MCFG_CPU_PROGRAM_MAP(multiscreen_mem)
+
+ MCFG_PIA6821_ADD(MC6821P_0_TAG, pia0_intf)
+ MCFG_PIA6821_ADD(MC6821P_1_TAG, pia1_intf)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_multiscreen_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_multiscreen );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_multiscreen_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_multiscreen_cartridge_device::c64_multiscreen_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_MULTISCREEN, "C64 Multiscreen cartridge", tag, owner, clock, "c64_mscr", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_multiscreen_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_multiscreen_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_multiscreen_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ int bank = m_bank & 0x0f;
+
+ if (bank == BANK_RAM)
+ {
+ data = m_nvram[offset & 0x1fff];
+ }
+ else
+ {
+ data = m_roml[(bank << 14) | (offset & 0x3fff)];
+ }
+ }
+ else if (!romh)
+ {
+ int bank = m_bank & 0x0f;
+
+ if (bank == BANK_RAM)
+ {
+ data = m_roml[offset & 0x3fff];
+ }
+ else
+ {
+ data = m_roml[(bank << 14) | (offset & 0x3fff)];
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_multiscreen_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (offset >= 0x8000 && offset < 0xa000)
+ {
+ int bank = m_bank & 0x0f;
+
+ if (bank == BANK_RAM)
+ {
+ m_nvram[offset & 0x1fff] = data;
+ }
+ }
+ else if (!io2)
+ {
+ m_bank = data;
+ }
+}
diff --git a/src/mess/machine/c64/multiscreen.h b/src/mess/machine/c64/multiscreen.h
new file mode 100644
index 00000000000..e6ae7be96c8
--- /dev/null
+++ b/src/mess/machine/c64/multiscreen.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Multiscreen cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __MULTISCREEN__
+#define __MULTISCREEN__
+
+
+#include "emu.h"
+#include "cpu/m6800/m6800.h"
+#include "machine/6821pia.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_multiscreen_cartridge_device
+
+class c64_multiscreen_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_multiscreen_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_MULTISCREEN;
+
+
+#endif
diff --git a/src/mess/machine/c64/neoram.c b/src/mess/machine/c64/neoram.c
new file mode 100644
index 00000000000..cd91adf425c
--- /dev/null
+++ b/src/mess/machine/c64/neoram.c
@@ -0,0 +1,100 @@
+/**********************************************************************
+
+ NeoRAM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "neoram.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_NEORAM = &device_creator<c64_neoram_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_neoram_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_neoram_cartridge_device::c64_neoram_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_NEORAM, "C64 NeoRAM cartridge", tag, owner, clock, "c64_neoram", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ device_nvram_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_neoram_cartridge_device::device_start()
+{
+ // allocate memory
+ c64_nvram_pointer(machine(), 0x200000);
+
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_neoram_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_neoram_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ offs_t addr = (m_bank << 8) | (offset & 0xff);
+ data = m_nvram[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_neoram_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ offs_t addr = (m_bank << 8) | (offset & 0xff);
+ m_nvram[addr] = data;
+ }
+ else if (!io2)
+ {
+ if (BIT(offset, 0))
+ {
+ m_bank = ((data & 0x7f) << 6) | (m_bank & 0x3f);
+ }
+ else
+ {
+ m_bank = (m_bank & 0x1fc0) | (data & 0x3f);
+ }
+ }
+}
diff --git a/src/mess/machine/c64/neoram.h b/src/mess/machine/c64/neoram.h
new file mode 100644
index 00000000000..e0c7fd3e93d
--- /dev/null
+++ b/src/mess/machine/c64/neoram.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ NeoRAM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __NEORAM__
+#define __NEORAM__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_neoram_cartridge_device
+
+class c64_neoram_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface,
+ public device_nvram_interface
+{
+public:
+ // construction/destruction
+ c64_neoram_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_nvram_interface overrides
+ virtual void nvram_default() { }
+ virtual void nvram_read(emu_file &file) { if (m_nvram != NULL) { file.read(m_nvram, m_nvram_size); } }
+ virtual void nvram_write(emu_file &file) { if (m_nvram != NULL) { file.write(m_nvram, m_nvram_size); } }
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT16 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_NEORAM;
+
+
+#endif
diff --git a/src/mess/machine/c64/ocean.c b/src/mess/machine/c64/ocean.c
new file mode 100644
index 00000000000..8bb881f3202
--- /dev/null
+++ b/src/mess/machine/c64/ocean.c
@@ -0,0 +1,116 @@
+/**********************************************************************
+
+ Ocean Software cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ Chase H.Q. 2: Special Criminal Investigation
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| LS02 |
+ |=| |
+ |=| |
+ |=| ROM0 ROM1 |
+ |=| LS273 |
+ |=| |
+ |=| |
+ |=| |
+ |===========================|
+
+ ROM0,1 - 28-pin ROM (Toshiba TC531000 pinout, markings scratched off)
+
+*/
+
+#include "ocean.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_OCEAN = &device_creator<c64_ocean_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_ocean_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_ocean_cartridge_device::c64_ocean_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_OCEAN, "C64 Ocean cartridge", tag, owner, clock, "c64_ocean", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_bank(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_ocean_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_ocean_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_ocean_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr & m_roml_mask];
+ }
+ else if (!romh && m_romh)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_romh[addr & m_romh_mask];
+ }
+ else if (!io1)
+ {
+ return m_bank;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_ocean_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_bank = data & 0x3f;
+ }
+}
diff --git a/src/mess/machine/c64/ocean.h b/src/mess/machine/c64/ocean.h
new file mode 100644
index 00000000000..99626fb5e07
--- /dev/null
+++ b/src/mess/machine/c64/ocean.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Ocean Software cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __OCEAN__
+#define __OCEAN__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_ocean_cartridge_device
+
+class c64_ocean_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_ocean_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_OCEAN;
+
+
+#endif
diff --git a/src/mess/machine/c64/pagefox.c b/src/mess/machine/c64/pagefox.c
new file mode 100644
index 00000000000..4d22263be4d
--- /dev/null
+++ b/src/mess/machine/c64/pagefox.c
@@ -0,0 +1,134 @@
+/**********************************************************************
+
+ Scanntronik Pagefox cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| |
+ |=| RAM LS11 |
+ |=| |
+ |=| LS139 |
+ |=| ROM0 |
+ |=| LS273 |
+ |=| |
+ |=| ROM1 LS00 |
+ |===========================|
+
+ RAM - NEC D43256-12L 32Kx8 RAM
+ ROM0 - SGS M27256-2FI 32Kx8 EPROM
+ ROM1 - National Instruments NMC27C256Q 32Kx8 EPROM
+
+*/
+
+#include "pagefox.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_PAGEFOX = &device_creator<c64_pagefox_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_pagefox_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_pagefox_cartridge_device::c64_pagefox_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_PAGEFOX, "C64 Pagefox cartridge", tag, owner, clock, "c64_pagefox", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_pagefox_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_pagefox_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_pagefox_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh)
+ {
+ if (BIT(m_bank, 3))
+ {
+ offs_t addr = (BIT(m_bank, 1) << 14) | (offset & 0x3fff);
+ data = m_ram[addr];
+ }
+ else
+ {
+ int bank = (m_bank >> 1) & 0x07;
+ offs_t addr = (bank << 14) | (offset & 0x3fff);
+ data = m_roml[addr];
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_pagefox_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (offset >= 0x8000 && offset < 0xc000)
+ {
+ if (BIT(m_bank, 3))
+ {
+ offs_t addr = (BIT(m_bank, 1) << 14) | (offset & 0x3fff);
+ m_ram[addr] = data;
+ }
+ }
+ else if (!io1 && BIT(offset, 7))
+ {
+ if (data == 0xff)
+ {
+ m_game = 1;
+ m_exrom = 1;
+ }
+ else
+ {
+ m_game = 0;
+ m_exrom = 0;
+ }
+
+ m_bank = data;
+ }
+}
diff --git a/src/mess/machine/c64/pagefox.h b/src/mess/machine/c64/pagefox.h
new file mode 100644
index 00000000000..b8c14b78942
--- /dev/null
+++ b/src/mess/machine/c64/pagefox.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Scanntronik Pagefox cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __PAGEFOX__
+#define __PAGEFOX__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_pagefox_cartridge_device
+
+class c64_pagefox_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_pagefox_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_PAGEFOX;
+
+
+#endif
diff --git a/src/mess/machine/c64/prophet64.c b/src/mess/machine/c64/prophet64.c
new file mode 100644
index 00000000000..fab038f6f46
--- /dev/null
+++ b/src/mess/machine/c64/prophet64.c
@@ -0,0 +1,87 @@
+/**********************************************************************
+
+ PROPHET64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "prophet64.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_PROPHET64 = &device_creator<c64_prophet64_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_prophet64_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_prophet64_cartridge_device::c64_prophet64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_PROPHET64, "PROPHET64", tag, owner, clock, "c64_prophet64", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_bank(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_prophet64_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_prophet64_cartridge_device::device_reset()
+{
+ m_bank = 0;
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_prophet64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_prophet64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ m_bank = data & 0x1f;
+ m_exrom = BIT(data, 5);
+ }
+}
diff --git a/src/mess/machine/c64/prophet64.h b/src/mess/machine/c64/prophet64.h
new file mode 100644
index 00000000000..131e4bdf922
--- /dev/null
+++ b/src/mess/machine/c64/prophet64.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ PROPHET64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __PROPHET64__
+#define __PROPHET64__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_prophet64_cartridge_device
+
+class c64_prophet64_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_prophet64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_PROPHET64;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/ps64.c b/src/mess/machine/c64/ps64.c
new file mode 100644
index 00000000000..b2f1a0115d0
--- /dev/null
+++ b/src/mess/machine/c64/ps64.c
@@ -0,0 +1,158 @@
+/**********************************************************************
+
+ PS-64 speech cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| |
+ |=| SW1|
+ |=| SC02 |
+ |=| |
+ |=| CN1|
+ |=| ROM LF347 |
+ |=| |
+ |=| |
+ |===========================|
+
+ SC02 - Votrax SSI-263AP Speech Synthesizer
+ ROM - Hynix Semiconductor HY27C64D-20 8Kx8 EPROM
+ LF347 - National Instruments LF347N JFET Operational Amplifier
+ SW1 - Module on/off switch
+ CN1 - connector to C64 video/audio port
+
+*/
+
+/*
+
+ TODO:
+
+ - Votrax SC02 emulation
+ - route sound to SID audio input
+ - on/off switch
+
+*/
+
+#include "ps64.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define SSI263_TAG "ssi263"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_PS64 = &device_creator<c64_ps64_cartridge_device>;
+
+
+//-------------------------------------------------
+// votrax_sc02_interface votrax_intf
+//-------------------------------------------------
+/*
+static struct votrax_sc02_interface votrax_intf =
+{
+ DEVCB_NULL
+};
+*/
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_ps64 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_ps64 )
+ //MCFG_SPEAKER_STANDARD_MONO("mono")
+ //MCFG_VOTRAX_SC02_ADD(SSI263_TAG, 2000000, votrax_intf)
+ //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_ps64_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_ps64 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_ps64_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_ps64_cartridge_device::c64_ps64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_PS64, "C64 PS-64", tag, owner, clock, "c64_ps64", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_ps64_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_ps64_cartridge_device::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_ps64_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!io1)
+ {
+ //sc02->read(offset & 0x07);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_ps64_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ // sc02->write(offset & 0x07, data);
+ }
+}
diff --git a/src/mess/machine/c64/ps64.h b/src/mess/machine/c64/ps64.h
new file mode 100644
index 00000000000..4a957aeb684
--- /dev/null
+++ b/src/mess/machine/c64/ps64.h
@@ -0,0 +1,53 @@
+/**********************************************************************
+
+ PS-64 speech cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __PS64__
+#define __PS64__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "sound/votrax.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_ps64_cartridge_device
+
+class c64_ps64_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_ps64_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_PS64;
+
+
+#endif
diff --git a/src/mess/machine/c64/reu.c b/src/mess/machine/c64/reu.c
new file mode 100644
index 00000000000..6f6444e0768
--- /dev/null
+++ b/src/mess/machine/c64/reu.c
@@ -0,0 +1,160 @@
+/**********************************************************************
+
+ Commodore 1700/1750/1764 RAM Expansion Unit emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "reu.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define MOS8726R1_TAG "u1"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_REU1700 = &device_creator<c64_reu1700_cartridge_device>;
+const device_type C64_REU1750 = &device_creator<c64_reu1750_cartridge_device>;
+const device_type C64_REU1764 = &device_creator<c64_reu1764_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_reu )
+//-------------------------------------------------
+
+ROM_START( c64_reu )
+ ROM_REGION( 0x8000, "roml", 0 )
+ ROM_CART_LOAD( "rom", 0x0000, 0x8000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_reu_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_reu );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_reu )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_reu )
+ MCFG_MOS8726_ADD(MOS8726R1_TAG)
+
+ MCFG_CARTSLOT_ADD("rom")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_reu_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_reu );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_reu_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_reu_cartridge_device::c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size) :
+ device_t(mconfig, type, name, tag, owner, clock, "c64_reu", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_dmac(*this, MOS8726R1_TAG),
+ m_variant(variant),
+ m_jp1(jp1),
+ m_ram_size(ram_size)
+{
+}
+
+c64_reu1700_cartridge_device::c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : c64_reu_cartridge_device(mconfig, C64_REU1700, "1700 REU", tag, owner, clock, TYPE_1700, 0, 128 * 1024) { }
+
+c64_reu1750_cartridge_device::c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : c64_reu_cartridge_device(mconfig, C64_REU1750, "1750 REU", tag, owner, clock, TYPE_1750, 1, 256 * 1024) { }
+
+c64_reu1764_cartridge_device::c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : c64_reu_cartridge_device(mconfig, C64_REU1764, "1764 REU", tag, owner, clock, TYPE_1764, 1, 512 * 1024) { }
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_reu_cartridge_device::device_start()
+{
+ // find memory region
+ m_roml = memregion("roml")->base();
+
+ // allocate memory
+ c64_ram_pointer(machine(), m_ram_size);
+
+ // setup DMA controller
+ m_dmac->set_unscaled_clock(m_slot->phi2());
+ m_dmac->bs_w(m_jp1);
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_reu_cartridge_device::device_reset()
+{
+ m_dmac->reset();
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_reu_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!m_dmac->romsel_r(roml, romh))
+ {
+ data = m_roml[offset & 0x7fff];
+ }
+ else if (!io2)
+ {
+ data = m_dmac->read(space, offset);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_reu_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ m_dmac->write(space, offset, data);
+ }
+}
diff --git a/src/mess/machine/c64/reu.h b/src/mess/machine/c64/reu.h
new file mode 100644
index 00000000000..95f87cb5a6d
--- /dev/null
+++ b/src/mess/machine/c64/reu.h
@@ -0,0 +1,100 @@
+/**********************************************************************
+
+ Commodore 1700/1750/1764 RAM Expansion Unit emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __REU__
+#define __REU__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+#include "machine/mos8726.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_reu_cartridge_device
+
+class c64_reu_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_reu_cartridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT32 variant, int jp1, size_t ram_size);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ enum
+ {
+ TYPE_1700,
+ TYPE_1750,
+ TYPE_1764
+ };
+
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+ required_device<mos8726_device> m_dmac;
+
+ int m_variant;
+ int m_jp1;
+ size_t m_ram_size;
+};
+
+
+// ======================> c64_reu1700_cartridge_device
+
+class c64_reu1700_cartridge_device : public c64_reu_cartridge_device
+{
+public:
+ // construction/destruction
+ c64_reu1700_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
+// ======================> c64_reu1750_cartridge_device
+
+class c64_reu1750_cartridge_device : public c64_reu_cartridge_device
+{
+public:
+ // construction/destruction
+ c64_reu1750_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+// ======================> c64_reu1700_cartridge_device
+
+class c64_reu1764_cartridge_device : public c64_reu_cartridge_device
+{
+public:
+ // construction/destruction
+ c64_reu1764_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+};
+
+
+// device type definition
+extern const device_type C64_REU1700;
+extern const device_type C64_REU1750;
+extern const device_type C64_REU1764;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/rex.c b/src/mess/machine/c64/rex.c
new file mode 100644
index 00000000000..5e0980e087d
--- /dev/null
+++ b/src/mess/machine/c64/rex.c
@@ -0,0 +1,79 @@
+/**********************************************************************
+
+ REX Datentechnik cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "rex.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_REX = &device_creator<c64_rex_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_rex_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_rex_cartridge_device::c64_rex_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_REX, "C64 Rex cartridge", tag, owner, clock, "c64_rex", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_rex_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_rex_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_rex_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!io2)
+ {
+ if ((offset & 0xc0) == 0xc0)
+ {
+ m_exrom = 0;
+ }
+ else
+ {
+ m_exrom = 1;
+ }
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/rex.h b/src/mess/machine/c64/rex.h
new file mode 100644
index 00000000000..b7df74c9e24
--- /dev/null
+++ b/src/mess/machine/c64/rex.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+
+ REX Datentechnik cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __REX__
+#define __REX__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_rex_cartridge_device
+
+class c64_rex_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_rex_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_REX;
+
+
+#endif
diff --git a/src/mess/machine/c64/rex_ep256.c b/src/mess/machine/c64/rex_ep256.c
new file mode 100644
index 00000000000..e6fe4325d6f
--- /dev/null
+++ b/src/mess/machine/c64/rex_ep256.c
@@ -0,0 +1,185 @@
+/**********************************************************************
+
+ Rex Datentechnik 256KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "rex_ep256.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_REX_EP256 = &device_creator<c64_rex_ep256_cartridge_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_rex_ep256 )
+//-------------------------------------------------
+
+ROM_START( c64_rex_ep256 )
+ ROM_REGION( 0x40000, "eprom", 0 )
+ ROM_CART_LOAD( "rom1", 0x00000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom2", 0x08000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom3", 0x10000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom4", 0x18000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom5", 0x20000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom6", 0x28000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom7", 0x30000, 0x08000, ROM_MIRROR )
+ ROM_CART_LOAD( "rom8", 0x38000, 0x08000, ROM_MIRROR )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_rex_ep256_cartridge_device::device_rom_region() const
+{
+ return ROM_NAME( c64_rex_ep256 );
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_rex_ep256 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_rex_ep256 )
+ MCFG_CARTSLOT_ADD("rom1")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom2")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom3")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom4")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom5")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom6")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom7")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+ MCFG_CARTSLOT_ADD("rom8")
+ MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_rex_ep256_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_rex_ep256 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_rex_ep256_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_rex_ep256_cartridge_device::c64_rex_ep256_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_REX_EP256, "C64 Rex 256KB EPROM cartridge", tag, owner, clock, "rexep256", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_eprom(*this, "eprom")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_rex_ep256_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+ save_item(NAME(m_reset));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_rex_ep256_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+ m_reset = 1;
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_rex_ep256_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ if (m_reset)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_eprom->base()[addr];
+ }
+ }
+ else if (!io2)
+ {
+ if ((offset & 0xf0) == 0xc0)
+ {
+ m_exrom = 1;
+ }
+ else if ((offset & 0xf0) == 0xe0)
+ {
+ m_exrom = 0;
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_rex_ep256_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2 && ((offset & 0xf0) == 0xa0))
+ {
+ /*
+
+ bit description
+
+ 0 socket selection bit 0
+ 1 socket selection bit 1
+ 2 socket selection bit 2
+ 3
+ 4
+ 5 bank selection bit 0
+ 6 bank selection bit 1
+ 7
+
+ */
+
+ m_reset = 0;
+
+ m_bank = ((data & 0x07) << 2) | ((data >> 5) & 0x03);
+ }
+}
diff --git a/src/mess/machine/c64/rex_ep256.h b/src/mess/machine/c64/rex_ep256.h
new file mode 100644
index 00000000000..da1d89c38ea
--- /dev/null
+++ b/src/mess/machine/c64/rex_ep256.h
@@ -0,0 +1,61 @@
+/**********************************************************************
+
+ Rex Datentechnik 256KB EPROM cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __REX_EP256__
+#define __REX_EP256__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_rex_ep256_cartridge_device
+
+class c64_rex_ep256_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_rex_ep256_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_memory_region m_eprom;
+
+ UINT8 m_bank;
+ int m_reset;
+};
+
+
+// device type definition
+extern const device_type C64_REX_EP256;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/ross.c b/src/mess/machine/c64/ross.c
new file mode 100644
index 00000000000..9e33f0a2a7b
--- /dev/null
+++ b/src/mess/machine/c64/ross.c
@@ -0,0 +1,93 @@
+/**********************************************************************
+
+ Ross cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "ross.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_ROSS = &device_creator<c64_ross_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_ross_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_ross_cartridge_device::c64_ross_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_ROSS, "C64 Ross cartridge", tag, owner, clock, "c64_ross", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_ross_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_ross_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+ m_game = 0;
+
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_ross_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+
+ data = m_roml[addr & m_roml_mask];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_ross_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_bank = 1;
+ }
+ else if (!io2)
+ {
+ m_exrom = 1;
+ m_game = 1;
+ }
+}
diff --git a/src/mess/machine/c64/ross.h b/src/mess/machine/c64/ross.h
new file mode 100644
index 00000000000..12b8e98740e
--- /dev/null
+++ b/src/mess/machine/c64/ross.h
@@ -0,0 +1,54 @@
+/**********************************************************************
+
+ Ross cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __ROSS__
+#define __ROSS__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_ross_cartridge_device
+
+class c64_ross_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_ross_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_ROSS;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/sfx_sound_expander.c b/src/mess/machine/c64/sfx_sound_expander.c
new file mode 100644
index 00000000000..1e74d958208
--- /dev/null
+++ b/src/mess/machine/c64/sfx_sound_expander.c
@@ -0,0 +1,288 @@
+/**********************************************************************
+
+ Commodore SFX Sound Expander cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "sfx_sound_expander.h"
+
+
+
+//**************************************************************************
+// MACROS / CONSTANTS
+//**************************************************************************
+
+#define YM3526_TAG "ic3"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SFX_SOUND_EXPANDER = &device_creator<c64_sfx_sound_expander_cartridge_device>;
+
+
+//-------------------------------------------------
+// ym3526_interface ym3526_config
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_sfx_sound_expander_cartridge_device::opl_irq_w )
+{
+ m_slot->irq_w(state);
+}
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_sfx_sound_expander )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_sfx_sound_expander )
+ MCFG_SPEAKER_STANDARD_MONO("mono")
+ MCFG_SOUND_ADD(YM3526_TAG, YM3526, XTAL_3_579545MHz)
+ MCFG_YM3526_IRQ_HANDLER(WRITELINE(c64_sfx_sound_expander_cartridge_device, opl_irq_w))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
+
+ MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_sfx_sound_expander_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_sfx_sound_expander );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_sfx_sound_expander )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_sfx_sound_expander )
+ PORT_START("KB0")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB1")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB2")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB3")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB4")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB5")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB6")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+
+ PORT_START("KB7")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD )
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_sfx_sound_expander_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_sfx_sound_expander );
+}
+
+
+
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
+
+//-------------------------------------------------
+// get_offset - get passthru expansion port offset
+//-------------------------------------------------
+
+inline offs_t c64_sfx_sound_expander_cartridge_device::get_offset(offs_t offset, int rw)
+{
+ // assimilate the 3 different MIDI cartridge 6850 ACIA register mappings?
+ return (offset & 0xfffc) | (rw << 1) | BIT(offset, 1);
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_sfx_sound_expander_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_sfx_sound_expander_cartridge_device::c64_sfx_sound_expander_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SFX_SOUND_EXPANDER, "C64 SFX Sound Expander cartridge", tag, owner, clock, "c64_sfxse", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_opl(*this, YM3526_TAG),
+ m_exp(*this, C64_EXPANSION_SLOT_TAG),
+ m_kb0(*this, "KB0"),
+ m_kb1(*this, "KB1"),
+ m_kb2(*this, "KB2"),
+ m_kb3(*this, "KB3"),
+ m_kb4(*this, "KB4"),
+ m_kb5(*this, "KB5"),
+ m_kb6(*this, "KB6"),
+ m_kb7(*this, "KB7")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_sfx_sound_expander_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_sfx_sound_expander_cartridge_device::device_reset()
+{
+ m_opl->reset();
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_sfx_sound_expander_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ data = m_exp->cd_r(space, get_offset(offset, 1), data, sphi2, ba, roml, romh, io1, io2);
+
+ if (!io2)
+ {
+ if (BIT(offset, 3))
+ {
+ switch (offset & 0x07)
+ {
+ case 0: data = m_kb0->read(); break;
+ case 1: data = m_kb1->read(); break;
+ case 2: data = m_kb2->read(); break;
+ case 3: data = m_kb3->read(); break;
+ case 4: data = m_kb4->read(); break;
+ case 5: data = m_kb5->read(); break;
+ case 6: data = m_kb6->read(); break;
+ case 7: data = m_kb7->read(); break;
+ }
+ }
+ else if (BIT(offset, 5))
+ {
+ data = m_opl->read(space, BIT(offset, 4));
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_sfx_sound_expander_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2 && BIT(offset, 5))
+ {
+ m_opl->write(space, BIT(offset, 4), data);
+ }
+
+ m_exp->cd_w(space, get_offset(offset, 0), data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_sfx_sound_expander_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->game_r(get_offset(offset, rw), sphi2, ba, rw, hiram);
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_sfx_sound_expander_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->exrom_r(get_offset(offset, rw), sphi2, ba, rw, hiram);
+}
diff --git a/src/mess/machine/c64/sfx_sound_expander.h b/src/mess/machine/c64/sfx_sound_expander.h
new file mode 100644
index 00000000000..091e26b80f9
--- /dev/null
+++ b/src/mess/machine/c64/sfx_sound_expander.h
@@ -0,0 +1,73 @@
+/**********************************************************************
+
+ Commodore SFX Sound Expander cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SFX_SOUND_EXPANDER__
+#define __SFX_SOUND_EXPANDER__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/cbmipt.h"
+#include "sound/3526intf.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_sfx_sound_expander_cartridge_device
+
+class c64_sfx_sound_expander_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_sfx_sound_expander_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_WRITE_LINE_MEMBER( opl_irq_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<ym3526_device> m_opl;
+ required_device<c64_expansion_slot_device> m_exp;
+ required_ioport m_kb0;
+ required_ioport m_kb1;
+ required_ioport m_kb2;
+ required_ioport m_kb3;
+ required_ioport m_kb4;
+ required_ioport m_kb5;
+ required_ioport m_kb6;
+ required_ioport m_kb7;
+
+ inline offs_t get_offset(offs_t offset, int rw);
+};
+
+
+// device type definition
+extern const device_type C64_SFX_SOUND_EXPANDER;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/silverrock.c b/src/mess/machine/c64/silverrock.c
new file mode 100644
index 00000000000..43465106e6e
--- /dev/null
+++ b/src/mess/machine/c64/silverrock.c
@@ -0,0 +1,133 @@
+/**********************************************************************
+
+ SilverRock Productions cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ e9048
+ |=============|
+ |=| LS00 |
+ |=| LS273|
+ |=| |
+ |=| |
+ |=| ROM |
+ |=| |
+ |=| |
+ |=| |
+ |=============|
+
+ ROM - Atmel AT27C010-25PC 128Kx8 OTP EPROM "HUGO 2012"
+
+*/
+
+#include "silverrock.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define UNSCRAMBLE_ADDRESS(_offset) \
+ BITSWAP16(_offset,15,14,13,12,1,0,2,3,11,10,9,8,7,6,5,4)
+
+#define UNSCRAMBLE_DATA(_data) \
+ BITSWAP8(_data,7,6,5,4,0,1,2,3)
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SILVERROCK = &device_creator<c64_silverrock_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_silverrock_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_silverrock_cartridge_device::c64_silverrock_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SILVERROCK, "C64 SilverRock cartridge", tag, owner, clock, "c64_silverrock", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_silverrock_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_silverrock_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_silverrock_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ addr = (addr & 0x10000) | UNSCRAMBLE_ADDRESS(addr);
+ data = UNSCRAMBLE_DATA(m_roml[addr]);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_silverrock_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ /*
+
+ bit description
+
+ 0
+ 1
+ 2
+ 3
+ 4 A14
+ 5 A15
+ 6 A16
+ 7 A13
+
+ */
+
+ m_bank = ((data >> 3) & 0x0e) | BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/silverrock.h b/src/mess/machine/c64/silverrock.h
new file mode 100644
index 00000000000..9fbfb279866
--- /dev/null
+++ b/src/mess/machine/c64/silverrock.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ SilverRock Productions cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SILVERROCK__
+#define __SILVERROCK__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_silverrock_cartridge_device
+
+class c64_silverrock_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_silverrock_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_SILVERROCK;
+
+
+#endif
diff --git a/src/mess/machine/c64/simons_basic.c b/src/mess/machine/c64/simons_basic.c
new file mode 100644
index 00000000000..26171a50171
--- /dev/null
+++ b/src/mess/machine/c64/simons_basic.c
@@ -0,0 +1,85 @@
+/**********************************************************************
+
+ VizaWrite 64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "simons_basic.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SIMONS_BASIC = &device_creator<c64_simons_basic_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_simons_basic_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_simons_basic_cartridge_device::c64_simons_basic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SIMONS_BASIC, "Simons' BASIC", tag, owner, clock, "c64_simons_basic", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_simons_basic_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_simons_basic_cartridge_device::device_reset()
+{
+ m_game = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_simons_basic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_simons_basic_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_game = !BIT(data, 0);
+ }
+}
diff --git a/src/mess/machine/c64/simons_basic.h b/src/mess/machine/c64/simons_basic.h
new file mode 100644
index 00000000000..c020a5b6475
--- /dev/null
+++ b/src/mess/machine/c64/simons_basic.h
@@ -0,0 +1,49 @@
+/**********************************************************************
+
+ Simons' BASIC cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SIMONS_BASIC__
+#define __SIMONS_BASIC__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_simons_basic_cartridge_device
+
+class c64_simons_basic_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_simons_basic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_SIMONS_BASIC;
+
+
+#endif
diff --git a/src/mess/machine/c64/stardos.c b/src/mess/machine/c64/stardos.c
new file mode 100644
index 00000000000..7fb925001cc
--- /dev/null
+++ b/src/mess/machine/c64/stardos.c
@@ -0,0 +1,195 @@
+/**********************************************************************
+
+ StarPoint Software StarDOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| |
+ |=| LS30 |
+ |=| LS157 |
+ |=| LS00 |
+ |=| ROM |
+ |=| 7407 |
+ |=| |
+ |=| SW1|
+ |===========================|
+
+ ROM - Toshiba TMM271128D-25 16Kx8 EPROM
+
+*/
+
+#include "stardos.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define IO1_FULL_CHARGE 27
+#define IO2_FULL_CHARGE 42
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_STARDOS = &device_creator<c64_stardos_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_stardos )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_stardos )
+ PORT_START("RESET")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_stardos_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_stardos );
+}
+
+
+
+//**************************************************************************
+// INLINE HELPERS
+//**************************************************************************
+
+//-------------------------------------------------
+// charge_io1_capacitor -
+//-------------------------------------------------
+
+inline void c64_stardos_cartridge_device::charge_io1_capacitor()
+{
+ m_io1_charge++;
+
+ if (m_io1_charge >= IO1_FULL_CHARGE)
+ {
+ m_exrom = 0;
+ m_io1_charge = 0;
+ }
+}
+
+
+//-------------------------------------------------
+// charge_io2_capacitor -
+//-------------------------------------------------
+
+void c64_stardos_cartridge_device::charge_io2_capacitor()
+{
+ m_io2_charge++;
+
+ if (m_io2_charge >= IO2_FULL_CHARGE)
+ {
+ m_exrom = 1;
+ m_io2_charge = 0;
+ }
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_stardos_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_stardos_cartridge_device::c64_stardos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_STARDOS, "C64 StarDOS cartridge", tag, owner, clock, "c64_stardos", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_io1_charge(0),
+ m_io2_charge(0)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_stardos_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_io1_charge));
+ save_item(NAME(m_io2_charge));
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_stardos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh)
+ {
+ // TODO BITSWAP8(7,6,5,4,3,1,2,0) ?
+ data = m_roml[offset & 0x3fff];
+ }
+ else if (!io1)
+ {
+ charge_io1_capacitor();
+ }
+ else if (!io2)
+ {
+ charge_io2_capacitor();
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_stardos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ charge_io1_capacitor();
+ }
+ else if (!io2)
+ {
+ charge_io2_capacitor();
+ }
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_stardos_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return !(sphi2 && ba & rw & ((offset & 0xe000) == 0xe000) & hiram);
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_stardos_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return (BIT(offset, 13)) ? 1 : m_exrom;
+}
diff --git a/src/mess/machine/c64/stardos.h b/src/mess/machine/c64/stardos.h
new file mode 100644
index 00000000000..7ecd82fb821
--- /dev/null
+++ b/src/mess/machine/c64/stardos.h
@@ -0,0 +1,61 @@
+/**********************************************************************
+
+ StarPoint Software StarDOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __STARDOS__
+#define __STARDOS__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/6821pia.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_stardos_cartridge_device
+
+class c64_stardos_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_stardos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ inline void charge_io1_capacitor();
+ inline void charge_io2_capacitor();
+
+ int m_io1_charge;
+ int m_io2_charge;
+};
+
+
+// device type definition
+extern const device_type C64_STARDOS;
+
+
+#endif
diff --git a/src/mess/machine/c64/std.c b/src/mess/machine/c64/std.c
new file mode 100644
index 00000000000..95f7930e69b
--- /dev/null
+++ b/src/mess/machine/c64/std.c
@@ -0,0 +1,69 @@
+/**********************************************************************
+
+ Commodore 64 Standard 8K/16K cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "std.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_STD = &device_creator<c64_standard_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_standard_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_standard_cartridge_device::c64_standard_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_STD, "C64 standard cartridge", tag, owner, clock, "c64_standard", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_standard_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_standard_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml && m_roml_mask)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ if (m_romh_mask)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+ else if (m_roml_mask == 0x3fff)
+ {
+ data = m_roml[offset & 0x3fff];
+ }
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/std.h b/src/mess/machine/c64/std.h
new file mode 100644
index 00000000000..02578b1a4ea
--- /dev/null
+++ b/src/mess/machine/c64/std.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+
+ Commodore 64 Standard 8K/16K cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_STANDARD_CARTRIDGE__
+#define __C64_STANDARD_CARTRIDGE__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_standard_cartridge_device
+
+class c64_standard_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_standard_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_STD;
+
+
+#endif
diff --git a/src/mess/machine/c64/structured_basic.c b/src/mess/machine/c64/structured_basic.c
new file mode 100644
index 00000000000..12232b627ac
--- /dev/null
+++ b/src/mess/machine/c64/structured_basic.c
@@ -0,0 +1,104 @@
+/**********************************************************************
+
+ Structured Basic cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "structured_basic.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_STRUCTURED_BASIC = &device_creator<c64_structured_basic_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_structured_basic_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_structured_basic_cartridge_device::c64_structured_basic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_STRUCTURED_BASIC, "C64 Structured Basic cartridge", tag, owner, clock, "c64_structured_basic", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_structured_basic_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_structured_basic_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_structured_basic_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_structured_basic_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ switch (data & 0x03)
+ {
+ case 0:
+ case 1:
+ m_exrom = 0;
+ m_bank = 0;
+ break;
+
+ case 2:
+ m_exrom = 0;
+ m_bank = 1;
+ break;
+
+ case 3:
+ m_exrom = 1;
+ m_bank = 0;
+ break;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/structured_basic.h b/src/mess/machine/c64/structured_basic.h
new file mode 100644
index 00000000000..e6d63240f39
--- /dev/null
+++ b/src/mess/machine/c64/structured_basic.h
@@ -0,0 +1,54 @@
+/**********************************************************************
+
+ Structured Basic cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __STRUCTURED_BASIC__
+#define __STRUCTURED_BASIC__
+
+
+#include "emu.h"
+#include "imagedev/cartslot.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_structured_basic_cartridge_device
+
+class c64_structured_basic_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_structured_basic_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_STRUCTURED_BASIC;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/super_explode.c b/src/mess/machine/c64/super_explode.c
new file mode 100644
index 00000000000..f73585870da
--- /dev/null
+++ b/src/mess/machine/c64/super_explode.c
@@ -0,0 +1,126 @@
+/**********************************************************************
+
+ Super Explode! cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "super_explode.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+// t = R*C = 3.3K * 0.47uF * 40% Vtr = 792.2905424610516 usec
+// (3.3K pull-up on the EXROM line inside the C64, PLA Vih min = 2.0V = 40% of 5.0V)
+#define TIMER_PERIOD 792
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SUPER_EXPLODE = &device_creator<c64_super_explode_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_super_explode_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_super_explode_cartridge_device::c64_super_explode_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SUPER_EXPLODE, "C64 Super Explode! cartridge", tag, owner, clock, "c64_super_explode", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_super_explode_cartridge_device::device_start()
+{
+ // allocate timer
+ m_exrom_timer = timer_alloc();
+
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_super_explode_cartridge_device::device_reset()
+{
+ m_bank = 0;
+
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+}
+
+
+//-------------------------------------------------
+// device_timer - handler timer events
+//-------------------------------------------------
+
+void c64_super_explode_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ m_exrom = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_super_explode_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+
+ data = m_roml[(m_bank << 13) | (offset & 0x1fff)];
+ }
+ else if (!io1)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+ }
+ else if (!io2)
+ {
+ data = m_roml[(m_bank << 13) | (offset & 0x1fff)];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_super_explode_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_exrom = 0;
+ m_exrom_timer->adjust(attotime::from_usec(TIMER_PERIOD), 0);
+ }
+ else if (!io2)
+ {
+ m_bank = BIT(data, 7);
+ }
+}
diff --git a/src/mess/machine/c64/super_explode.h b/src/mess/machine/c64/super_explode.h
new file mode 100644
index 00000000000..b3d354569e5
--- /dev/null
+++ b/src/mess/machine/c64/super_explode.h
@@ -0,0 +1,55 @@
+/**********************************************************************
+
+ Super Explode! cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SUPER_EXPLODE__
+#define __SUPER_EXPLODE__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_super_explode_cartridge_device
+
+class c64_super_explode_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_super_explode_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+
+ emu_timer *m_exrom_timer;
+};
+
+
+// device type definition
+extern const device_type C64_SUPER_EXPLODE;
+
+
+#endif
diff --git a/src/mess/machine/c64/super_games.c b/src/mess/machine/c64/super_games.c
new file mode 100644
index 00000000000..6444db71909
--- /dev/null
+++ b/src/mess/machine/c64/super_games.c
@@ -0,0 +1,103 @@
+/**********************************************************************
+
+ Commodore Super Games cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "super_games.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SUPER_GAMES = &device_creator<c64_super_games_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_super_games_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_super_games_cartridge_device::c64_super_games_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SUPER_GAMES, "C64 Super Games cartridge", tag, owner, clock, "c64_super_games", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_super_games_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_super_games_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_super_games_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh)
+ {
+ offs_t addr = (m_bank << 14) | (offset & 0x3fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_super_games_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2)
+ {
+ m_bank = data & 0x03;
+
+ if (BIT(data, 2))
+ {
+ if (BIT(data, 3))
+ {
+ m_game = 1;
+ m_exrom = 1;
+ }
+ else
+ {
+ m_game = 1;
+ m_exrom = 0;
+ }
+ }
+ else
+ {
+ m_game = 0;
+ m_exrom = 0;
+ }
+ }
+}
diff --git a/src/mess/machine/c64/super_games.h b/src/mess/machine/c64/super_games.h
new file mode 100644
index 00000000000..4dd2ef1953d
--- /dev/null
+++ b/src/mess/machine/c64/super_games.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Commodore Super Games cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SUPER_GAMES__
+#define __SUPER_GAMES__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_super_games_cartridge_device
+
+class c64_super_games_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_super_games_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_SUPER_GAMES;
+
+
+#endif
diff --git a/src/mess/machine/c64/supercpu.c b/src/mess/machine/c64/supercpu.c
new file mode 100644
index 00000000000..ce31ee70d24
--- /dev/null
+++ b/src/mess/machine/c64/supercpu.c
@@ -0,0 +1,307 @@
+/**********************************************************************
+
+ CMD SuperCPU v2 + SuperRAM emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "supercpu.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define G65816_TAG "g65816"
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SUPERCPU = &device_creator<c64_supercpu_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_supercpu )
+//-------------------------------------------------
+
+ROM_START( c64_supercpu )
+ ROM_REGION( 0x20000, G65816_TAG, 0 )
+ ROM_LOAD( "supercpu_dos_204.bin", 0x00000, 0x20000, CRC(f4151454) SHA1(6aa529a7b1b6de53e8979e407a77b4d5657727f5) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_supercpu_device::device_rom_region() const
+{
+ return ROM_NAME( c64_supercpu );
+}
+
+
+//-------------------------------------------------
+// ADDRESS_MAP( c64_supercpu_map )
+//-------------------------------------------------
+
+static ADDRESS_MAP_START( c64_supercpu_map, AS_PROGRAM, 8, c64_supercpu_device )
+ AM_RANGE(0x000000, 0x01ffff) AM_RAM AM_SHARE("sram")
+ AM_RANGE(0x020000, 0xf7ffff) AM_RAM AM_SHARE("dimm")
+ AM_RANGE(0xf80000, 0xf9ffff) AM_MIRROR(0x60000) AM_ROM AM_REGION(G65816_TAG, 0)
+ADDRESS_MAP_END
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_supercpu )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_supercpu )
+ MCFG_CPU_ADD(G65816_TAG, G65816, 1000000)
+ MCFG_CPU_PROGRAM_MAP(c64_supercpu_map)
+
+ MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_supercpu_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_supercpu );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_supercpu )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_supercpu )
+ PORT_START("FRONT")
+ PORT_DIPNAME( 0x01, 0x01, "Unit" )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x01, DEF_STR( On ) )
+ PORT_DIPNAME( 0x02, 0x02, "JiffyDOS" )
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( On ) )
+ PORT_DIPNAME( 0x04, 0x00, "Speed" )
+ PORT_DIPSETTING( 0x04, "Normal" )
+ PORT_DIPSETTING( 0x00, "Turbo" )
+
+ PORT_START("RESET")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_supercpu_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_supercpu );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_supercpu_device - constructor
+//-------------------------------------------------
+
+c64_supercpu_device::c64_supercpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SUPERCPU, "SuperCPU", tag, owner, clock, "c64_supercpu", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_maincpu(*this, G65816_TAG),
+ m_exp(*this, C64_EXPANSION_SLOT_TAG),
+ m_sram(*this, "sram"),
+ m_dimm(*this, "dimm")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_supercpu_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_supercpu_device::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_supercpu_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+
+ switch (offset)
+ {
+ case 0xd0b0:
+ data = 0x40;
+ break;
+
+ case 0xd0b1:
+ break;
+
+ case 0xd0b2:
+ break;
+
+ case 0xd0b3:
+ case 0xd0b4:
+ break;
+
+ case 0xd0b5:
+ break;
+
+ case 0xd0b6:
+ break;
+
+ case 0xd0b7:
+ break;
+
+ case 0xd0b8:
+ case 0xd0b9:
+ break;
+
+ case 0xd0ba:
+ break;
+
+ case 0xd0bb:
+ break;
+
+ case 0xd0bc:
+ case 0xd0bd:
+ case 0xd0be:
+ case 0xd0bf:
+ break;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_supercpu_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ switch (offset)
+ {
+ case 0xd071:
+ break;
+
+ case 0xd072:
+ break;
+
+ case 0xd073:
+ break;
+
+ case 0xd074:
+ case 0xd075:
+ case 0xd076:
+ case 0xd077:
+ break;
+
+ case 0xd078:
+ break;
+
+ case 0xd07a:
+ break;
+
+ case 0xd079:
+ case 0xd07b:
+ break;
+
+ case 0xd07c:
+ break;
+
+ case 0xd07d:
+ case 0xd07f:
+ break;
+
+ case 0xd0b0:
+ case 0xd0b1:
+ break;
+
+ case 0xd0b2:
+ break;
+
+ case 0xd0b3:
+ break;
+
+ case 0xd0b4:
+ break;
+
+ case 0xd0b5:
+ break;
+
+ case 0xd0b6:
+ break;
+
+ case 0xd0b7:
+ break;
+
+ case 0xd0b8:
+ break;
+
+ case 0xd0b9:
+ case 0xd0ba:
+ case 0xd0bb:
+ break;
+
+ case 0xd0bc:
+ break;
+
+ case 0xd0be:
+ break;
+
+ case 0xd0bd:
+ case 0xd0bf:
+ break;
+ }
+
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_supercpu_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->game_r(offset, sphi2, ba, rw, hiram);
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_supercpu_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->exrom_r(offset, sphi2, ba, rw, hiram);
+}
diff --git a/src/mess/machine/c64/supercpu.h b/src/mess/machine/c64/supercpu.h
new file mode 100644
index 00000000000..537e73e3ab7
--- /dev/null
+++ b/src/mess/machine/c64/supercpu.h
@@ -0,0 +1,65 @@
+/**********************************************************************
+
+ CMD SuperCPU v2 + SuperRAM emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SUPERCPU__
+#define __SUPERCPU__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/cbmipt.h"
+#include "cpu/g65816/g65816.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_supercpu_device
+
+class c64_supercpu_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_supercpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<legacy_cpu_device> m_maincpu;
+ required_device<c64_expansion_slot_device> m_exp;
+
+ required_shared_ptr<UINT8> m_sram;
+ required_shared_ptr<UINT8> m_dimm;
+};
+
+
+// device type definition
+extern const device_type C64_SUPERCPU;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/sw8k.c b/src/mess/machine/c64/sw8k.c
new file mode 100644
index 00000000000..16ddcb6dbcc
--- /dev/null
+++ b/src/mess/machine/c64/sw8k.c
@@ -0,0 +1,115 @@
+/**********************************************************************
+
+ C64 switchable 8K cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ 4040 + Fast Hack'em
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| |
+ |=| SW1 |
+ |=| ROM0 |
+ |=| |
+ |=| |
+ |=| ROM1 |
+ |=| |
+ |=| |
+ |===========================|
+
+ ROM0,1 - National Semiconductor NMC27C64Q 8Kx8 EPROM
+ SW1 - ROM selection switch
+
+*/
+
+#include "sw8k.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SW8K = &device_creator<c64_switchable_8k_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_easyflash )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_switchable_8k )
+ PORT_START("SW")
+ PORT_DIPNAME( 0x01, 0x00, "ROM Select" )
+ PORT_DIPSETTING( 0x00, "ROM 0" )
+ PORT_DIPSETTING( 0x01, "ROM 1" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_switchable_8k_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_switchable_8k );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_switchable_8k_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_switchable_8k_cartridge_device::c64_switchable_8k_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SW8K, "C64 Switchable 8K cartridge", tag, owner, clock, "c64_sw8k", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_sw(*this, "SW")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_switchable_8k_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_switchable_8k_cartridge_device::device_reset()
+{
+ m_bank = m_sw->read();
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_switchable_8k_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/sw8k.h b/src/mess/machine/c64/sw8k.h
new file mode 100644
index 00000000000..ad53bcde062
--- /dev/null
+++ b/src/mess/machine/c64/sw8k.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ C64 switchable 8K cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_SW8K__
+#define __C64_SW8K__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_switchable_8k_cartridge_device
+
+class c64_switchable_8k_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_switchable_8k_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_ioport m_sw;
+
+ int m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_SW8K;
+
+
+#endif
diff --git a/src/mess/machine/c64/swiftlink.c b/src/mess/machine/c64/swiftlink.c
new file mode 100644
index 00000000000..1e0317c601b
--- /dev/null
+++ b/src/mess/machine/c64/swiftlink.c
@@ -0,0 +1,183 @@
+/**********************************************************************
+
+ CMD SwiftLink RS-232 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ http://mclauchlan.site.net.au/scott/C=Hacking/C-Hacking10/C-Hacking10-swiftlink.html
+
+*/
+
+#include "swiftlink.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MOS6551_TAG "mos6551"
+#define RS232_TAG "rs232"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SWIFTLINK = &device_creator<c64_swiftlink_cartridge_device>;
+
+
+//-------------------------------------------------
+// rs232_port_interface rs232_intf
+//-------------------------------------------------
+
+static const rs232_port_interface rs232_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, rxd_w),
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, dcd_w),
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, dsr_w),
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, cts_w)
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_swiftlink )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_swiftlink )
+ MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, WRITELINE(c64_swiftlink_cartridge_device, acia_irq_w))
+ MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
+
+ MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_swiftlink_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_swiftlink );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_swiftlink )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_swiftlink )
+ PORT_START("CS")
+ PORT_DIPNAME( 0x03, 0x01, "Base Address" )
+ PORT_DIPSETTING( 0x00, "$D700 (C128)" )
+ PORT_DIPSETTING( 0x01, "$DE00" )
+ PORT_DIPSETTING( 0x02, "$DF00" )
+
+ PORT_START("IRQ")
+ PORT_DIPNAME( 0x01, 0x01, "Interrupt" )
+ PORT_DIPSETTING( 0x00, "IRQ" )
+ PORT_DIPSETTING( 0x01, "NMI" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_swiftlink_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_swiftlink );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_swiftlink_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_swiftlink_cartridge_device::c64_swiftlink_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SWIFTLINK, "C64 SwiftLink cartridge", tag, owner, clock, "c64_swiftlink", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MOS6551_TAG),
+ m_io_cs(*this, "CS"),
+ m_io_irq(*this, "IRQ")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_swiftlink_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_swiftlink_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_cs = m_io_cs->read();
+ m_irq = m_io_irq->read();
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_swiftlink_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
+ ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
+ {
+ data = m_acia->read(space, offset & 0x03);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_swiftlink_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
+ ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
+ {
+ m_acia->write(space, offset & 0x03, data);
+ }
+}
+
+
+//-------------------------------------------------
+// acia_irq_w -
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_swiftlink_cartridge_device::acia_irq_w )
+{
+ switch (m_irq)
+ {
+ case IRQ: m_slot->irq_w(state); break;
+ case NMI: m_slot->nmi_w(state); break;
+ }
+}
diff --git a/src/mess/machine/c64/swiftlink.h b/src/mess/machine/c64/swiftlink.h
new file mode 100644
index 00000000000..347af0b4ed6
--- /dev/null
+++ b/src/mess/machine/c64/swiftlink.h
@@ -0,0 +1,79 @@
+/**********************************************************************
+
+ CMD SwiftLink RS-232 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SWIFTLINK__
+#define __SWIFTLINK__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/mos6551.h"
+#include "machine/serial.h"
+
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_swiftlink_cartridge_device
+
+class c64_swiftlink_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_swiftlink_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<mos6551_device> m_acia;
+ required_ioport m_io_cs;
+ required_ioport m_io_irq;
+
+ enum
+ {
+ D700 = 0,
+ DE00,
+ DF00
+ };
+
+ enum
+ {
+ IRQ = 0,
+ NMI
+ };
+
+ int m_cs;
+ int m_irq;
+};
+
+
+// device type definition
+extern const device_type C64_SWIFTLINK;
+
+
+#endif
diff --git a/src/mess/machine/c64/system3.c b/src/mess/machine/c64/system3.c
new file mode 100644
index 00000000000..0acc6fd5f85
--- /dev/null
+++ b/src/mess/machine/c64/system3.c
@@ -0,0 +1,91 @@
+/**********************************************************************
+
+ System 3 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "system3.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SYSTEM3 = &device_creator<c64_system3_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_system3_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_system3_cartridge_device::c64_system3_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_SYSTEM3, "C64 System 3 cartridge", tag, owner, clock, "c64_system3", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_system3_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_system3_cartridge_device::device_reset()
+{
+ m_bank = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_system3_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_roml[addr];
+ }
+ else if (!io1)
+ {
+ m_bank = offset & 0x3f;
+ m_game = 1;
+ data = 0;
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_system3_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_bank = offset & 0x3f;
+ m_game = 0;
+ }
+}
diff --git a/src/mess/machine/c64/system3.h b/src/mess/machine/c64/system3.h
new file mode 100644
index 00000000000..286ed9a14c6
--- /dev/null
+++ b/src/mess/machine/c64/system3.h
@@ -0,0 +1,52 @@
+/**********************************************************************
+
+ Dinamic Software cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __SYSTEM3__
+#define __SYSTEM3__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_system3_cartridge_device
+
+class c64_system3_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_system3_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_SYSTEM3;
+
+
+#endif
diff --git a/src/mess/machine/c64/tdos.c b/src/mess/machine/c64/tdos.c
new file mode 100644
index 00000000000..95cf6ea3bd5
--- /dev/null
+++ b/src/mess/machine/c64/tdos.c
@@ -0,0 +1,192 @@
+/**********************************************************************
+
+ Triton QD TDOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ XM-2206-A (top)
+ XM-2205-A (bottom)
+
+ |===========================|
+ | CN4 |
+ | |
+ | ULA |
+ | |
+ | 6.5MHz |
+ | |
+ | SSDA |
+ | LS175 |
+ | LS367 |
+ | CN3 |
+ |=========|||||||||=========|
+ |||||||||
+ |=============|||||||||============|
+ | CN2 |
+ | LS00 LS02 LS138 |
+ |=======| |
+ |=| LS245 ROM |
+ |=| |
+ |=| |
+ |=| CN1|
+ |=| |
+ |=| |
+ |=| |
+ |=| SW1 |
+ |==========================================|
+
+ ROM - Hitachi HN482764G 8Kx8 EPROM "TDOS 1.2"
+ ULA - Ferranti ULA5RB073E1 XZ-2085-1 custom (?)
+ SSDA - Motorola MC68A52P SSDA
+ CN1 - C64 expansion connector (pass-thru)
+ CN2,3 - 19x1 flat ribbon cable to other PCB
+ CN4 - 9 wires to 3" drive
+ SW1 - cartridge on/off switch
+
+*/
+
+#include "tdos.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MC68A52P_TAG "mc6852"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_TDOS = &device_creator<c64_tdos_cartridge_device>;
+
+
+//-------------------------------------------------
+// MC6852_INTERFACE( ssda_intf )
+//-------------------------------------------------
+
+static MC6852_INTERFACE( ssda_intf )
+{
+ 0,
+ 0,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_multiscreen )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_tdos )
+ MCFG_MC6852_ADD(MC68A52P_TAG, XTAL_6_5MHz, ssda_intf)
+
+ MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_tdos_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_tdos );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_tdos_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_tdos_cartridge_device::c64_tdos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_TDOS, "C64 TDOS cartridge", tag, owner, clock, "c64_tdos", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_ssda(*this, MC68A52P_TAG),
+ m_exp(*this, C64_EXPANSION_SLOT_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_tdos_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_tdos_cartridge_device::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_tdos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+
+ // TODO
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_tdos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ // TODO
+ m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2);
+}
+
+
+//-------------------------------------------------
+// c64_game_r - GAME read
+//-------------------------------------------------
+
+int c64_tdos_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->game_r(offset, sphi2, ba, rw, hiram);
+}
+
+
+//-------------------------------------------------
+// c64_exrom_r - EXROM read
+//-------------------------------------------------
+
+int c64_tdos_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram)
+{
+ return m_exp->exrom_r(offset, sphi2, ba, rw, hiram);
+}
diff --git a/src/mess/machine/c64/tdos.h b/src/mess/machine/c64/tdos.h
new file mode 100644
index 00000000000..eea6bef25b3
--- /dev/null
+++ b/src/mess/machine/c64/tdos.h
@@ -0,0 +1,59 @@
+/**********************************************************************
+
+ Triton QD TDOS cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __TDOS__
+#define __TDOS__
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/cbmipt.h"
+#include "machine/mc6852.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_tdos_cartridge_device
+
+class c64_tdos_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_tdos_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram);
+
+private:
+ required_device<mc6852_device> m_ssda;
+ required_device<c64_expansion_slot_device> m_exp;
+};
+
+
+// device type definition
+extern const device_type C64_TDOS;
+
+
+#endif
diff --git a/src/mess/machine/c64/turbo232.c b/src/mess/machine/c64/turbo232.c
new file mode 100644
index 00000000000..78588bd9910
--- /dev/null
+++ b/src/mess/machine/c64/turbo232.c
@@ -0,0 +1,228 @@
+/**********************************************************************
+
+ CMD Turbo232 RS-232 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ http://ar.c64.org/wiki/Turbo232_Programming.txt
+
+*/
+
+#include "turbo232.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MOS6551_TAG "mos6551"
+#define RS232_TAG "rs232"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_TURBO232 = &device_creator<c64_turbo232_cartridge_device>;
+
+
+//-------------------------------------------------
+// rs232_port_interface rs232_intf
+//-------------------------------------------------
+
+static const rs232_port_interface rs232_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, rxd_w),
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, dcd_w),
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, dsr_w),
+ DEVCB_NULL,
+ DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, cts_w)
+};
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
+ MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, WRITELINE(c64_turbo232_cartridge_device, acia_irq_w))
+ MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
+
+ MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_turbo232_cartridge_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_turbo232 );
+}
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_turbo232 )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_turbo232 )
+ PORT_START("CS")
+ PORT_DIPNAME( 0x03, 0x01, "Base Address" )
+ PORT_DIPSETTING( 0x00, "$D700 (C128)" )
+ PORT_DIPSETTING( 0x01, "$DE00" )
+ PORT_DIPSETTING( 0x02, "$DF00" )
+
+ PORT_START("IRQ")
+ PORT_DIPNAME( 0x01, 0x01, "Interrupt" )
+ PORT_DIPSETTING( 0x00, "IRQ" )
+ PORT_DIPSETTING( 0x01, "NMI" )
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_turbo232_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_turbo232 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_turbo232_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_turbo232_cartridge_device::c64_turbo232_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_TURBO232, "C64 Turbo232 cartridge", tag, owner, clock, "c64_turbo232", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_acia(*this, MOS6551_TAG),
+ m_rs232(*this, RS232_TAG),
+ m_io_cs(*this, "CS"),
+ m_io_irq(*this, "IRQ")
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_turbo232_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_turbo232_cartridge_device::device_reset()
+{
+ m_acia->reset();
+
+ m_cs = m_io_cs->read();
+ m_irq = m_io_irq->read();
+
+ m_es = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_turbo232_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
+ ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
+ {
+ if (!(offset & 0xe0))
+ {
+ switch (offset & 0x07)
+ {
+ case 0: case 1: case 2: case 3:
+ data = m_acia->read(space, offset & 0x03);
+ break;
+
+ case 7:
+ data = m_es;
+ }
+ }
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_turbo232_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (((m_cs == DE00) && !io1) || ((m_cs == DF00) && !io2) ||
+ ((m_cs == D700) && ((offset & 0xff00) == 0xd700)))
+ {
+ if (!(offset & 0xe0))
+ {
+ switch (offset & 0x07)
+ {
+ case 0: case 1: case 2:
+ m_acia->write(space, offset & 0x03, data);
+ break;
+
+ case 3:
+ m_acia->write(space, offset & 0x03, data);
+
+ if (data & 0x0f)
+ m_es &= ~ES_M;
+ else
+ m_es |= ES_M;
+ break;
+
+ case 7:
+ if (m_es & ES_M)
+ {
+ data = m_es;
+
+ switch (m_es & ES_S_MASK)
+ {
+ case ES_S_230400: m_acia->set_rxc(XTAL_3_6864MHz); break;
+ case ES_S_115200: m_acia->set_rxc(XTAL_3_6864MHz/2); break;
+ case ES_S_57600: m_acia->set_rxc(XTAL_3_6864MHz/4); break;
+ case ES_S_UNDEFINED: m_acia->set_rxc(0); break;
+ }
+ }
+ }
+ }
+ }
+}
+
+
+//-------------------------------------------------
+// acia_irq_w -
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_turbo232_cartridge_device::acia_irq_w )
+{
+ switch (m_irq)
+ {
+ case IRQ: m_slot->irq_w(state); break;
+ case NMI: m_slot->nmi_w(state); break;
+ }
+}
diff --git a/src/mess/machine/c64/turbo232.h b/src/mess/machine/c64/turbo232.h
new file mode 100644
index 00000000000..d5b0e10178b
--- /dev/null
+++ b/src/mess/machine/c64/turbo232.h
@@ -0,0 +1,93 @@
+/**********************************************************************
+
+ CMD Turbo232 RS-232 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __TURBO232__
+#define __TURBO232__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "machine/mos6551.h"
+#include "machine/null_modem.h"
+#include "machine/serial.h"
+#include "machine/terminal.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_turbo232_cartridge_device
+
+class c64_turbo232_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_turbo232_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+ virtual ioport_constructor device_input_ports() const;
+
+ DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ required_device<mos6551_device> m_acia;
+ required_device<rs232_port_device> m_rs232;
+ required_ioport m_io_cs;
+ required_ioport m_io_irq;
+
+ enum
+ {
+ D700 = 0,
+ DE00,
+ DF00
+ };
+
+ enum
+ {
+ IRQ = 0,
+ NMI
+ };
+
+ enum
+ {
+ ES_S_230400 = 0x00,
+ ES_S_115200 = 0x01,
+ ES_S_57600 = 0x02,
+ ES_S_UNDEFINED = 0x03,
+ ES_S_MASK = 0x03,
+ ES_M = 0x04
+ };
+
+ int m_cs;
+ int m_irq;
+
+ UINT8 m_es;
+};
+
+
+// device type definition
+extern const device_type C64_TURBO232;
+
+
+#endif
diff --git a/src/mess/machine/c64/user.c b/src/mess/machine/c64/user.c
new file mode 100644
index 00000000000..ca09ef1af29
--- /dev/null
+++ b/src/mess/machine/c64/user.c
@@ -0,0 +1,108 @@
+/**********************************************************************
+
+ Commodore 64 User Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "machine/c64/user.h"
+
+
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type C64_USER_PORT = &device_creator<c64_user_port_device>;
+
+
+
+//**************************************************************************
+// CARD INTERFACE
+//**************************************************************************
+
+//-------------------------------------------------
+// device_c64_user_port_interface - constructor
+//-------------------------------------------------
+
+device_c64_user_port_interface::device_c64_user_port_interface(const machine_config &mconfig, device_t &device)
+ : device_slot_card_interface(mconfig,device)
+{
+ m_slot = dynamic_cast<c64_user_port_device *>(device.owner());
+}
+
+
+//-------------------------------------------------
+// ~device_c64_user_port_interface - destructor
+//-------------------------------------------------
+
+device_c64_user_port_interface::~device_c64_user_port_interface()
+{
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_user_port_device - constructor
+//-------------------------------------------------
+
+c64_user_port_device::c64_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_USER_PORT, "C64 user port", tag, owner, clock, "c64_user_port", __FILE__),
+ device_slot_interface(mconfig, *this),
+ m_write_cnt1(*this),
+ m_write_sp1(*this),
+ m_write_cnt2(*this),
+ m_write_sp2(*this),
+ m_write_flag2(*this),
+ m_write_reset(*this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_user_port_device::device_start()
+{
+ m_card = dynamic_cast<device_c64_user_port_interface *>(get_card_device());
+
+ // resolve callbacks
+ m_write_cnt1.resolve_safe();
+ m_write_sp1.resolve_safe();
+ m_write_cnt2.resolve_safe();
+ m_write_sp2.resolve_safe();
+ m_write_flag2.resolve_safe();
+ m_write_reset.resolve_safe();
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_user_port_device::device_reset()
+{
+ if (get_card_device())
+ {
+ get_card_device()->reset();
+ }
+}
+
+
+READ8_MEMBER( c64_user_port_device::pb_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->c64_pb_r(space, offset); return data; }
+WRITE8_MEMBER( c64_user_port_device::pb_w ) { if (m_card != NULL) m_card->c64_pb_w(space, offset, data); }
+READ_LINE_MEMBER( c64_user_port_device::pa2_r ) { int state = 1; if (m_card != NULL) state = m_card->c64_pa2_r(); return state; }
+WRITE_LINE_MEMBER( c64_user_port_device::pa2_w ) { if (m_card != NULL) m_card->c64_pa2_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::pc2_w ) { if (m_card != NULL) m_card->c64_pc2_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::atn_w ) { if (m_card != NULL) m_card->c64_atn_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::cnt1_w ) { if (m_card != NULL) m_card->c64_cnt1_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::sp1_w ) { if (m_card != NULL) m_card->c64_sp1_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::cnt2_w ) { if (m_card != NULL) m_card->c64_cnt2_w(state); }
+WRITE_LINE_MEMBER( c64_user_port_device::sp2_w ) { if (m_card != NULL) m_card->c64_sp2_w(state); }
diff --git a/src/mess/machine/c64/user.h b/src/mess/machine/c64/user.h
new file mode 100644
index 00000000000..905c97312bf
--- /dev/null
+++ b/src/mess/machine/c64/user.h
@@ -0,0 +1,156 @@
+/**********************************************************************
+
+ Commodore 64 User Port emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************
+
+ GND 1 A GND
+ +5V 2 B /FLAG2
+ /RESET 3 C PB0
+ CNT1 4 D PB1
+ SP1 5 E PB2
+ CNT2 6 F PB3
+ SP2 7 H PB4
+ /PC2 8 J PB5
+ ATN 9 K PB6
+ +9VAC 10 L PB7
+ +9VAC 11 M PA2
+ GND 12 N GND
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_USER_PORT__
+#define __C64_USER_PORT__
+
+#include "emu.h"
+
+
+
+//**************************************************************************
+// CONSTANTS
+//**************************************************************************
+
+#define C64_USER_PORT_TAG "user"
+
+
+
+//**************************************************************************
+// INTERFACE CONFIGURATION MACROS
+//**************************************************************************
+
+#define MCFG_C64_USER_PORT_ADD(_tag, _slot_intf, _def_slot, _reset) \
+ MCFG_DEVICE_ADD(_tag, C64_USER_PORT, 0) \
+ downcast<c64_user_port_device *>(device)->set_reset_callback(DEVCB2_##_reset); \
+ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
+
+
+#define MCFG_C64_USER_PORT_CIA1_CALLBACKS(_cnt, _sp) \
+ downcast<c64_user_port_device *>(device)->set_cia1_callbacks(DEVCB2_##_cnt, DEVCB2_##_sp);
+
+#define MCFG_C64_USER_PORT_CIA2_CALLBACKS(_cnt, _sp, _flag) \
+ downcast<c64_user_port_device *>(device)->set_cia2_callbacks(DEVCB2_##_cnt, DEVCB2_##_sp, DEVCB2_##_flag);
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_user_port_device
+
+class device_c64_user_port_interface;
+
+class c64_user_port_device : public device_t,
+ public device_slot_interface
+{
+public:
+ // construction/destruction
+ c64_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ template<class _reset> void set_reset_callback(_reset reset) { m_write_reset.set_callback(reset); }
+
+ template<class _cnt, class _sp> void set_cia1_callbacks(_cnt cnt, _sp sp) {
+ m_write_cnt1.set_callback(cnt);
+ m_write_sp1.set_callback(sp);
+ }
+
+ template<class _cnt, class _sp, class _flag> void set_cia2_callbacks(_cnt cnt, _sp sp, _flag flag) {
+ m_write_cnt2.set_callback(cnt);
+ m_write_sp2.set_callback(sp);
+ m_write_flag2.set_callback(flag);
+ }
+
+ // computer interface
+ DECLARE_READ8_MEMBER( pb_r );
+ DECLARE_WRITE8_MEMBER( pb_w );
+ DECLARE_READ_LINE_MEMBER( pa2_r );
+ DECLARE_WRITE_LINE_MEMBER( pa2_w );
+ DECLARE_WRITE_LINE_MEMBER( pc2_w );
+ DECLARE_WRITE_LINE_MEMBER( atn_w );
+ DECLARE_WRITE_LINE_MEMBER( cnt1_w );
+ DECLARE_WRITE_LINE_MEMBER( sp1_w );
+ DECLARE_WRITE_LINE_MEMBER( cnt2_w );
+ DECLARE_WRITE_LINE_MEMBER( sp2_w );
+
+ // cartridge interface
+ DECLARE_WRITE_LINE_MEMBER( cia_cnt1_w ) { m_write_cnt1(state); }
+ DECLARE_WRITE_LINE_MEMBER( cia_sp1_w ) { m_write_sp1(state); }
+ DECLARE_WRITE_LINE_MEMBER( cia_cnt2_w ) { m_write_cnt2(state); }
+ DECLARE_WRITE_LINE_MEMBER( cia_sp2_w ) { m_write_sp2(state); }
+ DECLARE_WRITE_LINE_MEMBER( cia_flag2_w ) { m_write_flag2(state); }
+ DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_write_reset(state); }
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ devcb2_write_line m_write_cnt1;
+ devcb2_write_line m_write_sp1;
+ devcb2_write_line m_write_cnt2;
+ devcb2_write_line m_write_sp2;
+ devcb2_write_line m_write_flag2;
+ devcb2_write_line m_write_reset;
+
+ device_c64_user_port_interface *m_card;
+};
+
+
+// ======================> device_c64_user_port_interface
+
+// class representing interface-specific live c64_expansion card
+class device_c64_user_port_interface : public device_slot_card_interface
+{
+public:
+ // construction/destruction
+ device_c64_user_port_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_c64_user_port_interface();
+
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset) { return 0xff; };
+ virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data) { };
+
+ virtual int c64_pa2_r() { return 1; };
+ virtual void c64_pa2_w(int state) { };
+ virtual void c64_cnt1_w(int state) { };
+ virtual void c64_sp1_w(int state) { };
+ virtual void c64_pc2_w(int state) { };
+ virtual void c64_cnt2_w(int state) { };
+ virtual void c64_sp2_w(int state) { };
+ virtual void c64_atn_w(int state) { };
+
+protected:
+ c64_user_port_device *m_slot;
+};
+
+
+// device type definition
+extern const device_type C64_USER_PORT;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/vic1011.c b/src/mess/machine/c64/vic1011.c
new file mode 100644
index 00000000000..fa173674fb0
--- /dev/null
+++ b/src/mess/machine/c64/vic1011.c
@@ -0,0 +1,164 @@
+/**********************************************************************
+
+ Commodore VIC-1011A/B RS-232C Adapter emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "vic1011.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define RS232_TAG "rs232"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_VIC1011 = &device_creator<c64_vic1011_device>;
+
+
+//-------------------------------------------------
+// rs232_port_interface rs232_intf
+//-------------------------------------------------
+
+static const rs232_port_interface rs232_intf =
+{
+ DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_vic1011_device, rxd_w),
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL
+};
+
+
+//-------------------------------------------------
+// MACHINE_DRIVER( vic1011 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( vic1011 )
+ MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_vic1011_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( vic1011 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_vic1011_device - constructor
+//-------------------------------------------------
+
+c64_vic1011_device::c64_vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, C64_VIC1011, "C64 VIC1011", tag, owner, clock, "c64_vic1011", __FILE__),
+ device_c64_user_port_interface(mconfig, *this),
+ m_rs232(*this, RS232_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_vic1011_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_pb_r - port B read
+//-------------------------------------------------
+
+UINT8 c64_vic1011_device::c64_pb_r(address_space &space, offs_t offset)
+{
+ /*
+
+ bit description
+
+ 0 Sin
+ 1
+ 2
+ 3
+ 4 DCDin
+ 5
+ 6 CTS
+ 7 DSR
+
+ */
+
+ UINT8 data = 0;
+
+ data |= !m_rs232->rx();
+ data |= m_rs232->dcd_r() << 4;
+ data |= m_rs232->cts_r() << 6;
+ data |= m_rs232->dsr_r() << 7;
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_pb_w - port B write
+//-------------------------------------------------
+
+void c64_vic1011_device::c64_pb_w(address_space &space, offs_t offset, UINT8 data)
+{
+ /*
+
+ bit description
+
+ 0
+ 1 RTS
+ 2 DTR
+ 3
+ 4
+ 5 DCDout
+ 6
+ 7
+
+ */
+
+ m_rs232->rts_w(BIT(data, 1));
+ m_rs232->dtr_w(BIT(data, 2));
+}
+
+
+//-------------------------------------------------
+// c64_pa2_w - PA2 write
+//-------------------------------------------------
+
+void c64_vic1011_device::c64_pa2_w(int state)
+{
+ m_rs232->tx(!state);
+}
+
+
+//-------------------------------------------------
+// rxd_w -
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( c64_vic1011_device::rxd_w )
+{
+ m_slot->cia_flag2_w(!state);
+}
diff --git a/src/mess/machine/c64/vic1011.h b/src/mess/machine/c64/vic1011.h
new file mode 100644
index 00000000000..5ec257e10c8
--- /dev/null
+++ b/src/mess/machine/c64/vic1011.h
@@ -0,0 +1,58 @@
+/**********************************************************************
+
+ Commodore VIC-1011A/B RS-232C Adapter emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __C64_VIC1011__
+#define __C64_VIC1011__
+
+#include "emu.h"
+#include "machine/c64/user.h"
+#include "machine/serial.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_vic1011_device
+
+class c64_vic1011_device : public device_t,
+ public device_c64_user_port_interface
+{
+public:
+ // construction/destruction
+ c64_vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ DECLARE_WRITE_LINE_MEMBER( rxd_w );
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_user_port_interface overrides
+ virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
+ virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data);
+ virtual void c64_pa2_w(int state);
+
+private:
+ required_device<rs232_port_device> m_rs232;
+};
+
+
+// device type definition
+extern const device_type C64_VIC1011;
+
+
+
+#endif
diff --git a/src/mess/machine/c64/vizastar.c b/src/mess/machine/c64/vizastar.c
new file mode 100644
index 00000000000..8dc4013911e
--- /dev/null
+++ b/src/mess/machine/c64/vizastar.c
@@ -0,0 +1,90 @@
+/**********************************************************************
+
+ VizaStar 64 XL4 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+ RB84 (C) MICROPORT
+ |===========================|
+ |=| |
+ |=| |
+ |=| |
+ |=| |
+ |=| ROM |
+ |=| |
+ |=| |
+ |=| |
+ |===========================|
+
+ ROM - Hitachi HN462732G 4Kx8 EPROM "V"
+
+*/
+
+#include "vizastar.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define UNSCRAMBLE_ADDRESS(_offset) \
+ BITSWAP16(_offset,15,14,13,12,5,0,7,10,11,9,8,6,4,3,2,1)
+
+#define UNSCRAMBLE_DATA(_data) \
+ BITSWAP8(_data,7,6,0,5,1,4,2,3)
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_VIZASTAR = &device_creator<c64_vizastar_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_vizastar_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_vizastar_cartridge_device::c64_vizastar_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_VIZASTAR, "VizaStar 64 XL4", tag, owner, clock, "c64_vizastar", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_vizastar_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_vizastar_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = UNSCRAMBLE_DATA(m_roml[UNSCRAMBLE_ADDRESS(offset & 0xfff)]);
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/vizastar.h b/src/mess/machine/c64/vizastar.h
new file mode 100644
index 00000000000..5661c0847fb
--- /dev/null
+++ b/src/mess/machine/c64/vizastar.h
@@ -0,0 +1,47 @@
+/**********************************************************************
+
+ VizaStar 64 XL4 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __VIZASTAR__
+#define __VIZASTAR__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_vizastar_cartridge_device
+
+class c64_vizastar_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_vizastar_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_VIZASTAR;
+
+
+#endif
diff --git a/src/mess/machine/c64/vw64.c b/src/mess/machine/c64/vw64.c
new file mode 100644
index 00000000000..b2720d50bc9
--- /dev/null
+++ b/src/mess/machine/c64/vw64.c
@@ -0,0 +1,128 @@
+/**********************************************************************
+
+ VizaWrite 64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===========================|
+ |=| LS10 LS122 C |
+ |=| R |
+ |=| |
+ |=| |
+ |=| ROM0 ROM2 ROM1 |
+ |=| |
+ |=| |
+ |=| |
+ |===========================|
+
+ ROM0 - Mitsubishi M5L2764K 8Kx8 EPROM "U"
+ ROM1 - Mitsubishi M5L2764K 8Kx8 EPROM "3"
+ ROM2 - Mitsubishi M5L2764K 8Kx8 EPROM "2" (located on solder side)
+ R - 56K
+ C - 47uF
+
+*/
+
+#include "vw64.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define UNSCRAMBLE_ADDRESS(_offset) \
+ BITSWAP16(_offset,15,14,13,12,6,2,8,10,11,9,7,5,4,3,1,0)
+
+#define UNSCRAMBLE_DATA(_data) \
+ BITSWAP8(_data,7,6,0,5,1,4,2,3)
+
+
+// 74LS122 tW=0.45*R*C = 1.1844s
+#define TIMER_PERIOD 1184
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_VW64 = &device_creator<c64_vizawrite_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_vizawrite_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_vizawrite_cartridge_device::c64_vizawrite_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_VW64, "VizaWrite 64", tag, owner, clock, "c64_vizawrite", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_vizawrite_cartridge_device::device_start()
+{
+ // allocate timer
+ m_game_timer = timer_alloc();
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_vizawrite_cartridge_device::device_reset()
+{
+ m_game = 0;
+
+ m_game_timer->adjust(attotime::from_msec(TIMER_PERIOD), 0);
+}
+
+
+//-------------------------------------------------
+// device_timer - handler timer events
+//-------------------------------------------------
+
+void c64_vizawrite_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+{
+ m_game = 1;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_vizawrite_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ offs_t addr = (m_game << 13) | (offset & 0x1fff);
+ data = UNSCRAMBLE_DATA(m_roml[UNSCRAMBLE_ADDRESS(addr)]);
+ }
+ else if (!romh)
+ {
+ offs_t addr = offset & 0x1fff;
+ data = UNSCRAMBLE_DATA(m_romh[UNSCRAMBLE_ADDRESS(addr)]);
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/vw64.h b/src/mess/machine/c64/vw64.h
new file mode 100644
index 00000000000..a24539c4645
--- /dev/null
+++ b/src/mess/machine/c64/vw64.h
@@ -0,0 +1,53 @@
+/**********************************************************************
+
+ VizaWrite 64 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __VW64__
+#define __VW64__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_vizawrite_cartridge_device
+
+class c64_vizawrite_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_vizawrite_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return 0; }
+
+private:
+ emu_timer *m_game_timer;
+};
+
+
+// device type definition
+extern const device_type C64_VW64;
+
+
+#endif
diff --git a/src/mess/machine/c64/warp_speed.c b/src/mess/machine/c64/warp_speed.c
new file mode 100644
index 00000000000..6dbf841acc8
--- /dev/null
+++ b/src/mess/machine/c64/warp_speed.c
@@ -0,0 +1,148 @@
+/**********************************************************************
+
+ Cinemaware Warp Speed cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+/*
+
+ PCB Layout
+ ----------
+
+ |===================|
+ |=| SW1 |
+ |=| |
+ |=| SW2 |
+ |=| |
+ |=| |
+ |=| ROM |
+ |=| LS109|
+ |=| |
+ |===================|
+
+ ROM - "DEI-356NR-WRPIIDA1 (C) NCR A8847 609-2415038 F833071" 16Kx8 ROM
+ SW1 - mode switch (C64/C128)
+ SW2 - reset button
+
+*/
+
+#include "warp_speed.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define UNSCRAMBLE_ADDRESS(_offset) \
+ BITSWAP16(_offset,15,14,12,13,5,2,7,9,11,10,8,6,4,3,1,0)
+
+#define UNSCRAMBLE_DATA(_data) \
+ BITSWAP8(_data,7,6,5,0,1,4,2,3)
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_WARP_SPEED = &device_creator<c64_warp_speed_cartridge_device>;
+
+
+//-------------------------------------------------
+// INPUT_PORTS( c64_warp_speed )
+//-------------------------------------------------
+
+static INPUT_PORTS_START( c64_warp_speed )
+ PORT_START("SW1")
+ PORT_DIPNAME( 0x01, 0x01, "Mode" )
+ PORT_DIPSETTING( 0x01, "C64" )
+ PORT_DIPSETTING( 0x00, "C128" )
+
+ PORT_START("SW2")
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_F11) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_expansion_slot_device, reset_w)
+INPUT_PORTS_END
+
+
+//-------------------------------------------------
+// input_ports - device-specific input ports
+//-------------------------------------------------
+
+ioport_constructor c64_warp_speed_cartridge_device::device_input_ports() const
+{
+ return INPUT_PORTS_NAME( c64_warp_speed );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_warp_speed_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_warp_speed_cartridge_device::c64_warp_speed_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_WARP_SPEED, "C64 Warp Speed cartridge", tag, owner, clock, "c64_warp_speed", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_warp_speed_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_warp_speed_cartridge_device::device_reset()
+{
+ m_exrom = 0;
+ m_game = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_warp_speed_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml || !romh || !io1 || !io2)
+ {
+ offs_t addr = UNSCRAMBLE_ADDRESS(offset & 0x3fff);
+ data = UNSCRAMBLE_DATA(m_roml[addr]);
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_warp_speed_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io1)
+ {
+ m_exrom = 0;
+ m_game = 0;
+ }
+ else if (!io2)
+ {
+ m_exrom = 1;
+ m_game = 1;
+ }
+}
diff --git a/src/mess/machine/c64/warp_speed.h b/src/mess/machine/c64/warp_speed.h
new file mode 100644
index 00000000000..a92d014d2eb
--- /dev/null
+++ b/src/mess/machine/c64/warp_speed.h
@@ -0,0 +1,55 @@
+/**********************************************************************
+
+ Cinemaware Warp Speed cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __WARP_SPEED__
+#define __WARP_SPEED__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_warp_speed_cartridge_device
+
+class c64_warp_speed_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_warp_speed_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual ioport_constructor device_input_ports() const;
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ //UINT8 m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_WARP_SPEED;
+
+
+#endif
diff --git a/src/mess/machine/c64/westermann.c b/src/mess/machine/c64/westermann.c
new file mode 100644
index 00000000000..376cb5f7fb5
--- /dev/null
+++ b/src/mess/machine/c64/westermann.c
@@ -0,0 +1,83 @@
+/**********************************************************************
+
+ Westermann Learning cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "westermann.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_WESTERMANN = &device_creator<c64_westermann_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_westermann_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_westermann_cartridge_device::c64_westermann_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_WESTERMANN, "C64 Westermann cartridge", tag, owner, clock, "c64_westermann", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_westermann_cartridge_device::device_start()
+{
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_westermann_cartridge_device::device_reset()
+{
+ m_game = 0;
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_westermann_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0x1fff];
+ }
+ else if (!romh)
+ {
+ if (m_romh_mask)
+ {
+ data = m_romh[offset & 0x1fff];
+ }
+ else
+ {
+ data = m_roml[offset & 0x3fff];
+ }
+ }
+ else if (!io2)
+ {
+ m_game = 1;
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/westermann.h b/src/mess/machine/c64/westermann.h
new file mode 100644
index 00000000000..20e010464a4
--- /dev/null
+++ b/src/mess/machine/c64/westermann.h
@@ -0,0 +1,48 @@
+/**********************************************************************
+
+ Westermann Learning cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __WESTERMANN__
+#define __WESTERMANN__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_westermann_cartridge_device
+
+class c64_westermann_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_westermann_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+};
+
+
+// device type definition
+extern const device_type C64_WESTERMANN;
+
+
+#endif
diff --git a/src/mess/machine/c64/xl80.c b/src/mess/machine/c64/xl80.c
new file mode 100644
index 00000000000..488a8f8169a
--- /dev/null
+++ b/src/mess/machine/c64/xl80.c
@@ -0,0 +1,255 @@
+/*
+
+XL 80 cartridge
+(c) 1984 20 Data Corporation
+
+PCB Layout
+----------
+
+ |==================================|
+ | LS175 LS20 LS139 |
+ | LS157 |
+|=======| |
+|=| RAM |
+|=| LS157 LS157 LS165 |
+|=| |
+|=| CN1|
+|=| CRTC ROM1 |
+|=| |
+|=| ROM0 LS245 LS151 |
+|=| 14.31818MHz|
+|=======| LS174 LS00 |
+ | HCU04 |
+ | LS74 LS161 LS74 |
+ |==================================|
+
+Notes:
+ All IC's shown.
+
+ CRTC - Hitachi HD46505SP
+ RAM - Toshiba TMM2016AP-12 2Kx8 Static RAM
+ ROM0 - GI 9433CS-0090 8Kx8 ROM
+ ROM1 - GI 9316CS-F67 2Kx8 ROM "DTC"
+ CN1 - RCA video output
+
+*/
+
+#include "xl80.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define RAM_SIZE 0x800
+
+#define HD46505SP_TAG "mc6845"
+#define MC6845_SCREEN_TAG "screen80"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_XL80 = &device_creator<c64_xl80_device>;
+
+
+//-------------------------------------------------
+// ROM( c64_xl80 )
+//-------------------------------------------------
+
+ROM_START( c64_xl80 )
+ ROM_REGION( 0x800, HD46505SP_TAG, 0 )
+ ROM_LOAD( "dtc.u14", 0x000, 0x800, CRC(9edf5e58) SHA1(4b244e6d94a7653a2e52c351589f0b469119fb04) )
+ROM_END
+
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *c64_xl80_device::device_rom_region() const
+{
+ return ROM_NAME( c64_xl80 );
+}
+
+//-------------------------------------------------
+// mc6845_interface crtc_intf
+//-------------------------------------------------
+
+void c64_xl80_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
+{
+ for (int column = 0; column < x_count; column++)
+ {
+ UINT8 code = m_ram[((ma + column) & 0x7ff)];
+ UINT16 addr = (code << 3) | (ra & 0x07);
+ UINT8 data = m_char_rom->base()[addr & 0x7ff];
+
+ if (column == cursor_x)
+ {
+ data = 0xff;
+ }
+
+ for (int bit = 0; bit < 8; bit++)
+ {
+ int x = (column * 8) + bit;
+ int color = BIT(data, 7);
+
+ bitmap.pix32(y, x) = RGB_MONOCHROME_WHITE[color];
+
+ data <<= 1;
+ }
+ }
+}
+
+static MC6845_UPDATE_ROW( c64_xl80_update_row )
+{
+ c64_xl80_device *xl80 = downcast<c64_xl80_device *>(device->owner());
+ xl80->crtc_update_row(device,bitmap,cliprect,ma,ra,y,x_count,cursor_x,param);
+}
+
+static MC6845_INTERFACE( crtc_intf )
+{
+ MC6845_SCREEN_TAG,
+ false,
+ 8,
+ NULL,
+ c64_xl80_update_row,
+ NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ DEVCB_NULL,
+ NULL
+};
+
+
+//-------------------------------------------------
+// GFXDECODE( c64_xl80 )
+//-------------------------------------------------
+
+static GFXDECODE_START( c64_xl80 )
+ GFXDECODE_ENTRY(HD46505SP_TAG, 0x0000, gfx_8x8x1, 0, 1)
+GFXDECODE_END
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_xl80 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_xl80 )
+ MCFG_SCREEN_ADD(MC6845_SCREEN_TAG, RASTER)
+ MCFG_SCREEN_UPDATE_DEVICE(HD46505SP_TAG, h46505_device, screen_update)
+ MCFG_SCREEN_SIZE(80*8, 24*8)
+ MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*8-1)
+ MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
+ MCFG_SCREEN_REFRESH_RATE(50)
+
+ //MCFG_GFXDECODE(c64_xl80)
+
+ MCFG_MC6845_ADD(HD46505SP_TAG, H46505, XTAL_14_31818MHz, crtc_intf)
+MACHINE_CONFIG_END
+
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor c64_xl80_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( c64_xl80 );
+}
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_xl80_device - constructor
+//-------------------------------------------------
+
+c64_xl80_device::c64_xl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_XL80, "XL 80", tag, owner, clock, "c64_xl80", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this),
+ m_crtc(*this, HD46505SP_TAG),
+ m_char_rom(*this, HD46505SP_TAG)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_xl80_device::device_start()
+{
+ // allocate memory
+ c64_ram_pointer(machine(), RAM_SIZE);
+
+ // state saving
+ save_pointer(NAME(m_ram), RAM_SIZE);
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void c64_xl80_device::device_reset()
+{
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_xl80_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!io2 && BIT(offset, 2))
+ {
+ if (offset & 0x01)
+ {
+ data = m_crtc->register_r(space, 0);
+ }
+ }
+ else if (offset >= 0x8000 && offset < 0x9000)
+ {
+ data = m_roml[offset & 0xfff];
+ }
+ else if (offset >= 0x9800 && offset < 0xa000)
+ {
+ data = m_ram[offset & 0x7ff];
+ }
+
+ return data;
+}
+
+
+//-------------------------------------------------
+// c64_cd_w - cartridge data write
+//-------------------------------------------------
+
+void c64_xl80_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (offset >= 0x9800 && offset < 0xa000)
+ {
+ m_ram[offset & 0x7ff] = data;
+ }
+ else if (!io2 && BIT(offset, 2))
+ {
+ if (offset & 0x01)
+ {
+ m_crtc->register_w(space, 0, data);
+ }
+ else
+ {
+ m_crtc->address_w(space, 0, data);
+ }
+ }
+}
diff --git a/src/mess/machine/c64/xl80.h b/src/mess/machine/c64/xl80.h
new file mode 100644
index 00000000000..f952a32e8eb
--- /dev/null
+++ b/src/mess/machine/c64/xl80.h
@@ -0,0 +1,63 @@
+/**********************************************************************
+
+ XL 80 cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __XL80__
+#define __XL80__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+#include "video/mc6845.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_xl80_device
+
+class c64_xl80_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_xl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // optional information overrides
+ virtual const rom_entry *device_rom_region() const;
+ virtual machine_config_constructor device_mconfig_additions() const;
+
+ // not really public
+ void crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+ virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return 1; }
+ virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw, int hiram) { return 0; }
+
+private:
+ required_device<h46505_device> m_crtc;
+ required_memory_region m_char_rom;
+};
+
+
+// device type definition
+extern const device_type C64_XL80;
+
+
+#endif
diff --git a/src/mess/machine/c64/zaxxon.c b/src/mess/machine/c64/zaxxon.c
new file mode 100644
index 00000000000..247870988af
--- /dev/null
+++ b/src/mess/machine/c64/zaxxon.c
@@ -0,0 +1,67 @@
+/**********************************************************************
+
+ Zaxxon/Super Zaxxon cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#include "zaxxon.h"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_ZAXXON = &device_creator<c64_zaxxon_cartridge_device>;
+
+
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// c64_zaxxon_cartridge_device - constructor
+//-------------------------------------------------
+
+c64_zaxxon_cartridge_device::c64_zaxxon_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, C64_ZAXXON, "C64 Zaxxon cartridge", tag, owner, clock, "c64_zaxxon", __FILE__),
+ device_c64_expansion_card_interface(mconfig, *this)
+{
+}
+
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void c64_zaxxon_cartridge_device::device_start()
+{
+ // state saving
+ save_item(NAME(m_bank));
+}
+
+
+//-------------------------------------------------
+// c64_cd_r - cartridge data read
+//-------------------------------------------------
+
+UINT8 c64_zaxxon_cartridge_device::c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2)
+{
+ if (!roml)
+ {
+ data = m_roml[offset & 0xfff];
+
+ m_bank = BIT(offset, 12);
+ }
+ else if (!romh)
+ {
+ offs_t addr = (m_bank << 13) | (offset & 0x1fff);
+ data = m_romh[addr];
+ }
+
+ return data;
+}
diff --git a/src/mess/machine/c64/zaxxon.h b/src/mess/machine/c64/zaxxon.h
new file mode 100644
index 00000000000..c8e9c5642e8
--- /dev/null
+++ b/src/mess/machine/c64/zaxxon.h
@@ -0,0 +1,50 @@
+/**********************************************************************
+
+ Zaxxon/Super Zaxxon cartridge emulation
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+**********************************************************************/
+
+#pragma once
+
+#ifndef __ZAXXON__
+#define __ZAXXON__
+
+
+#include "emu.h"
+#include "machine/c64/exp.h"
+
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> c64_zaxxon_cartridge_device
+
+class c64_zaxxon_cartridge_device : public device_t,
+ public device_c64_expansion_card_interface
+{
+public:
+ // construction/destruction
+ c64_zaxxon_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+
+ // device_c64_expansion_card_interface overrides
+ virtual UINT8 c64_cd_r(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2);
+
+private:
+ int m_bank;
+};
+
+
+// device type definition
+extern const device_type C64_ZAXXON;
+
+
+#endif