## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### LOCAL (Identify Names Local to a Macro Definition)

The LOCAL directive is used inside the body of a macro definition, and provides a method of automatically generating unique assembler labels each time the macro is expanded. The names appearing in the argument list of the LOCAL directive are known only to the enclosing macro, and each time they are referenced during a macro expansion a unique symbol is created. This prevents the assembler from issuing duplicate definition errors when the macro is expanded more than once and symbols contained therein are being used to create assembler labels.

Syntax

    LOCAL   Name   [ ,   Name . . . . ]

Remarks

The LOCAL directive is recognized only within the body of a macro given by a MACRO, FOR/IRP, FORC/IRPC, or REPEAT/REPT definition. The symbols created by the preprocessor are of the form ??nnnn, where nnnn is a hexadecimal number in the range 0000 through FFFF. You must avoid using identifiers of this form for your own purposes, because doing so can cause duplicate definition errors.

To insure that they have the proper effect, LOCAL statements should appear in the body of the macro before any other directives are used. It is acceptable for blank lines or comments to precede any LOCAL statements.

You can use multiple LOCAL statements if the argument list is too long to fit on one line, or if you want a vertical list of LOCAL symbols.

Example

    DISPLAY   MACRO   TT

    ;   Blank   lines   and   comments   are   ok   here
             LOCAL   AGAIN

    ; ;   DOS   macro   to   display   message   addressed   by   BX   TT   times
             MOV     CX , TT
             MOV     AH , 9
             MOV     DX , BX
    ; Generate   a   unique   label   for   AGAIN
    AGAIN :
             INT     21H
             LOOP    AGAIN
             ENDM