mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-04 10:44:37 +00:00
Creating the switch case for default names
This commit is contained in:
@@ -4,10 +4,12 @@
|
||||
|
||||
#include "DebugCpu.hpp"
|
||||
|
||||
using namespace ComSquare::CPU;
|
||||
|
||||
namespace ComSquare::Debugger
|
||||
{
|
||||
CPUDebug::CPUDebug(ComSquare::CPU::CPU &basicCPU, SNES &snes)
|
||||
: CPU::CPU(basicCPU), QMainWindow(), _ui(), _snes(snes)
|
||||
CPUDebug::CPUDebug(CPU &basicCPU, SNES &snes)
|
||||
: CPU(basicCPU), QMainWindow(), _ui(), _snes(snes)
|
||||
{
|
||||
this->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
this->setAttribute(Qt::WA_QuitOnClose, false);
|
||||
@@ -31,15 +33,10 @@ namespace ComSquare::Debugger
|
||||
|
||||
unsigned CPUDebug::_executeInstruction(uint8_t opcode)
|
||||
{
|
||||
this->_ui.logger->append(this->_getInstructionString(opcode).c_str());
|
||||
this->_ui.logger->append(CPUDebug::_getInstructionString(opcode).c_str());
|
||||
return CPU::_executeInstruction(opcode);
|
||||
}
|
||||
|
||||
std::string CPUDebug::_getInstructionString(uint8_t opcode)
|
||||
{
|
||||
return "Super";
|
||||
}
|
||||
|
||||
void CPUDebug::pause()
|
||||
{
|
||||
this->_isPaused = !this->_isPaused;
|
||||
@@ -48,4 +45,116 @@ namespace ComSquare::Debugger
|
||||
else
|
||||
this->_ui.actionPause->setText("Pause");
|
||||
}
|
||||
|
||||
std::string CPUDebug::_getInstructionString(uint8_t opcode)
|
||||
{
|
||||
switch (opcode) {
|
||||
case Instructions::BRK: return "BRK";
|
||||
|
||||
case Instructions::RTI: return "RTI";
|
||||
|
||||
case Instructions::ADC_IM: return "ADC";
|
||||
case Instructions::ADC_ABS: return "ADC";
|
||||
case Instructions::ADC_ABSl: return "ADC";
|
||||
case Instructions::ADC_DP: return "ADC";
|
||||
case Instructions::ADC_DPi: return "ADC";
|
||||
case Instructions::ADC_DPil: return "ADC";
|
||||
case Instructions::ADC_ABSX: return "ADC";
|
||||
case Instructions::ADC_ABSXl:return "ADC";
|
||||
case Instructions::ADC_ABSY: return "ADC";
|
||||
case Instructions::ADC_DPX: return "ADC";
|
||||
case Instructions::ADC_DPXi: return "ADC";
|
||||
case Instructions::ADC_DPYi: return "ADC";
|
||||
case Instructions::ADC_DPYil:return "ADC";
|
||||
case Instructions::ADC_SR: return "ADC";
|
||||
case Instructions::ADC_SRYi: return "ADC";
|
||||
|
||||
case Instructions::STA_ABS: return "STA";
|
||||
case Instructions::STA_ABSl: return "STA";
|
||||
case Instructions::STA_DP: return "STA";
|
||||
case Instructions::STA_DPi: return "STA";
|
||||
case Instructions::STA_DPil: return "STA";
|
||||
case Instructions::STA_ABSX: return "STA";
|
||||
case Instructions::STA_ABSXl:return "STA";
|
||||
case Instructions::STA_ABSY: return "STA";
|
||||
case Instructions::STA_DPX: return "STA";
|
||||
case Instructions::STA_DPXi: return "STA";
|
||||
case Instructions::STA_DPYi: return "STA";
|
||||
case Instructions::STA_DPYil:return "STA";
|
||||
case Instructions::STA_SR: return "STA";
|
||||
case Instructions::STA_SRYi: return "STA";
|
||||
|
||||
case Instructions::STX_ABS: return "STX";
|
||||
case Instructions::STX_DP: return "STX";
|
||||
case Instructions::STX_DPY: return "STX";
|
||||
|
||||
case Instructions::STY_ABS: return "STX";
|
||||
case Instructions::STY_DP: return "STX";
|
||||
case Instructions::STY_DPX: return "STX";
|
||||
|
||||
case Instructions::STZ_ABS: return "STX";
|
||||
case Instructions::STZ_DP: return "STX";
|
||||
case Instructions::STZ_ABSX: return "STX";
|
||||
case Instructions::STZ_DPX: return "STX";
|
||||
|
||||
case Instructions::LDA_IM: return "LDA";
|
||||
case Instructions::LDA_ABS: return "LDA";
|
||||
case Instructions::LDA_ABSl: return "LDA";
|
||||
case Instructions::LDA_DP: return "LDA";
|
||||
case Instructions::LDA_DPi: return "LDA";
|
||||
case Instructions::LDA_DPil: return "LDA";
|
||||
case Instructions::LDA_ABSX: return "LDA";
|
||||
case Instructions::LDA_ABSXl:return "LDA";
|
||||
case Instructions::LDA_ABSY: return "LDA";
|
||||
case Instructions::LDA_DPX: return "LDA";
|
||||
case Instructions::LDA_DPXi: return "LDA";
|
||||
case Instructions::LDA_DPYi: return "LDA";
|
||||
case Instructions::LDA_DPYil:return "LDA";
|
||||
case Instructions::LDA_SR: return "LDA";
|
||||
case Instructions::LDA_SRYi: return "LDA";
|
||||
|
||||
case Instructions::LDX_IM: return "LDX";
|
||||
case Instructions::LDX_ABS: return "LDX";
|
||||
case Instructions::LDX_DP: return "LDX";
|
||||
case Instructions::LDX_ABSY: return "LDX";
|
||||
case Instructions::LDX_DPY: return "LDX";
|
||||
|
||||
case Instructions::LDY_IM: return "LDY";
|
||||
case Instructions::LDY_ABS: return "LDY";
|
||||
case Instructions::LDY_DP: return "LDY";
|
||||
case Instructions::LDY_ABSY: return "LDY";
|
||||
case Instructions::LDY_DPY: return "LDY";
|
||||
|
||||
case Instructions::SEP: return "SEP";
|
||||
|
||||
case Instructions::REP: return "REP";
|
||||
|
||||
case Instructions::PHA: return "PHA";
|
||||
case Instructions::PHB: return "PHB";
|
||||
case Instructions::PHD: return "PHD";
|
||||
case Instructions::PHK: return "PHK";
|
||||
case Instructions::PHP: return "PHP";
|
||||
case Instructions::PHX: return "PHX";
|
||||
case Instructions::PHY: return "PHY";
|
||||
|
||||
case Instructions::PLA: return "PLA";
|
||||
case Instructions::PLB: return "PLB";
|
||||
case Instructions::PLD: return "PLD";
|
||||
case Instructions::PLP: return "PLP";
|
||||
case Instructions::PLX: return "PLX";
|
||||
case Instructions::PLY: return "PLY";
|
||||
|
||||
case Instructions::JSR_ABS: return "JSR";
|
||||
case Instructions::JSR_ABSXi: return "JSR";
|
||||
|
||||
case Instructions::JSL: return "JSR";
|
||||
|
||||
case Instructions::CLC: return "CLC";
|
||||
case Instructions::CLI: return "CLI";
|
||||
case Instructions::CLD: return "CLD";
|
||||
case Instructions::CLV: return "CLV";
|
||||
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace ComSquare::Debugger
|
||||
//! @brief Reimplement the basic instruction execution method to log instructions inside the logger view.
|
||||
unsigned _executeInstruction(uint8_t opcode) override;
|
||||
//! @brief Get a printable string representing an instruction.
|
||||
std::string _getInstructionString(uint8_t opcode);
|
||||
static std::string _getInstructionString(uint8_t opcode);
|
||||
public slots:
|
||||
//! @brief Pause/Resume the CPU.
|
||||
void pause();
|
||||
|
||||
Reference in New Issue
Block a user