Implementing an array of instructions with method's pointer for the CPU (it does not work well for now

This commit is contained in:
Anonymus Raccoon
2020-03-26 03:39:55 +01:00
parent 4b9f8002b9
commit bd948b520c
25 changed files with 924 additions and 724 deletions
+8 -4
View File
@@ -6,7 +6,7 @@
namespace ComSquare::CPU
{
void CPU::RESB()
int CPU::RESB(uint24_t)
{
this->_registers.p.i = true;
this->_registers.p.d = false;
@@ -18,9 +18,10 @@ namespace ComSquare::CPU
this->_registers.d = 0x0000;
this->_registers.sh = 0x01; // the low bit of the stack pointer is undefined on reset.
this->_registers.pc = this->_cartridgeHeader.emulationInterrupts.reset;
return 0;
}
void CPU::BRK()
int CPU::BRK(uint24_t)
{
if (this->_isEmulationMode) {
this->_registers.pc += 2;
@@ -41,9 +42,10 @@ namespace ComSquare::CPU
this->_registers.pbr = 0x0;
this->_registers.pc = this->_cartridgeHeader.nativeInterrupts.brk;
}
return !this->_isEmulationMode;
}
void CPU::COP()
int CPU::COP(uint24_t)
{
if (this->_isEmulationMode) {
this->_registers.pc += 2;
@@ -63,14 +65,16 @@ namespace ComSquare::CPU
this->_registers.pbr = 0x0;
this->_registers.pc = this->_cartridgeHeader.nativeInterrupts.cop;
}
return !this->_isEmulationMode;
}
void CPU::RTI()
int CPU::RTI(uint24_t)
{
this->_registers.p.flags = this->_pop();
this->_registers.pc = this->_pop16();
if (!this->_isEmulationMode)
this->_registers.pbr = this->_pop16();
return 0;
}
}