Sets a symbol equal to an expression in both type and value.
.set | Name, Expression |
The .set pseudo-op sets the Name symbol equal to the Expression value in type and in value. Using the .set pseudo-op may help to avoid errors with a frequently used expression. Equate the expression to a symbol, then refer to the symbol rather than the expression. To change the value of the expression, only change it within the .set statement. However, reassembling the program is necessary since .set assignments occur only at assembly time.
The Expression parameter is evaluated when the assembler encounters the .set pseudo-op. This evaluation is done using the rules in Combination Handling of Expressions ; and the type and value of the evaluation result are stored internally. If evaluating the Expression, results in an invalid type, all instructions which use the symbol Name will have an error.
The stored type and value for symbol Name, not the original expression definition, are used when Name is used in other instructions.
.set ap,14 # Assembler assigns value 14 # to the symbol ap -- ap # is absolute. . . lil ap,2 # Assembler substitutes value 14 # for the symbol. # Note that ap is a register # number in context # as lil's operand.
.csect a1[PR] L1: l 20,30(10) .csect a2[rw] .long 0x20 L2: .long 0x30 .set r1, L2 - L1 # r1 has type of E_REXT # r1 has value of 8 .long r1 + 10 .long L2 - r1 # Error will be reported. # L2 is E_REL # r1 is E_REXT # E_REL - E_REXT ==> Invalid type