I'm adapting the reko decompiler to use Capstone for its disassembler, instead of rolling my own. I'm using the .NET bindings provided by Capstone.NET.

The strategy is to replace the old ARM disassembler with the Capstone disassembler and then run the old unit tests to make sure nothing broke. I'm at a point where most test are passing, but the opcode E1F322D1, which both the old reko disassembler and ODA disassemble to:

 ldrsb r2, [r3, #33]!

But, Capstone responds with:

ldrsb r2,[r3,#&221]!

I don't have other disassemblers handy, so I'm uncertain who to trust!

What's the correct disassembly?

2 Answers 2


IDA agrees with the first one:

LDRSB R2, [R3,#33]!

Capstone might be trying to display something like #0x21, which would be equivalent, but it seems that something went wrong.

  • Indeed, after some further troubleshooting I narrowed down the problem to Capstone.NET and reported it. Hopefully a fix will be forthcoming soon. Commented Aug 11, 2015 at 20:31

From http://bear.ces.cwru.edu/eecs_382/ARM7-TDMI-manual-pt2.pdf:


E1F322D1 equals 11100001111100110010001011010001 in binary.

Your question is specific to the offset, so we can examine the last dozen bits of that binary string with regard to the decomposition rules in the screenshot above:

... Offset 1 SH 1 Offset
...  0010  1 10 1  0001

Thus, the high nibble is 0010 and the low nibble is 0001. If we combine them, we get 00100001 in binary, or 33 in decimal.

So the correct disassembly is ldrsb r2, [r3, #33]!.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.