Local Labels

A local label is a symbol that represents an address and has local scope: the range forward and backward within the file to the points where the assembler encounters a non-local labels.

The first character of a local label must be an at-sign (@). The subsequent characters of a local label can be:

Within an expanded macro, the scope of local labels works differently:

The following list shows the scope of a local labels in macros. The @SKIP label defined in the macro does not conflict with the @SKIP label defined in the main body of code.

Listing: Local Label Scope in a Macro


MAKEPOS       .MACRO

      cmp #1,  d0

      bne     @SKIP

      neg      d0

@SKIP:   ;Scope of this label is within the macro

     .ENDM

START:

     move COUNT,   d0

     cmp #1,       d0

     bne @SKIP

     MAKEPOS

@SKIP:    ;Scope of this label is START to END

          ;excluding lines arising from

          ;macro expansion

     addq #1,  d0

END: rts