diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-11-30 14:36:15 +1100 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-11-30 14:36:15 +1100 |
commit | d0f5e175f713a52d76d102780e0b899f3984c416 (patch) | |
tree | cfb4b030b186bf3dd4a155a78a9b232e4d971139 /src/cpu | |
parent | 401a2171b1fa2bcc077934191cc609208368152e (diff) |
overall progress
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/core.h | 4 | ||||
-rw-r--r-- | src/cpu/table.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/cpu/core.h b/src/cpu/core.h index 850f04b..5a73818 100644 --- a/src/cpu/core.h +++ b/src/cpu/core.h @@ -15,7 +15,7 @@ extern byte P; extern byte S; extern address PC; extern byte* Memory; -extern byte* ROM; +extern const byte ROM[]; enum Addressing @@ -58,4 +58,4 @@ void SetMemory(address x, byte y); extern void *current_instruction; extern AddData idata; -extern void (*func)(Addressing, address);
\ No newline at end of file +extern void (*func)(Addressing, address); 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); } |