Finishing the SEP

This commit is contained in:
AnonymusRaccoon
2020-02-13 18:57:31 +01:00
parent dffb9625f9
commit 072cb17bcb
4 changed files with 25 additions and 19 deletions
+2
View File
@@ -277,6 +277,8 @@ namespace ComSquare::CPU
case Instructions::LDY_ABSY: this->LDY(this->_getAbsoluteIndexedByYAddr()); return 4 + !this->_registers.p.m + this->_hasIndexCrossedPageBoundary; case Instructions::LDY_ABSY: this->LDY(this->_getAbsoluteIndexedByYAddr()); return 4 + !this->_registers.p.m + this->_hasIndexCrossedPageBoundary;
case Instructions::LDY_DPY: this->LDY(this->_getDirectIndexedByYAddr()); return 4 + !this->_registers.p.m + this->_registers.dl != 0; case Instructions::LDY_DPY: this->LDY(this->_getDirectIndexedByYAddr()); return 4 + !this->_registers.p.m + this->_registers.dl != 0;
case Instructions::SEP: this->SEP(this->_getImmediateAddr()); return 3;
default: default:
throw InvalidOpcode("CPU", opcode); throw InvalidOpcode("CPU", opcode);
} }
+3 -1
View File
@@ -258,7 +258,9 @@ namespace ComSquare::CPU
LDY_ABS = 0xAC, LDY_ABS = 0xAC,
LDY_DP = 0xA4, LDY_DP = 0xA4,
LDY_ABSY = 0xBC, LDY_ABSY = 0xBC,
LDY_DPY = 0xB4 LDY_DPY = 0xB4,
SEP = 0xE2
}; };
//! @brief The main CPU //! @brief The main CPU
@@ -8,6 +8,6 @@ namespace ComSquare::CPU
{ {
void CPU::SEP(uint24_t addr) void CPU::SEP(uint24_t addr)
{ {
this->_registers.p.flags |= this->_bus->read(addr);
} }
} }
+19 -17
View File
@@ -9,20 +9,22 @@
#include "../../sources/SNES.hpp" #include "../../sources/SNES.hpp"
#include "../../sources/Memory/MemoryBus.hpp" #include "../../sources/Memory/MemoryBus.hpp"
using namespace ComSquare; using namespace ComSquare;
//
//Test(SEP, setall) Test(SEP, setall)
//{ {
// auto pair = Init(); auto pair = Init();
// pair.second.wram->_data[0] = 0xFF; pair.second.wram->_data[0] = 0xFF;
// pair.second.cpu->SEP(0x0); pair.second.cpu->SEP(0x0);
// auto data = pair.second.cpu->_registers.p.flags; auto data = pair.second.cpu->_registers.p.flags;
// cr_assert_eq(data, 0xFF, "The flag should be 0xFF but it was %b", data); cr_assert_eq(data, 0xFF, "The flag should be 0xFF but it was %x", data);
//} }
//
//Test(SEP, setsome) Test(SEP, setsome)
//{ {
// auto pair = Init(); auto pair = Init();
// pair.second.wram->_data[0] = 0b10110101; pair.second.wram->_data[0] = 0b10110101;
// pair.second.cpu->SEP(0x0); pair.second.cpu->_registers.p.flags = 0b01000000;
// cr_assert_eq(pair.second.cpu->_registers.p.flags, 0xFF); pair.second.cpu->SEP(0x0);
//} auto data = pair.second.cpu->_registers.p.flags;
cr_assert_eq(data, 0b11110101, "The flag should be 245 but it was %i", data);
}