Program Structure

Symbols and Constants

Symbols and Constants

Both addresses and constants can be represented symbolically. Labels represent a symbolic address except when the label is on an .EQU, .REG, or .MACRO directive. If the label is on an .EQU or .REG directive, the label represents a symbolic constant. If the label is the .MACRO directive, the label represents a macro name.

Symbols are composed of uppercase and lowercase letters (A-Zand a-z), decimal digits (0-9), dollar signs ($), periods (.), ampersands (&), pound signs (#), and underscores (_). A symbol can begin with a letter, digit, underscore, or dollar sign. If a symbol begins with a digit it must contain a non-digit character. (The predefined register symbols begin with a percent sign (%).)

The Assembler considers uppercase and lowercase letters in symbols to be distinct. The mnemonics for operation codes, directives, and pseudo-operations can be written in either case. There is no explicit limit on the length of a symbol. The following are examples of legal symbols:

$START$

_start

PROGRAM

M$3

$global$

$$mulI

main

P_WRITE

loop1

1st_time

The following are examples of illegal symbols:

LOOP1 Contains an illegal character

&st_time

Begins with &

123Does not contain a nondigit

Integer constants can be written in decimal, octal, or hexadecimal notation, as in the C language. “Integer Constants” on page 22 lists the ranges of these integer constants.

Chapter 2

21