The vm611 Assembler


This document describes the assembler for vm611.

The assembler may be run on any CIS Linux machine via:

~cs611/bin/as611 file.asm

The assembler reads an assembly language program and writes an object file that contains the program expressed in machine language. The object file is in a format that is ready to be loaded and executed on vm611.

The assembler expects the input file to be given as the only command line argument. The input file name should end in ".asm". The assembler will create an output file whose name is the same, except the ".asm" is converted to ".obj".

The vm611 assembler is case-sensitive. Opcodes should be specified in lower case.

Labels may be arbitrarily long but they must start with a letter and be made up of only letters and digits. Label definitions are denoted by terminating the label string with a colon. A label definition must be the first thing on a line. A label definition may be on a line by itself. A label may only be defined once.

Integer constants may be expressed in either decimal or hexadecimal. Hexadecimal constants are denoted by a leading "0x" or "0X".

Comments begin with a '#' and continue to the end of the line. Comments may be on a line by themselves.

Blank lines are simply ignored. Whitespace at the beginning of a line is also ignored.

The assembler recognizes all instructions given in this table.

The operand types of the "push" and the "pop" instructions are indicated by either syntax of the operand or by "virtual" opcodes:

A label used in a "pop" or "push" instruction must be defined in the data section.

An opcode is separated from the following operand by any amount of spaces or tabs. However, the opcode and the operand must be on the same line.

The "branch" and "call" instructions take an address specification as the operand. The address must be specified by a label. A label may be used for an address specification before the label is defined. However, the label must be defined in the instruction section.

An assembly language program should have two sections: an instruction section followed by the data section. The beginning of the data section is specified by the "data" directive. The "data" directive may only be used once.

The assembler supports two other directives:

The "word" and "alloc" directives may only be used in the data section.

Instructions may not be specified in the data section.

When a label is defined in the instruction section, its address is the number of 4-bit nibbles that have been previously assembled in the instruction section. When a label is defined in the data section, its address is the number 32-bit words that have been previously assembled in the data section.

When the assembler reaches the end of the assembly language program, it generates a vm611 object file. See the vm611 webpage for the details of vm611 object files.

At the end of processing the assembler prints an error message to stderr for each undefined label.


Last modified on September 16, 2003.

Comments and questions should be directed to hatcher@unh.edu