summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ryan Holtz <rholtz@batcountryentertainment.com>2008-01-24 04:10:40 +0000
committer Ryan Holtz <rholtz@batcountryentertainment.com>2008-01-24 04:10:40 +0000
commita67e5be6db4b4bd7e86b34df65eafef8c86b7418 (patch)
tree2c58772f4bf594cbb485165182719691d01e7cd3
parentf1d2bde33382ed6b252a2d9ef3d611ab6e0090b4 (diff)
Credit to SGINut.
Changes: - ARM7: Added support for the BLX opcode in THUMB mode.
-rw-r--r--src/emu/cpu/arm7/arm7dasm.c25
-rw-r--r--src/emu/cpu/arm7/arm7exec.c23
2 files changed, 34 insertions, 14 deletions
diff --git a/src/emu/cpu/arm7/arm7dasm.c b/src/emu/cpu/arm7/arm7dasm.c
index 3af2d7d6fc2..42890e01e09 100644
--- a/src/emu/cpu/arm7/arm7dasm.c
+++ b/src/emu/cpu/arm7/arm7dasm.c
@@ -1200,17 +1200,26 @@ UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
}
break;
case 0xe: /* B #offs */
- offs = ( opcode & THUMB_BRANCH_OFFS ) << 1;
- if( offs & 0x00000800 )
- {
- offs |= 0xfffff800;
- }
- pBuf += sprintf( pBuf, "B #%08x (%08x)", offs, pc + 4 + offs);
+ if( insn & THUMB_BLOP_LO )
+ {
+ addr = ( ( opcode & THUMB_BLOP_OFFS ) << 1 ) & 0xfffc;
+ pBuf += sprintf( pBuf, "BLX (LO) %08x", addr );
+ dasmflags = DASMFLAG_STEP_OVER;
+ }
+ else
+ {
+ offs = ( opcode & THUMB_BRANCH_OFFS ) << 1;
+ if( offs & 0x00000800 )
+ {
+ offs |= 0xfffff800;
+ }
+ pBuf += sprintf( pBuf, "B #%08x (%08x)", offs, pc + 4 + offs);
+ }
break;
case 0xf: /* BL */
if( opcode & THUMB_BLOP_LO )
{
- pBuf += sprintf( pBuf, "BL (LO) %04x", ( opcode & THUMB_BLOP_OFFS ) << 1 );
+ pBuf += sprintf( pBuf, "BL (LO) %08x", ( opcode & THUMB_BLOP_OFFS ) << 1 );
dasmflags = DASMFLAG_STEP_OVER;
}
else
@@ -1220,7 +1229,7 @@ UINT32 thumb_disasm( char *pBuf, UINT32 pc, UINT16 opcode )
{
addr |= 0xff800000;
}
- pBuf += sprintf( pBuf, "BL (HI) %04x", ( opcode & THUMB_BLOP_OFFS ) << 12 );
+ pBuf += sprintf( pBuf, "BL (HI) %08x", addr );
dasmflags = DASMFLAG_STEP_OVER;
}
break;
diff --git a/src/emu/cpu/arm7/arm7exec.c b/src/emu/cpu/arm7/arm7exec.c
index f1afb4250b0..e4845f33503 100644
--- a/src/emu/cpu/arm7/arm7exec.c
+++ b/src/emu/cpu/arm7/arm7exec.c
@@ -1109,12 +1109,23 @@
}
break;
case 0xe: /* B #offs */
- offs = ( insn & THUMB_BRANCH_OFFS ) << 1;
- if( offs & 0x00000800 )
- {
- offs |= 0xfffff800;
- }
- R15 += 4 + offs;
+ if( insn & THUMB_BLOP_LO )
+ {
+ addr = GET_REGISTER(14);
+ addr += ( insn & THUMB_BLOP_OFFS ) << 1;
+ addr &= 0xfffffffc;
+ SET_REGISTER( 14, ( R15 + 4 ) | 1 );
+ R15 = addr;
+ }
+ else
+ {
+ offs = ( insn & THUMB_BRANCH_OFFS ) << 1;
+ if( offs & 0x00000800 )
+ {
+ offs |= 0xfffff800;
+ }
+ R15 += 4 + offs;
+ }
break;
case 0xf: /* BL */
if( insn & THUMB_BLOP_LO )