mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-03 02:23:49 +00:00
Adding an error message on invalid instructions
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <QPainter>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace ComSquare::CPU;
|
||||
|
||||
@@ -134,8 +135,19 @@ namespace ComSquare::Debugger
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CPUDebug::pause()
|
||||
void CPUDebug::showError(const DebuggableError &error)
|
||||
{
|
||||
QMessageBox msg;
|
||||
msg.setIcon(QMessageBox::Critical);
|
||||
msg.setText("Invalid rom action");
|
||||
msg.setInformativeText(error.what());
|
||||
msg.exec();
|
||||
}
|
||||
|
||||
void CPUDebug::pause(bool forcePause)
|
||||
{
|
||||
if (forcePause && this->_isPaused)
|
||||
return;
|
||||
this->_isPaused = !this->_isPaused;
|
||||
if (this->_isPaused)
|
||||
this->_ui.actionPause->setText("Continue");
|
||||
|
||||
@@ -248,8 +248,10 @@ namespace ComSquare::Debugger
|
||||
std::string _getAbsoluteIndirectLongValue(uint24_t pc);
|
||||
|
||||
public:
|
||||
//! @brief Show an error dialog related to an exception.
|
||||
void showError(const DebuggableError &error);
|
||||
//! @brief Pause/Resume the CPU.
|
||||
void pause();
|
||||
void pause(bool forcePause = false);
|
||||
//! @brief Step - Execute a single instruction.
|
||||
void step();
|
||||
//! @brief Next - Continue running instructions until the next line is reached.
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace ComSquare::Debugger
|
||||
|
||||
std::string CPUDebug::_getAbsoluteIndirectValue(uint24_t pc)
|
||||
{
|
||||
uint24_t value = this->_bus->read(pc) + (this->_bus->read(pc + 1, true) << 8u);
|
||||
uint24_t value = this->_bus->read(pc, true) + (this->_bus->read(pc + 1, true) << 8u);
|
||||
return "(" + Utility::to_hex(value, Utility::HexString::AsmPrefix) + ")";
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace ComSquare::Debugger
|
||||
|
||||
std::string CPUDebug::_getAbsoluteIndirectIndexedByXValue(uint24_t pc)
|
||||
{
|
||||
uint24_t value = this->_bus->read(pc) + (this->_bus->read(pc + 1, true) << 8u);
|
||||
uint24_t value = this->_bus->read(pc, true) + (this->_bus->read(pc + 1, true) << 8u);
|
||||
return "(" + Utility::to_hex(value, Utility::HexString::AsmPrefix) + ", x)";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user