A166 User's Guide

Local Symbols

Standard macros may include local labels that are the targets of branches. Fixed label names cause errors if the macro is called more than once. This happens because the same label name may be used only once in a source file. This problem may be solved by using local symbols. Local macro symbols are replaced with a unique, sequentially-numbered label that increments each time the macro is invoked.

The following example shows how the local label lab is created using the LOCAL statement in the macro definition.

BMOVE   MACRO   src, dst, cnt
LOCAL   lab
        MOV     R2,#cnt
        MOV     R1,#src
        MOV     R0,#dst
lab:    MOVB    [R0+],[R1]
        ADD     R1,#1
        CMPD1   R2,#0
        JMP     CC_NZ, lab
        ENDM

Note

  • Local labels must be declared line immediately folowing the macro definition.
  • Up to 16 local labels may be defined in a macro.