summaryrefslogtreecommitdiff
path: root/src/cpu/table.c
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-12-07 02:19:48 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-12-07 02:19:48 +1100
commit98dd41e2ce7dedb81ab91342eed29da017006ea4 (patch)
treede5efd1f899815dcad218accda405873687cbaf1 /src/cpu/table.c
parent5bb10fc4121a8c8434dcd367f2e611599a11e12e (diff)
about to rip apart my code, so saving progress
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;
}