Search code examples
assemblyarmaddressing-modearmv8

Offset an index with the value in another register ARMv8


If I am able to load a register (R5) with a value from memory + some offset using the command:

LDR R5, [R12, #4]

How would I go about using the value of another register (R7 =0x0004 for example) as the offset?

LDR R5, [R12, &R7]

Solution

  • You almost have it, but the & symbol doesn't belong. It's simply

    LDR R5, [R12, R7]