diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp index 8c94a0662f8..6f9ef5f7926 100644 --- a/src/devices/cpu/tms9900/tms9900.cpp +++ b/src/devices/cpu/tms9900/tms9900.cpp @@ -341,7 +341,7 @@ void tms99xx_device::state_import(const device_state_entry &entry) break; default: // Workspace registers - if (index <= TMS9900_R15 && started()) + if (index <= TMS9900_R15) write_workspace_register_debug(index-TMS9900_R0, (uint16_t)m_state_any); break; } @@ -373,7 +373,7 @@ void tms99xx_device::state_export(const device_state_entry &entry) default: // Workspace registers if (index <= TMS9900_R15) - m_state_any = started() ? read_workspace_register_debug(index-TMS9900_R0) : 0; + m_state_any = read_workspace_register_debug(index-TMS9900_R0); break; } } diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index 6cbb64a350c..c1b07bcbc70 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -339,7 +339,7 @@ void tms9995_device::state_import(const device_state_entry &entry) break; default: // Workspace registers - if (index <= TMS9995_R15 && started()) + if (index <= TMS9995_R15) write_workspace_register_debug(index-TMS9995_R0, (uint16_t)m_state_any); break; } @@ -371,7 +371,7 @@ void tms9995_device::state_export(const device_state_entry &entry) default: // Workspace registers if (index <= TMS9995_R15) - m_state_any = started() ? read_workspace_register_debug(index-TMS9995_R0) : 0; + m_state_any = read_workspace_register_debug(index-TMS9995_R0); break; } } diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index d0ade8edc4b..d234cd4a69b 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -101,7 +101,7 @@ device_state_entry &device_state_entry::formatstr(const char *_format) // set the DSF_CUSTOM_STRING flag by formatting with a nullptr string m_flags &= ~DSF_CUSTOM_STRING; - format(nullptr); + format(nullptr, 0); return *this; } @@ -201,12 +201,10 @@ double device_state_entry::entry_dvalue() const // pieces of indexed state as a string //------------------------------------------------- -std::string device_state_entry::format(const char *string, bool maxout) const +std::string device_state_entry::format(const char *string, u64 result, bool maxout) const { - std::string dest; - u64 result = value(); - // parse the format + std::string dest; bool leadzero = false; bool percent = false; bool explicitsign = false; @@ -400,7 +398,7 @@ std::string device_state_entry::to_string() const custom = string_format("%-12G", entry_dvalue()); // ask the entry to format itself - return format(custom.c_str()); + return format(custom.c_str(), value()); } @@ -412,7 +410,7 @@ std::string device_state_entry::to_string() const int device_state_entry::max_length() const { // ask the entry to format itself maximally - return format("", true).length(); + return format("", value(), true).length(); } diff --git a/src/emu/distate.h b/src/emu/distate.h index f0cf04eadeb..182010c8142 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -104,10 +104,10 @@ protected: private: // helpers void format_from_mask(); - std::string format(const char *string, bool maxout = false) const; + std::string format(const char *string, u64 result, bool maxout = false) const; // statics - static const u64 k_decimal_divisor[20]; // divisors for outputting decimal values + static const u64 k_decimal_divisor[20]; // divisors for outputting decimal values // public state description device_state_interface *m_device_state; // link to parent device state @@ -357,13 +357,12 @@ protected: virtual void interface_post_start() override; // constants - static constexpr int FAST_STATE_MIN = -4; // range for fast state - static constexpr int FAST_STATE_MAX = 256; // lookups + static constexpr int FAST_STATE_MIN = -4; // range for fast state + static constexpr int FAST_STATE_MAX = 256; // lookups // state - std::vector> m_state_list; // head of state list - device_state_entry * m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN]; - // fast access to common entries + std::vector> m_state_list; // head of state list + device_state_entry *m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN]; // fast access to common entries }; // iterator