mirror of
https://github.com/zoriya/ComSquare.git
synced 2025-12-20 14:15:11 +00:00
Adding all the ADC in the instruction switch case
This commit is contained in:
@@ -199,24 +199,24 @@ namespace ComSquare::CPU
|
||||
uint8_t opcode = this->_bus->read(this->_registers.pc);
|
||||
|
||||
switch (opcode) {
|
||||
case 0x0:
|
||||
return this->BRK();
|
||||
case 0x61:
|
||||
case 0x63:
|
||||
case 0x65:
|
||||
case 0x67:
|
||||
case 0x69:
|
||||
case 0x6D:
|
||||
case 0x6F:
|
||||
case 0x71:
|
||||
case 0x72:
|
||||
case 0x73:
|
||||
case 0x75:
|
||||
case 0x77:
|
||||
case 0x79:
|
||||
case 0x7D:
|
||||
case 0x7F:
|
||||
return this->ADC();
|
||||
case Instructions::BRK: return this->BRK();
|
||||
|
||||
case Instructions::ADC_DPXi: return this->ADC(this->_getDirectIndirectIndexedXAddr());
|
||||
case Instructions::ADC_SR: return this->ADC(this->_getStackRelativeAddr());
|
||||
case Instructions::ADC_DP: return this->ADC(this->_getDirectAddr());
|
||||
case Instructions::ADC_DPil: return this->ADC(this->_getDirectIndirectLongAddr());
|
||||
case Instructions::ADC_IM: return this->ADC(this->_getImmediateAddr());
|
||||
case Instructions::ADC_ABS: return this->ADC(this->_getAbsoluteAddr());
|
||||
case Instructions::ADC_ABSl: return this->ADC(this->_getAbsoluteLongAddr());
|
||||
case Instructions::ADC_DPYi: return this->ADC(this->_getDirectIndirectIndexedYAddr());
|
||||
case Instructions::ADC_DPi: return this->ADC(this->_getDirectIndirectAddr());
|
||||
case Instructions::ADC_SRYi: return this->ADC(this->_getStackRelativeIndirectIndexedYAddr());
|
||||
case Instructions::ADC_DPX: return this->ADC(this->_getDirectIndexedByXAddr());
|
||||
case Instructions::ADC_DPYil:return this->ADC(this->_getDirectIndirectIndexedYLongAddr());
|
||||
case Instructions::ADC_ABSY: return this->ADC(this->_getAbsoluteIndexedByYAddr());
|
||||
case Instructions::ADC_ABSX: return this->ADC(this->_getAbsoluteIndexedByXAddr());
|
||||
case Instructions::ADC_ABSXl:return this->ADC(this->_getAbsoluteIndexedByXLongAddr());
|
||||
|
||||
default:
|
||||
throw InvalidOpcode("CPU", opcode);
|
||||
}
|
||||
@@ -253,7 +253,7 @@ namespace ComSquare::CPU
|
||||
return addr;
|
||||
}
|
||||
|
||||
uint24_t CPU::_getDirectIndirectIndexedAddr()
|
||||
uint24_t CPU::_getDirectIndirectIndexedYAddr()
|
||||
{
|
||||
uint16_t dp = this->_bus->read(this->_registers.pac++) + this->_registers.d;
|
||||
uint24_t base = this->_bus->read(dp);
|
||||
@@ -262,7 +262,7 @@ namespace ComSquare::CPU
|
||||
return base + this->_registers.y;
|
||||
}
|
||||
|
||||
uint24_t CPU::_getDirectIndirectIndexedLongAddr()
|
||||
uint24_t CPU::_getDirectIndirectIndexedYLongAddr()
|
||||
{
|
||||
uint16_t dp = this->_bus->read(this->_registers.pac++) + this->_registers.d;
|
||||
uint24_t base = this->_bus->read(dp);
|
||||
@@ -271,7 +271,7 @@ namespace ComSquare::CPU
|
||||
return base;
|
||||
}
|
||||
|
||||
uint24_t CPU::_getDirectIndexedIndirectAddr()
|
||||
uint24_t CPU::_getDirectIndirectIndexedXAddr()
|
||||
{
|
||||
uint16_t dp = this->_bus->read(this->_registers.pac++) + this->_registers.d;
|
||||
dp += this->_registers.x;
|
||||
@@ -311,7 +311,7 @@ namespace ComSquare::CPU
|
||||
return effective + this->_registers.y;
|
||||
}
|
||||
|
||||
uint24_t CPU::_getAbsoluteLongIndexedByXAddr()
|
||||
uint24_t CPU::_getAbsoluteIndexedByXLongAddr()
|
||||
{
|
||||
uint24_t lng = this->_bus->read(this->_registers.pac++);
|
||||
lng += this->_bus->read(this->_registers.pac++) << 8u;
|
||||
@@ -377,7 +377,7 @@ namespace ComSquare::CPU
|
||||
return this->_bus->read(this->_registers.pac++) + this->_registers.s;
|
||||
}
|
||||
|
||||
uint24_t CPU::_getStackRelativeIndirectIndexedAddr()
|
||||
uint24_t CPU::_getStackRelativeIndirectIndexedYAddr()
|
||||
{
|
||||
uint24_t base = this->_bus->read(this->_registers.pac++) + this->_registers.s;
|
||||
base += this->_registers.dbr << 16u;
|
||||
|
||||
Reference in New Issue
Block a user