From e0e1611043dd6cebb2f0af1ec1b13b47fb216c9a Mon Sep 17 00:00:00 2001 From: Melefo <42809472+Melefo@users.noreply.github.com> Date: Fri, 20 Mar 2020 14:12:16 +0100 Subject: [PATCH] Fixing APU debugger buttons Fixing APU MOV instruction --- sources/APU/Instructions/8bitDataTransmission.cpp | 6 ++---- sources/Debugger/APUDebug.cpp | 8 ++++---- tests/APU/testAPUInstructions.cpp | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sources/APU/Instructions/8bitDataTransmission.cpp b/sources/APU/Instructions/8bitDataTransmission.cpp index 0b4f593..f75e83d 100644 --- a/sources/APU/Instructions/8bitDataTransmission.cpp +++ b/sources/APU/Instructions/8bitDataTransmission.cpp @@ -9,12 +9,10 @@ namespace ComSquare::APU { int APU::MOV(uint24_t memFrom, uint8_t ®To, int cycles, bool incrementX) { - uint8_t data = this->_internalRead(memFrom); - - regTo = data; + regTo = memFrom; if (incrementX) this->_internalRegisters.x++; - this->_setNZflags(data); + this->_setNZflags(regTo); return cycles; } diff --git a/sources/Debugger/APUDebug.cpp b/sources/Debugger/APUDebug.cpp index 177f7a7..1177468 100644 --- a/sources/Debugger/APUDebug.cpp +++ b/sources/Debugger/APUDebug.cpp @@ -20,8 +20,8 @@ namespace ComSquare::Debugger this->setAttribute(Qt::WA_QuitOnClose, false); this->_ui.setupUi(this); - //QMainWindow::connect(this->_ui.resumeButton, SIGNAL(clicked()), this, SLOT(APUDebug::pause())); - //QMainWindow::connect(this->_ui.stepButton, SIGNAL(clicked()), this, SLOT(APUDebug::step())); + QMainWindow::connect(this->_ui.resumeButton, &QPushButton::clicked, this, &APUDebug::pause); + QMainWindow::connect(this->_ui.stepButton, &QPushButton::clicked, this, &APUDebug::step); this->show(); this->_updatePanel(); } @@ -475,7 +475,7 @@ namespace ComSquare::Debugger int APUDebug::_executeInstruction() { if (this->_isPaused) - return 0; + return 0xFF; if (this->_isStepping) { this->_isStepping = false; this->_isPaused = true; @@ -494,7 +494,7 @@ namespace ComSquare::Debugger } if (this->_isPaused) return; - return APU::update(cycles); + APU::update(cycles); } catch (InvalidOpcode &e) { this->pause(); this->_ui.logger->append(e.what()); diff --git a/tests/APU/testAPUInstructions.cpp b/tests/APU/testAPUInstructions.cpp index 1f253de..770c110 100644 --- a/tests/APU/testAPUInstructions.cpp +++ b/tests/APU/testAPUInstructions.cpp @@ -1256,9 +1256,8 @@ Test(VIIIDataTransmission, MovMemToReg) apu->_internalRegisters.x = 0x23; apu->_internalRegisters.a = 0x44; - apu->_internalWrite(0x23, 0x56); result = apu->MOV(apu->_getIndexXAddr(), apu->_internalRegisters.a, 4, true); cr_assert_eq(result, 4); cr_assert_eq(apu->_internalRegisters.x, 0x24); - cr_assert_eq(apu->_internalRegisters.a, 0x56); + cr_assert_eq(apu->_internalRegisters.a, 0x23); } \ No newline at end of file