(MESS) apple2/3: CFFA2 now ignores 6502 spurious reads during write cycles. [R. Belmont]

This commit is contained in:
R. Belmont 2014-02-16 16:58:47 +00:00
parent 6a57b6378f
commit 36d081e756
2 changed files with 17 additions and 4 deletions

View File

@ -117,13 +117,16 @@ void a2bus_cffa2000_device::device_start()
m_rom[0x801] = 13; m_rom[0x801] = 13;
save_item(NAME(m_lastdata)); save_item(NAME(m_lastdata));
save_item(NAME(m_lastreaddata));
save_item(NAME(m_writeprotect)); save_item(NAME(m_writeprotect));
save_item(NAME(m_eeprom)); save_item(NAME(m_eeprom));
save_item(NAME(m_inwritecycle));
} }
void a2bus_cffa2000_device::device_reset() void a2bus_cffa2000_device::device_reset()
{ {
m_writeprotect = true; m_writeprotect = true;
m_inwritecycle = false;
} }
@ -136,7 +139,7 @@ UINT8 a2bus_cffa2000_device::read_c0nx(address_space &space, UINT8 offset)
switch (offset) switch (offset)
{ {
case 0: case 0:
return m_lastdata>>8; return m_lastreaddata>>8;
case 3: case 3:
m_writeprotect = false; m_writeprotect = false;
@ -147,8 +150,12 @@ UINT8 a2bus_cffa2000_device::read_c0nx(address_space &space, UINT8 offset)
break; break;
case 8: case 8:
m_lastdata = m_ata->read_cs0(space, offset-8, 0xffff); // Apple /// driver uses sta $c080,x when writing, which causes spurious reads of c088
return m_lastdata & 0xff; if (!m_inwritecycle)
{
m_lastreaddata = m_ata->read_cs0(space, offset - 8, 0xffff);
}
return m_lastreaddata & 0xff;
case 9: case 9:
case 0xa: case 0xa:
@ -170,11 +177,15 @@ UINT8 a2bus_cffa2000_device::read_c0nx(address_space &space, UINT8 offset)
void a2bus_cffa2000_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) void a2bus_cffa2000_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data)
{ {
m_inwritecycle = false;
switch (offset) switch (offset)
{ {
case 0: case 0:
m_lastdata &= 0x00ff; m_lastdata &= 0x00ff;
m_lastdata |= data<<8; m_lastdata |= data<<8;
// printf("%02x to 0, m_lastdata = %x\n", data, m_lastdata);
m_inwritecycle = true;
break; break;
case 3: case 3:
@ -188,6 +199,7 @@ void a2bus_cffa2000_device::write_c0nx(address_space &space, UINT8 offset, UINT8
case 8: case 8:
m_lastdata &= 0xff00; m_lastdata &= 0xff00;
m_lastdata |= data; m_lastdata |= data;
// printf("%02x to 8, m_lastdata = %x\n", data, m_lastdata);
m_ata->write_cs0(space, offset-8, m_lastdata, 0xffff); m_ata->write_cs0(space, offset-8, m_lastdata, 0xffff);
break; break;

View File

@ -47,8 +47,9 @@ protected:
UINT8 m_eeprom[0x1000]; UINT8 m_eeprom[0x1000];
private: private:
UINT16 m_lastdata; UINT16 m_lastdata, m_lastreaddata;
bool m_writeprotect; bool m_writeprotect;
bool m_inwritecycle;
}; };
class a2bus_cffa2_device : public a2bus_cffa2000_device, public device_nvram_interface class a2bus_cffa2_device : public a2bus_cffa2000_device, public device_nvram_interface