2 | Program Structure |
An assembly language program is a sequence of statements. There are three classes of statements:
•Instructions
•
•Directives
Instructions represent a single machine instruction in symbolic form.
Directives communicate information about the program to the Assembler, but do not generally cause the Assembler to output any machine instructions.
An assembly statement contains four fields:
•Label
•Opcode
•Operands
•Comments
Each of these fields is optional. However the operands field cannot appear without an opcode field.The label field is used to associate a symbolic address with an instruction or data location, or to define a symbolic constant using the .EQU, .REG, or .MACRO directives. This field is optional for all but a few statement types; if present, the label must begin in column one of a source program line. If a label appears on a line by itself, or with a comment only, the label is associated with the next address within the same subspace and location counter.
When the label field begins with the pound sign (#) character, it is not treated as a label. If # is followed by white space and an integer, the Assembler's line number counter, used when reporting errors, is reset to the value of the integer. Otherwise, the line beginning with # is ignored. This feature is for the use of the C language preprocessor cpp.
The opcode field contains either a mnemonic machine instruction, a
19