From 0a37300bcf05385da830c45c57e2bfc5e41d2a6b Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 11 May 2013 14:55:29 -0700 Subject: [PATCH] Improve LDR/STR cycle counting --- src/gba/gba-memory.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gba/gba-memory.c b/src/gba/gba-memory.c index f7e166eb7..1a7304889 100644 --- a/src/gba/gba-memory.c +++ b/src/gba/gba-memory.c @@ -158,7 +158,7 @@ int32_t GBALoad32(struct ARMMemory* memory, uint32_t address, int* cycleCounter) if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 2 + wait; } // Unaligned 32-bit loads are "rotated" so they make some semblance of sense int rotate = (address & 3) << 3; @@ -221,7 +221,7 @@ int16_t GBALoad16(struct ARMMemory* memory, uint32_t address, int* cycleCounter) } if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 2 + wait; } return value; } @@ -276,7 +276,7 @@ int8_t GBALoad8(struct ARMMemory* memory, uint32_t address, int* cycleCounter) { } if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 2 + wait; } return value; } @@ -318,7 +318,7 @@ void GBAStore32(struct ARMMemory* memory, uint32_t address, int32_t value, int* } if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 1 + wait; } } @@ -364,7 +364,7 @@ void GBAStore16(struct ARMMemory* memory, uint32_t address, int16_t value, int* } if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 1 + wait; } } @@ -410,7 +410,7 @@ void GBAStore8(struct ARMMemory* memory, uint32_t address, int8_t value, int* cy } if (cycleCounter) { - *cycleCounter += wait; + *cycleCounter += 1 + wait; } }