Program Structure

The machine instruction mnemonics and completers are described in the PA-RISC 1.1 Architecture and Instruction Set Reference Manual and PA-RISC 2.0 Architecture.

The operands field follows the opcode field, separated by a blank or tab. Operands are separated by commas. The meaning of the operands depends on the specific statement type, determined by the opcode.

The number of operands permitted or required depends upon the specific instruction.

The comments field is introduced with a semicolon, and causes the Assembler to ignore the remainder of the source line. A comment can appear on a line by itself.

The following listing contains several assembly language statements. The headings identify the four fields.

Label

Opcode

Operands

Comments

JAN

.EQU

1

;declares a symbolic constant

SUM

.WORD

0

;reserve a word and set to zero

LOOP

LDW

4(%r1),%r2

 

 

ADD

%r2,%r3,%r4

 

 

STW

%r4,SUM-$global$(%dp)

 

 

BL

LOOP,%r0

 

Statements are normally written on separate lines. It is sometimes useful, especially when using a macro preprocessor, to be able to write several statements on one line. This can be done by separating the statements with the “!” character. When this feature is used, a label can be placed only on the first statement of the line, and a comment can only follow the last statement on the line. The .LABEL directive can override this condition by providing a means for declaring a label within a multi-statement line.

20

Chapter 2