From 8f09f4249cec8ccc187b3f9ee5094fb3080900a9 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Mon, 1 May 2023 11:00:25 +1000 Subject: memory access thru function; will be vital later. --- headers/addressing.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'headers/addressing.h') 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; } } -- cgit v1.2.3