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
@@ -7,7 +7,7 @@
namespace ComSquare::CPU
{
void CPU::ADC(uint24_t valueAddr)
int CPU::ADC(uint24_t valueAddr)
{
unsigned value = this->_bus->read(valueAddr) + this->_registers.p.c;
if (!this->_registers.p.m)
@@ -25,9 +25,10 @@ namespace ComSquare::CPU
this->_registers.a %= 0x100;
this->_registers.p.z = this->_registers.a == 0;
this->_registers.p.n = this->_registers.a & negativeMask;
return 0;
}
void CPU::SBC(uint24_t valueAddr)
int CPU::SBC(uint24_t valueAddr)
{
unsigned negativeMask = this->_isEmulationMode ? 0x80u : 0x8000u;
unsigned value = this->_bus->read(valueAddr);
@@ -45,5 +46,6 @@ namespace ComSquare::CPU
this->_registers.a %= 0x100;
this->_registers.p.z = this->_registers.a == 0;
this->_registers.p.n = this->_registers.a & negativeMask;
return 0;
}
}