SPRU513Z August 2001 – October 2023 SM320F28335-EP
All labels in an assembly language program must be unique. This includes labels in macros. If a macro is expanded more than once, its labels are defined more than once. Defining a label more than once is illegal. The macro language provides a method of defining labels in macros so that the labels are unique. Simply follow each label with a question mark, and the assembler replaces the question mark with a period followed by a unique number. When the macro is expanded, you do not see the unique number in the listing file. Your label appears with the question mark as it did in the macro definition. You cannot declare this label as global. See Section 4.8.3 for more about labels.
The syntax for a unique label is:
label ? |
Unique Labels in a Macro shows unique label generation in a macro. The maximum label length is shortened to allow for the unique suffix. For example, if the macro is expanded fewer than 10 times, the maximum label length is 126 characters. If the macro is expanded from 10 to 99 times, the maximum label length is 125. The label with its unique suffix is shown in the cross-listing file. To obtain a cross-listing file, invoke the assembler with the --asm_cross_reference_listing option (see Section 4.14).
1
2 min .macro x, y, z
3
4 MOV z, y
5 CMP x, y
6 B l?,GT
7 MOV z, x
8 l?
9 .endm
10
11 00000000 min AH, AL, PH
1
1 00000000 2FA9 MOV PH, AL
1 00000001 55A9 CMP AH, AL
1 00000002 6202 B l?,GT
1 00000003 2FA8 MOV PH, AH
1 l?
12
LABEL VALUE DEFN REF
.TMS320C2800 000001 0
.TMS320C2800_FPU32 000000 0
__TI_ASSEMBLER_VERSION_QUAL_ID__ 001c52 0
__TI_ASSEMBLER_VERSION_QUAL__ 000049 0
__TI_ASSEMBLER_VERSION__ 4c4f28 0
l$1$ 000004' 12 11