summaryrefslogtreecommitdiff
path: root/src/cpu/table.c
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 14:36:15 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 14:36:15 +1100
commitd0f5e175f713a52d76d102780e0b899f3984c416 (patch)
treecfb4b030b186bf3dd4a155a78a9b232e4d971139 /src/cpu/table.c
parent401a2171b1fa2bcc077934191cc609208368152e (diff)
overall progress
Diffstat (limited to 'src/cpu/table.c')
-rw-r--r--src/cpu/table.c10
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);
}