Share via


ARM Constant and Variable Declarations

9/7/2007

The following ARM Assembly directives are for setting constants.

Directive Syntax Description

*

label *expression

Identical to EQU.

Gives a symbolic label to a fixed or program-relative expression.

CN

label CN numeric-expression

Names a coprocessor register number; c0 to c15 are predefined and cannot be used as labels.

CP

label CP numeric-expression

Gives a name to a coprocessor number, if available, that must be within the range 0 to 15.

The names p0 - p15 are predefined and cannot be used as labels.

EQU

label EQU expression

Gives a symbolic label to a fixed or program-relative expression.

FN

label FN numeric-expression

Defines the names of floating-point registers, if available.

The names F0-F7 and f0-f7 are predefined.

The predefined register names cannot be used as labels but can be used as numeric expressions.

RN

label RN numeric-expression

Defines register names. Refer to registers by name only.

The names R0-R15, r0-r15, PC, pc, LR, and lr are predefined.

The predefined register names cannot be used as labels but can be used as numeric expressions.

The assembler supports global and local variables. The scope of global variables extends across the entire source file, while that of local variables is restricted to a particular instantiation of a macro.

The following table ARM assembly directives are for setting local and global variables.

Directive Syntax Description

GBLA

GBLA variable-name

Defines a global arithmetic variable.

Values of arithmetic variables are 32-bit unsigned integers.

GBLL

GBLL variable-name

Defines a global logical variable.

GBLS

GBLS variable-name

Defines a global string variable.

LCLA

LCLA variable-name

Defines a local arithmetic variable with an initial state of 0.

LCLL

LCLL variable-name

Defines a local logical variable with an initial state of FALSE.

LCLS

LCLS variable-name

Defines a local string variable with an initial state of NULL string.

SETA

variable-name SETA expression

Sets the value of an arithmetic variable.

SETL

variable-name SETL expression

Sets the value of a logical variable.

SETS

variable-name SETS expression

Sets the value of a string variable.

Note that when you set the value of a string variable, you must use quotes.

You can declare local variables only from within a macro. In addition, after you declare a variable, you cannot use its name for any other purpose.

The assembler substitutes values for some variables:

  • If a variable name has a $ character prefix, the assembler substitutes the variable value before it checks the line syntax.
  • If the variable is a logical or arithmetic variable, the assembler performs an .STR operation on the variable, and replaces the variable with the result of the operation.

See Also

Concepts

ARM Assembler Directives