summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Curt Coder <curtcoder@mail.com>2013-02-06 18:57:58 +0000
committerGravatarGravatar Curt Coder <curtcoder@mail.com>2013-02-06 18:57:58 +0000
commitd9bcbe5a8c23fc65fc1cf36eae2289464fe454f1 (patch) (github)
tree3bf0f6c1a4a48e86de63c9cbeb1f93a7d9d79a68
parentb9698df878da5dc57c6af82371ea37f7d6d6407c (diff)
downloadmame-d9bcbe5a8c23fc65fc1cf36eae2289464fe454f1.tar.bz2
mame-d9bcbe5a8c23fc65fc1cf36eae2289464fe454f1.zip
(MESS) c64: Added CMD SwiftLink cartridge emulation. [Curt Coder]
-rw-r--r--.gitattributes2
-rw-r--r--hash/c64_flop.xml48
-rw-r--r--src/emu/machine/mos6551.c47
-rw-r--r--src/mess/machine/c64_swiftlink.c165
-rw-r--r--src/mess/machine/c64_swiftlink.h78
-rw-r--r--src/mess/machine/cbmipt.c1
-rw-r--r--src/mess/machine/cbmipt.h1
-rw-r--r--src/mess/mess.mak1
8 files changed, 329 insertions, 14 deletions
diff --git a/.gitattributes b/.gitattributes
index 101870ee26b..25270020e70 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6969,6 +6969,8 @@ src/mess/machine/c64_supercpu.c svneol=native#text/plain
src/mess/machine/c64_supercpu.h svneol=native#text/plain
src/mess/machine/c64_sw8k.c svneol=native#text/plain
src/mess/machine/c64_sw8k.h svneol=native#text/plain
+src/mess/machine/c64_swiftlink.c svneol=native#text/plain
+src/mess/machine/c64_swiftlink.h svneol=native#text/plain
src/mess/machine/c64_system3.c svneol=native#text/plain
src/mess/machine/c64_system3.h svneol=native#text/plain
src/mess/machine/c64_tdos.c svneol=native#text/plain
diff --git a/hash/c64_flop.xml b/hash/c64_flop.xml
index bda3917ac12..ab75d9bc412 100644
--- a/hash/c64_flop.xml
+++ b/hash/c64_flop.xml
@@ -825,4 +825,52 @@
</part>
</software>
+ <software name="swiftlnk">
+ <description>CMD SwiftLink</description>
+ <year>1990</year>
+ <publisher>CMD</publisher>
+
+ <part name="flop1" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 1 Side 1"/>
+ <dataarea name="flop" size="174848">
+ <rom name="cmd_swiftlink_utils_d1s1.d64" size="174848" crc="f70f4ff8" sha1="d70d6b0c8c2f408286ce0ea9edcfe6c5cf1af60a" offset="0" />
+ </dataarea>
+ </part>
+
+ <part name="flop2" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 1 Side 2"/>
+ <dataarea name="flop" size="174848">
+ <rom name="cmd_swiftlink_utils_d1s2.d64" size="174848" crc="b9e18c85" sha1="b8b65c99ac1474b89729756adbdd969a3e9e9aa6" offset="0" />
+ </dataarea>
+ </part>
+
+ <part name="flop3" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 2 Side 1"/>
+ <dataarea name="flop" size="174848">
+ <rom name="cmd_swiftlink_utils_d2s1.d64" size="174848" crc="de2828a1" sha1="6516d4674dddc58a9d7787bcb9ea55d4b4fc9898" offset="0" />
+ </dataarea>
+ </part>
+
+ <part name="flop4" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 2 Side 2"/>
+ <dataarea name="flop" size="175531">
+ <rom name="cmd_swiftlink_utils_d2s2.d64" size="175531" crc="309d1b76" sha1="847b06a65238861c84dee715e48a635978647303" offset="0" />
+ </dataarea>
+ </part>
+
+ <part name="flop5" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 3 Side 1"/>
+ <dataarea name="flop" size="174848">
+ <rom name="cmd_swiftlink_utils_d3s1.d64" size="174848" crc="180ff985" sha1="0b0f4c610cc5a062287ae20e41d9df78b9dc6007" offset="0" />
+ </dataarea>
+ </part>
+
+ <part name="flop6" interface="floppy_5_25">
+ <feature name="part_id" value="Disk 3 Side 2"/>
+ <dataarea name="flop" size="174848">
+ <rom name="cmd_swiftlink_utils_d3s2.d64" size="174848" crc="d2ec8d3c" sha1="02413c30f631986c17984f54dac48b9aec0904af" offset="0" />
+ </dataarea>
+ </part>
+ </software>
+
</softwarelist>
diff --git a/src/emu/machine/mos6551.c b/src/emu/machine/mos6551.c
index 9f09ebee54b..06c3927c95a 100644
--- a/src/emu/machine/mos6551.c
+++ b/src/emu/machine/mos6551.c
@@ -7,6 +7,17 @@
**********************************************************************/
+/*
+
+ TODO:
+
+ - receiver disable
+ - IRQ on DCD/DSR change
+ - parity
+ - framing error
+
+*/
+
#include "mos6551.h"
@@ -85,16 +96,16 @@ void mos6551_device::device_reset()
void mos6551_device::tra_complete()
{
- if ((m_cmd & CMD_TC_MASK) == CMD_TC_TIE_RTS_LO)
- {
- m_st |= ST_IRQ;
- m_irq_handler(ASSERT_LINE);
- }
-
if (!(m_st & ST_TDRE))
{
transmit_register_setup(m_tdr);
m_st |= ST_TDRE;
+
+ if ((m_cmd & CMD_TC_MASK) == CMD_TC_TIE_RTS_LO)
+ {
+ m_st |= ST_IRQ;
+ m_irq_handler(ASSERT_LINE);
+ }
}
}
@@ -109,15 +120,15 @@ void mos6551_device::rcv_complete()
{
m_st |= ST_OR;
}
- else
- {
- m_st |= ST_RDRF;
+
+ m_st &= ~(ST_FE | ST_PE);
- if (!(m_cmd & CMD_RIE))
- {
- m_st |= ST_IRQ;
- m_irq_handler(ASSERT_LINE);
- }
+ m_st |= ST_RDRF;
+
+ if (!(m_cmd & CMD_RIE))
+ {
+ m_st |= ST_IRQ;
+ m_irq_handler(ASSERT_LINE);
}
}
@@ -244,6 +255,12 @@ WRITE8_MEMBER( mos6551_device::write )
{
transmit_register_setup(m_tdr);
m_st |= ST_TDRE;
+
+ if ((m_cmd & CMD_TC_MASK) == CMD_TC_TIE_RTS_LO)
+ {
+ m_st |= ST_IRQ;
+ m_irq_handler(ASSERT_LINE);
+ }
}
break;
@@ -274,4 +291,6 @@ WRITE8_MEMBER( mos6551_device::write )
void mos6551_device::set_rxc(int clock)
{
m_ext_rxc = clock;
+
+ update_serial();
}
diff --git a/src/mess/machine/c64_swiftlink.c b/src/mess/machine/c64_swiftlink.c
new file mode 100644
index 00000000000..b35d11353be
--- /dev/null
+++ b/src/mess/machine/c64_swiftlink.c
@@ -0,0 +1,165 @@
+/**********************************************************************
+
+ 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 "c64_swiftlink.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MOS6551_TAG "mos6551"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_SWIFTLINK = &device_creator<c64_swiftlink_cartridge_device>;
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_swiftlink )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_swiftlink )
+ MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, DEVWRITELINE(DEVICE_SELF, c64_swiftlink_cartridge_device, acia_irq_w))
+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 (C128)" )
+ 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),
+ 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..b51920e8705
--- /dev/null
+++ b/src/mess/machine/c64_swiftlink.h
@@ -0,0 +1,78 @@
+/**********************************************************************
+
+ 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/c64exp.h"
+#include "machine/mos6551.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_config_complete() { m_shortname = "c64_swiftlink"; }
+ 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/cbmipt.c b/src/mess/machine/cbmipt.c
index 2a6dbff58fd..a80d69a53c4 100644
--- a/src/mess/machine/cbmipt.c
+++ b/src/mess/machine/cbmipt.c
@@ -1128,6 +1128,7 @@ SLOT_INTERFACE_START( c64_expansion_cards )
SLOT_INTERFACE("reu1764", C64_REU1764)
SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
SLOT_INTERFACE("supercpu", C64_SUPERCPU)
+ SLOT_INTERFACE("swiftlink", C64_SWIFTLINK)
// the following need ROMs from the software list
SLOT_INTERFACE_INTERNAL("standard", C64_STD)
diff --git a/src/mess/machine/cbmipt.h b/src/mess/machine/cbmipt.h
index d2beb62c0fe..dfdb61ba776 100644
--- a/src/mess/machine/cbmipt.h
+++ b/src/mess/machine/cbmipt.h
@@ -55,6 +55,7 @@
#include "machine/c64_super_games.h"
#include "machine/c64_supercpu.h"
#include "machine/c64_sw8k.h"
+#include "machine/c64_swiftlink.h"
#include "machine/c64_system3.h"
#include "machine/c64_tdos.h"
#include "machine/c64_vw64.h"
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index bb3286abd2f..f21717fa75b 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -886,6 +886,7 @@ $(MESSOBJ)/cbm.a: \
$(MESS_MACHINE)/c64_super_games.o \
$(MESS_MACHINE)/c64_supercpu.o \
$(MESS_MACHINE)/c64_sw8k.o \
+ $(MESS_MACHINE)/c64_swiftlink.o \
$(MESS_MACHINE)/c64_system3.o \
$(MESS_MACHINE)/c64_tdos.o \
$(MESS_MACHINE)/c64_vw64.o \