3.2 Labels

The PIC Assembler is more strict than MPASM regarding the definition of labels.

A label is a symbolic alias that is assigned a value equal to the current location within the current psect. This assignment is typically performed by the linker.

In the PIC Assembler, a label definition consists of any valid assembly identifier followed by a colon, :. In MPASM, the colon is option. When migrating, you must add colons to any label in MPASM code that does not already use one.

Label identifiers used by the PIC Assembler are always case sensitive.

A label identifier can contain any number of characters drawn from the alphabetics, numerics, and the special characters: dollar, $; question mark, ?; and underscore, _. The first character of an identifier cannot be numeric. A identifier cannot have the same name as any of the assembler directives, keywords, or psect flags. A label definition can appear on a line by itself or it can be positioned to the left of an instruction or assembler directive.

The following shows the definition of valid and unique labels in the PIC Assembler.

An_identifier:
  movlw 55
an_identifier:  movlw  0AAh
an_identifier1:  DW 0x1234
?$_12345:
  return