[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Assembler Language Reference

Statements

The AIX assembler language has three kinds of statements: instruction statements, pseudo-operation statements, and null statements. The assembler also uses separator characters, labels, mnemonics, operands, and comments.

Instruction Statements and Pseudo-Operation Statements

An instruction or pseudo-op statement has the following syntax:

[label:] mnemonic [operand1[,operand2...]] [# comment]

The assembler recognizes the end of a statement when one of the following appears:

Null Statements

A null statement does not have a mnemonic or any operands. It can contain a label, a comment, or both. Processing a null statement does not change the value of the location counter.

Null statements are useful primarily for making assembler source code easier for people to read.

A null statement has the following syntax:

[label:] [# comment]

The spaces between the label and the comment are optional.

If the null statement has a label, the label receives the value of the next statement, even if the next statement is on a different line. The assembler gives the label the value contained in the current location counter. For example:

here:
       a 3,4,5

is synonymous with

here:  a 3,4,5
Note: Certain pseudo-ops (.csect, .comm, and .lcomm, for example) may prevent a null statement's label from receiving the value of the address of the next statement.

Separator Characters

The separator characters are spaces, tabs, and commas. Commas separate operands. Spaces or tabs separate the other parts of a statement. A tab can be used wherever a space is shown in this book.

The spaces shown in the syntax of an instruction or pseudo-op are required.

With the AIX Version 4 assembler, Branch Conditional instructions need a separator character (space or tab) between the mnemonic and operands for unambiguous processing by the assembler. (See "Migration of Branch Conditional Statements with No Separator after Mnemonic" for more information.)

Optionally, you can put one or more spaces after a comma, before a pound sign (#), and after a #.

Labels

The label entry is optional. A line may have zero, one, or more labels. Moreover, a line may have a label but no other contents.

To define a label, place a symbol before the : (colon). The assembler gives the label the value contained in the assembler's current location counter. This value represents a relocatable address. For example:

subtr:   sf 3,4,5
# The label subtr: receives the value 
# of the address of the sf instruction.
# You can now use subtr in subsequent statements
# to refer to this address.

If the label is in a statement with an instruction that causes data alignment, the label receives its value before the alignment occurs. For example:

# Assume that the location counter now 
# contains the value of 98.
place:   .long expr
# When the assembler processes this statement, it
# sets place to address 98. But the .long is a pseudo-op that
# aligns expr on a fullword. Thus, the assembler puts
# expr at the next available fullword boundary, which is 
# address 100. In this case, place is not actually the address
# at which expr is stored; referring to place will not put you 
# at the location of expr.

Mnemonics

The mnemonic field identifies whether a statement is an instruction statement or a pseudo-op statement. Each mnemonic requires a certain number of operands in a certain format.

For an instruction statement, the mnemonic field contains an abbreviation like ai (Add Immediate) or sf (Subtract From). This mnemonic describes an operation where the system microprocessor processes a single machine instruction that is associated with a numerical operation code (op code). All instructions are 4 bytes long. When the assembler encounters an instruction, the assembler increments the location counter by the required number of bytes.

For a pseudo-op statement, the mnemonic represents an instruction to the assembler program itself. There is no associated op code, and the mnemonic does not describe an operation to the processor. Some pseudo-ops increment the location counter; others do not. See the "Pseudo-ops Overview" for a list of pseudo-ops that change the location counter.

Operands

The existence and meaning of the operands depends on the mnemonic used. Some mnemonics do not require any operands. Other mnemonics require one or more operands.

The assembler interprets each operand in context with the operand's mnemonic. Many operands are expressions that refer to registers or symbols. For instruction statements, operands can be immediate data directly assembled into the instruction.

Comments

Comments are optional and are ignored by the assembler. Every line of a comment must be preceded by a # (pound sign); there is no other way to designate comments.

Related Information

Character Set

Reserved Words

Line Format

Symbols

Constants

Operators

Expressions

The atof subroutine.

The .comm pseudo-op, .csect pseudo-op, .double pseudo-op, .dsect pseudo-op, .float pseudo-op, .lcomm pseudo-op, .tc pseudo-op, .toc pseudo-op, .tocof pseudo-op.


[ Previous | Next | Contents | Home | Search ]