diff options
Diffstat (limited to 'src/cpu/table.c')
-rw-r--r-- | src/cpu/table.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cpu/table.c b/src/cpu/table.c index 7ec0891..0af04f9 100644 --- a/src/cpu/table.c +++ b/src/cpu/table.c @@ -18,10 +18,20 @@ Addressing* GetInstructionTableAddressing(int i){ } void CallInstructionTable(int i, address val){ + val = 0; // TODO: Let the initial value of val be redundant for now so as to not break anything, but fix later + // Setup to call the correct function. uintptr_t a = GetInstructionTableFunction(i); memcpy(&func, a, sizeof(uintptr_t)); + // Find the correct addressing mode. Addressing* r = (InstructionTable + ((sizeof(uintptr_t)*256) + (sizeof(Addressing) * i))); + // Set idata idata = fAddress(*r, val); + // Set val + if (idata.length > 0) + val += GetMemory(PC+1); + if (idata.length > 1) + val += GetMemory(PC+2) << 8; + // Perform function func(*r, val); } |