mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-06 11:22:27 +00:00
Fixing the BRK/COP
This commit is contained in:
+2
-2
@@ -384,9 +384,9 @@ namespace ComSquare::CPU
|
||||
//! @brief All the instructions of the CPU.
|
||||
//! @info Instructions are indexed by their opcode
|
||||
Instruction _instructions[0x100] = {
|
||||
{&CPU::BRK, 7, "brk", AddressingMode::Implied, 2}, // 00
|
||||
{&CPU::BRK, 7, "brk", AddressingMode::Immediate8bits, 2}, // 00
|
||||
{&CPU::ORA, 6, "ora", AddressingMode::DirectPageIndirectIndexedByX, 2}, // 01
|
||||
{&CPU::COP, 7, "cop", AddressingMode::Implied, 2}, // 02
|
||||
{&CPU::COP, 7, "cop", AddressingMode::Immediate8bits, 2}, // 02
|
||||
{&CPU::ORA, 4, "ora", AddressingMode::StackRelative, 2}, // 03
|
||||
{&CPU::BRK, 7, "tsb #-#", AddressingMode::Implied, 2}, // 04
|
||||
{&CPU::ORA, 3, "ora", AddressingMode::DirectPage, 2}, // 05
|
||||
|
||||
@@ -24,16 +24,14 @@ namespace ComSquare::CPU
|
||||
int CPU::BRK(uint24_t, AddressingMode)
|
||||
{
|
||||
if (this->_isEmulationMode) {
|
||||
this->_registers.pc += 2;
|
||||
this->_push(this->_registers.pc);
|
||||
this->_registers.p.x_b = true;
|
||||
this->_push(this->_registers.p.flags);
|
||||
this->_registers.p.i = true;
|
||||
this->_registers.p.d = false;
|
||||
this->_registers.pbr = 0x0;
|
||||
this->_registers.pc = this->_cartridgeHeader.emulationInterrupts.brk;
|
||||
} else {
|
||||
this->_push(this->_registers.pbr);
|
||||
this->_registers.pc += 2;
|
||||
this->_push(this->_registers.pc);
|
||||
this->_push(this->_registers.p.flags);
|
||||
this->_registers.p.i = true;
|
||||
@@ -47,16 +45,14 @@ namespace ComSquare::CPU
|
||||
int CPU::COP(uint24_t, AddressingMode)
|
||||
{
|
||||
if (this->_isEmulationMode) {
|
||||
this->_registers.pc += 2;
|
||||
this->_push(this->_registers.pc);
|
||||
this->_push(this->_registers.p.flags);
|
||||
this->_registers.p.i = true;
|
||||
this->_registers.p.d = false;
|
||||
this->_registers.pbr = 0x0;
|
||||
this->_registers.pc = this->_cartridgeHeader.emulationInterrupts.cop;
|
||||
|
||||
} else {
|
||||
this->_push(this->_registers.pbr);
|
||||
this->_registers.pc += 2;
|
||||
this->_push(this->_registers.pc);
|
||||
this->_push(this->_registers.p.flags);
|
||||
this->_registers.p.i = true;
|
||||
|
||||
Reference in New Issue
Block a user