summaryrefslogtreecommitdiff
path: root/src/cpu/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/table.c')
-rw-r--r--src/cpu/table.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cpu/table.c b/src/cpu/table.c
index 735ab80..4e60f58 100644
--- a/src/cpu/table.c
+++ b/src/cpu/table.c
@@ -17,24 +17,28 @@ Addressing* GetInstructionTableAddressing(int i){
return r;
}
-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
+void CallInstructionTable(){
+ int val = 0;
// Setup to call the correct function.
+ int i = (address)GetMemory(PC);
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)));
+ Addressing r = *(Addressing*)(InstructionTable + ((sizeof(uintptr_t)*256) + (sizeof(Addressing) * i)));
// Set val
- if (fAddressGetLength(*r) >= 2)
+ if (fAddressGetLength(r) >= 2)
val += (address)GetMemory(PC+1);
- if (fAddressGetLength(*r) == 3)
+ if (fAddressGetLength(r) == 3)
val += (address)GetMemory(PC+2) << 8;
+
// Set idata
- idata = fAddress(*r, val);
+ idata = fAddress(r, val);
// Perform function
- func(*r, val); // TODO: MARKER FOR 3/12/2023
+ func(r, val); // TODO: MARKER FOR 3/12/2023
+
+
PC += idata.length;
}