From d0f5e175f713a52d76d102780e0b899f3984c416 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Thu, 30 Nov 2023 14:36:15 +1100 Subject: overall progress --- src/cpu/table.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/cpu/table.c') 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); } -- cgit v1.2.3