From f581f29068c91644e4e2cde5e7275051ed731a56 Mon Sep 17 00:00:00 2001 From: "R. Belmont" Date: Sat, 22 Mar 2014 21:36:29 +0000 Subject: [PATCH] (MESS) apple2: Support the Corvus flat-cable interface card, also used in the Corvus Concept. [R. Belmont] --- .gitattributes | 2 + src/emu/bus/a2bus/a2corvus.c | 183 +++++++++++++++++++++++++++++++++++ src/emu/bus/a2bus/a2corvus.h | 53 ++++++++++ src/emu/bus/bus.mak | 1 + src/mess/drivers/apple2.c | 2 + 5 files changed, 241 insertions(+) create mode 100644 src/emu/bus/a2bus/a2corvus.c create mode 100644 src/emu/bus/a2bus/a2corvus.h diff --git a/.gitattributes b/.gitattributes index e5d56e080bf..a7d703ff457 100644 --- a/.gitattributes +++ b/.gitattributes @@ -398,6 +398,8 @@ src/emu/bus/a2bus/a2bus.c svneol=native#text/plain src/emu/bus/a2bus/a2bus.h svneol=native#text/plain src/emu/bus/a2bus/a2cffa.c svneol=native#text/plain src/emu/bus/a2bus/a2cffa.h svneol=native#text/plain +src/emu/bus/a2bus/a2corvus.c svneol=native#text/plain +src/emu/bus/a2bus/a2corvus.h svneol=native#text/plain src/emu/bus/a2bus/a2diskii.c svneol=native#text/plain src/emu/bus/a2bus/a2diskii.h svneol=native#text/plain src/emu/bus/a2bus/a2eauxslot.c svneol=native#text/plain diff --git a/src/emu/bus/a2bus/a2corvus.c b/src/emu/bus/a2bus/a2corvus.c new file mode 100644 index 00000000000..dc5ca2fc5c9 --- /dev/null +++ b/src/emu/bus/a2bus/a2corvus.c @@ -0,0 +1,183 @@ +/********************************************************************* + + a2corvus.c + + Implementation of the Corvus flat-cable hard disk interface + for the Apple II. + + This same card was used in the Corvus Concept. + + C0n0 = drive read/write + C0n1 = read status (busy in bit 7, data direction in bit 6) + + Reads and writes to C0n2+ happen; the contents of the reads are thrown away + immediately by all the code I've examined, and sending the writes to the + drive's write port makes it not work so they're intended to be ignored too. + + 5 MB: -chs 144,4,20 -ss 512 + 10 MB: -chs 358,3,20 -ss 512 + 20 MB: -chs 388,5,20 -ss 512 + + To set up a disk from scratch on the Apple II: + 1) Create a disk of your desired capacity using CHDMAN -c none and the parameters + listed above for each of the possible sizes. + 2) Boot apple2p with the corvus in slot 2 and a diskii(ng) in slot 6 with the + "Corvus Hard Drive - Diagnostics.dsk" mounted. + 3) Press F to format. Accept all the default options from now on; + there is no "format switch" to worry about with the current emulation. + 4) Quit MESS. Restart with the corvus in slot 6 and a diskii(ng) in slot 7 + with the "Corvus Hard Drive - Utilities 1.dsk" mounted. + 5) When you get the BASIC prompt, "LOAD BSYSGEN" + 7) Type "15100 Z(II) = PEEK(20480 + II)" to fix a bug in the program + and press Enter. + 8) Type RUN and press Enter + 9) Choose drive 1 and press Y at "OK TO BSYSGEN?" + 10) When the format completes, type "RUN APPLESOFT BOOT PREP" and press Enter. + 11) Once it finishes, quit MESS. Remove the diskii(ng) from slot 7 and + the system should boot from the Corvus HD. + +*********************************************************************/ + +#include "a2corvus.h" +#include "includes/apple2.h" +#include "imagedev/harddriv.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type A2BUS_CORVUS = &device_creator; + +#define CORVUS_ROM_REGION "corvus_rom" +#define CORVUS_HD_TAG "corvushd" + +static MACHINE_CONFIG_FRAGMENT(corvus) + MCFG_DEVICE_ADD(CORVUS_HD_TAG, CORVUS_HDC, 0) + MCFG_HARDDISK_CONFIG_ADD("harddisk1", corvus_hdc_t::hd_intf) + MCFG_HARDDISK_CONFIG_ADD("harddisk2", corvus_hdc_t::hd_intf) + MCFG_HARDDISK_CONFIG_ADD("harddisk3", corvus_hdc_t::hd_intf) + MCFG_HARDDISK_CONFIG_ADD("harddisk4", corvus_hdc_t::hd_intf) +MACHINE_CONFIG_END + +ROM_START( corvus ) + ROM_REGION(0x800, CORVUS_ROM_REGION, 0) + ROM_LOAD( "a4.7.u10", 0x0000, 0x0800, CRC(1cf6e32a) SHA1(dbd6efeb3b54c0523b8b4eda8b3d737413f6a91a) ) +ROM_END + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor a2bus_corvus_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( corvus ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const rom_entry *a2bus_corvus_device::device_rom_region() const +{ + return ROM_NAME( corvus ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_corvus_device::a2bus_corvus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_a2bus_card_interface(mconfig, *this), + m_corvushd(*this, CORVUS_HD_TAG) +{ +} + +a2bus_corvus_device::a2bus_corvus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, A2BUS_CORVUS, "Corvus Flat Cable interface", tag, owner, clock, "a2corvus", __FILE__), + device_a2bus_card_interface(mconfig, *this), + m_corvushd(*this, CORVUS_HD_TAG) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_corvus_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, CORVUS_ROM_REGION))->base(); +} + +void a2bus_corvus_device::device_reset() +{ +} + + +/*------------------------------------------------- + read_c0nx - called for reads from this card's c0nx space +-------------------------------------------------*/ + +UINT8 a2bus_corvus_device::read_c0nx(address_space &space, UINT8 offset) +{ + switch (offset) + { + case 0: + return m_corvushd->read(space, 0); + + case 1: + return m_corvushd->status_r(space, 0); + + default: + logerror("Corvus: read unhandled c0n%x (PC=%x)\n", offset, space.device().safe_pc()); + break; + } + + return 0xff; +} + + +/*------------------------------------------------- + write_c0nx - called for writes to this card's c0nx space +-------------------------------------------------*/ + +void a2bus_corvus_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) +{ + if (offset == 0) + { + m_corvushd->write(space, 0, data); + } +} + +/*------------------------------------------------- + read_cnxx - called for reads from this card's cnxx space +-------------------------------------------------*/ + +UINT8 a2bus_corvus_device::read_cnxx(address_space &space, UINT8 offset) +{ + // one slot image at the end of the ROM, it appears + return m_rom[offset+0x700]; +} + +/*------------------------------------------------- + read_c800 - called for reads from this card's c800 space +-------------------------------------------------*/ + +UINT8 a2bus_corvus_device::read_c800(address_space &space, UINT16 offset) +{ + return m_rom[offset & 0x7ff]; +} + diff --git a/src/emu/bus/a2bus/a2corvus.h b/src/emu/bus/a2bus/a2corvus.h new file mode 100644 index 00000000000..cf1b98c0402 --- /dev/null +++ b/src/emu/bus/a2bus/a2corvus.h @@ -0,0 +1,53 @@ +/********************************************************************* + + a2corvus.h + + Implementation of the Corvus flat-cable hard disk interface + for the Apple II. + +*********************************************************************/ + +#ifndef __A2BUS_CORVUS__ +#define __A2BUS_CORVUS__ + +#include "emu.h" +#include "a2bus.h" +#include "machine/corvushd.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_corvus_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_corvus_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + a2bus_corvus_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 const rom_entry *device_rom_region() const; + + required_device m_corvushd; + +protected: + virtual void device_start(); + virtual void device_reset(); + + // overrides of standard a2bus slot functions + virtual UINT8 read_c0nx(address_space &space, UINT8 offset); + virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data); + virtual UINT8 read_cnxx(address_space &space, UINT8 offset); + virtual UINT8 read_c800(address_space &space, UINT16 offset); + +private: + UINT8 *m_rom; +}; + +// device type definition +extern const device_type A2BUS_CORVUS; + +#endif /* __A2BUS_CORVUS__ */ diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 5f88e66e292..dc9c8bb3bc8 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -651,6 +651,7 @@ BUSOBJS += $(BUSOBJ)/a2bus/a2pic.o BUSOBJS += $(BUSOBJ)/a2bus/a2estd80col.o BUSOBJS += $(BUSOBJ)/a2bus/a2eext80col.o BUSOBJS += $(BUSOBJ)/a2bus/a2eramworks3.o +BUSOBJS += $(BUSOBJ)/a2bus/a2corvus.o endif #------------------------------------------------- diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index 846814c5c16..e724963ba5b 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -210,6 +210,7 @@ Apple 3.5 and Apple 5.25 drives - up to three devices #include "bus/a2bus/a2applicard.h" #include "bus/a2bus/a2ultraterm.h" #include "bus/a2bus/a2pic.h" +#include "bus/a2bus/a2corvus.h" #include "bus/a2bus/a2estd80col.h" #include "bus/a2bus/a2eext80col.h" #include "bus/a2bus/a2eramworks3.h" @@ -997,6 +998,7 @@ static SLOT_INTERFACE_START(apple2_cards) SLOT_INTERFACE("ultratermenh", A2BUS_ULTRATERMENH) /* Videx UltraTerm (enhanced //e) */ SLOT_INTERFACE("aevm80", A2BUS_VTC2) /* Applied Engineering ViewMaster 80 */ SLOT_INTERFACE("parallel", A2BUS_PIC) /* Apple Parallel Interface Card */ + SLOT_INTERFACE("corvus", A2BUS_CORVUS) /* Corvus flat-cable HDD interface (must go in slot 6) */ SLOT_INTERFACE_END static SLOT_INTERFACE_START(apple2eaux_cards)