summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Curt Coder <curtcoder@mail.com>2013-02-06 19:19:17 +0000
committerGravatarGravatar Curt Coder <curtcoder@mail.com>2013-02-06 19:19:17 +0000
commit30acea03a2c6962f24543347a79d5df8c5e2228d (patch) (github)
tree458c052a52665c408ea8ac913ffb6b42dec3b3a7
parentd9bcbe5a8c23fc65fc1cf36eae2289464fe454f1 (diff)
downloadmame-30acea03a2c6962f24543347a79d5df8c5e2228d.tar.bz2
mame-30acea03a2c6962f24543347a79d5df8c5e2228d.zip
(MESS) c64: Added CMD Turbo232 cartridge emulation. [Curt Coder]
-rw-r--r--.gitattributes2
-rw-r--r--hash/c64_flop.xml12
-rw-r--r--src/mess/machine/c64_turbo232.c209
-rw-r--r--src/mess/machine/c64_turbo232.h90
-rw-r--r--src/mess/machine/cbmipt.c1
-rw-r--r--src/mess/machine/cbmipt.h1
-rw-r--r--src/mess/mess.mak1
7 files changed, 316 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index 25270020e70..f429cd2dcd3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6975,6 +6975,8 @@ 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
src/mess/machine/c64_tdos.h svneol=native#text/plain
+src/mess/machine/c64_turbo232.c svneol=native#text/plain
+src/mess/machine/c64_turbo232.h svneol=native#text/plain
src/mess/machine/c64_vw64.c svneol=native#text/plain
src/mess/machine/c64_vw64.h svneol=native#text/plain
src/mess/machine/c64_warp_speed.c svneol=native#text/plain
diff --git a/hash/c64_flop.xml b/hash/c64_flop.xml
index ab75d9bc412..970e958452e 100644
--- a/hash/c64_flop.xml
+++ b/hash/c64_flop.xml
@@ -873,4 +873,16 @@
</part>
</software>
+ <software name="turbo232">
+ <description>CMD Turbo232</description>
+ <year>1997</year>
+ <publisher>CMD</publisher>
+
+ <part name="flop1" interface="floppy_5_25">
+ <dataarea name="flop" size="174848">
+ <rom name="turbo232.d64" size="174848" crc="48874d98" sha1="28b6d25bb0b62df81c4b17d9205c059c6736e817" offset="0" />
+ </dataarea>
+ </part>
+ </software>
+
</softwarelist>
diff --git a/src/mess/machine/c64_turbo232.c b/src/mess/machine/c64_turbo232.c
new file mode 100644
index 00000000000..7cc5cf8be58
--- /dev/null
+++ b/src/mess/machine/c64_turbo232.c
@@ -0,0 +1,209 @@
+/**********************************************************************
+
+ 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 "c64_turbo232.h"
+
+
+
+//**************************************************************************
+// MACROS/CONSTANTS
+//**************************************************************************
+
+#define MOS6551_TAG "mos6551"
+
+
+
+//**************************************************************************
+// DEVICE DEFINITIONS
+//**************************************************************************
+
+const device_type C64_TURBO232 = &device_creator<c64_turbo232_cartridge_device>;
+
+
+//-------------------------------------------------
+// MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
+//-------------------------------------------------
+
+static MACHINE_CONFIG_FRAGMENT( c64_turbo232 )
+ MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, DEVWRITELINE(DEVICE_SELF, c64_turbo232_cartridge_device, acia_irq_w))
+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 (C128)" )
+ 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),
+ 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_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(230400*16); break;
+ case ES_S_115200: m_acia->set_rxc(115200*16); break;
+ case ES_S_57600: m_acia->set_rxc(57600*16); 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..3baaa01ee51
--- /dev/null
+++ b/src/mess/machine/c64_turbo232.h
@@ -0,0 +1,90 @@
+/**********************************************************************
+
+ 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/c64exp.h"
+#include "machine/mos6551.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_config_complete() { m_shortname = "c64_turbo232"; }
+ 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
+ };
+
+ 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/cbmipt.c b/src/mess/machine/cbmipt.c
index a80d69a53c4..38c3431640e 100644
--- a/src/mess/machine/cbmipt.c
+++ b/src/mess/machine/cbmipt.c
@@ -1129,6 +1129,7 @@ SLOT_INTERFACE_START( c64_expansion_cards )
SLOT_INTERFACE("sfxse", C64_SFX_SOUND_EXPANDER)
SLOT_INTERFACE("supercpu", C64_SUPERCPU)
SLOT_INTERFACE("swiftlink", C64_SWIFTLINK)
+ SLOT_INTERFACE("turbo232", C64_TURBO232)
// 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 dfdb61ba776..0f107eec607 100644
--- a/src/mess/machine/cbmipt.h
+++ b/src/mess/machine/cbmipt.h
@@ -58,6 +58,7 @@
#include "machine/c64_swiftlink.h"
#include "machine/c64_system3.h"
#include "machine/c64_tdos.h"
+#include "machine/c64_turbo232.h"
#include "machine/c64_vw64.h"
#include "machine/c64_warp_speed.h"
#include "machine/c64_westermann.h"
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index f21717fa75b..40907804f16 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -889,6 +889,7 @@ $(MESSOBJ)/cbm.a: \
$(MESS_MACHINE)/c64_swiftlink.o \
$(MESS_MACHINE)/c64_system3.o \
$(MESS_MACHINE)/c64_tdos.o \
+ $(MESS_MACHINE)/c64_turbo232.o \
$(MESS_MACHINE)/c64_vw64.o \
$(MESS_MACHINE)/c64_warp_speed.o \
$(MESS_MACHINE)/c64_westermann.o \