label field

The label field is optional and has two uses. Most frequently, the field contains a symbol used to identify a statement referenced by other statements. Symbols used in this way are labels. Alternatively, the field contains a symbol whose value is set by the assignment operator. For more information on the second use, see Chapter 5

When the assembler encounters a label, it assigns the current value of the location counter to the label. A colon (:) is used to delimit (terminate) each label in the label field. (When the label is used in the operand field of an instruction, the colon is omitted.)

The rules for label name construction are the same as the rules as for any symbol. Refer to the Section called symbol and label construction

A label referencing an instruction need not be on the same line as the instruction. This allows the programmer, when writing source code, to devote a separate line with comments to labels, providing clearer documentation of the program and allowing for easier editing of the source code.

		.=01000H ; set location counter to 01000H
                         ; label SUB is assigned 01000H
	SUB:
		NOP
		.
		.
		.
		.

	

Caution

Read the following before using labels on a blank line.

The assembler always processes labels on a line after it processes any following fields. Therefore, when a label appears on the same line as an assignment statement which alters the location counter, the label is assigned the location counter value after the location counter is altered. A label on a preceding line in this case is not the same value.

		.=01001H ; set location counter to 01001H
	SUB:             ; label SUB is 01001H
	SUB4:   .=01010  ; label SUB4 is assigned 01010H