Symbols can be assigned a string value. This enables you to create aliases for character strings by equating them to symbolic names. Symbols that represent character strings are called substitution symbols. When the assembler encounters a substitution symbol, its string value is substituted for the symbol name. Unlike symbolic constants, substitution symbols can be redefined.
A string can be assigned to a substitution symbol anywhere within a program; for example:
.asg "R2", stack-pointer
; Assigns the string R2 to the substitution symbol stack-pointer.
.asg "0x20", block2
; Assigns the string 0x20 to the substitution symbol block2.
ADD stack-pointer, stack-pointer, block2
; Adds the value in SP to 0x20 and stores the result in SP.
When you are using macros, substitution symbols are important because macro parameters are actually substitution symbols that are assigned a macro argument. The following code shows how substitution symbols are used in macros:
sign_extend_32_8 .macro dest, src
.newblock
MOV dest, src
; zero extends src into dest
QBBC $1, dest, 7
FILL &dest.b1, 3
$1:
.endm
See Section 6 for more information about macros.