mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
(MESS) Apple II: General modernization, some tagmap cleanup, and prep work to emulate IIe aux slot cards. [R. Belmont]
This commit is contained in:
parent
8b61b1bf35
commit
5a78cc106e
@ -237,7 +237,7 @@ WRITE8_MEMBER(apple2_state::a2bus_nmi_w)
|
||||
WRITE8_MEMBER(apple2_state::a2bus_inh_w)
|
||||
{
|
||||
m_inh_slot = data;
|
||||
apple2_update_memory(machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -707,6 +707,7 @@ static MACHINE_CONFIG_DERIVED( apple2p, apple2_common )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( apple2e, apple2_common )
|
||||
MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2e)
|
||||
MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2e)
|
||||
/* internal ram */
|
||||
MCFG_RAM_ADD(RAM_TAG)
|
||||
@ -748,6 +749,7 @@ static MACHINE_CONFIG_DERIVED( tk2000, apple2_common )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( mprof3, apple2e )
|
||||
MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
|
||||
|
||||
/* internal ram */
|
||||
MCFG_RAM_MODIFY(RAM_TAG)
|
||||
@ -763,6 +765,8 @@ static MACHINE_CONFIG_DERIVED( apple2ep, apple2e )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_DERIVED( apple2c, apple2ee )
|
||||
MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
|
||||
|
||||
MCFG_A2BUS_SLOT_REMOVE("sl1") // IIc has no slots, of course :)
|
||||
MCFG_A2BUS_SLOT_REMOVE("sl2")
|
||||
MCFG_A2BUS_SLOT_REMOVE("sl3")
|
||||
|
@ -272,7 +272,7 @@ WRITE8_MEMBER(apple2gs_state::a2bus_nmi_w)
|
||||
WRITE8_MEMBER(apple2gs_state::a2bus_inh_w)
|
||||
{
|
||||
m_inh_slot = data;
|
||||
apple2_update_memory(machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
static const struct a2bus_interface a2bus_intf =
|
||||
|
@ -75,7 +75,8 @@
|
||||
enum machine_type_t
|
||||
{
|
||||
APPLE_II, // Apple II/II+
|
||||
APPLE_IIEPLUS, // Apple IIe/IIc/IIgs/IIc+
|
||||
APPLE_IIE, // Apple IIe with aux slots
|
||||
APPLE_IIEPLUS, // Apple IIc/IIgs/IIc+ with permanent aux memory
|
||||
TK2000, // Microdigital TK2000
|
||||
LASER128, // Laser 128/128EX/128EX2
|
||||
SPACE84 // "Space 84" with flipped text mode
|
||||
@ -257,6 +258,7 @@ public:
|
||||
read8_delegate rd_inh_e000;
|
||||
write8_delegate wd_inh_e000;
|
||||
DECLARE_MACHINE_START(apple2);
|
||||
DECLARE_MACHINE_START(apple2e);
|
||||
DECLARE_VIDEO_START(apple2);
|
||||
DECLARE_PALETTE_INIT(apple2);
|
||||
DECLARE_MACHINE_START(apple2orig);
|
||||
@ -272,6 +274,8 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(a2bus_inh_w);
|
||||
void apple2_update_memory_postload();
|
||||
virtual void machine_reset();
|
||||
void apple2_setup_memory(const apple2_memmap_config *config);
|
||||
void apple2_update_memory();
|
||||
};
|
||||
|
||||
|
||||
@ -306,9 +310,6 @@ void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask);
|
||||
|
||||
int apple2_pressed_specialkey(running_machine &machine, UINT8 key);
|
||||
|
||||
void apple2_setup_memory(running_machine &machine, const apple2_memmap_config *config);
|
||||
void apple2_update_memory(running_machine &machine);
|
||||
|
||||
/*----------- defined in video/apple2.c -----------*/
|
||||
|
||||
void apple2_video_start(running_machine &machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo);
|
||||
|
@ -46,20 +46,18 @@ READ8_MEMBER(apple2_state::read_floatingbus)
|
||||
|
||||
|
||||
|
||||
void apple2_setup_memory(running_machine &machine, const apple2_memmap_config *config)
|
||||
void apple2_state::apple2_setup_memory(const apple2_memmap_config *config)
|
||||
{
|
||||
apple2_state *state = machine.driver_data<apple2_state>();
|
||||
state->m_mem_config = *config;
|
||||
state->m_current_meminfo = NULL;
|
||||
apple2_update_memory(machine);
|
||||
m_mem_config = *config;
|
||||
m_current_meminfo = NULL;
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void apple2_update_memory(running_machine &machine)
|
||||
void apple2_state::apple2_update_memory()
|
||||
{
|
||||
apple2_state *state = machine.driver_data<apple2_state>();
|
||||
address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
address_space& space = m_maincpu->space(AS_PROGRAM);
|
||||
int i, bank;
|
||||
char rbank[10], wbank[10];
|
||||
int full_update = 0;
|
||||
@ -73,37 +71,37 @@ void apple2_update_memory(running_machine &machine)
|
||||
int wh_nop = 0;
|
||||
|
||||
/* need to build list of current info? */
|
||||
if (!state->m_current_meminfo)
|
||||
if (!m_current_meminfo)
|
||||
{
|
||||
for (i = 0; state->m_mem_config.memmap[i].end; i++)
|
||||
for (i = 0; m_mem_config.memmap[i].end; i++)
|
||||
;
|
||||
state->m_current_meminfo = auto_alloc_array(machine, apple2_meminfo, i);
|
||||
m_current_meminfo = auto_alloc_array(machine(), apple2_meminfo, i);
|
||||
full_update = 1;
|
||||
}
|
||||
|
||||
/* get critical info */
|
||||
rom = machine.root_device().memregion("maincpu")->base();
|
||||
rom_length = machine.root_device().memregion("maincpu")->bytes() & ~0xFFF;
|
||||
rom = memregion("maincpu")->base();
|
||||
rom_length = memregion("maincpu")->bytes() & ~0xFFF;
|
||||
|
||||
/* loop through the entire memory map */
|
||||
bank = state->m_mem_config.first_bank;
|
||||
for (i = 0; state->m_mem_config.memmap[i].get_meminfo; i++)
|
||||
bank = m_mem_config.first_bank;
|
||||
for (i = 0; m_mem_config.memmap[i].get_meminfo; i++)
|
||||
{
|
||||
/* retrieve information on this entry */
|
||||
memset(&meminfo, 0, sizeof(meminfo));
|
||||
state->m_mem_config.memmap[i].get_meminfo(machine, state->m_mem_config.memmap[i].begin, state->m_mem_config.memmap[i].end, &meminfo);
|
||||
m_mem_config.memmap[i].get_meminfo(machine(), m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo);
|
||||
|
||||
bank_disposition = state->m_mem_config.memmap[i].bank_disposition;
|
||||
bank_disposition = m_mem_config.memmap[i].bank_disposition;
|
||||
|
||||
/* do we need to memory reading? */
|
||||
if (full_update
|
||||
|| (meminfo.read_mem != state->m_current_meminfo[i].read_mem)
|
||||
|| (meminfo.read_handler != state->m_current_meminfo[i].read_handler))
|
||||
|| (meminfo.read_mem != m_current_meminfo[i].read_mem)
|
||||
|| (meminfo.read_handler != m_current_meminfo[i].read_handler))
|
||||
{
|
||||
rbase = NULL;
|
||||
sprintf(rbank,"bank%d",bank);
|
||||
begin = state->m_mem_config.memmap[i].begin;
|
||||
end_r = state->m_mem_config.memmap[i].end;
|
||||
begin = m_mem_config.memmap[i].begin;
|
||||
end_r = m_mem_config.memmap[i].end;
|
||||
rh = NULL;
|
||||
|
||||
LOG(("apple2_update_memory(): Updating RD {%06X..%06X} [#%02d] --> %08X\n",
|
||||
@ -118,29 +116,29 @@ void apple2_update_memory(running_machine &machine)
|
||||
else if (meminfo.read_mem == APPLE2_MEM_FLOATING)
|
||||
{
|
||||
/* floating RAM */
|
||||
rh = &state->read_delegates_master[0];
|
||||
rh = &read_delegates_master[0];
|
||||
}
|
||||
else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX)
|
||||
{
|
||||
/* auxillary memory */
|
||||
assert(state->m_mem_config.auxmem);
|
||||
assert(m_mem_config.auxmem);
|
||||
offset = meminfo.read_mem & APPLE2_MEM_MASK;
|
||||
rbase = &state->m_mem_config.auxmem[offset];
|
||||
rbase = &m_mem_config.auxmem[offset];
|
||||
}
|
||||
else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_SLOT)
|
||||
{
|
||||
// slots 1-2
|
||||
if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
|
||||
{
|
||||
rh = &state->read_delegates_master[1];
|
||||
rh = &read_delegates_master[1];
|
||||
}
|
||||
else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200)
|
||||
{ // slot 3
|
||||
rh = &state->read_delegates_master[2];
|
||||
rh = &read_delegates_master[2];
|
||||
}
|
||||
else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
|
||||
{ // slots 4-7
|
||||
rh = &state->read_delegates_master[3];
|
||||
rh = &read_delegates_master[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,11 +154,11 @@ void apple2_update_memory(running_machine &machine)
|
||||
else
|
||||
{
|
||||
/* RAM */
|
||||
if (end_r >= state->m_ram->size())
|
||||
end_r = state->m_ram->size() - 1;
|
||||
if (end_r >= m_ram->size())
|
||||
end_r = m_ram->size() - 1;
|
||||
offset = meminfo.read_mem & APPLE2_MEM_MASK;
|
||||
if (end_r >= begin)
|
||||
rbase = &state->m_ram->pointer()[offset];
|
||||
rbase = &m_ram->pointer()[offset];
|
||||
}
|
||||
|
||||
/* install the actual handlers */
|
||||
@ -173,32 +171,32 @@ void apple2_update_memory(running_machine &machine)
|
||||
}
|
||||
|
||||
/* did we 'go past the end?' */
|
||||
if (end_r < state->m_mem_config.memmap[i].end)
|
||||
space.nop_read(end_r + 1, state->m_mem_config.memmap[i].end);
|
||||
if (end_r < m_mem_config.memmap[i].end)
|
||||
space.nop_read(end_r + 1, m_mem_config.memmap[i].end);
|
||||
|
||||
/* set the memory bank */
|
||||
if (rbase)
|
||||
{
|
||||
state->membank(rbank)->set_base(rbase);
|
||||
membank(rbank)->set_base(rbase);
|
||||
}
|
||||
|
||||
/* record the current settings */
|
||||
state->m_current_meminfo[i].read_mem = meminfo.read_mem;
|
||||
state->m_current_meminfo[i].read_handler = meminfo.read_handler;
|
||||
m_current_meminfo[i].read_mem = meminfo.read_mem;
|
||||
m_current_meminfo[i].read_handler = meminfo.read_handler;
|
||||
}
|
||||
|
||||
/* do we need to memory writing? */
|
||||
if (full_update
|
||||
|| (meminfo.write_mem != state->m_current_meminfo[i].write_mem)
|
||||
|| (meminfo.write_handler != state->m_current_meminfo[i].write_handler))
|
||||
|| (meminfo.write_mem != m_current_meminfo[i].write_mem)
|
||||
|| (meminfo.write_handler != m_current_meminfo[i].write_handler))
|
||||
{
|
||||
wbase = NULL;
|
||||
if (bank_disposition == A2MEM_MONO)
|
||||
sprintf(wbank,"bank%d",bank);
|
||||
else if (bank_disposition == A2MEM_DUAL)
|
||||
sprintf(wbank,"bank%d",bank+1);
|
||||
begin = state->m_mem_config.memmap[i].begin;
|
||||
end_w = state->m_mem_config.memmap[i].end;
|
||||
begin = m_mem_config.memmap[i].begin;
|
||||
end_w = m_mem_config.memmap[i].end;
|
||||
wh = NULL;
|
||||
|
||||
LOG(("apple2_update_memory(): Updating WR {%06X..%06X} [#%02d] --> %08X\n",
|
||||
@ -213,9 +211,9 @@ void apple2_update_memory(running_machine &machine)
|
||||
else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX)
|
||||
{
|
||||
/* auxillary memory */
|
||||
assert(state->m_mem_config.auxmem);
|
||||
assert(m_mem_config.auxmem);
|
||||
offset = meminfo.write_mem & APPLE2_MEM_MASK;
|
||||
wbase = &state->m_mem_config.auxmem[offset];
|
||||
wbase = &m_mem_config.auxmem[offset];
|
||||
}
|
||||
else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_SLOT)
|
||||
{
|
||||
@ -224,15 +222,15 @@ void apple2_update_memory(running_machine &machine)
|
||||
// slots 1-2
|
||||
if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
|
||||
{
|
||||
wh = &state->write_delegates_master[0];
|
||||
wh = &write_delegates_master[0];
|
||||
}
|
||||
else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200)
|
||||
{ // slot 3
|
||||
wh = &state->write_delegates_master[1];
|
||||
wh = &write_delegates_master[1];
|
||||
}
|
||||
else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
|
||||
{ // slots 4-7
|
||||
wh = &state->write_delegates_master[2];
|
||||
wh = &write_delegates_master[2];
|
||||
}
|
||||
}
|
||||
else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_ROM)
|
||||
@ -243,11 +241,11 @@ void apple2_update_memory(running_machine &machine)
|
||||
else
|
||||
{
|
||||
/* RAM */
|
||||
if (end_w >= state->m_ram->size())
|
||||
end_w = state->m_ram->size() - 1;
|
||||
if (end_w >= m_ram->size())
|
||||
end_w = m_ram->size() - 1;
|
||||
offset = meminfo.write_mem & APPLE2_MEM_MASK;
|
||||
if (end_w >= begin)
|
||||
wbase = &state->m_ram->pointer()[offset];
|
||||
wbase = &m_ram->pointer()[offset];
|
||||
}
|
||||
|
||||
|
||||
@ -265,18 +263,18 @@ void apple2_update_memory(running_machine &machine)
|
||||
}
|
||||
|
||||
/* did we 'go past the end?' */
|
||||
if (end_w < state->m_mem_config.memmap[i].end)
|
||||
space.nop_write(end_w + 1, state->m_mem_config.memmap[i].end);
|
||||
if (end_w < m_mem_config.memmap[i].end)
|
||||
space.nop_write(end_w + 1, m_mem_config.memmap[i].end);
|
||||
|
||||
/* set the memory bank */
|
||||
if (wbase)
|
||||
{
|
||||
state->membank(wbank)->set_base(wbase);
|
||||
membank(wbank)->set_base(wbase);
|
||||
}
|
||||
|
||||
/* record the current settings */
|
||||
state->m_current_meminfo[i].write_mem = meminfo.write_mem;
|
||||
state->m_current_meminfo[i].write_handler = meminfo.write_handler;
|
||||
m_current_meminfo[i].write_mem = meminfo.write_mem;
|
||||
m_current_meminfo[i].write_handler = meminfo.write_handler;
|
||||
}
|
||||
bank += bank_disposition;
|
||||
}
|
||||
@ -286,7 +284,7 @@ void apple2_update_memory(running_machine &machine)
|
||||
|
||||
void apple2_state::apple2_update_memory_postload()
|
||||
{
|
||||
apple2_update_memory(machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
|
||||
@ -394,8 +392,8 @@ INT8 apple2_slotram_r(address_space &space, int slotnum, int offset)
|
||||
UINT32 rom_length, slot_length;
|
||||
|
||||
// find slot_ram if any
|
||||
rom = space.machine().root_device().memregion("maincpu")->base();
|
||||
rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
|
||||
rom = state->memregion("maincpu")->base();
|
||||
rom_length = state->memregion("maincpu")->bytes() & ~0xFFF;
|
||||
slot_length = state->memregion("maincpu")->bytes() - rom_length;
|
||||
slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
|
||||
|
||||
@ -405,7 +403,7 @@ INT8 apple2_slotram_r(address_space &space, int slotnum, int offset)
|
||||
{
|
||||
// printf("slotram_r: taking cnxx_slot to -1\n");
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
|
||||
return slot_ram[offset];
|
||||
@ -429,7 +427,7 @@ READ8_MEMBER(apple2_state::apple2_c1xx_r )
|
||||
{
|
||||
// printf("c1xx_r: taking cnxx_slot to %d\n", slotnum);
|
||||
m_a2_cnxx_slot = slotnum;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
return slotdevice->read_cnxx(space, offset&0xff);
|
||||
@ -451,8 +449,8 @@ WRITE8_MEMBER(apple2_state::apple2_c1xx_w )
|
||||
UINT32 rom_length, slot_length;
|
||||
|
||||
// find slot_ram if any
|
||||
rom = space.machine().root_device().memregion("maincpu")->base();
|
||||
rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
|
||||
rom = memregion("maincpu")->base();
|
||||
rom_length = memregion("maincpu")->bytes() & ~0xFFF;
|
||||
slot_length = memregion("maincpu")->bytes() - rom_length;
|
||||
slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
|
||||
|
||||
@ -486,7 +484,7 @@ READ8_MEMBER(apple2_state::apple2_c3xx_r )
|
||||
{
|
||||
// printf("c3xx_r: taking cnxx_slot to %d\n", slotnum);
|
||||
m_a2_cnxx_slot = slotnum;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
return slotdevice->read_cnxx(space, offset&0xff);
|
||||
}
|
||||
@ -507,8 +505,8 @@ WRITE8_MEMBER(apple2_state::apple2_c3xx_w )
|
||||
UINT32 rom_length, slot_length;
|
||||
|
||||
// find slot_ram if any
|
||||
rom = space.machine().root_device().memregion("maincpu")->base();
|
||||
rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
|
||||
rom = memregion("maincpu")->base();
|
||||
rom_length = memregion("maincpu")->bytes() & ~0xFFF;
|
||||
slot_length = memregion("maincpu")->bytes() - rom_length;
|
||||
slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
|
||||
|
||||
@ -521,7 +519,7 @@ WRITE8_MEMBER(apple2_state::apple2_c3xx_w )
|
||||
{
|
||||
// printf("c3xx_w: taking cnxx_slot to %d\n", slotnum);
|
||||
m_a2_cnxx_slot = slotnum;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
slotdevice->write_cnxx(space, offset&0xff, data);
|
||||
}
|
||||
@ -546,7 +544,7 @@ READ8_MEMBER(apple2_state::apple2_c4xx_r )
|
||||
if (slotdevice->take_c800() && (m_a2_cnxx_slot != slotnum))
|
||||
{
|
||||
m_a2_cnxx_slot = slotnum;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
return slotdevice->read_cnxx(space, offset&0xff);
|
||||
}
|
||||
@ -567,8 +565,8 @@ WRITE8_MEMBER ( apple2_state::apple2_c4xx_w )
|
||||
UINT32 rom_length, slot_length;
|
||||
|
||||
// find slot_ram if any
|
||||
rom = space.machine().root_device().memregion("maincpu")->base();
|
||||
rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
|
||||
rom = memregion("maincpu")->base();
|
||||
rom_length = memregion("maincpu")->bytes() & ~0xFFF;
|
||||
slot_length = memregion("maincpu")->bytes() - rom_length;
|
||||
slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
|
||||
|
||||
@ -581,7 +579,7 @@ WRITE8_MEMBER ( apple2_state::apple2_c4xx_w )
|
||||
{
|
||||
// printf("c4xx_w: taking cnxx_slot to %d\n", slotnum);
|
||||
m_a2_cnxx_slot = slotnum;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
slotdevice->write_cnxx(space, offset&0xff, data);
|
||||
}
|
||||
@ -599,7 +597,7 @@ READ8_MEMBER(apple2_state::apple2_cfff_r)
|
||||
{
|
||||
// printf("cfff_r: taking cnxx_slot to -1\n");
|
||||
m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
|
||||
return apple2_getfloatingbusvalue(space.machine());
|
||||
@ -611,7 +609,7 @@ WRITE8_MEMBER(apple2_state::apple2_cfff_w)
|
||||
{
|
||||
// printf("cfff_w: taking cnxx_slot to -1\n");
|
||||
m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1001,7 +999,7 @@ void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask)
|
||||
{
|
||||
apple2_state *state = machine.driver_data<apple2_state>();
|
||||
LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask,
|
||||
(unsigned int) machine.device("maincpu")->safe_pc()));
|
||||
(unsigned int) state->m_maincpu->pc()));
|
||||
|
||||
assert((val & mask) == val);
|
||||
|
||||
@ -1016,7 +1014,7 @@ void apple2_setvar(running_machine &machine, UINT32 val, UINT32 mask)
|
||||
// disable flags that don't apply (INTCXROM/SLOTC3ROM on II/II+ for instance)
|
||||
state->m_flags &= ~state->m_flags_mask;
|
||||
|
||||
apple2_update_memory(machine);
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
|
||||
|
||||
@ -1064,7 +1062,7 @@ UINT8 apple2_getfloatingbusvalue(running_machine &machine)
|
||||
|
||||
// video scanner data
|
||||
//
|
||||
i = (machine.device<cpu_device>("maincpu"))->total_cycles() % kClocksPerVSync; // cycles into this VSync
|
||||
i = state->m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync
|
||||
|
||||
// machine state switches
|
||||
//
|
||||
@ -1566,10 +1564,10 @@ READ8_MEMBER ( apple2_state::apple2_c07x_r )
|
||||
|
||||
if (offset == 0)
|
||||
{
|
||||
m_joystick_x1_time = space.machine().time().as_double() + x_calibration * m_joy1x->read();
|
||||
m_joystick_y1_time = space.machine().time().as_double() + y_calibration * m_joy1y->read();
|
||||
m_joystick_x2_time = space.machine().time().as_double() + x_calibration * m_joy2x->read();
|
||||
m_joystick_y2_time = space.machine().time().as_double() + y_calibration * m_joy2y->read();
|
||||
m_joystick_x1_time = machine().time().as_double() + x_calibration * m_joy1x->read();
|
||||
m_joystick_y1_time = machine().time().as_double() + y_calibration * m_joy1y->read();
|
||||
m_joystick_x2_time = machine().time().as_double() + x_calibration * m_joy2x->read();
|
||||
m_joystick_y2_time = machine().time().as_double() + y_calibration * m_joy2y->read();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -1583,6 +1581,21 @@ READ8_MEMBER ( apple2_state::apple2_c07x_r )
|
||||
|
||||
WRITE8_MEMBER ( apple2_state::apple2_c07x_w )
|
||||
{
|
||||
// this a machine with an aux slot?
|
||||
if (m_machinetype == APPLE_IIE)
|
||||
{
|
||||
device_a2eauxslot_card_interface *auxslotdevice = NULL;
|
||||
|
||||
auxslotdevice = m_a2eauxslot->get_a2eauxslot_card();
|
||||
|
||||
if (auxslotdevice)
|
||||
{
|
||||
auxslotdevice->write_c07x(space, offset&0xf, data);
|
||||
}
|
||||
}
|
||||
|
||||
// AE RamWorks manual indicates that even if the auxslot card sees the c07x write,
|
||||
// so does the motherboard and it will trigger the paddles. So always call this.
|
||||
apple2_c07x_r(space, offset, 0);
|
||||
}
|
||||
|
||||
@ -1804,7 +1817,32 @@ MACHINE_START_MEMBER(apple2_state,apple2)
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = apple2_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
|
||||
apple2_setup_memory(machine(), &mem_cfg);
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(apple2_state,apple2e)
|
||||
{
|
||||
apple2_memmap_config mem_cfg;
|
||||
void *apple2cp_ce00_ram = NULL;
|
||||
|
||||
m_flags_mask = 0;
|
||||
|
||||
/* there appears to be some hidden RAM that is swapped in on the Apple
|
||||
* IIc plus; I have not found any official documentation but the BIOS
|
||||
* clearly uses this area as writeable memory */
|
||||
if (!strcmp(machine().system().name, "apple2cp"))
|
||||
apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200);
|
||||
|
||||
m_machinetype = APPLE_IIE;
|
||||
|
||||
apple2_init_common(machine());
|
||||
|
||||
/* setup memory */
|
||||
memset(&mem_cfg, 0, sizeof(mem_cfg));
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = apple2_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(apple2_state,laser128)
|
||||
@ -1821,7 +1859,7 @@ MACHINE_START_MEMBER(apple2_state,laser128)
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = apple2_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)NULL;
|
||||
apple2_setup_memory(machine(), &mem_cfg);
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(apple2_state,apple2orig)
|
||||
@ -1841,7 +1879,7 @@ MACHINE_START_MEMBER(apple2_state,apple2orig)
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = apple2_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
|
||||
apple2_setup_memory(machine(), &mem_cfg);
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(apple2_state,space84)
|
||||
@ -1861,7 +1899,7 @@ MACHINE_START_MEMBER(apple2_state,space84)
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = apple2_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
|
||||
apple2_setup_memory(machine(), &mem_cfg);
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
MACHINE_START_MEMBER(apple2_state,tk2000)
|
||||
@ -1880,7 +1918,7 @@ MACHINE_START_MEMBER(apple2_state,tk2000)
|
||||
mem_cfg.first_bank = 1;
|
||||
mem_cfg.memmap = tk2000_memmap_entries;
|
||||
mem_cfg.auxmem = (UINT8*)NULL;
|
||||
apple2_setup_memory(machine(), &mem_cfg);
|
||||
apple2_setup_memory(&mem_cfg);
|
||||
}
|
||||
|
||||
int apple2_state::apple2_pressed_specialkey(UINT8 key)
|
||||
|
@ -261,7 +261,7 @@ void apple2gs_add_irq(running_machine &machine, UINT16 irq_mask)
|
||||
logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask));
|
||||
|
||||
state->m_pending_irqs |= irq_mask;
|
||||
machine.device("maincpu")->execute().set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ void apple2gs_remove_irq(running_machine &machine, UINT16 irq_mask)
|
||||
logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask));
|
||||
|
||||
state->m_pending_irqs &= ~irq_mask;
|
||||
machine.device("maincpu")->execute().set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -513,6 +513,7 @@ static void adb_write_datareg(running_machine &machine, UINT8 data)
|
||||
state->m_adb_command_length = 0;
|
||||
state->m_adb_command_pos = 0;
|
||||
|
||||
// printf("ADB command %02x\n", data);
|
||||
switch(data)
|
||||
{
|
||||
case 0x00: /* ??? */
|
||||
@ -534,10 +535,10 @@ static void adb_write_datareg(running_machine &machine, UINT8 data)
|
||||
break;
|
||||
|
||||
case 0x07: /* synchronize */
|
||||
if (state->memregion("maincpu")->bytes() == 0x40000) /* HACK */
|
||||
state->m_adb_command_length = 8;
|
||||
if (state->m_is_rom3)
|
||||
state->m_adb_command_length = 8; // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options
|
||||
else
|
||||
state->m_adb_command_length = 4;
|
||||
state->m_adb_command_length = 4; // ROM 0/1 has 4 bytes sync
|
||||
break;
|
||||
|
||||
case 0x08: /* write memory */
|
||||
@ -603,6 +604,7 @@ static void adb_write_datareg(running_machine &machine, UINT8 data)
|
||||
|
||||
case ADBSTATE_INCOMMAND:
|
||||
assert(state->m_adb_command_pos < ARRAY_LENGTH(state->m_adb_command_bytes));
|
||||
// printf("ADB param %02x\n", data);
|
||||
state->m_adb_command_bytes[state->m_adb_command_pos++] = data;
|
||||
break;
|
||||
|
||||
@ -1057,8 +1059,8 @@ READ8_MEMBER( apple2gs_state::apple2gs_c0xx_r )
|
||||
case 0x74: case 0x75: case 0x76: case 0x77:
|
||||
case 0x78: case 0x79: case 0x7a: case 0x7b:
|
||||
case 0x7c: case 0x7d: case 0x7e: case 0x7f:
|
||||
offset |= (space.machine().root_device().memregion("maincpu")->bytes() - 1) & ~0x3FFF;
|
||||
result = space.machine().root_device().memregion("maincpu")->base()[offset];
|
||||
offset |= (memregion("maincpu")->bytes() - 1) & ~0x3FFF;
|
||||
result = memregion("maincpu")->base()[offset];
|
||||
break;
|
||||
|
||||
case 0x21: /* C021 - MONOCOLOR */
|
||||
@ -1160,7 +1162,7 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w )
|
||||
|
||||
case 0x2D: /* C02D - SLTROMSEL */
|
||||
m_sltromsel = data;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
break;
|
||||
|
||||
case 0x31: /* C031 - DISKREG */
|
||||
@ -1186,13 +1188,13 @@ WRITE8_MEMBER( apple2gs_state::apple2gs_c0xx_w )
|
||||
if (m_shadow != data)
|
||||
{
|
||||
m_shadow = data;
|
||||
apple2_update_memory(space.machine());
|
||||
apple2_update_memory();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x36: /* C036 - CYAREG */
|
||||
m_cyareg = data & ~0x20;
|
||||
space.machine().device("maincpu")->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
|
||||
m_maincpu->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
|
||||
break;
|
||||
|
||||
case 0x38: /* C038 - SCCBREG */
|
||||
@ -1587,7 +1589,7 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o
|
||||
}
|
||||
else if ((address & 0x000F00) == 0x000000) // accessing C0xx?
|
||||
{
|
||||
result = state->apple2gs_c0xx_r(machine.device("maincpu")->memory().space(AS_PROGRAM), address, 0);
|
||||
result = state->apple2gs_c0xx_r(state->m_maincpu->space(AS_PROGRAM), address, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1603,7 +1605,7 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o
|
||||
{
|
||||
// accessing a slot mapped to internal, let's put back the internal ROM
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
result = *apple2gs_getslotmem(machine, address);
|
||||
}
|
||||
else
|
||||
@ -1614,7 +1616,7 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o
|
||||
if (slotdevice->take_c800())
|
||||
{
|
||||
state->m_a2_cnxx_slot = slot;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
result = slotdevice->read_cnxx(space, address&0xff);
|
||||
}
|
||||
@ -1634,7 +1636,7 @@ static UINT8 apple2gs_xxCxxx_r(address_space &space, running_machine &machine, o
|
||||
if ((address & 0xfff) == 0xfff)
|
||||
{
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1669,7 +1671,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of
|
||||
if ((address & 0xfff) == 0xfff)
|
||||
{
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1679,7 +1681,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of
|
||||
}
|
||||
else if ((address & 0x000F00) == 0x000000)
|
||||
{
|
||||
state->apple2gs_c0xx_w(machine.device("maincpu")->memory().space(AS_PROGRAM), address, data, 0);
|
||||
state->apple2gs_c0xx_w(state->m_maincpu->space(AS_PROGRAM), address, data, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1696,7 +1698,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of
|
||||
{
|
||||
// accessing a slot mapped to internal, let's put back the internal ROM
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
*apple2gs_getslotmem(machine, address) = data;
|
||||
}
|
||||
else
|
||||
@ -1707,7 +1709,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of
|
||||
if (slotdevice->take_c800())
|
||||
{
|
||||
state->m_a2_cnxx_slot = slot;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
slotdevice->write_cnxx(space, address&0xff, data);
|
||||
}
|
||||
@ -1722,7 +1724,7 @@ static void apple2gs_xxCxxx_w(address_space &space, running_machine &machine, of
|
||||
if ((address & 0xfff) == 0xfff)
|
||||
{
|
||||
state->m_a2_cnxx_slot = -1;
|
||||
apple2_update_memory(space.machine());
|
||||
state->apple2_update_memory();
|
||||
}
|
||||
|
||||
if ( state->m_a2_cnxx_slot >= 0 && state->m_a2_cnxx_slot <= 7 )
|
||||
@ -1829,7 +1831,7 @@ static READ8_HANDLER(apple2gs_bank_echo_r)
|
||||
static void apple2gs_setup_memory(running_machine &machine)
|
||||
{
|
||||
apple2gs_state *state = machine.driver_data<apple2gs_state>();
|
||||
address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
address_space& space = state->m_maincpu->space(AS_PROGRAM);
|
||||
offs_t begin, end;
|
||||
apple2_memmap_config cfg;
|
||||
|
||||
@ -1873,10 +1875,10 @@ static void apple2gs_setup_memory(running_machine &machine)
|
||||
state->membank("bank2")->set_base(state->m_slowmem);
|
||||
|
||||
/* install alternate ROM bank */
|
||||
begin = 0x1000000 - machine.root_device().memregion("maincpu")->bytes();
|
||||
begin = 0x1000000 - state->memregion("maincpu")->bytes();
|
||||
end = 0xffffff;
|
||||
space.install_read_bank(begin, end, "bank3");
|
||||
state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base());
|
||||
state->membank("bank3")->set_base(state->memregion("maincpu")->base());
|
||||
|
||||
/* install new xxC000-xxCFFF handlers */
|
||||
space.install_legacy_read_handler(0x00c000, 0x00cfff, FUNC(apple2gs_00Cxxx_r));
|
||||
@ -1901,7 +1903,7 @@ static void apple2gs_setup_memory(running_machine &machine)
|
||||
cfg.memmap = apple2gs_memmap_entries;
|
||||
cfg.auxmem = state->m_slowmem;
|
||||
cfg.auxmem_length = 0x20000;
|
||||
apple2_setup_memory(machine, &cfg);
|
||||
state->apple2_setup_memory(&cfg);
|
||||
}
|
||||
|
||||
|
||||
@ -1919,6 +1921,9 @@ MACHINE_RESET_MEMBER(apple2gs_state,apple2gs)
|
||||
{
|
||||
apple2gs_refresh_delegates();
|
||||
|
||||
// call "base class" machine reset to set up m_rambase and the language card
|
||||
machine_reset();
|
||||
|
||||
m_cur_slot6_image = NULL;
|
||||
m_newvideo = 0x00;
|
||||
m_vgcint = 0x00;
|
||||
@ -1970,7 +1975,7 @@ MACHINE_START_MEMBER(apple2gs_state,apple2gscommon)
|
||||
apple2_init_common(machine());
|
||||
|
||||
/* set up Apple IIgs vectoring */
|
||||
g65816_set_read_vector_callback(machine().device("maincpu"), read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this));
|
||||
g65816_set_read_vector_callback(m_maincpu, read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this));
|
||||
|
||||
/* setup globals */
|
||||
m_is_rom3 = true;
|
||||
@ -2187,7 +2192,7 @@ UINT8 apple2gs_state::keyglu_816_read(UINT8 offset)
|
||||
m_glu_sysstat |= 0x80;
|
||||
}
|
||||
m_glu_816_read_dstat = true;
|
||||
printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20);
|
||||
// printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20);
|
||||
return m_glu_sysstat;
|
||||
|
||||
case GLU_DATA:
|
||||
|
Loading…
Reference in New Issue
Block a user