Everything

.LOCAL


Defines the specified symbol name as a local symbol that is valid only within the macro body where it is defined.

[Syntax]

Symbol field
Mnemonic field
Operand field
Comment field
[label:]
.LOCAL 
symbol-name[, ... ]
[; comment]

[Function]

-

Defines the specified symbol name as a local symbol that is valid only within the macro body where it is defined.

[Description]

-

If a macro that defines a symbol within the macro body is referenced more than once, the assembler will output a double definition error for the symbol.
By using the .LOCAL directive, you can reference (or call) a macro, which defines symbol(s) within the macro body, more than once.

-

The maximum number of symbol names depends on the usable amount of memory.

-

The .LOCAL directive can only be used within a macro definition or in "#pragma inline_asm" in a C source program.

-

The .LOCAL directive should be used before the symbol specified in the operand field is referenced. Using this directive at the beginning of a macro body is recommended.

-

All symbol names defined through the .LOCAL directive within a module should be different. A single name cannot be assigned to multiple local symbols used in each macro body.

-

A symbol defined through the .LOCAL directive cannot be referenced from outside of the macro.

-

Reserved words cannot be defined as symbols. When the same symbol as a user-defined symbol is specified, the definition through the .LOCAL directive takes priority.

-

If a symbol having the same name as a formal parameter for a macro definition is defined as a local symbol in the definition of the macro through the .LOCAL directive, an error will occur.

[Example]

m1      .MACRO  par
        .LOCAL  AA, BB
AA:     .DB4    AA
BB:     .DB4    par
        .ENDM
m1      10
m1      20

The expansion is as follows.

.LL00000000:    .DB4    .LL00000000
.LL00000001:    .DB4    10
.LL00000002:    .DB4    .LL00000002
.LL00000003:    .DB4    20