mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
apricot: fix iop ram access with expansion cards
This commit is contained in:
parent
9de83ac835
commit
58e21376c9
@ -62,6 +62,8 @@ apricot_expansion_bus_device::apricot_expansion_bus_device(const machine_config
|
||||
device_t(mconfig, APRICOT_EXPANSION_BUS, "Apricot Expansion Bus", tag, owner, clock, "apricot_exp_bus", __FILE__),
|
||||
m_program(NULL),
|
||||
m_io(NULL),
|
||||
m_program_iop(NULL),
|
||||
m_io_iop(NULL),
|
||||
m_dma1_handler(*this),
|
||||
m_dma2_handler(*this),
|
||||
m_ext1_handler(*this),
|
||||
@ -102,10 +104,12 @@ void apricot_expansion_bus_device::device_start()
|
||||
void apricot_expansion_bus_device::device_reset()
|
||||
{
|
||||
cpu_device *cpu = m_owner->subdevice<cpu_device>(m_cpu_tag);
|
||||
if (!cpu->started())
|
||||
printf("cpu not running yet\n");
|
||||
m_program = &cpu->space(AS_PROGRAM);
|
||||
m_io = &cpu->space(AS_IO);
|
||||
|
||||
cpu_device *iop = m_owner->subdevice<cpu_device>(m_iop_tag);
|
||||
m_program_iop = &iop->space(AS_PROGRAM);
|
||||
m_io_iop = &iop->space(AS_IO);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -122,10 +126,20 @@ void apricot_expansion_bus_device::add_card(device_apricot_expansion_card_interf
|
||||
// set_cpu_tag - set cpu we are attached to
|
||||
//-------------------------------------------------
|
||||
|
||||
void apricot_expansion_bus_device::set_cpu_tag(device_t &device, device_t *owner, const char *cpu_tag)
|
||||
void apricot_expansion_bus_device::set_cpu_tag(device_t &device, device_t *owner, const char *tag)
|
||||
{
|
||||
apricot_expansion_bus_device &bus = dynamic_cast<apricot_expansion_bus_device &>(device);
|
||||
bus.m_cpu_tag = cpu_tag;
|
||||
bus.m_cpu_tag = tag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_iop_tag - set iop we are attached to
|
||||
//-------------------------------------------------
|
||||
|
||||
void apricot_expansion_bus_device::set_iop_tag(device_t &device, device_t *owner, const char *tag)
|
||||
{
|
||||
apricot_expansion_bus_device &bus = dynamic_cast<apricot_expansion_bus_device &>(device);
|
||||
bus.m_iop_tag = tag;
|
||||
}
|
||||
|
||||
// callbacks from slot device to the host
|
||||
@ -136,6 +150,18 @@ WRITE_LINE_MEMBER( apricot_expansion_bus_device::ext2_w ) { m_ext2_handler(state
|
||||
WRITE_LINE_MEMBER( apricot_expansion_bus_device::int2_w ) { m_int2_handler(state); }
|
||||
WRITE_LINE_MEMBER( apricot_expansion_bus_device::int3_w ) { m_int3_handler(state); }
|
||||
|
||||
//-------------------------------------------------
|
||||
// install_ram - attach ram to cpu/iop
|
||||
//-------------------------------------------------
|
||||
|
||||
void apricot_expansion_bus_device::install_ram(offs_t addrstart, offs_t addrend, void *baseptr)
|
||||
{
|
||||
m_program->install_ram(addrstart, addrend, baseptr);
|
||||
|
||||
if (m_program_iop)
|
||||
m_program_iop->install_ram(addrstart, addrend, baseptr);
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CARTRIDGE INTERFACE
|
||||
|
@ -57,6 +57,9 @@
|
||||
MCFG_DEVICE_ADD(_tag, APRICOT_EXPANSION_BUS, 0) \
|
||||
apricot_expansion_bus_device::set_cpu_tag(*device, owner, _cpu_tag);
|
||||
|
||||
#define MCFG_EXPANSION_IOP_ADD(_tag) \
|
||||
apricot_expansion_bus_device::set_iop_tag(*device, owner, _tag);
|
||||
|
||||
#define MCFG_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
|
||||
MCFG_DEVICE_ADD(_tag, APRICOT_EXPANSION_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
|
||||
@ -134,13 +137,11 @@ public:
|
||||
{ return downcast<apricot_expansion_bus_device &>(device).m_int3_handler.set_callback(object); }
|
||||
|
||||
// inline configuration
|
||||
static void set_cpu_tag(device_t &device, device_t *owner, const char *cpu_tag);
|
||||
static void set_cpu_tag(device_t &device, device_t *owner, const char *tag);
|
||||
static void set_iop_tag(device_t &device, device_t *owner, const char *tag);
|
||||
|
||||
void add_card(device_apricot_expansion_card_interface *card);
|
||||
|
||||
address_space *m_program;
|
||||
address_space *m_io;
|
||||
|
||||
// from cards
|
||||
DECLARE_WRITE_LINE_MEMBER( dma1_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( dma2_w );
|
||||
@ -149,6 +150,8 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( int2_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( int3_w );
|
||||
|
||||
void install_ram(offs_t addrstart, offs_t addrend, void *baseptr);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
@ -157,6 +160,12 @@ protected:
|
||||
private:
|
||||
simple_list<device_apricot_expansion_card_interface> m_dev;
|
||||
|
||||
// address spaces we have access to
|
||||
address_space *m_program;
|
||||
address_space *m_io;
|
||||
address_space *m_program_iop;
|
||||
address_space *m_io_iop;
|
||||
|
||||
devcb_write_line m_dma1_handler;
|
||||
devcb_write_line m_dma2_handler;
|
||||
devcb_write_line m_ext1_handler;
|
||||
@ -166,6 +175,7 @@ private:
|
||||
|
||||
// configuration
|
||||
const char *m_cpu_tag;
|
||||
const char *m_iop_tag;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -65,9 +65,9 @@ void apricot_256k_ram_device::device_start()
|
||||
void apricot_256k_ram_device::device_reset()
|
||||
{
|
||||
if (m_sw->read() == 0)
|
||||
m_bus->m_program->install_ram(0x40000, 0x7ffff, &m_ram[0]);
|
||||
m_bus->install_ram(0x40000, 0x7ffff, &m_ram[0]);
|
||||
else
|
||||
m_bus->m_program->install_ram(0x80000, 0xbffff, &m_ram[0]);
|
||||
m_bus->install_ram(0x80000, 0xbffff, &m_ram[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -119,9 +119,9 @@ void apricot_128k_ram_device::device_start()
|
||||
void apricot_128k_ram_device::device_reset()
|
||||
{
|
||||
if (m_strap->read() == 1)
|
||||
m_bus->m_program->install_ram(0x40000, 0x5ffff, &m_ram[0]);
|
||||
m_bus->install_ram(0x40000, 0x5ffff, &m_ram[0]);
|
||||
else if (m_strap->read() == 2)
|
||||
m_bus->m_program->install_ram(0x60000, 0x7ffff, &m_ram[0]);
|
||||
m_bus->install_ram(0x60000, 0x7ffff, &m_ram[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -173,5 +173,5 @@ void apricot_512k_ram_device::device_start()
|
||||
void apricot_512k_ram_device::device_reset()
|
||||
{
|
||||
if (m_strap->read() == 0)
|
||||
m_bus->m_program->install_ram(0x40000, 0xbffff, &m_ram[0]);
|
||||
m_bus->install_ram(0x40000, 0xbffff, &m_ram[0]);
|
||||
}
|
||||
|
@ -473,6 +473,7 @@ static MACHINE_CONFIG_START( apricot, apricot_state )
|
||||
|
||||
// expansion bus
|
||||
MCFG_EXPANSION_ADD("exp", "ic91")
|
||||
MCFG_EXPANSION_IOP_ADD("ic71")
|
||||
MCFG_EXPANSION_SLOT_ADD("exp:1", apricot_expansion_cards, NULL)
|
||||
MCFG_EXPANSION_SLOT_ADD("exp:2", apricot_expansion_cards, NULL)
|
||||
MACHINE_CONFIG_END
|
||||
|
Loading…
Reference in New Issue
Block a user