Symbolic Constants

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:

sym .set 3 MVK sym,B1

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:

sym .set B1 MVK 10,sym

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 ; value offset = 0 delta .int ; delta offset = 4 i_len .endstruct ; item size = 8 array .tag item .bss array, i_len*K ; declare an array of K "items" .text LDW *+B14(array.delta + 2*i_len),A1 ; access array [2].delta

The assembler also has many predefined symbolic constants; these are discussed in Section 4.8.6.