summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-05-04 16:45:17 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-05-04 16:52:21 -0400
commitba98efd5452595a483e88cc429b84e8eb3f0a3ea (patch)
tree743efb27dbb66890973130a72ae3414f343d35bb
parentef5272ed16f81510998ac2f6e5ad36cb54ab4eac (diff)
m68705: Prevent registration of illegal debug states for nonexistent port latches/DDRs
distate: Sanity check (nw)
-rw-r--r--src/devices/cpu/m6805/m68705.cpp10
-rw-r--r--src/emu/distate.cpp2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp
index fbac7b282fe..52bbff50338 100644
--- a/src/devices/cpu/m6805/m68705.cpp
+++ b/src/devices/cpu/m6805/m68705.cpp
@@ -248,7 +248,7 @@ template <offs_t B> READ8_MEMBER(m68705_device::eprom_r)
template <offs_t B> WRITE8_MEMBER(m68705_device::eprom_w)
{
- LOGEPROM("EPROM programming latch write%s%s: %04X = %02\n",
+ LOGEPROM("EPROM programming latch write%s%s: %04X = %02X\n",
!pcr_vpon() ? " [Vpp low]" : "", !pcr_ple() ? " [disabled]" : "", B + offset, data);
// programming latch enabled when /VPON and /PLE are asserted
@@ -417,7 +417,7 @@ void m6805_hmos_device::device_start()
add_port_latch_state<0>();
add_port_latch_state<1>();
add_port_latch_state<2>();
- add_port_latch_state<3>(); // FIXME: only if present
+ // PORTD has no latch registered since it is either input-only or nonexistent
add_port_ddr_state<0>();
add_port_ddr_state<1>();
add_port_ddr_state<2>();
@@ -576,12 +576,14 @@ void m6805_hmos_device::burn_cycles(unsigned count)
template <std::size_t N> void m6805_hmos_device::add_port_latch_state()
{
- state_add(M68705_LATCHA + N, util::string_format("LATCH%c", 'A' + N).c_str(), m_port_latch[N]).mask(~m_port_mask[N] & 0xff);
+ if (m_port_mask[N] != 0xff)
+ state_add(M68705_LATCHA + N, util::string_format("LATCH%c", 'A' + N).c_str(), m_port_latch[N]).mask(~m_port_mask[N] & 0xff).formatstr("%02X");
}
template <std::size_t N> void m6805_hmos_device::add_port_ddr_state()
{
- state_add(M68705_DDRA + N, util::string_format("DDR%c", 'A' + N).c_str(), m_port_ddr[N]).mask(~m_port_mask[N] & 0xff);
+ if (m_port_mask[N] != 0xff)
+ state_add(M68705_DDRA + N, util::string_format("DDR%c", 'A' + N).c_str(), m_port_ddr[N]).mask(~m_port_mask[N] & 0xff).formatstr("%02X");
}
void m68705_device::internal_map(address_map &map)
diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp
index 71462ce3275..2dcf4301ac4 100644
--- a/src/emu/distate.cpp
+++ b/src/emu/distate.cpp
@@ -129,6 +129,8 @@ void device_state_entry::format_from_mask()
}
// make up a format based on the mask
+ if (m_datamask == 0)
+ throw emu_fatalerror("%s state entry requires a nonzero mask\n", m_symbol.c_str());
int width = 0;
for (u64 tempmask = m_datamask; tempmask != 0; tempmask >>= 4)
width++;