diff options
Diffstat (limited to 'src/emu/distate.h')
-rw-r--r-- | src/emu/distate.h | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/emu/distate.h b/src/emu/distate.h index 5888313440e..b4727c259f4 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -27,8 +27,7 @@ enum { STATE_GENPC = -1, // generic program counter (live) STATE_GENPCBASE = -2, // generic program counter (base of current instruction) - STATE_GENSP = -3, // generic stack pointer - STATE_GENFLAGS = -4 // generic flags + STATE_GENFLAGS = -3 // generic flags }; @@ -105,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 @@ -287,20 +286,21 @@ class device_state_interface : public device_interface friend class device_state_entry; public: + using entrylist_type = std::vector<std::unique_ptr<device_state_entry> >; + // construction/destruction device_state_interface(const machine_config &mconfig, device_t &device); virtual ~device_state_interface(); // configuration access - const std::vector<std::unique_ptr<device_state_entry>> &state_entries() const { return m_state_list; } + const entrylist_type &state_entries() const { return m_state_list; } // state getters - u64 state_int(int index) { const device_state_entry *entry = state_find_entry(index); return (entry == nullptr) ? 0 : entry->value(); } + u64 state_int(int index) const { const device_state_entry *entry = state_find_entry(index); return (entry == nullptr) ? 0 : entry->value(); } std::string state_string(int index) const { const device_state_entry *entry = state_find_entry(index); return (entry == nullptr) ? std::string("???") : entry->to_string(); } - offs_t pc() { return state_int(STATE_GENPC); } - offs_t pcbase() { return state_int(STATE_GENPCBASE); } - offs_t sp() { return state_int(STATE_GENSP); } - u64 flags() { return state_int(STATE_GENFLAGS); } + offs_t pc() const { return state_int(STATE_GENPC); } + offs_t pcbase() const { return state_int(STATE_GENPCBASE); } + u64 flags() const { return state_int(STATE_GENFLAGS); } // state setters void set_state_int(int index, u64 value) { const device_state_entry *entry = state_find_entry(index); if (entry != nullptr) entry->set_value(value); } @@ -309,10 +309,6 @@ public: // find the entry for a given index const device_state_entry *state_find_entry(int index) const; - // deliberately ambiguous functions; if you have the state interface - // just use it directly - device_state_interface &state() { return *this; } - public: // protected eventually // add a new state register item @@ -363,17 +359,16 @@ 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<std::unique_ptr<device_state_entry>> 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 + entrylist_type 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 -typedef device_interface_iterator<device_state_interface> state_interface_iterator; +typedef device_interface_enumerator<device_state_interface> state_interface_enumerator; |