This document describes the assembler for the IAS computer.
The assembler may be run on any CIS Linux machine via:
~cs611/bin/iasm 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 the IAS computer.
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 IAS 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.
Integer constants may be expressed in either decimal or hexadecimal. Hexadecimal constants are denoted by a leading "0x" or "0X". The assembler only supports integer constants whose values may be expressed in 32 bits.
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. Opcodes must be given in lower case, however. If an instruction has a secondary opcode then only its secondary opcode should be specified in the program.
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.
Most instructions take an address specification as the operand. The address may be specified as either a label or by giving the value of the address as an integer constant. A label may be used for an address specification before the label is defined.
The LSHIFT and RSHIFT instructions take a shift distance (0 < n < 80) as an integer constant. The MOVE instructions do not take an operand.
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 DATA directive must be specified in lower case.
The assembler supports two other directives:
Instructions may not be specified in the data section.
The assembler starts assembling at address two. (Memory cells 0 and 1 are reserved for two header words. See the discussion below about IAS object files.) The assembler assembles two instructions per word.
When a label is defined, its address is the number of words that have been previously fully assembled. Note that if an odd number of instructions have been assembled and then a label definition appears, the address for the label would be the same if the label definition had been given one instruction earlier.
When the DATA directive appears, the assembler will start the data section on an even word boundary. This means an empty instruction (all zero bits) will be inserted if an odd number of instructions has been assembled prior to the DATA directive.
The assembler will assemble at most 1024 words. Note that this is less than the memory size of the IAS computer, which contains 4096 words.
When the assembler reaches the end of the assembly language program, it generates an IAS object file.
An IAS object file is a sequence of 40-bit words. Each 40-bit value is stored in five bytes in Little Endian fashion.
An IAS object file starts with two header words. The first word contains the length of the object file in words. (This length includes the two header words.) The second word contains the length of the instruction section in words. (This second length does not include the two header words.)
The program's instructions follow the two header words. The data words follow the instructions. The assembler pads the file length to a multiple of 60 bytes (12 40-bit words) by extending the data section with zero words. This is done so that the object file will exactly fit on a series of IAS cards, which each contain 12 IAS 40-bit words.
The assembler prints some statistics to stderr at the end of its processing:
The assembler also prints information about the labels used by the program. For each label it prints an 'I' or 'O', then the label's address, and then the label's name. This information is printed to stdout.
The 'I' indicates the label is an "insymbol". In this case the label is defined in this file.
The 'O' indicates the label is an "outsymbol". In this case the label is used but not defined in this file. The address associated with the label is the address of an instruction that uses the label. An 'L' or 'H' is appended to the address to indicate whether the instruction is in the high half or low half of the word indicated by the address. If an outsymbol is used more than once, then a line will be printed for each use. For each outsymbol an error message is also printed to stderr.
Comments and questions should be directed to hatcher@unh.edu