Numeric local labels
Numeric local labels are a type of label that you refer to by number rather than by name. They are used in a similar way to PC-relative labels, but their scope is more limited.
numeric local label is a number in the range 0-99, optionally followed by a name. Unlike other labels, a numeric local label can be defined many times and the same number can be used for more than one numeric local label in an area.
Numeric local labels do not appear in the object file. This
means that, for example, a debugger cannot set a breakpoint directly
on a numeric local label, like it can for named local labels kept using
the KEEP
directive.
A numeric local label can be used in place of
in
source lines in an assembly language module:symbol
On its own, that is, where there is no instruction or directive.
On a line that contains an instruction.
On a line that contains a code- or data-generating directive.
A numeric local label is generally used where you might use a PC-relative label.
Numeric local labels are typically used for loops and conditional code within a routine, or for small subroutines that are only used locally. They are particularly useful when you are generating labels in macros.
The scope of numeric local labels is limited by the AREA
directive. Use the ROUT
directive to limit
the scope of numeric local labels more tightly. A reference to a numeric local label refers
to a matching label within the same scope. If there is no matching label within the scope in
either direction, armasm generates an error message and the assembly fails.
You can use the same number for more than one numeric local label even within the same scope. By default, armasm links a numeric local label reference to:
The most recent numeric local label with the same number, if there is one within the scope.
The next following numeric local label with the same number, if there is not a preceding one within the scope.
Use the optional parameters to modify this search pattern if required.