all repos — mgba @ 95e1dd9c35c2fb4c5d942d65431aae4e3ece2142

mGBA Game Boy Advance Emulator

Revert "GBA Memory: Improve gamepak prefetch timing"

This reverts commit 8a6cf8dc9c00082e9917b4777f949de0d35ce710.
Vicki Pfau vi@endrift.com
Sat, 18 Jan 2020 19:35:45 -0800
commit

95e1dd9c35c2fb4c5d942d65431aae4e3ece2142

parent

4ca16fb2ef9288d64f9c895888e28dd94e7e1a36

2 files changed, 5 insertions(+), 7 deletions(-)

jump to
M CHANGESCHANGES

@@ -92,7 +92,6 @@ - ARM: Partially fix LDM/STM writeback with empty register list

- ARM: Fix stepping when events are pending - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) - GBA Memory: Fix open bus from IWRAM (fixes mgba.io/i/1575) - - GBA Memory: Improve gamepak prefetch timing - GBA Timers: Improve timer startup emulation - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) - GBA Video: Fix BLDY for semitransparent sprite on non-target-2 backgrounds
M src/gba/memory.csrc/gba/memory.c

@@ -1622,19 +1622,17 @@ previousLoads = dist >> 1;

maxLoads -= previousLoads; } - int32_t s = cpu->memory.activeSeqCycles16; + int32_t s = cpu->memory.activeSeqCycles16 + 1; int32_t n2s = cpu->memory.activeNonseqCycles16 - cpu->memory.activeSeqCycles16 + 1; // Figure out how many sequential loads we can jam in - int32_t stall = s + 1; + int32_t stall = s; int32_t loads = 1; while (stall < wait && loads < maxLoads) { stall += s; ++loads; } - memory->lastPrefetchedPc = cpu->gprs[ARM_PC] + WORD_SIZE_THUMB * (loads + previousLoads - 1); - if (stall > wait) { // The wait cannot take less time than the prefetch stalls wait = stall;

@@ -1643,9 +1641,10 @@

// This instruction used to have an N, convert it to an S. wait -= n2s; + memory->lastPrefetchedPc = cpu->gprs[ARM_PC] + WORD_SIZE_THUMB * (loads + previousLoads - 1); + // The next |loads|S waitstates disappear entirely, so long as they're all in a row - wait -= stall - 1; - + cpu->cycles -= (s - 1) * loads; return wait; }