Keil™, An ARM® Company

RealView Assembler User's Guide

Register‑relative and program‑relative expressions

3.6.6. Register‑relative and program‑relative expressions

A register‑relative expression evaluates to a named register plus or minus a numeric constant (see MAP).

A program‑relative expression evaluates to the Program Counter (PC), plus or minus a numeric constant. It is normally a label combined with a numeric expression.

Note

The value used in program-relative addresses is:

  • the address of the instruction following the instruction being executed

  • OR 0xFFFFFFFC (this makes no difference in ARM code)

  • plus or minus the numeric constant.

Example

        LDR     r4,=data+4*n    ; n is an assembly‑time variable
        ; code
        MOV     pc,lr
data    DCD     value0
        ; n‑1 DCD directives
        DCD     valuen          ; data+4*n points here
        ; more DCD directives
Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0379A