mirror of https://github.com/mgba-emu/mgba.git
Implement BX
This commit is contained in:
parent
d7ff6aa14b
commit
7c8d76eb06
|
@ -390,7 +390,20 @@ DEFINE_INSTRUCTION_THUMB(BL2, \
|
||||||
cpu->gprs[ARM_LR] = pc - 1; \
|
cpu->gprs[ARM_LR] = pc - 1; \
|
||||||
THUMB_WRITE_PC;)
|
THUMB_WRITE_PC;)
|
||||||
|
|
||||||
DEFINE_INSTRUCTION_THUMB(BX, ARM_STUB)
|
DEFINE_INSTRUCTION_THUMB(BX, \
|
||||||
|
int rm = opcode & 0x0000000F; \
|
||||||
|
_ARMSetMode(cpu, cpu->gprs[rm] & 0x00000001);
|
||||||
|
int misalign = 0;
|
||||||
|
if (rm == ARM_PC) {
|
||||||
|
misalign = cpu->gprs[rm] & 0x00000002;
|
||||||
|
}
|
||||||
|
cpu->gprs[ARM_PC] = cpu->gprs[rm] & 0xFFFFFFFE - misalign; \
|
||||||
|
if (cpu->executionMode == MODE_THUMB) { \
|
||||||
|
THUMB_WRITE_PC; \
|
||||||
|
} else { \
|
||||||
|
ARM_WRITE_PC; \
|
||||||
|
})
|
||||||
|
|
||||||
DEFINE_INSTRUCTION_THUMB(SWI, ARM_STUB)
|
DEFINE_INSTRUCTION_THUMB(SWI, ARM_STUB)
|
||||||
|
|
||||||
#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \
|
#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \
|
||||||
|
|
Loading…
Reference in New Issue