mirror of
https://github.com/holub/mame
synced 2025-07-01 08:18:59 +03:00
hd6301: instead of skip, zerofill nvram when no battery save
This commit is contained in:
parent
1d51167965
commit
5cf0ba72d5
@ -1571,28 +1571,27 @@ bool hd6301_cpu_device::nvram_write(util::write_stream &file)
|
|||||||
if (!m6801_cpu_device::nvram_write(file))
|
if (!m6801_cpu_device::nvram_write(file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// skip if it's currently not battery-backed
|
size_t actual;
|
||||||
if (m_nvram_battery)
|
std::vector<uint8_t> buf(7);
|
||||||
{
|
|
||||||
size_t actual;
|
|
||||||
uint8_t buf[7];
|
|
||||||
|
|
||||||
// misc registers
|
// misc registers
|
||||||
buf[0] = m_s.b.h;
|
buf[0] = m_s.b.h;
|
||||||
buf[1] = m_s.b.l;
|
buf[1] = m_s.b.l;
|
||||||
buf[2] = m_x.b.h;
|
buf[2] = m_x.b.h;
|
||||||
buf[3] = m_x.b.l;
|
buf[3] = m_x.b.l;
|
||||||
buf[4] = m_d.b.h;
|
buf[4] = m_d.b.h;
|
||||||
buf[5] = m_d.b.l;
|
buf[5] = m_d.b.l;
|
||||||
buf[6] = m_tdr;
|
buf[6] = m_tdr;
|
||||||
|
|
||||||
if (file.write(&buf, sizeof(buf), actual) || (sizeof(buf) != actual))
|
// port output latches
|
||||||
return false;
|
buf.insert(buf.end(), m_port_data, m_port_data + sizeof(m_port_data));
|
||||||
|
|
||||||
// port output latches
|
// zerofill if it's currently not battery-backed
|
||||||
if (file.write(&m_port_data[0], sizeof(m_port_data), actual) || sizeof(m_port_data) != actual)
|
if (!m_nvram_battery)
|
||||||
return false;
|
std::fill(buf.begin(), buf.end(), 0);
|
||||||
}
|
|
||||||
|
if (file.write(buf.data(), buf.size(), actual) || (buf.size() != actual))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1602,15 +1601,18 @@ bool hd6301x_cpu_device::nvram_write(util::write_stream &file)
|
|||||||
if (!hd6301_cpu_device::nvram_write(file))
|
if (!hd6301_cpu_device::nvram_write(file))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// skip if it's currently not battery-backed
|
size_t actual;
|
||||||
if (m_nvram_battery)
|
std::vector<uint8_t> buf;
|
||||||
{
|
|
||||||
size_t actual;
|
|
||||||
|
|
||||||
// port output latches
|
// port output latches
|
||||||
if (file.write(&m_portx_data[0], sizeof(m_portx_data), actual) || sizeof(m_portx_data) != actual)
|
buf.insert(buf.begin(), m_portx_data, m_portx_data + sizeof(m_portx_data));
|
||||||
return false;
|
|
||||||
}
|
// zerofill if it's currently not battery-backed
|
||||||
|
if (!m_nvram_battery)
|
||||||
|
std::fill(buf.begin(), buf.end(), 0);
|
||||||
|
|
||||||
|
if (file.write(buf.data(), buf.size(), actual) || (buf.size() != actual))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user