SLAU131V October 2004 – February 2020
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 #shift3, R11
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:
OP1 .set R11
MOV OP1, 2(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
value .int ; constant offsets value = 0
delta .int ; constant offsets value = 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.