summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/a2zipdrive.c
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2013-02-18 21:11:17 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2013-02-18 21:11:17 +0000
commitd9cdaf16491d1ed13fb85054484d1b3fd9ed84f1 (patch)
tree5ab2831e8b5a6525590518cb3812021ea39caa9d /src/mess/machine/a2zipdrive.c
parentb151e90f28ce25999e616f45dc6da1cacfb39036 (diff)
(MESS) Apple II: Added support for Street Electronics Echo Plus and Zip Technologies ZipDrive cards [R. Belmont, Lord Nightmare]
Diffstat (limited to 'src/mess/machine/a2zipdrive.c')
-rw-r--r--src/mess/machine/a2zipdrive.c199
1 files changed, 199 insertions, 0 deletions
diff --git a/src/mess/machine/a2zipdrive.c b/src/mess/machine/a2zipdrive.c
new file mode 100644
index 00000000000..c3bdefe2a73
--- /dev/null
+++ b/src/mess/machine/a2zipdrive.c
@@ -0,0 +1,199 @@
+/*********************************************************************
+
+ a2zipdrive.c
+
+ ZIP Technologies ZipDrive IDE card
+
+ NOTE: No known dump exists of the formatter utility and the
+ format of the custom partition record (block 0) that the card
+ expects has not yet been determined, so this is largely untested
+ and will work only with a drive dump from real h/w.
+
+ PLEASE use it only on a backup copy of said dump and contact MESSdev
+ if you have one!
+
+ Partition block format:
+ +0000: ASCII "Zip Technologies"
+
+*********************************************************************/
+
+#include "a2zipdrive.h"
+#include "includes/apple2.h"
+#include "machine/idectrl.h"
+#include "imagedev/harddriv.h"
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type A2BUS_ZIPDRIVE = &device_creator<a2bus_zipdrive_device>;
+
+#define ZIPDRIVE_ROM_REGION "zipdrive_rom"
+#define ZIPDRIVE_IDE_TAG "zipdrive_ide"
+
+static MACHINE_CONFIG_FRAGMENT( zipdrive )
+ MCFG_IDE_CONTROLLER_ADD(ZIPDRIVE_IDE_TAG, ide_image_devices, "hdd", "hdd", false)
+MACHINE_CONFIG_END
+
+ROM_START( zipdrive )
+ ROM_REGION(0x2000, ZIPDRIVE_ROM_REGION, 0)
+ ROM_LOAD( "zip drive - rom.bin", 0x000000, 0x002000, CRC(fd800a40) SHA1(46636bfed88c864139e3d2826661908a8c07c459) )
+ROM_END
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+//-------------------------------------------------
+// machine_config_additions - device-specific
+// machine configurations
+//-------------------------------------------------
+
+machine_config_constructor a2bus_zipdrivebase_device::device_mconfig_additions() const
+{
+ return MACHINE_CONFIG_NAME( zipdrive );
+}
+
+//-------------------------------------------------
+// rom_region - device-specific ROM region
+//-------------------------------------------------
+
+const rom_entry *a2bus_zipdrivebase_device::device_rom_region() const
+{
+ return ROM_NAME( zipdrive );
+}
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+a2bus_zipdrivebase_device::a2bus_zipdrivebase_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, type, name, tag, owner, clock),
+ device_a2bus_card_interface(mconfig, *this),
+ m_ide(*this, ZIPDRIVE_IDE_TAG)
+{
+}
+
+a2bus_zipdrive_device::a2bus_zipdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ a2bus_zipdrivebase_device(mconfig, A2BUS_ZIPDRIVE, "Zip Technologies ZipDrive", tag, owner, clock)
+{
+ m_shortname = "a2zipdrv";
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void a2bus_zipdrivebase_device::device_start()
+{
+ // set_a2bus_device makes m_slot valid
+ set_a2bus_device();
+
+ astring tempstring;
+ m_rom = device().machine().root_device().memregion(this->subtag(tempstring, ZIPDRIVE_ROM_REGION))->base();
+
+ save_item(NAME(m_lastdata));
+}
+
+void a2bus_zipdrivebase_device::device_reset()
+{
+ popmessage("Zip Drive partition format unknown, contact MESSdev if you have the software or a drive dump!");
+}
+
+
+/*-------------------------------------------------
+ read_c0nx - called for reads from this card's c0nx space
+-------------------------------------------------*/
+
+UINT8 a2bus_zipdrivebase_device::read_c0nx(address_space &space, UINT8 offset)
+{
+ switch (offset)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return ide_controller_r(m_ide, 0x1f0+offset, 1);
+
+ case 8: // data port
+ m_lastdata = ide_controller_r(m_ide, 0x1f0, 2);
+// printf("%04x @ IDE data\n", m_lastdata);
+ return m_lastdata&0xff;
+
+ case 9:
+ return (m_lastdata>>8) & 0xff;
+
+ default:
+ logerror("a2zipdrive: unhandled read @ C0n%x\n", offset);
+ break;
+ }
+
+ return 0xff;
+}
+
+
+/*-------------------------------------------------
+ write_c0nx - called for writes to this card's c0nx space
+-------------------------------------------------*/
+
+void a2bus_zipdrivebase_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
+{
+ switch (offset)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+// printf("%02x to IDE controller @ %x\n", data, offset);
+ ide_controller_w(m_ide, 0x1f0+offset, 1, data);
+ break;
+
+ case 8:
+// printf("%02x to IDE data lo\n", data);
+ m_lastdata = data;
+ break;
+
+ case 9:
+// printf("%02x to IDE data hi\n", data);
+ m_lastdata &= 0x00ff;
+ m_lastdata |= (data << 8);
+ ide_controller_w(m_ide, 0x1f0, 2, m_lastdata);
+ break;
+
+ default:
+ logerror("a2zipdrive: write %02x @ unhandled C0n%x\n", data, offset);
+ break;
+ }
+}
+
+/*-------------------------------------------------
+ read_cnxx - called for reads from this card's cnxx space
+-------------------------------------------------*/
+
+UINT8 a2bus_zipdrivebase_device::read_cnxx(address_space &space, UINT8 offset)
+{
+ int slotimg = m_slot * 0x100;
+
+ // ROM contains CnXX images for each of slots 1-7 at 0x0 and 0x1000
+ return m_rom[offset+slotimg+0x1000];
+}
+
+/*-------------------------------------------------
+ read_c800 - called for reads from this card's c800 space
+-------------------------------------------------*/
+
+UINT8 a2bus_zipdrivebase_device::read_c800(address_space &space, UINT16 offset)
+{
+ offset &= 0x7ff;
+
+ return m_rom[offset+0x1800];
+}
+