Keil Logo

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:    MOV     A,@R1
        MOV     @R0,A
        INC     R0
        INC     R1
        DJNZ    R2,lab
        ENDM

Note

  • Local labels must be declared in the line immediately following the macro definition.
  • Up to 16 local labels may be defined in a macro.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.