mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-31 17:33:07 +00:00
Implementing the REP instruction
This commit is contained in:
@@ -279,6 +279,8 @@ namespace ComSquare::CPU
|
||||
|
||||
case Instructions::SEP: this->SEP(this->_getImmediateAddr()); return 3;
|
||||
|
||||
case Instructions::REP: this->REP(this->_getImmediateAddr()); return 3;
|
||||
|
||||
default:
|
||||
throw InvalidOpcode("CPU", opcode);
|
||||
}
|
||||
|
||||
+6
-2
@@ -260,7 +260,9 @@ namespace ComSquare::CPU
|
||||
LDY_ABSY = 0xBC,
|
||||
LDY_DPY = 0xB4,
|
||||
|
||||
SEP = 0xE2
|
||||
SEP = 0xE2,
|
||||
|
||||
REP = 0xC2
|
||||
};
|
||||
|
||||
//! @brief The main CPU
|
||||
@@ -360,7 +362,9 @@ namespace ComSquare::CPU
|
||||
//! @brief Load the Y index register from memory.
|
||||
void LDY(uint24_t addr);
|
||||
//! @brief Set status bits.
|
||||
void SEP(uint24_t addr);
|
||||
void SEP(uint24_t valueAddr);
|
||||
//! @brief Reset status bits.
|
||||
void REP(uint24_t valueAddr);
|
||||
public:
|
||||
explicit CPU(std::shared_ptr<Memory::MemoryBus> bus, Cartridge::Header &cartridgeHeader);
|
||||
CPU(const CPU &) = default;
|
||||
|
||||
@@ -6,8 +6,17 @@
|
||||
|
||||
namespace ComSquare::CPU
|
||||
{
|
||||
void CPU::SEP(uint24_t addr)
|
||||
void CPU::SEP(uint24_t valueAddr)
|
||||
{
|
||||
this->_registers.p.flags |= this->_bus->read(addr);
|
||||
this->_registers.p.flags |= this->_bus->read(valueAddr);
|
||||
}
|
||||
|
||||
void CPU::REP(uint24_t valueAddr)
|
||||
{
|
||||
this->_registers.p.flags &= ~this->_bus->read(valueAddr);
|
||||
if (this->_isEmulationMode) {
|
||||
this->_registers.p.x_b = true;
|
||||
this->_registers.p.m = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user