Fix execute() dispatch, addrModes mask, reg() operand ptr, cast warnings, and Enter key step

This commit is contained in:
Arturo
2026-03-31 01:19:00 -06:00
parent 7d3781681d
commit f82aa627c4
3 changed files with 25 additions and 15 deletions

View File

@@ -80,7 +80,7 @@ namespace spider {
_opers[1] = _opers[0];
// call specific addressing mode
(this->*(CPU::addrModes[_addrm]))();
(this->*(CPU::addrModes[_addrm & 0b111]))(); // mask added here too
}
void CPU::fetchOperSrc() {
@@ -88,17 +88,19 @@ namespace spider {
_alu = &ALU1;
// call specific addressing mode
(this->*(CPU::addrModes[_addrm]))();
(this->*(CPU::addrModes[_addrm & 0b111]))(); // mask keeps index within 0-7
// modify the _addrm register
_addrm = static_cast<u8>((_addrm >> 3) & 0x1F);
_addrm++;
}
void CPU::execute() {
(this->*(CPU::addrModes[_opcode]))();
(this->*(CPU::instrMap[_opcode]))(); // no null check needed
}
// Addressing Modes //
/**
@@ -145,6 +147,7 @@ namespace spider {
// get byte
u8 reg = (_reel->readU8(RI) >> sh) & 0xF;
_alu = &GPR[reg];
_opers[0] = _alu; // explicitly sets _opers[0] = _dst
RI += use;
// store no-op