diff options
Diffstat (limited to 'src/cpu/addressing.c')
-rw-r--r-- | src/cpu/addressing.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cpu/addressing.c b/src/cpu/addressing.c index 60ec4f0..903e5d0 100644 --- a/src/cpu/addressing.c +++ b/src/cpu/addressing.c @@ -5,7 +5,7 @@ #include"addressing.h" -//Holds address of current instruction. +//Holds address of current instruction. I don't think it's being used at all besides fAddressGetCycles(), so will be removed. void* current_instruction; address fAddressGetAddress(Addressing mode, address x) { @@ -30,15 +30,15 @@ address fAddressGetAddress(Addressing mode, address x) { case eZeroPageIndexedY: return ((x + Y) & 0x00FF); case eIndexedIndirect: - return ((address)(GetMemory(x+X+1))<<8) + (address)(GetMemory(x+X)); + return (((address)(GetMemory(x+X+1)))<<8) + (address)(GetMemory(x+X)); case eIndirectIndexed: - return ((address)(GetMemory(x+1))<<8) + (address)(GetMemory(x)) + Y; + return ((address)(GetMemory(x+1))<<8) + (address)(GetMemory(x)) + Y; } } int fAddressGetLength(Addressing mode){ switch(mode){ - case eAbsolute: case eAbsoluteIndexedX: case eAbsoluteIndexedY: + case eAbsolute: case eAbsoluteIndexedX: case eAbsoluteIndexedY: case eIndirectAbsolute: return 3; case eAccumulator: case eImplied: return 1; @@ -61,6 +61,8 @@ byte fAddressGetValue(Addressing mode, address x, address addr) { } } +// At the moment not run, and will probably be replaced by just direct storage of values. +// The code making up this is likely way less performant and larger than just looking up stored values, so I will change it in the future to do that instead. int fAddressGetCycles(Addressing mode, address x, address addr) { int cycles; @@ -174,6 +176,6 @@ AddData fAddress(Addressing mode, address x) { ret.add = fAddressGetAddress (mode, x); ret.value = fAddressGetValue (mode, x, ret.add); ret.length = fAddressGetLength (mode); - ret.cycles = fAddressGetCycles (mode, x, ret.add); + //ret.cycles = fAddressGetCycles (mode, x, ret.add); return ret; } |