1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /********************************************************************* 4 5 dvstate.h 6 7 State debugger view. 8 9 ***************************************************************************/ 10 11 #ifndef MAME_EMU_DEBUG_DVSTATE_H 12 #define MAME_EMU_DEBUG_DVSTATE_H 13 14 #pragma once 15 16 #include "debugvw.h" 17 18 19 //************************************************************************** 20 // TYPE DEFINITIONS 21 //************************************************************************** 22 23 // data sources for state views 24 class debug_view_state_source : public debug_view_source 25 { 26 friend class debug_view_state; 27 28 public: 29 // construction/destruction 30 debug_view_state_source(std::string &&name, device_t &device); 31 32 private: 33 // internal state 34 device_state_interface *m_stateintf; // state interface 35 device_execute_interface *m_execintf; // execution interface 36 }; 37 38 39 // debug view for state 40 class debug_view_state : public debug_view 41 { 42 friend class debug_view_manager; 43 44 // construction/destruction 45 debug_view_state(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate); 46 virtual ~debug_view_state(); 47 48 protected: 49 // view overrides 50 virtual void view_update() override; 51 virtual void view_notify(debug_view_notification type) override; 52 53 private: 54 class state_item 55 { 56 public: 57 state_item(int index, const char *name, u8 valuechars); 58 state_item(const state_item &) = default; 59 state_item(state_item &&) = default; 60 state_item &operator=(const state_item &) = default; 61 state_item &operator=(state_item &&) = default; 62 value()63 u64 value() const { return m_currval; } changed()64 bool changed() const { return m_lastval != m_currval; } index()65 int index() const { return m_index; } value_length()66 u8 value_length() const { return m_vallen; } 67 68 void update(u64 newval, bool save); 69 70 private: 71 u64 m_lastval; // last value 72 u64 m_currval; // current value 73 int m_index; // index 74 u8 m_vallen; // number of value chars 75 76 public: 77 std::string m_symbol; // symbol 78 }; 79 80 // internal helpers 81 void enumerate_sources(); 82 void reset(); 83 void recompute(); 84 85 // internal state 86 int m_divider; // dividing column 87 u64 m_last_update; // execution counter at last update 88 std::vector<state_item> m_state_list; // state data 89 90 // constants 91 static constexpr int REG_DIVIDER = -10; 92 static constexpr int REG_CYCLES = -11; 93 static constexpr int REG_BEAMX = -12; 94 static constexpr int REG_BEAMX_S0 = -12; 95 static constexpr int REG_BEAMX_S1 = -13; 96 static constexpr int REG_BEAMX_S2 = -14; 97 static constexpr int REG_BEAMX_S3 = -15; 98 static constexpr int REG_BEAMX_S4 = -16; 99 static constexpr int REG_BEAMX_S5 = -17; 100 static constexpr int REG_BEAMX_S6 = -18; 101 static constexpr int REG_BEAMX_S7 = -19; 102 static constexpr int REG_BEAMY = -20; 103 static constexpr int REG_BEAMY_S0 = -20; 104 static constexpr int REG_BEAMY_S1 = -21; 105 static constexpr int REG_BEAMY_S2 = -22; 106 static constexpr int REG_BEAMY_S3 = -23; 107 static constexpr int REG_BEAMY_S4 = -24; 108 static constexpr int REG_BEAMY_S5 = -25; 109 static constexpr int REG_BEAMY_S6 = -26; 110 static constexpr int REG_BEAMY_S7 = -27; 111 static constexpr int REG_FRAME = -28; 112 static constexpr int REG_FRAME_S0 = -28; 113 static constexpr int REG_FRAME_S1 = -29; 114 static constexpr int REG_FRAME_S2 = -30; 115 static constexpr int REG_FRAME_S3 = -31; 116 static constexpr int REG_FRAME_S4 = -32; 117 static constexpr int REG_FRAME_S5 = -33; 118 static constexpr int REG_FRAME_S6 = -34; 119 static constexpr int REG_FRAME_S7 = -35; 120 }; 121 122 123 #endif // MAME_EMU_DEBUG_DVSTATE_H 124