A symbolic constant is a symbol with a value that is an absolute constant expression (see Section 4.9). By using symbolic constants, you can assign meaningful names to constant expressions. The .set and .struct/.tag/.endstruct directives enable you to set symbolic constants (see Define Assembly-Time Constant). Once defined, symbolic constants cannot be redefined.
If you use the .set directive to assign a value to a symbol , the symbol becomes a symbolic constant and may be used where a constant expression is expected. For example:
shift3 .set 3
MOV R0, #shift3
You can also use the .set directive to assign symbolic constants for other symbols, such as register names. In this case, the symbolic constant becomes a synonym for the register:
AuxR1 .set R1
LDR AuxR1, [SP]
The following example shows how the .set directive can be used with the .struct, .tag. and .endstruct directives. It creates the symbolic constants K, maxbuf, item, value, delta, and i_len.
K .set 1024 ;constant definitions
maxbuf .set 2*K
item .struct ;item structure definition
.int value ;constant offsets value = 0
.int delta ;constant offsets delta = 1
i_len .endstruct
array .tag item ;array declaration
.bss array, i_len*K
The assembler also has many predefined symbolic constants; these are discussed in Section 4.8.6.