mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
(MESS) Apple I: Support CFFA1 Compact Flash/IDE adaptor [R. Belmont, based on a patch by Christopher Bachmann]
This commit is contained in:
parent
6c6b08a833
commit
e78d72a32c
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -392,6 +392,8 @@ src/emu/bus/a1bus/a1bus.c svneol=native#text/plain
|
||||
src/emu/bus/a1bus/a1bus.h svneol=native#text/plain
|
||||
src/emu/bus/a1bus/a1cassette.c svneol=native#text/plain
|
||||
src/emu/bus/a1bus/a1cassette.h svneol=native#text/plain
|
||||
src/emu/bus/a1bus/a1cffa.c svneol=native#text/plain
|
||||
src/emu/bus/a1bus/a1cffa.h svneol=native#text/plain
|
||||
src/emu/bus/a2bus/a2alfam2.c svneol=native#text/plain
|
||||
src/emu/bus/a2bus/a2alfam2.h svneol=native#text/plain
|
||||
src/emu/bus/a2bus/a2applicard.c svneol=native#text/plain
|
||||
|
156
src/emu/bus/a1bus/a1cffa.c
Normal file
156
src/emu/bus/a1bus/a1cffa.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*********************************************************************
|
||||
|
||||
a1cffa.c
|
||||
|
||||
Rich Dreher's Compact Flash for Apple I
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include "a1cffa.h"
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
#define CFFA_ROM_REGION "cffa_rom"
|
||||
#define CFFA_ATA_TAG "cffa_ata"
|
||||
|
||||
const device_type A1BUS_CFFA = &device_creator<a1bus_cffa_device>;
|
||||
|
||||
MACHINE_CONFIG_FRAGMENT( cffa )
|
||||
MCFG_ATA_INTERFACE_ADD(CFFA_ATA_TAG, ata_devices, "hdd", NULL, false)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( cffa )
|
||||
ROM_REGION(0x2000, CFFA_ROM_REGION, 0)
|
||||
ROM_LOAD ("cffaromv1.1.bin", 0x0000, 0x1fe0, CRC(bf6b55ad) SHA1(6a290be18485a06f243a3561c4e01be5aafa4bfe) )
|
||||
ROM_END
|
||||
|
||||
//-------------------------------------------------
|
||||
// machine_config_additions - device-specific
|
||||
// machine configurations
|
||||
//-------------------------------------------------
|
||||
|
||||
machine_config_constructor a1bus_cffa_device::device_mconfig_additions() const
|
||||
{
|
||||
return MACHINE_CONFIG_NAME( cffa );
|
||||
}
|
||||
|
||||
const rom_entry *a1bus_cffa_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME( cffa );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
a1bus_cffa_device::a1bus_cffa_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, A1BUS_CFFA, "CFFA Compact Flash for Apple I", tag, owner, clock, "cffa1", __FILE__),
|
||||
device_a1bus_card_interface(mconfig, *this),
|
||||
m_ata(*this, CFFA_ATA_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
a1bus_cffa_device::a1bus_cffa_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_a1bus_card_interface(mconfig, *this),
|
||||
m_ata(*this, CFFA_ATA_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void a1bus_cffa_device::device_start()
|
||||
{
|
||||
set_a1bus_device();
|
||||
|
||||
astring tempstring;
|
||||
m_rom = device().machine().root_device().memregion(this->subtag(tempstring, CFFA_ROM_REGION))->base();
|
||||
|
||||
install_device(0xafe0, 0xafff, read8_delegate(FUNC(a1bus_cffa_device::cffa_r), this), write8_delegate(FUNC(a1bus_cffa_device::cffa_w), this));
|
||||
install_bank(0x9000, 0xafdf, 0, 0, (char *)"bank_cffa1", m_rom);
|
||||
|
||||
save_item(NAME(m_lastdata));
|
||||
save_item(NAME(m_writeprotect));
|
||||
}
|
||||
|
||||
void a1bus_cffa_device::device_reset()
|
||||
{
|
||||
m_writeprotect = false;
|
||||
m_lastdata = 0;
|
||||
}
|
||||
|
||||
READ8_MEMBER(a1bus_cffa_device::cffa_r)
|
||||
{
|
||||
switch (offset & 0xf)
|
||||
{
|
||||
case 0x0:
|
||||
return m_lastdata>>8;
|
||||
|
||||
case 0x3:
|
||||
m_writeprotect = false;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
m_writeprotect = true;
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
m_lastdata = m_ata->read_cs0(space, (offset & 0xf) - 8, 0xff);
|
||||
return m_lastdata & 0x00ff;
|
||||
|
||||
case 0x9:
|
||||
case 0xa:
|
||||
case 0xb:
|
||||
case 0xc:
|
||||
case 0xd:
|
||||
case 0xe:
|
||||
case 0xf:
|
||||
return m_ata->read_cs0(space, (offset & 0xf) - 8, 0xff);
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(a1bus_cffa_device::cffa_w)
|
||||
{
|
||||
switch (offset & 0xf)
|
||||
{
|
||||
case 0x0:
|
||||
m_lastdata &= 0x00ff;
|
||||
m_lastdata |= data<<8;
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
m_writeprotect = false;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
m_writeprotect = true;
|
||||
break;
|
||||
|
||||
|
||||
case 0x8:
|
||||
m_ata->write_cs0(space, (offset & 0xf) - 8, data, 0xff);
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
case 0xa:
|
||||
case 0xb:
|
||||
case 0xc:
|
||||
case 0xd:
|
||||
case 0xe:
|
||||
case 0xf:
|
||||
m_ata->write_cs0(space, (offset & 0xf) - 8, data, 0xff);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
51
src/emu/bus/a1bus/a1cffa.h
Normal file
51
src/emu/bus/a1bus/a1cffa.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*********************************************************************
|
||||
|
||||
a1cffa.h
|
||||
|
||||
Rich Dreher's Compact Flash for Apple I
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef __A1BUS_CFFA__
|
||||
#define __A1BUS_CFFA__
|
||||
|
||||
#include "emu.h"
|
||||
#include "a1bus.h"
|
||||
#include "machine/ataintf.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class a1bus_cffa_device:
|
||||
public device_t,
|
||||
public device_a1bus_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
a1bus_cffa_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
a1bus_cffa_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);
|
||||
|
||||
// optional information overrides
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
|
||||
required_device<ata_interface_device> m_ata;
|
||||
|
||||
DECLARE_READ8_MEMBER(cffa_r);
|
||||
DECLARE_WRITE8_MEMBER(cffa_w);
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
private:
|
||||
UINT8 *m_rom;
|
||||
UINT16 m_lastdata;
|
||||
bool m_writeprotect;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
extern const device_type A1BUS_CFFA;
|
||||
|
||||
#endif /* __A1BUS_CFFA__ */
|
@ -1077,5 +1077,6 @@ ifneq ($(filter A1BUS,$(BUSES)),)
|
||||
OBJDIRS += $(BUSOBJ)/a1bus
|
||||
BUSOBJS += $(BUSOBJ)/a1bus/a1bus.o
|
||||
BUSOBJS += $(BUSOBJ)/a1bus/a1cassette.o
|
||||
BUSOBJS += $(BUSOBJ)/a1bus/a1cffa.o
|
||||
endif
|
||||
|
||||
|
@ -133,6 +133,7 @@ When the prompt returns, press Stop.
|
||||
|
||||
#include "bus/a1bus/a1bus.h"
|
||||
#include "bus/a1bus/a1cassette.h"
|
||||
#include "bus/a1bus/a1cffa.h"
|
||||
|
||||
/* port i/o functions */
|
||||
|
||||
@ -257,6 +258,7 @@ INPUT_PORTS_END
|
||||
|
||||
static SLOT_INTERFACE_START(apple1_cards)
|
||||
SLOT_INTERFACE("cassette", A1BUS_CASSETTE)
|
||||
SLOT_INTERFACE("cffa", A1BUS_CFFA)
|
||||
SLOT_INTERFACE_END
|
||||
|
||||
/* machine definition */
|
||||
|
Loading…
Reference in New Issue
Block a user