.local


The specified string is declared as a local symbol that will be replaced as a specific identifier.

[Syntax]

Symbol field
Mnemonic field
Operand field
Comment field
 
.local 
symbol-name[, ... ]
[; comment]

[Function]

-

The .local directive declares a specified symbol name as a local symbol that will be replaced as an assembler-specific symbol.

[Use]

-

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.

[Description]

-

The maximum number of symbol names that can be used depends on the amount of memory.

-

For a symbol defined by a label or symbol definition directive, the definition name is replaced with a name specific to each macro call.

-

Only a label written after this directive within the macro body or a symbol defined by a symbol definition directive can be specified as the symbol name.

-

The .local directive can be written in only a macro body, PEPT-ENDM block, IRP-ENDM block, or inline_asm function defined in a C source program. In any other case, an error will be output.

-

If multiple local symbols are declared with the same name within a single block, an error will be output. Local symbols can be declared with the same name as long as they are in different blocks or they are within and without nested blocks.

[Example]

m1      .macro  x
        .local  a, b
        a:      .dw     a
        b:      .dw     x
.endm
m1      10
m1      20

The expansion is as follows.

.??00000000:    .dw     .??00000000
.??00000001:    .dw     10
.??00000002:    .dw     .??00000002
.??00000003:    .dw     20