as(1) - Unix First Edition Manual Page
11/3/71AS (I)

NAME as -- assembler
SYNOPSIS as name1 . . .
DESCRIPTION as assembles the concatenation of name1, .... as is based onthe DEC--provided assembler PAL--11R [references], although it

was coded locally. Therefore, only the differences will berecorded.

Character changes are:for use

@ * # $ ; /In as, the character ";" is a logical new line; several operations may appear on one line if separated by ";".Several new expression operators have been provided: \> right shift (logical)\< left shift * multiplication\/ division % remainder (no longer means "register")! one's complement [] parentheses for grouping^ result has value of left, type of right

For example location 0 (relocatable) can be written "0^.";another way to denote register 2 is "2^r0" All of the preceding operators are binary; if a left operandis missing, it is taken to be 0. The ! operator adds its left operand to the one's complement of its right operand. There is a conditional assembly operation code different fromthat of PAL-11R (whose conditionals are not provided):

.if expression... .end if If the expression evaluates to non-zero the section of codebetween the ".if" and the .endif is assembled; otherwise it is ignored. ".if" s may be nested. Temporary labels like those introduced by Knuth [reference]may be employed. A temporary label is defined as follows:

11/3/71AS (I)

n: where n is a digit 0 ,.. 9. Symbols of the form "nf" refer tothe first label n: following the use of the symbol; those of the form nb refer to the last "n:". The same n may be usedmany times. Labels of this form are less taxing both on the imagination of the programmer and on the symbol table spaceof the assembler.

The PAL-11R opcodes ".eot" and ".end" are redundant and areomitted.

The symbols

r0 ... r5 sp

pcac mqdiv mullsh ashnor csw

are redefined with appropriate values. The symbol csw refersto the console switches. ".." is the relocation constant and is added to each relocatable symbol; normally it is 40000(8);it may be changed to assemble a section of code at a location different from that in which it will be executed.

It is illegal to assign a value to "."less than its currentvalue.

The new opcode "sys" is used to specify system calls. Namesfor system calls are predefined. See the section on system calls for their names. Strings of characters may be assembled in a way moreconvenient than PAL-11's ".ascii" operation (which is, therefore, omitted). Strings are included between the stringquotes '<' and '>' :

Escape sequences exist to enter non graphic and otherdifficult characters. These sequences are also effective in single and double character constants introduced by single(') and double (") quotes respectively.

11/3/71AS (I)

use for\n newline (012) \0 NULL (000)\> > \t TAB (011)\\ \

The binary output of the assembler is placed on the filea.out in the current directory. a.out also contains the symbol table from the assembly and relocation bits. Theoutput of the assembler is executable immediately if the assembly was error--free and if there were no unresolvedexternal references. The link editor ld may be used to combine several assembly outputs and resolve global symbols. The multiple location counter feature of PALIIR is notsupported.

The assembler does not produce a listing of the sourceprogram. This is not a serious drawback; the debugger db discussed below is sufficiently powerful to render a printedoctal translation of the source unnecessary.
FILES /etc/as2 pass 2 of the assemblera.tmpl temporary

a.tmp2 temporarya.tmp3 temporary a.out object
SEE_ALSO ld, nm, sh, un, db, a.out (format of output)
DIAGNOSTICS When an input file cannot be read, its name followed by aquestion mark is typed and assembly ceases.

When syntactic or semantic errors occur, a single--characterdiagnostic is typed out together with the line number and the file name in which it occurred. Errors in pass I causecancellation of pass 2. The possible errors are:

) parentheses error ] parentheses error* Indirection ("*") used illegally A error in AddressB Branch instruction has too remote an address E error in ExpressionF error in local ( or "b") type symbol

G Garbage (unknown) characterM Multiply defined symbol as label 0 Odd---- word quantity assembled at odd

11/3/71AS (I)

addressP Phase error " .." different in pass 2 from pass 1 valueR Relocation error U Undefined symbolX syntaX error

BUGS Symbol table overflow is not checked.