fix apple2gs regressions [R. Belmont]

This commit is contained in:
arbee 2017-02-06 21:19:47 -05:00
parent 94cfc518e3
commit 39d9dbb9e3
3 changed files with 40 additions and 134 deletions

View File

@ -60,7 +60,6 @@
#include "machine/ram.h"
#include "bus/a2bus/a2bus.h"
#include "bus/a2bus/a2lang.h"
#include "bus/a2bus/a2diskii.h"
#include "bus/a2bus/a2mockingboard.h"
#include "bus/a2bus/a2cffa.h"
@ -376,7 +375,6 @@ static MACHINE_CONFIG_START( apple2gs, apple2gs_state )
MCFG_A2BUS_OUT_IRQ_CB(WRITELINE(apple2gs_state, a2bus_irq_w))
MCFG_A2BUS_OUT_NMI_CB(WRITELINE(apple2gs_state, a2bus_nmi_w))
MCFG_A2BUS_OUT_INH_CB(WRITELINE(apple2gs_state, a2bus_inh_w))
MCFG_A2BUS_ONBOARD_ADD("a2bus", "sl0", A2BUS_LANG, NOOP)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl1", apple2_cards, nullptr)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl2", apple2_cards, nullptr)
MCFG_A2BUS_SLOT_ADD("a2bus", "sl3", apple2_cards, nullptr)

View File

@ -286,6 +286,7 @@ public:
void apple2_refresh_delegates();
int apple2_pressed_specialkey(uint8_t key);
void langcard_touch(offs_t offset);
read8_delegate read_delegates_master[4];
write8_delegate write_delegates_master[3];

View File

@ -50,7 +50,33 @@ void apple2_state::apple2_setup_memory(const apple2_memmap_config *config)
apple2_update_memory();
}
void apple2_state::langcard_touch(offs_t offset)
{
uint32_t val, mask;
//logerror("language card bankswitch read, offset: $c08%0x\n", offset);
// determine which flags to change
mask = VAR_LCWRITE | VAR_LCRAM | VAR_LCRAM2;
val = 0;
if (offset & 0x01)
val |= VAR_LCWRITE;
switch(offset & 0x03)
{
case 0x03:
case 0x00:
val |= VAR_LCRAM;
break;
}
if ((offset & 0x08) == 0)
val |= VAR_LCRAM2;
// change the flags
apple2_setvar(val, mask);
}
void apple2_state::apple2_update_memory()
{
@ -348,64 +374,21 @@ READ8_MEMBER(apple2_state::apple2_c080_r)
offset &= 0x7F;
slot = offset / 0x10;
if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128))
if (slot == 0)
{
if (slot == 1)
{
offset &= 0xf;
if (offset >= 8 && offset <= 0xb)
{
return m_acia1->read(space, offset-8);
}
}
else if (slot == 2)
{
offset &= 0xf;
if (offset >= 8 && offset <= 0xb)
{
return m_acia2->read(space, offset-8);
}
}
langcard_touch(offset);
return 0;
}
if ((m_machinetype == APPLE_IICPLUS) && (slot == 6))
{
offset &= 0xf;
return m_iicpiwm->read(offset);
}
if ((m_machinetype == LASER128) && (slot == 5))
{
offset &= 0xf;
uint8_t retval = m_exp_regs[offset];
if (offset == 3)
{
retval = m_exp_ram[m_exp_liveptr&m_exp_addrmask];
m_exp_liveptr++;
m_exp_regs[0] = m_exp_liveptr & 0xff;
m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff;
m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior;
}
return retval;
}
if ((m_machinetype == LASER128) && (slot == 6))
{
offset &= 0xf;
return m_laserudc->read(offset);
}
/* now identify the device */
slotdevice = m_a2bus->get_a2bus_card(slot);
slotdevice = m_a2bus->get_a2bus_card(slot);
/* and if we can, read from the slot */
if (slotdevice != nullptr)
{
return slotdevice->read_c0nx(space, offset % 0x10);
}
/* and if we can, read from the slot */
if (slotdevice != nullptr)
{
return slotdevice->read_c0nx(space, offset % 0x10);
}
}
return 0;
@ -420,85 +403,9 @@ WRITE8_MEMBER(apple2_state::apple2_c080_w)
offset &= 0x7F;
slot = offset / 0x10;
if ((m_machinetype == APPLE_IIC) || (m_machinetype == APPLE_IICPLUS) || (m_machinetype == LASER128))
if (slot == 0)
{
if (slot == 1)
{
offset &= 0xf;
if (offset >= 8 && offset <= 0xb)
{
m_acia1->write(space, offset-8, data);
return;
}
}
else if (slot == 2)
{
offset &= 0xf;
if (offset >= 8 && offset <= 0xb)
{
m_acia2->write(space, offset-8, data);
return;
}
}
}
if ((m_machinetype == APPLE_IICPLUS) && (slot == 6))
{
offset &= 0xf;
m_iicpiwm->write(offset, data);
return;
}
if ((m_machinetype == LASER128) && (slot == 5))
{
switch (offset & 0xf)
{
case 0:
m_exp_wptr &= ~0xff;
m_exp_wptr |= data;
m_exp_regs[0] = m_exp_wptr & 0xff;
m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
m_exp_liveptr = m_exp_wptr;
break;
case 1:
m_exp_wptr &= ~0xff00;
m_exp_wptr |= (data<<8);
m_exp_regs[0] = m_exp_wptr & 0xff;
m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
m_exp_liveptr = m_exp_wptr;
break;
case 2:
m_exp_wptr &= ~0xff0000;
m_exp_wptr |= (data<<16);
m_exp_regs[0] = m_exp_wptr & 0xff;
m_exp_regs[1] = (m_exp_wptr>>8) & 0xff;
m_exp_regs[2] = ((m_exp_wptr>>16) & 0xff) | m_exp_bankhior;
m_exp_liveptr = m_exp_wptr;
break;
case 3:
// printf("Write %02x to RAM[%x]\n", data, m_liveptr);
m_exp_ram[(m_exp_liveptr&m_exp_addrmask)] = data;
m_exp_liveptr++;
m_exp_regs[0] = m_exp_liveptr & 0xff;
m_exp_regs[1] = (m_exp_liveptr>>8) & 0xff;
m_exp_regs[2] = ((m_exp_liveptr>>16) & 0xff) | m_exp_bankhior;
break;
default:
m_exp_regs[offset] = data;
break;
}
}
if ((m_machinetype == LASER128) && (slot == 6))
{
offset &= 0xf;
m_laserudc->write(space, offset, data);
langcard_touch(offset);
return;
}