An equate is a symbol that represents any value. To create an equate, use the .equ or .set directive.
The first character of an equate must be a:
Subsequent characters can be from the preceding list or a:
The assembler allows forward equates. This means that a reference to an equate can be in a file before the equate's definition. When an assembler encounters such a symbol whose value is not known, the assembler retains the expression and marks it as unresolved. After the assembler reads the entire file, it reevaluates any unresolved expressions. If necessary, the assembler repeatedly reevaluates expressions until it resolves them all or cannot resolve them any further. If the assembler cannot resolve an expression, it issues an error message.
The code of the following listing shows a valid forward equate.
.data .long alloc_size alloc_size .set rec_size + 4 ; a valid forward equate on next line rec_size .set table_start-table_end .text;... table_start: ; ... table_end:
However, the code of the following listing is not valid. The assembler cannot immediately resolve the expression in the .space directive, so the effect on the location counter is unknown.
;invalid forward equate on next line rec_size .set table_start-table_end .space rec_size .text; ... table_start: ; ... table_end: