diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-05-01 11:00:25 +1000 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-05-01 11:00:25 +1000 |
commit | 8f09f4249cec8ccc187b3f9ee5094fb3080900a9 (patch) | |
tree | fef74c955ebba3c7815e2981857a07c95b1a97c9 /headers/addressing.h | |
parent | 138bb8eeb4b67ab17a6d77e7afa9cd265759da0d (diff) |
memory access thru function; will be vital later.
Diffstat (limited to 'headers/addressing.h')
-rw-r--r-- | headers/addressing.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/headers/addressing.h b/headers/addressing.h index af102fd..c5db440 100644 --- a/headers/addressing.h +++ b/headers/addressing.h @@ -37,7 +37,7 @@ int fAddressGetLength(Addressing addr){ switch(addr){ case eAbsolute: case eAbsoluteIndexedX: case eAbsoluteIndexedY: return 3; - case eAccumulator: + case eAccumulator: case eImplied: return 1; default: return 2; @@ -93,10 +93,10 @@ AddData fAddress(Addressing addr, short x) { break; case eIndexedIndirect: - ret.add = (((address)Memory[x+X+1])<<8) + (Memory[x+X]); + ret.add = ((getMemory(x+X+1))<<8) + (getMemory(x+X)); break; case eIndirectIndexed: - ret.add = (((address)Memory[x+1])<<8) + (Memory[x]) + Y; + ret.add = ((getMemory(x+1))<<8) + (getMemory(x)) + Y; break; } @@ -117,7 +117,7 @@ AddData fAddress(Addressing addr, short x) { break; default: - ret.value = Memory[ret.add]; + ret.value = getMemory(ret.add); } // LENGTH @@ -214,11 +214,11 @@ AddData fAddress(Addressing addr, short x) { || current_instruction == &fEOR || current_instruction == &fAND || current_instruction == &fORA || current_instruction == &fCMP ){ switch(addr){ case eAbsoluteIndexedX: - if ((x & 0xFFFC) != ((x + X) & 0xFFFC)) ret.cycles++; break; + if ((x & 0xFF00) != ((x + X) & 0xFF00)) ret.cycles++; break; case eAbsoluteIndexedY: - if ((x & 0xFFFC) != ((x + Y) & 0xFFFC)) ret.cycles++; break; + if ((x & 0xFF00) != ((x + Y) & 0xFF00)) ret.cycles++; break; case eIndirectIndexed: - if ((ret.add & 0xFFFC) != (ret.add - Y & 0xFFFC)) ret.cycles++; break; + if ((ret.add & 0xFF00) != (ret.add - Y & 0xFF00)) ret.cycles++; break; } } |