I'm still working on this

This commit is contained in:
2026-03-29 07:50:11 -06:00
parent b397371a53
commit 43f5d26b3d
9 changed files with 255 additions and 47 deletions

View File

@@ -67,9 +67,10 @@ namespace spider {
void CPU::fetchInstr() {
u16 i = _reel->readU16(RI);
_opcode = (i >> 7) & 0x1FF;
_addrm = (i >> 2) & 0x1F;
_size = i & 0x3;
const u16 oc = (i >> 7);
_opcode = oc & 0x1FF; // GCC WHY!
_addrm = static_cast<u8>((i >> 2) & 0x1F);
_size = static_cast<u8>(i & 0x3);
RI += 2;
}
@@ -90,7 +91,7 @@ namespace spider {
(this->*(CPU::addrModes[_addrm]))();
// modify the _addrm register
_addrm >>= 3;
_addrm = static_cast<u8>((_addrm >> 3) & 0x1F);
_addrm++;
}
@@ -138,7 +139,13 @@ namespace spider {
void CPU::reg() { // NOT FINISHED
// Two consecutive registers can be declared
// Shift if the top part will become .reg too
u8 sh = (_addrm & 0b11000 == 0b11000) * 4;
u8 sh = ((_addrm & 0b11000) == 0b11000) * 4;
u8 use = 1 - (sh >> 2); // (sh / 4)
// get byte
u8 reg = (_reel->readU8(RI) >> sh) & 0xF;
_alu = &GPR[reg];
RI += use;
// store no-op
_post = &CPU::imp;