mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-06-07 19:50:48 +00:00
Implementing the COP instruction
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user