ComSquare
CPUDebug.hpp
Go to the documentation of this file.
1 //
2 // Created by anonymus-raccoon on 2/14/20.
3 //
4 
5 #pragma once
6 
9 #include "ui/ui_cpuView.h"
10 #include "Models/Ints.hpp"
11 #include "Memory/MemoryBus.hpp"
12 #include "CPU/Instruction.hpp"
13 #include <QtWidgets/QStyledItemDelegate>
14 #include <filesystem>
15 #include <optional>
16 #include <QTimer>
17 
18 namespace ComSquare
19 {
20  class SNES;
21 
22  namespace CPU
23  {
24  class CPU;
25  }
26 
27  namespace Debugger::CPU
28  {
29  class CPUDebug;
30 
33  {
35  uint8_t opcode;
37  std::string name;
39  std::string params;
41  std::string proceededParams;
42  };
43 
45  class StackModel : public QAbstractTableModel
46  {
47  Q_OBJECT
48  private:
51 
52  public:
53  explicit StackModel(Memory::IMemoryBus &bus, CPUDebug &cpu);
54  StackModel(const StackModel &) = delete;
55  const StackModel &operator=(const StackModel &) = delete;
56  ~StackModel() override = default;
57 
59  [[nodiscard]] int rowCount(const QModelIndex &parent) const override;
61  [[nodiscard]] int columnCount(const QModelIndex &parent) const override;
63  [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
65  [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
66  };
67 
69  class HistoryModel : public QAbstractTableModel
70  {
71  Q_OBJECT
72  private:
73  std::vector<ExecutedInstruction> _instructions = {};
74 
75  public:
76  HistoryModel();
77  HistoryModel(const HistoryModel &) = delete;
78  const HistoryModel &operator=(const HistoryModel &) = delete;
79  ~HistoryModel() override = default;
80 
82  void log(const ExecutedInstruction &);
84  void clear();
85 
87  [[nodiscard]] int rowCount(const QModelIndex &parent) const override;
89  [[nodiscard]] int columnCount(const QModelIndex &parent) const override;
91  [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
93  [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
94  };
95 
97  class DisassemblyModel : public QAbstractTableModel
98  {
99  Q_OBJECT
100  private:
102 
103  public:
104  explicit DisassemblyModel(CPUDebug &cpu);
105  DisassemblyModel(const DisassemblyModel &) = delete;
106  const DisassemblyModel &operator=(const DisassemblyModel &) = delete;
107  ~DisassemblyModel() override = default;
108 
110  [[nodiscard]] int rowCount(const QModelIndex &parent) const override;
112  [[nodiscard]] int columnCount(const QModelIndex &parent) const override;
114  [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
116  [[nodiscard]] QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
117  };
118 
120  class RowPainter : public QStyledItemDelegate
121  {
122  Q_OBJECT
123  private:
126 
127  public:
128  explicit RowPainter(CPUDebug &cpu, QObject *parent = nullptr);
129  RowPainter &operator=(const RowPainter &) = delete;
130  ~RowPainter() override = default;
131 
132  protected:
133  [[nodiscard]] QSize sizeHint(const QStyleOptionViewItem &options, const QModelIndex &index) const override;
134  void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
135  };
136 
138  {
142  };
143 
146  {
149  bool mFlag = true;
152  bool xFlag = true;
154  bool isEmulationMode = true;
157  };
158 
161  {
165  std::string argument;
167  uint8_t opcode;
170 
173  std::string argument,
174  uint8_t opcode);
177  ~DisassembledInstruction() = default;
178  };
179 
181  struct Breakpoint
182  {
186  bool oneTime;
187  };
188 
190  struct Label
191  {
195  std::string name;
197  std::optional<unsigned> size;
198  };
199 
201  class CPUDebug : public QObject
202  {
203  Q_OBJECT
204  private:
210  QTimer _timer;
212  Ui::CPUView _ui;
222  bool _isPaused = true;
224  bool _isStepping = false;
228  std::vector<Label> _labels;
231 
233  void _loadLabels(std::filesystem::path romPath);
235  void _logInstruction();
240  std::vector<DisassembledInstruction> _disassemble(uint24_t startAddr, uint24_t size,
241  DisassemblyContext &ctx);
243  void _updateDisassembly(uint24_t start, uint24_t refreshSize = 0xFF);
247  std::string _getInstructionParameter(const ComSquare::CPU::Instruction &instruction,
248  uint24_t pc,
249  DisassemblyContext &ctx) const;
251  void _updateRegistersPanel();
252 
255  [[nodiscard]] std::string _getImmediateValue(uint24_t pc, bool dual) const;
257  [[nodiscard]] std::string _getAbsoluteValue(uint24_t pc) const;
259  [[nodiscard]] std::string _getAbsoluteLongValue(uint24_t pc) const;
261  [[nodiscard]] std::string _getDirectValue(uint24_t pc) const;
263  [[nodiscard]] std::string _getDirectIndirectValue(uint24_t pc) const;
265  [[nodiscard]] std::string _getDirectIndirectLongValue(uint24_t pc) const;
267  [[nodiscard]] std::string _getAbsoluteIndexByXValue(uint24_t pc) const;
269  [[nodiscard]] std::string _getAbsoluteIndexByXLongValue(uint24_t pc) const;
271  [[nodiscard]] std::string _getAbsoluteIndexByYValue(uint24_t pc) const;
273  [[nodiscard]] std::string _getDirectIndexedByXValue(uint24_t pc) const;
275  [[nodiscard]] std::string _getDirectIndexedByYValue(uint24_t pc) const;
277  [[nodiscard]] std::string _getDirectIndexedByXIndirectValue(uint24_t pc) const;
279  [[nodiscard]] std::string _getDirectIndirectIndexedByYValue(uint24_t pc) const;
281  [[nodiscard]] std::string _getDirectIndirectIndexedByYLongValue(uint24_t pc) const;
283  [[nodiscard]] std::string _getStackRelativeValue(uint24_t pc) const;
285  [[nodiscard]] std::string _getStackRelativeIndirectIndexedByYValue(uint24_t pc) const;
287  [[nodiscard]] std::string _getAbsoluteIndirectValue(uint24_t pc) const;
289  [[nodiscard]] std::string _getAbsoluteIndirectIndexedByXValue(uint24_t pc) const;
291  [[nodiscard]] std::string _getAbsoluteIndirectLongValue(uint24_t pc) const;
292 
293  public slots:
295  unsigned update();
296  public:
298  static void showError(const DebuggableError &error);
301  void pause(bool forcePause = false);
303  void step();
305  void next();
307  void clearHistory();
309  void toggleBreakpoint(int logicalIndex);
311  std::vector<DisassembledInstruction> disassembled;
313  std::vector<Breakpoint> breakpoints;
315  [[nodiscard]] std::string getProceededParameters() const;
317  [[nodiscard]] uint24_t getPC() const;
319  [[nodiscard]] uint16_t getStackPointer() const;
322 
324  CPUDebug(ComSquare::CPU::CPU &cpu, SNES &snes);
325  CPUDebug(const CPUDebug &) = delete;
326  CPUDebug &operator=(const CPUDebug &) = delete;
327  ~CPUDebug() override;
328 
330  void focus();
331  };
332  }// namespace Debugger
333 }// namespace ComSquare
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndexedByYValue
std::string _getDirectIndexedByYValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct index by y addressing mode.
Definition: Disassembly.cpp:181
ComSquare::Debugger::CPU::CPUDebug::_disassemble
std::vector< DisassembledInstruction > _disassemble(uint24_t startAddr, uint24_t size, DisassemblyContext &ctx)
Disassemble part of the memory (using the bus) and parse it to a map of address and disassembled inst...
Definition: Disassembly.cpp:25
ComSquare::Debugger::CPU::DisassembledInstruction::address
uint24_t address
The address of the instruction.
Definition: CPUDebug.hpp:163
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteLongValue
std::string _getAbsoluteLongValue(uint24_t pc) const
Return a printable string corresponding to the value of an absolute long addressing mode.
Definition: Disassembly.cpp:163
ComSquare::Debugger::CPU::CPUDebug::getPC
uint24_t getPC() const
Return the current program counter of this CPU.
Definition: CPUDebug.cpp:256
ComSquare::Debugger::CPU::Label
Struct representing a label.
Definition: CPUDebug.hpp:190
ComSquare::Debugger::CPU::DisassemblyModel::rowCount
int rowCount(const QModelIndex &parent) const override
The number of row the table has.
Definition: CPUDebug.cpp:303
MemoryBus.hpp
ComSquare::Debugger::CPU::CPUDebug::clearHistory
void clearHistory()
Clear the history panel.
Definition: CPUDebug.cpp:216
ComSquare::Debugger::CPU::CPUDebug::_ui
Ui::CPUView _ui
A widget that contain the whole UI.
Definition: CPUDebug.hpp:212
Ints.hpp
ComSquare::Debugger::CPU::StackModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Override the headers to use hex values.
Definition: CPUDebug.cpp:426
ComSquare::Debugger::CPU::Unsafe
@ Unsafe
Definition: CPUDebug.hpp:140
ComSquare::Debugger::CPU::CPUDebug::next
void next()
Next - Continue running instructions until the next line is reached.
Definition: CPUDebug.cpp:160
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteValue
std::string _getAbsoluteValue(uint24_t pc) const
Return a printable string corresponding to the value of an absolute addressing mode.
Definition: Disassembly.cpp:157
ComSquare::Debugger::CPU::CPUDebug::breakpoints
std::vector< Breakpoint > breakpoints
The list of breakpoints the user has set.
Definition: CPUDebug.hpp:313
ComSquare::CPU::CPU
The main CPU.
Definition: CPU.hpp:26
ComSquare::Debugger::CPU::ExecutedInstruction::name
std::string name
The name of the instruction.
Definition: CPUDebug.hpp:37
ComSquare::Debugger::CPU::StackModel
The qt model that show the stack.
Definition: CPUDebug.hpp:45
ComSquare::Debugger::CPU::Safe
@ Safe
Definition: CPUDebug.hpp:139
ComSquare::Debugger::CPU::CPUDebug::_window
ClosableWindow * _window
The QT window for this debugger.
Definition: CPUDebug.hpp:208
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndirectValue
std::string _getAbsoluteIndirectValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indirect addressing mode.
Definition: Disassembly.cpp:258
ComSquare::Debugger::CPU::CPUDebug::_logInstruction
void _logInstruction()
Add the instruction under the PC to the history log.
Definition: CPUDebug.cpp:125
ComSquare::Debugger::CPU::DisassemblyModel::data
QVariant data(const QModelIndex &index, int role) const override
Return a data representing the table cell.
Definition: CPUDebug.cpp:308
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndirectLongValue
std::string _getAbsoluteIndirectLongValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indirect long addressing mode.
Definition: Disassembly.cpp:264
ComSquare::Debugger::CPU::DisassembledInstruction
Struct representing an instruction in an human readable way (created by disassembling the rom).
Definition: CPUDebug.hpp:160
ComSquare::Debugger::CPU::StackModel::data
QVariant data(const QModelIndex &index, int role) const override
Return a data representing the table cell.
Definition: CPUDebug.cpp:405
ComSquare::Debugger::CPU::CPUDebug::_getImmediateValue
std::string _getImmediateValue(uint24_t pc, bool dual) const
Return a printable string corresponding to the value of a 8 or 16 bits immediate addressing mode.
Definition: Disassembly.cpp:141
ComSquare::Debugger::CPU::TrustLevel
TrustLevel
Definition: CPUDebug.hpp:137
ComSquare::Debugger::CPU::CPUDebug::_updateRegistersPanel
void _updateRegistersPanel()
Update the register's panel (accumulator, stack pointer...)
Definition: CPUDebug.cpp:182
ComSquare::Debugger::CPU::DisassemblyContext::mFlag
bool mFlag
The accumulator and Memory width flag (in native mode only) - 0 = 16 bits mode, 1 = 8 bits mode....
Definition: CPUDebug.hpp:149
ComSquare::Debugger::CPU::HistoryModel::log
void log(const ExecutedInstruction &)
Log a new instruction.
Definition: CPUDebug.cpp:488
ComSquare::Debugger::CPU::DisassemblyContext::isEmulationMode
bool isEmulationMode
Is the CPU emulating a 6502? If yes, some instructions don't change flags the same way.
Definition: CPUDebug.hpp:154
ComSquare::Debugger::CPU::HistoryModel::HistoryModel
HistoryModel()
ComSquare::Debugger::CPU::HistoryModel::data
QVariant data(const QModelIndex &index, int role) const override
Return a data representing the table cell.
Definition: CPUDebug.cpp:448
ComSquare::Debugger::CPU::CPUDebug::_painter
RowPainter _painter
A custom painter that highlight breakpoints and the PC's position.
Definition: CPUDebug.hpp:216
ComSquare::Debugger::ClosableWindow
Definition: ClosableWindow.hpp:12
ComSquare::Debugger::CPU::CPUDebug::focus
void focus()
Focus the debugger's window.
Definition: CPUDebug.cpp:251
ComSquare::Debugger::CPU::CPUDebug::_historyModel
HistoryModel _historyModel
The history model.
Definition: CPUDebug.hpp:220
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndirectLongValue
std::string _getDirectIndirectLongValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct indirect long addressing mode.
Definition: Disassembly.cpp:195
ComSquare::Debugger::CPU::StackModel::_bus
Memory::IMemoryBus & _bus
Definition: CPUDebug.hpp:49
ComSquare::Debugger::CPU::StackModel::rowCount
int rowCount(const QModelIndex &parent) const override
The number of row the table has.
Definition: CPUDebug.cpp:395
ComSquare::Debugger::CPU::HistoryModel::operator=
const HistoryModel & operator=(const HistoryModel &)=delete
ComSquare::Debugger::CPU::HistoryModel::_instructions
std::vector< ExecutedInstruction > _instructions
Definition: CPUDebug.hpp:73
ComSquare::Debugger::CPU::DisassemblyModel::~DisassemblyModel
~DisassemblyModel() override=default
ComSquare::CPU::Instruction
Struct containing basic information about instructions.
Definition: Instruction.hpp:51
ComSquare::Debugger::CPU::HistoryModel::clear
void clear()
Remove every instructions of the history.
Definition: CPUDebug.cpp:497
ComSquare::Debugger::CPU::CPUDebug::_labels
std::vector< Label > _labels
A list of labels and their size.
Definition: CPUDebug.hpp:228
ComSquare::Debugger::CPU::StackModel::~StackModel
~StackModel() override=default
uint24_t
unsigned uint24_t
Definition: Ints.hpp:10
ComSquare::Debugger::CPU::DisassembledInstruction::operator=
DisassembledInstruction & operator=(const DisassembledInstruction &)=default
ComSquare::Debugger::CPU::DisassemblyContext::level
TrustLevel level
Sometimes, the flags can't be tracked correctly after an instruction so the next instructions may not...
Definition: CPUDebug.hpp:156
ComSquare::Debugger::CPU::ExecutedInstruction::opcode
uint8_t opcode
Opcode of the instruction.
Definition: CPUDebug.hpp:35
ComSquare::Debugger::CPU::CPUDebug::_getInstructionParameter
std::string _getInstructionParameter(const ComSquare::CPU::Instruction &instruction, uint24_t pc, DisassemblyContext &ctx) const
Get the parameter of the instruction as an hexadecimal string.
Definition: Disassembly.cpp:84
ComSquare::Debugger::CPU::DisassemblyModel::DisassemblyModel
DisassemblyModel(CPUDebug &cpu)
Definition: CPUDebug.cpp:294
ComSquare::Debugger::CPU::HistoryModel
The qt model that show the history.
Definition: CPUDebug.hpp:69
ComSquare::Debugger::CPU::DisassembledInstruction::opcode
uint8_t opcode
The opcode of the instruction.
Definition: CPUDebug.hpp:167
ComSquare::Debugger::CPU::Label::name
std::string name
The name of this label.
Definition: CPUDebug.hpp:195
ComSquare::Debugger::CPU::CPUDebug::_stackModel
StackModel _stackModel
The stack viewer's model.
Definition: CPUDebug.hpp:218
ComSquare::Debugger::CPU::Breakpoint::oneTime
bool oneTime
If this is true, the breakpoint will be deleted on first hit and won't be shown on the disassembly vi...
Definition: CPUDebug.hpp:186
ComSquare::Debugger::CPU::DisassemblyContext::xFlag
bool xFlag
The indeX register width flag (in native mode only) - 0 = 16 bits mode, 1 = 8 bits mode OR the Break ...
Definition: CPUDebug.hpp:152
ComSquare::Debugger::CPU::CPUDebug::_parseInstruction
DisassembledInstruction _parseInstruction(uint24_t pc, DisassemblyContext &ctx) const
Parse the instruction at the program counter given to have human readable information.
Definition: Disassembly.cpp:76
ComSquare::Debugger::CPU::CPUDebug::pause
void pause(bool forcePause=false)
Pause/Resume the CPU.
Definition: CPUDebug.cpp:142
ComSquare::SNES
Container of all the components of the SNES.
Definition: SNES.hpp:32
ComSquare::Debugger::CPU::CPUDebug::disassembled
std::vector< DisassembledInstruction > disassembled
The list of disassembled instructions to show on the debugger.
Definition: CPUDebug.hpp:311
ComSquare::Debugger::CPU::CPUDebug::_getStackRelativeValue
std::string _getStackRelativeValue(uint24_t pc) const
Return a printable string corresponding to the value of a stack relative addressing mode.
Definition: Disassembly.cpp:248
ComSquare::Debugger::CPU::ExecutedInstruction::params
std::string params
Readable parameters (disassembly style)
Definition: CPUDebug.hpp:39
ComSquare::Debugger::CPU::Compromised
@ Compromised
Definition: CPUDebug.hpp:141
DebuggableError.hpp
ComSquare::Debugger::CPU::CPUDebug::operator=
CPUDebug & operator=(const CPUDebug &)=delete
ComSquare::Debugger::CPU::RowPainter::sizeHint
QSize sizeHint(const QStyleOptionViewItem &options, const QModelIndex &index) const override
Definition: CPUDebug.cpp:385
ComSquare::Debugger::CPU::RowPainter::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: CPUDebug.cpp:363
ComSquare::Debugger::CPU::Label::size
std::optional< unsigned > size
The size of the definition related to this label.
Definition: CPUDebug.hpp:197
ComSquare::Debugger::CPU::CPUDebug::_timer
QTimer _timer
Internal timer used for update intervals.
Definition: CPUDebug.hpp:210
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndexByXLongValue
std::string _getAbsoluteIndexByXLongValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indexed by x long addressing mode.
Definition: Disassembly.cpp:212
ComSquare::Debugger::CPU::DisassembledInstruction::~DisassembledInstruction
~DisassembledInstruction()=default
ComSquare::Memory::IMemoryBus
The memory bus is the component responsible of mapping addresses to components address and transmitti...
Definition: IMemoryBus.hpp:19
ComSquare::Debugger::CPU::DisassembledInstruction::level
TrustLevel level
Are we sure that this instruction has been correctly disassembled?
Definition: CPUDebug.hpp:169
ComSquare::Debugger::CPU::CPUDebug::_updateDisassembly
void _updateDisassembly(uint24_t start, uint24_t refreshSize=0xFF)
Update disassembly with the new state of the processor.
Definition: CPUDebug.cpp:221
ComSquare::Debugger::CPU::StackModel::_cpu
CPUDebug & _cpu
Definition: CPUDebug.hpp:50
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndexByXValue
std::string _getAbsoluteIndexByXValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indexed by x addressing mode.
Definition: Disassembly.cpp:200
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndexByYValue
std::string _getAbsoluteIndexByYValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indexed by y addressing mode.
Definition: Disassembly.cpp:206
ComSquare::Debugger::CPU::CPUDebug::_isStepping
bool _isStepping
If this is set to true, the CPU will execute one instruction and pause itself.
Definition: CPUDebug.hpp:224
ComSquare::Debugger::CPU::CPUDebug::~CPUDebug
~CPUDebug() override
Definition: CPUDebug.cpp:81
ComSquare::Debugger::CPU::StackModel::operator=
const StackModel & operator=(const StackModel &)=delete
ComSquare::Debugger::CPU::CPUDebug
A window that show registers and the disassembly of a CPU.
Definition: CPUDebug.hpp:201
ComSquare::Debugger::CPU::Breakpoint
Struct representing a breakpoint set by the user or by the app.
Definition: CPUDebug.hpp:181
ComSquare::Debugger::CPU::RowPainter::~RowPainter
~RowPainter() override=default
CPU
Label CPU
Definition: form.txt:1
ComSquare::Debugger::CPU::CPUDebug::update
unsigned update()
Update the current debugger and the underlying CPU.
Definition: CPUDebug.cpp:87
ComSquare::Debugger::CPU::DisassemblyModel::_cpu
CPUDebug & _cpu
Definition: CPUDebug.hpp:101
ComSquare::Debugger::CPU::DisassemblyModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Override the headers to use hex values.
Definition: CPUDebug.cpp:337
ComSquare::Debugger::CPU::CPUDebug::getProceededParameters
std::string getProceededParameters() const
Get a string representing the actual value of the arguments of the next instruction to execute.
Definition: CPUDebug.cpp:266
ComSquare::Debugger::CPU::StackModel::StackModel
StackModel(Memory::IMemoryBus &bus, CPUDebug &cpu)
Definition: CPUDebug.cpp:390
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndirectIndexedByYValue
std::string _getDirectIndirectIndexedByYValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct indirect index by y addressing mode.
Definition: Disassembly.cpp:230
ComSquare::Debugger::CPU::Breakpoint::address
uint24_t address
The address of the breakpoint.
Definition: CPUDebug.hpp:184
ComSquare::DebuggableError
Definition: DebuggableError.hpp:11
ComSquare::Debugger::CPU::Label::address
uint24_t address
The address of this label.
Definition: CPUDebug.hpp:193
ComSquare::Debugger::CPU::CPUDebug::_snes
SNES & _snes
A reference to the snes (to disable the debugger).
Definition: CPUDebug.hpp:226
ComSquare::Debugger::CPU::CPUDebug::toggleBreakpoint
void toggleBreakpoint(int logicalIndex)
Called when the user clicks on a section header. It enable/disable a breakpoint for this address.
Definition: CPUDebug.cpp:169
ClosableWindow.hpp
ComSquare::Debugger::CPU::CPUDebug::initialStackPointer
uint16_t initialStackPointer
The stack pointer before the execution of any instructions.
Definition: CPUDebug.hpp:321
ComSquare::Debugger::CPU::CPUDebug::step
void step()
Step - Execute a single instruction.
Definition: CPUDebug.cpp:154
ComSquare::Debugger::CPU::HistoryModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Override the headers to use hex values.
Definition: CPUDebug.cpp:470
ComSquare::Debugger::CPU::CPUDebug::_getAbsoluteIndirectIndexedByXValue
std::string _getAbsoluteIndirectIndexedByXValue(uint24_t pc) const
Return a printable string corresponding to the value of a absolute indirect indexed by x addressing m...
Definition: Disassembly.cpp:273
ComSquare::Debugger::CPU::CPUDebug::_cpu
ComSquare::CPU::CPU & _cpu
The basic CPU to debug.
Definition: CPUDebug.hpp:206
ComSquare::Debugger::CPU::CPUDebug::getStackPointer
uint16_t getStackPointer() const
Return the current stack pointer.
Definition: CPUDebug.cpp:261
ComSquare::Debugger::CPU::CPUDebug::_getDisassemblyContext
DisassemblyContext _getDisassemblyContext()
Return a disassembly context representing the current state of the processor.
Definition: CPUDebug.cpp:246
ComSquare::Debugger::CPU::ExecutedInstruction
An instruction that has already been executed. Used for the history viewer.
Definition: CPUDebug.hpp:32
ComSquare::Debugger::CPU::HistoryModel::rowCount
int rowCount(const QModelIndex &parent) const override
The number of row the table has.
Definition: CPUDebug.cpp:438
ComSquare::Debugger::CPU::CPUDebug::_callback
int _callback
The callback ID for the on reset of the CPU.
Definition: CPUDebug.hpp:230
ComSquare::Debugger::CPU::DisassembledInstruction::argument
std::string argument
A string representing the argument with the right addressing mode.
Definition: CPUDebug.hpp:165
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndexedByXValue
std::string _getDirectIndexedByXValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct index by x addressing mode.
Definition: Disassembly.cpp:172
ComSquare::Debugger::CPU::CPUDebug::_loadLabels
void _loadLabels(std::filesystem::path romPath)
Load labels from a symbol file.
Definition: CPUDebug.cpp:280
ComSquare::Debugger::CPU::DisassemblyModel::operator=
const DisassemblyModel & operator=(const DisassemblyModel &)=delete
ComSquare::Debugger::CPU::RowPainter::RowPainter
RowPainter(CPUDebug &cpu, QObject *parent=nullptr)
Definition: CPUDebug.cpp:359
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndirectValue
std::string _getDirectIndirectValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct indirect addressing mode.
Definition: Disassembly.cpp:190
ComSquare::Debugger::CPU::CPUDebug::_getStackRelativeIndirectIndexedByYValue
std::string _getStackRelativeIndirectIndexedByYValue(uint24_t pc) const
Return a printable string corresponding to the value of a stack relative indirect indexed by y addres...
Definition: Disassembly.cpp:253
ComSquare::Debugger::CPU::CPUDebug::showError
static void showError(const DebuggableError &error)
Show an error dialog related to an exception.
Definition: CPUDebug.cpp:133
ComSquare::Debugger::CPU::CPUDebug::_getDirectValue
std::string _getDirectValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct addressing mode.
Definition: Disassembly.cpp:152
ComSquare::Debugger::CPU::ExecutedInstruction::proceededParams
std::string proceededParams
The address to read from after processing the parameter.
Definition: CPUDebug.hpp:41
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndirectIndexedByYLongValue
std::string _getDirectIndirectIndexedByYLongValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct indirect index by y long addressing ...
Definition: Disassembly.cpp:239
ComSquare::Debugger::CPU::DisassemblyContext
Struct used to emulate the state of the processor during the disassembly since instructions take a di...
Definition: CPUDebug.hpp:145
ComSquare::Debugger::CPU::DisassemblyModel::columnCount
int columnCount(const QModelIndex &parent) const override
The number of column the table has.
Definition: CPUDebug.cpp:298
ComSquare::Debugger::CPU::HistoryModel::~HistoryModel
~HistoryModel() override=default
ComSquare::Debugger::CPU::RowPainter::operator=
RowPainter & operator=(const RowPainter &)=delete
ComSquare::Debugger::CPU::DisassembledInstruction::DisassembledInstruction
DisassembledInstruction(const ComSquare::CPU::Instruction &instruction, uint24_t address, std::string argument, uint8_t opcode)
Definition: Disassembly.cpp:14
ComSquare::Debugger::CPU::RowPainter::_cpu
CPUDebug & _cpu
The CPU to get PC and breakpoints from.
Definition: CPUDebug.hpp:125
ComSquare::Debugger::CPU::DisassemblyModel
The qt model that show the disassembly.
Definition: CPUDebug.hpp:97
Instruction.hpp
ComSquare
Definition: APU.cpp:12
ComSquare::Debugger::CPU::StackModel::columnCount
int columnCount(const QModelIndex &parent) const override
The number of column the table has.
Definition: CPUDebug.cpp:400
ComSquare::Debugger::CPU::CPUDebug::_isPaused
bool _isPaused
If this is set to true, the execution of the CPU will be paused.
Definition: CPUDebug.hpp:222
ComSquare::Debugger::CPU::CPUDebug::CPUDebug
CPUDebug(ComSquare::CPU::CPU &cpu, SNES &snes)
Convert a basic CPU to a debugging CPU.
Definition: CPUDebug.cpp:19
ComSquare::Debugger::CPU::CPUDebug::_getDirectIndexedByXIndirectValue
std::string _getDirectIndexedByXIndirectValue(uint24_t pc) const
Return a printable string corresponding to the value of a direct indirect index by x addressing mode.
Definition: Disassembly.cpp:221
ComSquare::Debugger::CPU::HistoryModel::columnCount
int columnCount(const QModelIndex &parent) const override
The number of column the table has.
Definition: CPUDebug.cpp:443
ComSquare::Debugger::CPU::RowPainter
The qt class that highlight breakpoints and the PC's position.
Definition: CPUDebug.hpp:120
ComSquare::Debugger::CPU::CPUDebug::_model
DisassemblyModel _model
The disassembly viewer's model.
Definition: CPUDebug.hpp:214