From 04f51efddf7e437f5bd108e48d2ffa2aa07ea088 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Thu, 26 Mar 2020 15:29:34 +0100
Subject: [PATCH] Cleaning the debugger
---
sources/Debugger/CPUDebug.cpp | 25 ++++++++++++++++++-------
sources/Debugger/CPUDebug.hpp | 2 ++
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/sources/Debugger/CPUDebug.cpp b/sources/Debugger/CPUDebug.cpp
index 34e091c..9455189 100644
--- a/sources/Debugger/CPUDebug.cpp
+++ b/sources/Debugger/CPUDebug.cpp
@@ -24,12 +24,12 @@ namespace ComSquare::Debugger
this->_window->setAttribute(Qt::WA_DeleteOnClose);
this->_ui.setupUi(this->_window);
-
- this->_ui.disasembly->setModel(&this->_model);
- this->_ui.disasembly->setShowGrid(false);
- this->_ui.disasembly->verticalHeader()->hide();
- this->_ui.disasembly->horizontalHeader()->hide();
- this->_ui.disasembly->horizontalHeader()->setStretchLastSection(true);
+//
+// this->_ui.disasembly->setModel(&this->_model);
+// this->_ui.disasembly->setShowGrid(false);
+// this->_ui.disasembly->verticalHeader()->hide();
+// this->_ui.disasembly->horizontalHeader()->hide();
+// this->_ui.disasembly->horizontalHeader()->setStretchLastSection(true);
QMainWindow::connect(this->_ui.actionPause, &QAction::triggered, this, &CPUDebug::pause);
QMainWindow::connect(this->_ui.actionStep, &QAction::triggered, this, &CPUDebug::step);
@@ -213,7 +213,18 @@ namespace ComSquare::Debugger
std::string CPUDebug::_getInstructionString(uint24_t pc)
{
uint8_t opcode = this->_bus->read(pc++, true);
- return this->_instructions[opcode].name;
+
+ return this->_instructions[opcode].name + this->_getInstructionParameter(pc);
+ }
+
+ std::string CPUDebug::_getInstructionParameter(uint24_t pc)
+ {
+ Instruction instruction = this->_instructions[opcode];
+
+ switch (instruction.addressingMode) {
+ case ImmediateForA:
+ return this->_getImmediateAddrForA(pc);
+ }
}
int CPUDebug::RESB(uint24_t)
diff --git a/sources/Debugger/CPUDebug.hpp b/sources/Debugger/CPUDebug.hpp
index 82a57a0..0e29686 100644
--- a/sources/Debugger/CPUDebug.hpp
+++ b/sources/Debugger/CPUDebug.hpp
@@ -57,6 +57,8 @@ namespace ComSquare::Debugger
unsigned _executeInstruction(uint8_t opcode) override;
//! @brief Get a printable string representing an instruction at the program counter given as parameter.
std::string _getInstructionString(uint24_t pc);
+ //! @brief Get the parameter of the instruction as an hexadecimal string.
+ std::string _getInstructionParameter(uint24_t pc);
//! @brief Get a printable string representing the flags.
std::string _getFlagsString();
//! @brief Update the register's panel (accumulator, stack pointer...)