A statement is a combination of mnemonics, operands, and comments that defines the object code to be created at assembly time. Each line of source code contains a single statement.

Assembler source lines

Assembler statements take the form:

[label] [operation] [operands] [comment]

All fields are optional, although the operand or label fields may be required if certain directives or instructions are used in the operation field.

Label Field

The label field starts at the left of the line, with no preceding spaces. A label name is a sequence of alphanumeric characters, starting with a letter. You can also use the dollar sign '$' and underline character '_' in label names. A colon may be placed directly after the label, or it can be omitted. If a colon is placed after a label, it defines that label to have the value of the location counter in the current section.

Operation field

The operation field contains either a machine instruction or an assembler directive. You must write these in either all uppercase or all lowercase—mixed case is not allowed. The operation field must not start at the leftmost position of the line; at least one space must precede it, if there is no label field. At least one space must separate the label field and the operation field.

Operand field

The contents of the operand depend upon the instruction or directive in the operation field. Different instructions and directives have different operand field formats. Please refer to the specific directive documentation for details of the operand field.

Comment field

The comment field is optional. It contains information that is not essential to the assembler but is useful for documentation. The comment field must be separated from any preceding fields by at least one space.

Comments

To help others better understand some particularly tricky piece of code, you can insert comments into the source code. Comments are informational and have no significance for the assembler. They come in two forms: single-line comments and multi-line comments.

Single-line comments

A single-line comment is introduced either by the single character ; or by the two consecutive characters //.

Syntax

// character
; character

The assembler ignores all characters from the comment introducer to the end of the line. This type of comment is particularly good when you want to comment a single assembler line.

Multi-line coomments

A multi-line comment resembles a standard C comment, it is introduced by the characters /* and is terminated by */.

Syntax

/* character*/

Anything between these delimiters is ignored by the assembler. You can use this type of comment to place large amounts of commentary, such as copyright notices or functional descriptions, into your code.