diff --git a/sources/APU/Instructions/8bitArithmetic.cpp b/sources/APU/Instructions/8bitArithmetic.cpp index c09c58f..2010d99 100644 --- a/sources/APU/Instructions/8bitArithmetic.cpp +++ b/sources/APU/Instructions/8bitArithmetic.cpp @@ -63,10 +63,9 @@ namespace ComSquare::APU int APU::CMP(uint24_t operand1, uint24_t operand2, int cycles) { uint8_t data1 = this->_internalRead(operand1); - uint8_t data2 = this->_internalRead(operand2); - this->_internalRegisters.c = data1 >= data2; - this->_setNZflags(data1 - data2); + this->_internalRegisters.c = data1 >= operand2; + this->_setNZflags(data1 - operand2); return cycles; } diff --git a/sources/Debugger/APUDebug.cpp b/sources/Debugger/APUDebug.cpp index 21bcdfa..6e11913 100644 --- a/sources/Debugger/APUDebug.cpp +++ b/sources/Debugger/APUDebug.cpp @@ -38,8 +38,8 @@ namespace ComSquare::Debugger this->_ui.port2hexaLineEdit->setText(Utility::to_hex(this->_registers.port2).c_str()); this->_ui.port2LineEdit->setText(Utility::to_binary(this->_registers.port2).c_str()); - this->_ui.port3hexaLineEdit->setText(Utility::to_hex(this->_registers.port2).c_str()); - this->_ui.port3LineEdit->setText(Utility::to_binary(this->_registers.port2).c_str()); + this->_ui.port3hexaLineEdit->setText(Utility::to_hex(this->_registers.port3).c_str()); + this->_ui.port3LineEdit->setText(Utility::to_binary(this->_registers.port3).c_str()); this->_ui.controlhexaLineEdit->setText(Utility::to_hex(this->_registers.ctrlreg).c_str()); this->_ui.controlLineEdit->setText(Utility::to_binary(this->_registers.ctrlreg).c_str()); @@ -81,7 +81,7 @@ namespace ComSquare::Debugger this->_ui.xIndexLineEdit->setText(Utility::to_hex(this->_internalRegisters.x).c_str()); this->_ui.yIndexLineEdit->setText(Utility::to_hex(this->_internalRegisters.y).c_str()); this->_ui.accumlatorLineEdit->setText(Utility::to_hex(this->_internalRegisters.a).c_str()); - this->_ui.programCounterLineEdit->setText(Utility::to_hex(this->_internalRegisters.pc).c_str()); + this->_ui.programCounterLineEdit->setText(Utility::to_hex(this->_internalRegisters.pc + 0x0001u).c_str()); this->_ui.programStatusWordLineEdit->setText(this->_getPSWString().c_str()); this->_ui.mvolLprogressBar->setValue(this->_dsp->getRegisters().mvolL);