diff --git a/.gitattributes b/.gitattributes index 4f95e826bbc..b1666ad4641 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6949,6 +6949,8 @@ src/mess/machine/990_tap.c svneol=native#text/plain src/mess/machine/990_tap.h svneol=native#text/plain src/mess/machine/a2alfam2.c svneol=native#text/plain src/mess/machine/a2alfam2.h svneol=native#text/plain +src/mess/machine/a2applicard.c svneol=native#text/plain +src/mess/machine/a2applicard.h svneol=native#text/plain src/mess/machine/a2arcadebd.c svneol=native#text/plain src/mess/machine/a2arcadebd.h svneol=native#text/plain src/mess/machine/a2bus.c svneol=native#text/plain diff --git a/src/mess/drivers/apple2.c b/src/mess/drivers/apple2.c index b315ad204cf..915580301e4 100644 --- a/src/mess/drivers/apple2.c +++ b/src/mess/drivers/apple2.c @@ -213,6 +213,7 @@ Apple 3.5 and Apple 5.25 drives - up to three devices #include "machine/a2arcadebd.h" #include "machine/a2midi.h" #include "machine/a2zipdrive.h" +#include "machine/a2applicard.h" #include "machine/a2estd80col.h" #include "machine/a2eext80col.h" #include "machine/a2eramworks3.h" @@ -638,6 +639,7 @@ static SLOT_INTERFACE_START(apple2_cards) SLOT_INTERFACE("zipdrive", A2BUS_ZIPDRIVE) /* ZIP Technologies IDE card */ SLOT_INTERFACE("echoiiplus", A2BUS_ECHOPLUS) /* Street Electronics Echo Plus (Echo II + Mockingboard clone) */ SLOT_INTERFACE("scsi", A2BUS_SCSI) /* Apple II SCSI Card */ + SLOT_INTERFACE("applicard", A2BUS_APPLICARD) /* PCPI Applicard */ SLOT_INTERFACE_END static SLOT_INTERFACE_START(apple2eaux_cards) @@ -825,6 +827,20 @@ static MACHINE_CONFIG_DERIVED( space84, apple2p ) MCFG_MACHINE_START_OVERRIDE(apple2_state,space84) MACHINE_CONFIG_END +#if 0 +static MACHINE_CONFIG_DERIVED( laba2p, apple2p ) + MCFG_MACHINE_START_OVERRIDE(apple2_state,laba2p) + + MCFG_A2BUS_SLOT_REMOVE("sl0") + MCFG_A2BUS_SLOT_REMOVE("sl3") + MCFG_A2BUS_SLOT_REMOVE("sl6") + + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl3", A2BUS_LAB_80COL, NULL) + MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl6", A2BUS_LAB_FDC, NULL) + +MACHINE_CONFIG_END +#endif + /*************************************************************************** Game driver(s) @@ -1131,6 +1147,28 @@ ROM_START(am64) ROM_LOAD( "tk10.bin", 0x0800, 0x0800, CRC(a06c5b78) SHA1(27c5160b913e0f62120f384026d24b9f1acb6970) ) ROM_END +#if 0 +ROM_START(laba2p) /* II Plus clone with on-board Disk II controller and Videx-compatible 80-column card, supposedly from lab equipment */ + ROM_REGION(0x1000,"gfx1",0) + ROM_LOAD( "char.u30", 0x0000, 0x1000, CRC(2dbaef88) SHA1(9834842796132a11facd57923326d6954bcb609f) ) + + ROM_REGION(0x4700,"maincpu",0) + ROM_LOAD( "maind0.u35", 0x1000, 0x1000, CRC(24d73c7b) SHA1(d17a15868dc875c67061c95ec53a6b2699d3a425) ) + ROM_LOAD( "maine0.u34", 0x2000, 0x2000, CRC(314462ca) SHA1(5a23616dca14e59b4aca8ff6cfa0d98592a78a79) ) + + ROM_REGION(0x1000, "fw80col", 0) + ROM_LOAD( "80cfw.u3", 0x0000, 0x1000, CRC(92d2b8b0) SHA1(5149483eb3e550ece1584e85fc821bb04d068dec) ) // firmware for on-board Videx + + ROM_REGION(0x1000, "cg80col", 0) + ROM_LOAD( "80ccgv80.u25", 0x0000, 0x1000, CRC(6d5e2707) SHA1(c56f76e8a366fee7374eb09f4866435c692490b2) ) // character generator for on-board Videx + + ROM_REGION(0x800, "diskii", 0) + ROM_LOAD( "diskfw.u7", 0x0000, 0x0800, CRC(9207ef4e) SHA1(5fcffa4c68b16a7ef2f62651d4c7470400e5bd35) ) // firmware for on-board Disk II + + ROM_REGION(0x800, "unknown", 0) + ROM_LOAD( "unk.u5", 0x0000, 0x0800, CRC(240a1774) SHA1(e6aeb0702dc99d76fd8c5a642fdfbe9ab896acd4) ) // unknown ROM +ROM_END +#endif /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ COMP( 1977, apple2, 0, 0, apple2, apple2, driver_device, 0, "Apple Computer", "Apple ][", GAME_SUPPORTS_SAVE ) @@ -1158,3 +1196,5 @@ COMP( 1983, agat7, apple2, 0, apple2p, apple2p, driver_device, COMP( 1984, agat9, apple2, 0, apple2p, apple2p, driver_device, 0, "Agat", "Agat-9", GAME_NOT_WORKING) COMP( 1985, space84, apple2, 0, space84, apple2p, driver_device, 0, "ComputerTechnik/IBS", "Space 84", GAME_NOT_WORKING ) COMP( 1985, am64, apple2, 0, space84, apple2p, driver_device, 0, "ASEM", "AM 64", GAME_SUPPORTS_SAVE ) +//COMP( 19??, laba2p, apple2, 0, laba2p, apple2p, driver_device, 0, "", "Lab equipment Apple II Plus clone", GAME_SUPPORTS_SAVE ) + diff --git a/src/mess/machine/a2applicard.c b/src/mess/machine/a2applicard.c new file mode 100644 index 00000000000..163e988f13e --- /dev/null +++ b/src/mess/machine/a2applicard.c @@ -0,0 +1,284 @@ +/********************************************************************* + + a2applicard.c + + Implementation of the PCPI AppliCard Z-80 card + + Unlike the SoftCard and clones, this has its own 64k of RAM on board + and the Z80 runs completely independently of the host's 6502. + +*********************************************************************/ + +#include "a2applicard.h" +#include "includes/apple2.h" +#include "cpu/z80/z80.h" +#include "machine/z80ctc.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type A2BUS_APPLICARD = &device_creator; + +#define Z80_TAG "z80" +#define Z80_ROM_REGION "z80_rom" + +static ADDRESS_MAP_START( z80_mem, AS_PROGRAM, 8, a2bus_applicard_device ) + AM_RANGE(0x0000, 0xffff) AM_READWRITE(dma_r, dma_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( z80_io, AS_IO, 8, a2bus_applicard_device ) + AM_RANGE(0x00, 0x60) AM_MIRROR(0xff00) AM_READWRITE(z80_io_r, z80_io_w) +ADDRESS_MAP_END + +MACHINE_CONFIG_FRAGMENT( a2applicard ) + MCFG_CPU_ADD(Z80_TAG, Z80, 6000000) // Z80 runs at 6 MHz + MCFG_CPU_PROGRAM_MAP(z80_mem) + MCFG_CPU_IO_MAP(z80_io) +MACHINE_CONFIG_END + +ROM_START( a2applicard ) + ROM_REGION(0x800, Z80_ROM_REGION, 0) + ROM_LOAD( "applicard-v9.bin", 0x000000, 0x000800, CRC(1d461000) SHA1(71d633be864b6084362e85108a4e600cbe6e44fe) ) +ROM_END + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor a2bus_applicard_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( a2applicard ); +} + +//------------------------------------------------- +// device_rom_region - device-specific ROMs +//------------------------------------------------- + +const rom_entry *a2bus_applicard_device::device_rom_region() const +{ + return ROM_NAME( a2applicard ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_applicard_device::a2bus_applicard_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_z80(*this, Z80_TAG) +{ +} + +a2bus_applicard_device::a2bus_applicard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, A2BUS_APPLICARD, "PCPI Applicard", tag, owner, clock, "a2aplcrd", __FILE__), + device_a2bus_card_interface(mconfig, *this), + m_z80(*this, Z80_TAG) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_applicard_device::device_start() +{ + // set_a2bus_device makes m_slot valid + set_a2bus_device(); + + // locate Z80 ROM + astring tempstring; + m_z80rom = device().machine().root_device().memregion(this->subtag(tempstring, Z80_ROM_REGION))->base(); + + save_item(NAME(m_bROMAtZ80Zero)); + save_item(NAME(m_z80stat)); + save_item(NAME(m_6502stat)); + save_item(NAME(m_toz80)); + save_item(NAME(m_to6502)); + save_item(NAME(m_z80ram)); + + memset(m_z80ram, 0, 64*1024); +} + +void a2bus_applicard_device::device_reset() +{ + m_bROMAtZ80Zero = true; +} + +UINT8 a2bus_applicard_device::read_c0nx(address_space &space, UINT8 offset) +{ + switch (offset & 0xf) + { + case 0: + m_6502stat = false; + return m_to6502; + + case 1: + return m_toz80; + + case 2: + if (m_z80stat) + { + return 0x80; + } + return false; + + case 3: + if (m_6502stat) + { + return 0x80; + } + return false; + + case 5: + m_bROMAtZ80Zero = true; + m_toz80 = false; + m_to6502 = false; + m_z80->reset(); + break; + + case 6: // IRQ on Z80 via CTC channel 3 (CP/M doesn't use the CTC or IRQs) + fatalerror("Applicard: Z80 IRQ not supported yet\n"); + break; + + case 7: // NMI on Z80 (direct) + m_z80->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + break; + + } + return 0xff; +} + +void a2bus_applicard_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) +{ + switch (offset & 0xf) + { + case 0: // are these legal to write? + case 2: + case 3: + break; + + case 1: + m_z80stat = true; + m_toz80 = data; + break; + + case 5: + case 6: + case 7: + read_c0nx(space, offset); // let the read handler take care of these + break; + } +} + +READ8_MEMBER( a2bus_applicard_device::z80_io_r ) +{ + UINT8 tmp = 0; + + switch (offset) + { + case 0: + return m_to6502; + + case 0x20: + m_z80stat = false; + return m_toz80; + + case 0x40: + if (m_z80stat) + { + tmp |= 0x80; + } + if (m_6502stat) + { + tmp |= 1; + } + return tmp; + + case 0x60: + break; + } + return 0xff; +} + +WRITE8_MEMBER( a2bus_applicard_device::z80_io_w ) +{ + switch (offset) + { + case 0: + m_to6502 = data; + m_6502stat = true; + break; + + case 0x60: + if (data & 1) + { + m_bROMAtZ80Zero = true; + } + else + { + m_bROMAtZ80Zero = false; + } + break; + } +} + +//------------------------------------------------- +// dma_r - +//------------------------------------------------- + +READ8_MEMBER( a2bus_applicard_device::dma_r ) +{ + if (offset < 0x8000) + { + if (m_bROMAtZ80Zero) + { + return m_z80rom[offset & 0x7ff]; + } + else + { + return m_z80ram[offset]; + } + } + else + { + return m_z80ram[offset]; + } + return 0xff; +} + + +//------------------------------------------------- +// dma_w - +//------------------------------------------------- + +WRITE8_MEMBER( a2bus_applicard_device::dma_w ) +{ + if (offset < 0x8000) + { + // writing only works if ROM not mapped from 0-7fff + if (!m_bROMAtZ80Zero) + { + m_z80ram[offset] = data; + } + } + else + { + m_z80ram[offset] = data; + } +} + +bool a2bus_applicard_device::take_c800() +{ + return false; +} diff --git a/src/mess/machine/a2applicard.h b/src/mess/machine/a2applicard.h new file mode 100644 index 00000000000..e02ce521bfc --- /dev/null +++ b/src/mess/machine/a2applicard.h @@ -0,0 +1,59 @@ +/********************************************************************* + + a2applicard.h + + Implementation of the PCPI AppliCard Z-80 card + +*********************************************************************/ + +#ifndef __A2BUS_APPLICARD__ +#define __A2BUS_APPLICARD__ + +#include "emu.h" +#include "machine/a2bus.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_applicard_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_applicard_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_applicard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + + DECLARE_READ8_MEMBER( dma_r ); + DECLARE_WRITE8_MEMBER( dma_w ); + DECLARE_READ8_MEMBER( z80_io_r ); + DECLARE_WRITE8_MEMBER( z80_io_w ); + +protected: + virtual void device_start(); + virtual void device_reset(); + virtual const rom_entry *device_rom_region() const; + + // 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 bool take_c800(); + + required_device m_z80; + +private: + bool m_bROMAtZ80Zero; + bool m_z80stat, m_6502stat; + UINT8 m_toz80, m_to6502; + UINT8 m_z80ram[64*1024]; + UINT8 *m_z80rom; +}; + +// device type definition +extern const device_type A2BUS_APPLICARD; + +#endif /* __A2BUS_APPLICARD__ */ diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 65379299c00..d13cdf23f6c 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -925,6 +925,7 @@ $(MESSOBJ)/apple.a: \ $(MESS_MACHINE)/a2midi.o \ $(MESS_MACHINE)/a2vulcan.o \ $(MESS_MACHINE)/a2zipdrive.o\ + $(MESS_MACHINE)/a2applicard.o \ $(MESS_MACHINE)/a2estd80col.o \ $(MESS_MACHINE)/a2eext80col.o \ $(MESS_MACHINE)/a2eramworks3.o \