Implementing the COP instruction

This commit is contained in:
AnonymusRaccoon
2020-02-19 18:44:45 +01:00
parent 27f755e315
commit 52b5a6ba23
5 changed files with 83 additions and 6 deletions
+22
View File
@@ -43,6 +43,28 @@ namespace ComSquare::CPU
}
}
void CPU::COP()
{
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.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;
this->_registers.p.d = false;
this->_registers.pbr = 0x0;
this->_registers.pc = this->_cartridgeHeader.nativeInterrupts.cop;
}
}
void CPU::RTI()
{
this->_registers.p.flags = this->_pop();