The basic unit of an assembly language program is a line of code. The specific language is defined by a set of rules that specify the symbols that can be used and how they may be combined to form a line of code.
Rules of the Language
- Each line of an assembly language program is arranged in three columns called fields which specify the following information:
- The label field may be empty or it may specify a symbolic address.
- The instruction field specifies a machine instruction or a pseudo instruction.
- The comment field may be empty or it may include a comment.
- A symbolic address, which is terminated by a comma, consists of one, two, or three, but not more than three alphanumeric characters. The first character must be a letter; the next two may be letters or numerals. A symbolic address in the instruction field specifies the memory location of an operand.
- The instruction field in an assembly language program may specify one of the following items:
- A memory reference instruction (MRI)
ADD PTR I
2. A register reference or input-output instruction (non MRI)
E.g. CLA
3. A pseudo instruction with or without an operand
E.g. ORG 0
END
- A MRI occupies two or three symbols separated by spaces. The first must be a three letter symbol defining an MRI operation code, the second is symbolic address and the third symbol, which may or may not be present, is the letter I. If I is missing, it denotes direct address instruction. If I is present, it denotes indirect address instruction.
- A non MRI is defined as an instruction that does not have an address part. It consists of only operation code.
- A pseudo instruction is not a machine instruction but rather an instruction to the assembler giving information about some phase of the translation.
- A line of code may or may not have a comment, but if it has, it must be preceded by a slash for the assembler to recognize the beginning of a comment field. Comments are inserted for explanation purposes only and are neglected during the binary translation process.
- Example:
Listing of Translated Program
No comments:
Post a Comment