SPRU513Z August 2001 – October 2023 SM320F28335-EP
Assign a Substitution Symbol
.asg "character string",substitution symbol
.define "character string",substitution symbol
.eval expression,substitution symbol
The .asg and .define directives assign character strings to substitution symbols. Substitution symbols are stored in the substitution symbol table. The .asg directive can be used in many of the same ways as the .set directive, but while .set assigns a constant value (which cannot be redefined) to a symbol, .asg assigns a character string (which can be redefined) to a substitution symbol.
The .define directive functions in the same manner as the .asg directive, except that .define disallows creation of a substitution symbol that has the same name as a register symbol or mnemonic. It does not create a new symbol name space in the assembler, rather it uses the existing substitution symbol name space. The .define directive is used to prevent corruption of the assembly environment when converting C/C++ headers. See Chapter 13 for more information about using C/C++ headers in assembly source.
The .eval directive performs arithmetic on substitution symbols, which are stored in the substitution symbol table. This directive evaluates the expression and assigns the string value of the result to the substitution symbol. The .eval directive is especially useful as a counter in .loop/.endloop blocks.
See the .unasg/.undefine topic for information on turning off a substitution symbol.
This example shows how .asg and .eval can be used.
1 .sslist
2 .asg XAR6, FP
3 00000000 0964 ADD ACC, #100
4 00000001 7786 NOP *FP++
# NOP *XAR6++
5 00000002 7786 NOP *XAR6++
6
7 .asg 0, x
8 .loop 5
9 .eval x+1, x
10 .word x
11 .endloop
1 .eval x+1, x
# .eval 0+1, x
1 00000003 0001 .word x
# .word 1
1 .eval x+1, x
# .eval 1+1, x
1 00000004 0002 .word x
# .word 2
1 .eval x+1, x
# .eval 2+1, x
1 00000005 0003 .word x
# .word 3
1 .eval x+1, x
# .eval 3+1, x
1 00000006 0004 .word x
# .word 4
1 .eval x+1, x
# .eval 4+1, x
1 00000007 0005 .word x
# .word 5