ARM7 updates [Tim Schuerewegen]:

- Fixed "MOV x, R15, LSL #y" form as tested by ARMWrestler
- Added unimplemented Thumb MOV variant used by GBA Moto GP
This commit is contained in:
R. Belmont 2011-01-23 03:22:54 +00:00
parent cf804649b3
commit 410a8d8f2d
3 changed files with 14 additions and 1 deletions

View File

@ -343,7 +343,8 @@ static UINT32 decodeShift(arm_state *cpustate, UINT32 insn, UINT32 *pCarry)
UINT32 t = (insn & INSN_OP2_SHIFT_TYPE) >> INSN_OP2_SHIFT_TYPE_SHIFT;
if ((insn & INSN_OP2_RM) == 0xf) {
rm += 8;
// "If a register is used to specify the shift amount the PC will be 12 bytes ahead." (instead of 8)
rm += t & 1 ? 12 : 8;
}
/* All shift types ending in 1 are Rk, not #k */

View File

@ -939,6 +939,11 @@ static UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
case 0x2: /* MOV */
switch( ( opcode & THUMB_HIREG_H ) >> THUMB_HIREG_H_SHIFT )
{
case 0x0:
rs = ( opcode & THUMB_HIREG_RS ) >> THUMB_HIREG_RS_SHIFT;
rd = opcode & THUMB_HIREG_RD;
pBuf += sprintf( pBuf, "MOV R%d, R%d", rd, rs );
break;
case 0x1:
rs = ( opcode & THUMB_HIREG_RS ) >> THUMB_HIREG_RS_SHIFT;
rd = opcode & THUMB_HIREG_RD;

View File

@ -580,6 +580,13 @@
case 0x2: /* MOV */
switch ((insn & THUMB_HIREG_H) >> THUMB_HIREG_H_SHIFT)
{
case 0x0: // MOV Rd, Rs (undefined)
// "The action of H1 = 0, H2 = 0 for Op = 00 (ADD), Op = 01 (CMP) and Op = 10 (MOV) is undefined, and should not be used."
rs = (insn & THUMB_HIREG_RS) >> THUMB_HIREG_RS_SHIFT;
rd = insn & THUMB_HIREG_RD;
SET_REGISTER(cpustate, rd, GET_REGISTER(cpustate, rs));
R15 += 2;
break;
case 0x1: // MOV Rd, Hs
rs = (insn & THUMB_HIREG_RS) >> THUMB_HIREG_RS_SHIFT;
rd = insn & THUMB_HIREG_RD;