I'm having trouble deciphering this block of assembly code. What would the value of r1 be by the end and how would I get there?
3242ba66 f6454118 movw r1, 0x5c18
3242ba6a 466f mov r7, sp
3242ba6c f6c0415a movt r1, 0xc5a
3242ba70 f2460002 movw r0, 0x6002
3242ba74 f6c0405a movt r0, 0xc5a
3242ba78 4479 add r1, pc
3242ba7a 4478 add r0, pc
3242ba7c 6809 ldr r1, [r1, #0]
movw
followed by a movt
is a common way to load a 32-bit value into a register. It's the equivalent of OR-ing those two immediate values together, with the movt
being the upper 16-bit. In this case, r1 = (movt immediate value << 16) | (movw immediate value))
.
3242ba66 f6454118 movw r1, 0x5c18 // r1 = 0x5c18
3242ba6a 466f mov r7, sp
3242ba6c f6c0415a movt r1, 0xc5a // r1 = (r1 & 0xffff) | (0xc5a << 16)
3242ba70 f2460002 movw r0, 0x6002
3242ba74 f6c0405a movt r0, 0xc5a
3242ba78 4479 add r1, pc // r1 = r1 + pc
3242ba7a 4478 add r0, pc
3242ba7c 6809 ldr r1, [r1, #0] // r1 = *(r1 + 0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With