SPRUI03E June 2015 – January 2023
A label must be a legal identifier (see Section 5.9.1) placed in column 1. Every instruction may optionally have a label. Many directives allow a label, and some require a label.
A label can be followed by a colon (:). The colon is not treated as part of the label name. If you do not use a label, the first character position must contain a blank, a semicolon, or an asterisk. You cannot use a label on an instruction that is in parallel with a previous instruction.
When you use a label on an assembly instruction or data directive, an assembler symbol (Section 5.9) with the same name is created. Its value is the current value of the section program counter (SPC, see Section 3.5.5). This symbol represents the address of that instruction. In the following example, the .word directive is used to create an array of 3 words. Because a label was used, the assembly symbol Start refers to the first word, and the symbol will have the value 40h.
. . . .
. . . .
9 * Assume some code was assembled
10 00000040 0000000A Start: .word 0Ah,3,7
00000044 00000003
00000048 00000007
When a label appears on a line by itself, it points to the instruction on the next line (the SPC is not incremented):
1 00000000 Here:
2 00000000 00000003 .word 3
A label on a line by itself is equivalent to writing:
Here: .equ $ ; $ provides the current value of the SPC
If you do not use a label, the character in column 1 must be a blank, an asterisk, or a semicolon.