From ca475f455922871c2763a63fd9fa6737e8f64b50 Mon Sep 17 00:00:00 2001 From: arbee Date: Wed, 20 Mar 2019 08:51:23 -0400 Subject: apple2: Support for Focus Drive IDE interface. [R. Belmont, anonymous] --- src/devices/bus/a2bus/a2zipdrive.cpp | 107 ++++++++++++++++++++++++++++++++--- src/devices/bus/a2bus/a2zipdrive.h | 18 +++++- src/mame/drivers/apple2gs.cpp | 1 + 3 files changed, 116 insertions(+), 10 deletions(-) diff --git a/src/devices/bus/a2bus/a2zipdrive.cpp b/src/devices/bus/a2bus/a2zipdrive.cpp index aaeb6ed6219..41034fab231 100644 --- a/src/devices/bus/a2bus/a2zipdrive.cpp +++ b/src/devices/bus/a2bus/a2zipdrive.cpp @@ -2,16 +2,19 @@ // copyright-holders:R. Belmont /********************************************************************* - a2zipdrive.c + a2zipdrive.cpp ZIP Technologies ZipDrive IDE card + Parsons Engineering Focus Drive IDE card - NOTE: No known dump exists of the formatter utility and the + These cards are very, very similar. Maybe Parsons designed both? + + NOTE: No known dump exists of the Zip 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 + PLEASE use it only on a backup copy of said dump and contact MAMEdev if you have one! Partition block format: @@ -29,6 +32,7 @@ //************************************************************************** DEFINE_DEVICE_TYPE(A2BUS_ZIPDRIVE, a2bus_zipdrive_device, "a2zipdrv", "Zip Technologies ZipDrive") +DEFINE_DEVICE_TYPE(A2BUS_FOCUSDRIVE, a2bus_focusdrive_device, "a2focdrv", "Parsons Engineering Focus Drive") #define ZIPDRIVE_ROM_REGION "zipdrive_rom" #define ZIPDRIVE_ATA_TAG "zipdrive_ata" @@ -38,6 +42,11 @@ ROM_START( zipdrive ) ROM_LOAD( "zip drive - rom.bin", 0x000000, 0x002000, CRC(fd800a40) SHA1(46636bfed88c864139e3d2826661908a8c07c459) ) ROM_END +ROM_START( focusdrive ) + ROM_REGION(0x2000, ZIPDRIVE_ROM_REGION, 0) + ROM_LOAD( "focusrom.bin", 0x001000, 0x001000, CRC(0fd0ba25) SHA1(acf414aa145fcfa1c12aca0269f1f7ada82f1c04) ) +ROM_END + /*************************************************************************** FUNCTION PROTOTYPES ***************************************************************************/ @@ -60,6 +69,11 @@ const tiny_rom_entry *a2bus_zipdrivebase_device::device_rom_region() const return ROM_NAME( zipdrive ); } +const tiny_rom_entry *a2bus_focusdrive_device::device_rom_region() const +{ + return ROM_NAME( focusdrive ); +} + //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -76,6 +90,11 @@ a2bus_zipdrive_device::a2bus_zipdrive_device(const machine_config &mconfig, cons { } +a2bus_focusdrive_device::a2bus_focusdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_zipdrivebase_device(mconfig, A2BUS_FOCUSDRIVE, tag, owner, clock) +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -89,9 +108,12 @@ void a2bus_zipdrivebase_device::device_start() void a2bus_zipdrivebase_device::device_reset() { - popmessage("Zip Drive partition format unknown, contact MESSdev if you have the software or a drive dump!"); } +void a2bus_focusdrive_device::device_reset() +{ + m_rom[0x1c6c] = 0x03; // eat 3 IDE words here instead of 1, fixes a bug? in the original ROM +} /*------------------------------------------------- read_c0nx - called for reads from this card's c0nx space @@ -112,7 +134,7 @@ uint8_t a2bus_zipdrivebase_device::read_c0nx(uint8_t offset) return m_ata->read_cs0(offset, 0xff); case 8: // data port - m_lastdata = m_ata->read_cs0(offset); + m_lastdata = m_ata->read_cs0(offset, 0xffff); // printf("%04x @ IDE data\n", m_lastdata); return m_lastdata&0xff; @@ -120,13 +142,42 @@ uint8_t a2bus_zipdrivebase_device::read_c0nx(uint8_t offset) return (m_lastdata>>8) & 0xff; default: - logerror("a2zipdrive: unhandled read @ C0n%x\n", offset); + logerror("unhandled read @ C0n%x\n", offset); break; } return 0xff; } +uint8_t a2bus_focusdrive_device::read_c0nx(uint8_t offset) +{ + switch (offset) + { + case 8: + case 9: + case 0xa: + case 0xb: + case 0xc: + case 0xd: + case 0xe: + case 0xf: + return m_ata->read_cs0(offset&7, 0xff); + + case 0: // data port + m_lastdata = m_ata->read_cs0(offset, 0xffff); + //printf("%04x @ IDE data\n", m_lastdata); + return m_lastdata&0xff; + + case 1: + return (m_lastdata>>8) & 0xff; + + default: + logerror("unhandled read @ C0n%x\n", offset); + break; + } + + return 0xff; +} /*------------------------------------------------- write_c0nx - called for writes to this card's c0nx space @@ -157,7 +208,7 @@ void a2bus_zipdrivebase_device::write_c0nx(uint8_t offset, uint8_t data) // printf("%02x to IDE data hi\n", data); m_lastdata &= 0x00ff; m_lastdata |= (data << 8); - m_ata->write_cs0(0, m_lastdata); + m_ata->write_cs0(0, m_lastdata, 0xffff); break; default: @@ -166,6 +217,48 @@ void a2bus_zipdrivebase_device::write_c0nx(uint8_t offset, uint8_t data) } } +void a2bus_focusdrive_device::write_c0nx(uint8_t offset, uint8_t data) +{ + switch (offset) + { + case 8: + case 9: + case 0xa: + case 0xb: + case 0xc: + case 0xd: + case 0xe: + case 0xf: + // due to a bug in the 6502 firmware, eat data if DRQ is set + #if 0 + while (m_ata->read_cs0(7, 0xff) & 0x08) + { + m_ata->read_cs0(0, 0xffff); + printf("eating 2 bytes to clear DRQ\n"); + } + #endif +// printf("%02x to IDE controller @ %x\n", data, offset); + m_ata->write_cs0(offset & 7, data, 0xff); + break; + + case 0: +// printf("%02x to IDE data lo\n", data); + m_lastdata = data; + break; + + case 1: +// printf("%02x to IDE data hi\n", data); + m_lastdata &= 0x00ff; + m_lastdata |= (data << 8); + m_ata->write_cs0(0, m_lastdata, 0xffff); + break; + + default: + printf("focus: write %02x @ unhandled C0n%x\n", data, offset); + break; + } +} + /*------------------------------------------------- read_cnxx - called for reads from this card's cnxx space -------------------------------------------------*/ diff --git a/src/devices/bus/a2bus/a2zipdrive.h b/src/devices/bus/a2bus/a2zipdrive.h index 8187e04cdd2..9e3e68e79f2 100644 --- a/src/devices/bus/a2bus/a2zipdrive.h +++ b/src/devices/bus/a2bus/a2zipdrive.h @@ -5,8 +5,9 @@ a2zipdrive.h ZIP Technologies ZipDrive IDE card + Parsons Engineering Focus Drive IDE card - See important NOTE at the top of a2zipdrive.c! + See important NOTE at the top of a2zipdrive.cpp! *********************************************************************/ @@ -44,8 +45,6 @@ protected: required_device m_ata; uint8_t *m_rom; - -private: uint16_t m_lastdata; }; @@ -55,7 +54,20 @@ public: a2bus_zipdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class a2bus_focusdrive_device : public a2bus_zipdrivebase_device +{ +public: + a2bus_focusdrive_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_reset() override; + virtual const tiny_rom_entry *device_rom_region() const override; + virtual uint8_t read_c0nx(uint8_t offset) override; + virtual void write_c0nx(uint8_t offset, uint8_t data) override; +}; + // device type definition DECLARE_DEVICE_TYPE(A2BUS_ZIPDRIVE, a2bus_zipdrive_device) +DECLARE_DEVICE_TYPE(A2BUS_FOCUSDRIVE, a2bus_focusdrive_device) #endif // MAME_BUS_A2BUS_ZIPDRIVE_H diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 491c0dd1391..bdfc493032f 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -4522,6 +4522,7 @@ static void apple2_cards(device_slot_interface &device) device.option_add("arcbd", A2BUS_ARCADEBOARD); /* Third Millenium Engineering Arcade Board */ device.option_add("midi", A2BUS_MIDI); /* Generic 6840+6850 MIDI board */ device.option_add("zipdrive", A2BUS_ZIPDRIVE); /* ZIP Technologies IDE card */ + device.option_add("focusdrive", A2BUS_FOCUSDRIVE); /* Focus Drive IDE card */ device.option_add("echoiiplus", A2BUS_ECHOPLUS); /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ device.option_add("scsi", A2BUS_SCSI); /* Apple II SCSI Card */ device.option_add("applicard", A2BUS_APPLICARD); /* PCPI Applicard */ -- cgit v1.2.3