diff --git a/CHANGES b/CHANGES index 58f4109ec..2e2c72a2d 100644 --- a/CHANGES +++ b/CHANGES @@ -29,6 +29,7 @@ Bugfixes: - GB, GBA Savedata: Fix savestate-related save overwriting (fixes mgba.io/i/834) - Qt: Fix timezone issues with time overrides - Qt: Fix sprite export pausing game indefinitely (fixes mgba.io/i/841) + - ARM: Fix MSR when T bit is set Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) diff --git a/src/arm/isa-arm.c b/src/arm/isa-arm.c index 8533833bc..84e894313 100644 --- a/src/arm/isa-arm.c +++ b/src/arm/isa-arm.c @@ -663,8 +663,9 @@ DEFINE_INSTRUCTION_ARM(MSR, } _ARMReadCPSR(cpu); if (cpu->executionMode == MODE_THUMB) { - LOAD_16(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_THUMB) & cpu->memory.activeMask, cpu->memory.activeRegion); - LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); + cpu->prefetch[0] = 0x46C0; // nop + cpu->prefetch[1] &= 0xFFFF; + cpu->gprs[ARM_PC] += WORD_SIZE_THUMB; } else { LOAD_32(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_ARM) & cpu->memory.activeMask, cpu->memory.activeRegion); LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); @@ -704,8 +705,9 @@ DEFINE_INSTRUCTION_ARM(MSRI, } _ARMReadCPSR(cpu); if (cpu->executionMode == MODE_THUMB) { - LOAD_16(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_THUMB) & cpu->memory.activeMask, cpu->memory.activeRegion); - LOAD_16(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion); + cpu->prefetch[0] = 0x46C0; // nop + cpu->prefetch[1] &= 0xFFFF; + cpu->gprs[ARM_PC] += WORD_SIZE_THUMB; } else { LOAD_32(cpu->prefetch[0], (cpu->gprs[ARM_PC] - WORD_SIZE_ARM) & cpu->memory.activeMask, cpu->memory.activeRegion); LOAD_32(cpu->prefetch[1], cpu->gprs[ARM_PC] & cpu->memory.activeMask, cpu->memory.activeRegion);