summaryrefslogtreecommitdiff
path: root/src/cpu/table.c
diff options
context:
space:
mode:
authoralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 19:19:22 +1100
committeralekseiplusplus <alekseijeaves@protonmail.com>2023-11-30 19:19:22 +1100
commit40447eccd6db43d636ccc518ae7792b7b43834b5 (patch)
tree09471aa08737e6555dd060179b6a33944e931f51 /src/cpu/table.c
parent7a3307ad3785a6cd72c820ea6b44086817a20e81 (diff)
fixed BIT and branch instructions
Diffstat (limited to 'src/cpu/table.c')
-rw-r--r--src/cpu/table.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cpu/table.c b/src/cpu/table.c
index 9597657..27ec8f2 100644
--- a/src/cpu/table.c
+++ b/src/cpu/table.c
@@ -26,10 +26,10 @@ void CallInstructionTable(int i, address val){
Addressing* r = (InstructionTable + ((sizeof(uintptr_t)*256) + (sizeof(Addressing) * i)));
// Set val
- if (fAddressGetLength(*r) > 0)
- val += GetMemory(PC+1);
- if (fAddressGetLength(*r) > 1)
- val += GetMemory(PC+2) << 8;
+ if (fAddressGetLength(*r) >= 2)
+ val += (address)GetMemory(PC+1);
+ if (fAddressGetLength(*r) == 3)
+ val += (address)GetMemory(PC+2) << 8;
// Set idata
idata = fAddress(*r, val);
@@ -193,8 +193,8 @@ void InitInstructionTable(){
SetInstructionTable(0xC4, (uintptr_t)&fCPY, eZeroPage);
SetInstructionTable(0xCC, (uintptr_t)&fCPY, eAbsolute);
//BIT(Addressing, address);
- SetInstructionTable(0x4C, (uintptr_t)&fBIT, eZeroPage);
- SetInstructionTable(0x6C, (uintptr_t)&fBIT, eAbsolute);
+ SetInstructionTable(0x24, (uintptr_t)&fBIT, eZeroPage);
+ SetInstructionTable(0x2C, (uintptr_t)&fBIT, eAbsolute);
// Shift and Rotate Instructions
//ASL(Addressing, address);