SPRUI03E June 2015 – January 2023
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:
.global _table
.asg "B14", PAGEPTR
.asg "*+B15(4)", LOCAL1
.asg "*+B15(8)", LOCAL2
LDW *+PAGEPTR(_table),A0
NOP 4
STW A0,LOCAL1
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:
MAC .macro src1, src2, dst ; Multiply/Accumulate macro
MPY src1, src2, src2
NOP
ADD src2, dst, dst
.endm
* MAC macro invocation
MACA0,A1,A2
See Chapter 7 for more information about macros.