Share via


ARM Constant and Variable Declarations

The following table shows the ARM Assembly directives for setting constants.

Directive Syntax Description
EQU
label EQU expression
Gives a symbolic label to a fixed or program-relative expression.
*
label *expression
Identical to EQU. Gives a symbolic label to a fixed or program-relative expression.
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.
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.
CP
label CP numeric-expression
Gives a name to a coprocessor number, if available, which must be within the range 0 to 15. The names p0 - p15 are predefined and cannot be used as labels.
CN
label CN numeric-expression
Names a coprocessor register number; c0 to c15 are predefined and cannot be used as labels.

The assembler supports both 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 describes the ARM assembly directives 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 initial state 0.
LCLL
LCLL variable-name
Defines a local logical variable with initial state FALSE.
LCLS
LCLS variable-name
Defines a local string variable with initial state 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   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, once you declare a variable, you cannot use its name for any other purpose. The assembler substitutes values for certain variables:

  • If 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

ARM Assembler Directives | ARM Assembler | ARM Initialization and Layout Directives | ARM Linking Directives | ARM Diagnostic Directives | ARM Directives for Conditional Assembly | ARM Dynamic Listing Directive Options | ARM-Thumb Interworking Directives | ARM Assembler Directives for Macro Definition | Miscellaneous ARM Directives

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.