HPlogo HP Assembler Reference Manual: HP 9000 Computers > Chapter 2 Program Structure

Symbols and Constants

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

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-Z and 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:

LOOP|1      Contains an illegal character
&st_time    Begins with &
123         Does not contain a nondigit

Integer constants can be written in decimal, octal, or hexadecimal notation, as in the C language. Table 2-1 “Integer Constants” lists the ranges of these integer constants.

Table 2-1 Integer Constants

Signed

Unsigned

Decimal

-2147483648 through 2147483647

0
through 4294967295

Octal

020000000000 through 017777777777

0
through 037777777777

Hexadecimal

0x80000000 through 0x7FFFFFFF

0
through 0xFFFFFFFF

 

The period (.) is a special symbol reserved to denote the current offset of the location counter. It is useful in address expressions to refer to a location relative to the current instruction or data word. This symbol is considered relocatable, and can be used anywhere a relocatable symbol can be used, with the exception of the label field.

The period cannot be used in an expression involving another label, such as sym+., sym-., .+sym, or .-sym. It can be used in an expression that has only a constant, such as .+8 or .-8.

© 1998 Hewlett-Packard Development Company, L.P.