summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/arm
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-04-07 19:17:25 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-04-07 19:17:25 -0400
commit151e1b4bcc5a64355f55b870d1f5eb74d27223e6 (patch)
tree31edd432396454e44644aab01e73675fc1e8caa4 /src/devices/cpu/arm
parent7a3a0a42438c45188a19466f3c9b9dbc8bd5b03a (diff)
arm: Calculate R15-relative offsets in disassembly
Diffstat (limited to 'src/devices/cpu/arm')
-rw-r--r--src/devices/cpu/arm/armdasm.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/devices/cpu/arm/armdasm.cpp b/src/devices/cpu/arm/armdasm.cpp
index 81bd4c8dc6e..047fb2b3f70 100644
--- a/src/devices/cpu/arm/armdasm.cpp
+++ b/src/devices/cpu/arm/armdasm.cpp
@@ -245,27 +245,32 @@ offs_t arm_disassembler::disassemble(std::ostream &stream, offs_t pc, const data
}
}
+ int memreg = (opcode >> 16) & 0xf;
WritePadding(stream, start_position);
- util::stream_format( stream, "R%d, [R%d",
- (opcode>>12)&0xf, (opcode>>16)&0xf );
+ util::stream_format(stream, "R%d, [R%d", (opcode >> 12) & 0xf, memreg);
if( opcode&0x02000000 )
{
/* register form */
- WriteRegisterOperand1( stream, opcode );
- util::stream_format( stream, "]" );
+ WriteRegisterOperand1(stream, opcode);
+ util::stream_format(stream, "]");
}
else
{
/* immediate form */
- util::stream_format( stream, "]" );
+ util::stream_format(stream, "]");
+ uint16_t displacement = opcode & 0xfff;
if( opcode&0x00800000 )
{
- util::stream_format( stream, ", #$%x", opcode&0xfff );
+ util::stream_format(stream, ", #$%x", displacement);
+ if (memreg == 15)
+ util::stream_format(stream, " ; [$%x]", pc + 8 + displacement);
}
else
{
- util::stream_format( stream, ", -#$%x", opcode&0xfff );
+ util::stream_format(stream, ", -#$%x", displacement);
+ if (memreg == 15)
+ util::stream_format(stream, " ; [$%x]", pc + 8 - displacement);
}
}
}