From ba98efd5452595a483e88cc429b84e8eb3f0a3ea Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 4 May 2019 16:45:17 -0400 Subject: m68705: Prevent registration of illegal debug states for nonexistent port latches/DDRs distate: Sanity check (nw) --- src/devices/cpu/m6805/m68705.cpp | 10 ++++++---- src/emu/distate.cpp | 2 ++ 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 READ8_MEMBER(m68705_device::eprom_r) template 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 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 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++; -- cgit v1.2.3