ARM Constant and Variable Declarations
9/7/2007
The following ARM Assembly directives are for setting constants.
Directive | Syntax | Description |
---|---|---|
* |
|
Identical to EQU. Gives a symbolic label to a fixed or program-relative expression. |
CN |
|
Names a coprocessor register number; c0 to c15 are predefined and cannot be used as labels. |
CP |
|
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 |
|
Gives a symbolic label to a fixed or program-relative expression. |
FN |
|
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 |
|
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 |
|
Defines a global arithmetic variable. Values of arithmetic variables are 32-bit unsigned integers. |
GBLL |
|
Defines a global logical variable. |
GBLS |
|
Defines a global string variable. |
LCLA |
|
Defines a local arithmetic variable with an initial state of 0. |
LCLL |
|
Defines a local logical variable with an initial state of FALSE. |
LCLS |
|
Defines a local string variable with an initial state of NULL string. |
SETA |
|
Sets the value of an arithmetic variable. |
SETL |
|
Sets the value of a logical variable. |
SETS |
|
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.