all repos — mgba @ 45473bf7bcf33c58c408d75ff8d06f84774eb79d

mGBA Game Boy Advance Emulator

ARM7: Fix cycle counting for loads
Jeffrey Pfau jeffrey@endrift.com
Fri, 27 Mar 2015 21:21:17 -0700
commit

45473bf7bcf33c58c408d75ff8d06f84774eb79d

parent

afff253928e9364cc0632fc5dfa8ec56f49f9dba

3 files changed, 6 insertions(+), 4 deletions(-)

jump to
M CHANGESCHANGES

@@ -59,6 +59,7 @@ - GBA: Initialize gba.sync to null

- GBA: Fix timer initialization - GBA Memory: Fix I cycles that had been moved to ARM7 core - GBA Memory: Fix cycle counting for 32-bit load/stores + - ARM7: Fix cycle counting for loads Misc: - GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples - GBA Memory: Simplify memory API and use fixed bus width
M src/arm/isa-arm.csrc/arm/isa-arm.c

@@ -254,7 +254,7 @@

#define ADDR_MODE_4_WRITEBACK_STM cpu->gprs[rn] = address; #define ARM_LOAD_POST_BODY \ - ++currentCycles; \ + currentCycles += 1 + cpu->memory.activeNonseqCycles32 - cpu->memory.activeSeqCycles32; \ if (rd == ARM_PC) { \ ARM_WRITE_PC; \ }

@@ -562,14 +562,14 @@ ARM_STORE_POST_BODY;)

DEFINE_LOAD_STORE_MULTIPLE_INSTRUCTION_ARM(LDM, load, - ++currentCycles; + currentCycles += 1 + cpu->memory.activeNonseqCycles32 - cpu->memory.activeSeqCycles32; if (rs & 0x8000) { ARM_WRITE_PC; }) DEFINE_LOAD_STORE_MULTIPLE_INSTRUCTION_ARM(STM, store, - currentCycles += cpu->memory.activeNonseqCycles32 - cpu->memory.activeSeqCycles32) + ARM_STORE_POST_BODY;) DEFINE_INSTRUCTION_ARM(SWP, int rm = opcode & 0xF;
M src/arm/isa-thumb.csrc/arm/isa-thumb.c

@@ -41,7 +41,8 @@ THUMB_SUBTRACTION_S(m, n, D)

#define THUMB_PREFETCH_CYCLES (1 + cpu->memory.activeSeqCycles16) -#define THUMB_LOAD_POST_BODY ++currentCycles; +#define THUMB_LOAD_POST_BODY \ + currentCycles += 1 + cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16; #define THUMB_STORE_POST_BODY \ currentCycles += cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16;