11/3/71                                                    AS (I)





NAME            as -- assembler



SYNOPSIS        as name  ...
                       1


DESCRIPTION     as assembles the concatenation of name , .... as
                                                      1
                is based on the DEC-provided assembler PAL-11R

                [references], although it was coded locally.

                Therefore, only the differences will be recorded.



                Character changes are:



                     for    use

                      @      *

                      #      $

                      ;      /



                In as, the character ";" is a logical new line;

                several operations may appear on one line if sep-

                arated 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 writ-

                ten "0^."; another way to denote register 2 is

                "2^r0".



                All of the preceding operators are binary; if a

                left operand is 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 from that of PAL-11R (whose condition-

                als are not provided):



                     .if expression

                     ...

                     .endif



                If the expression evaluates to non-zero, the sec-

                tion of code between the ".if" and the ".endif"

                is assembled; otherwise it is ignored.  ".if"s

                may be nested.



                Temporary labels like those introduced by Knuth

                [references] may be employed.  A temporary label

                is defined as follows:



                     n:



                where n is a digit 0 ... 9.  Symbols of the form

                "nf" refer to the first label "n:" following the

                use of the symbol; those of the form "nb" refer

                to the last "n:".  The same "n" may be used many

                times.  Labels of this form are less taxing both

                on the imagination of the programmer and on the

                symbol table space of the assembler.



                The PAL-11R opcodes ".word", ".eot" and ".end"

                are redundant and are omitted.



                The symbols



                     r0 ... r5

                     sp

                     pc

                     ac

                     mq

                     div

                     mul

                     lsh

                     ash

                     nor

                     csw

                     ..



                are predefined with appropriate values.  The sym-

                bol "csw" refers to 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 current value.



                The new opcode "sys" is used to specify system

                calls.  Names for system calls are predefined.

                See the section on system calls for their names.



                Strings of characters may be assembled in a way

                more convenient than PAL-11's ".ascii" operation

                (which is, therefore, omitted).  Strings are in-

                cluded between the string quotes "<" and ">":



                     <here is a string>



                Escape sequences exist to enter non graphic and

                other difficult characters.  These sequences are

                also effective in single and double character

                constants introduced by single (') and double (")

                quotes respectively.



                     use  for

                     \n   newline (012)

                     \0   NULL (000)

                     \>   >

                     \t   TAB (011)

                     \\   \



                The binary output of the assembler is placed on

                the file "a.out" in the current directory.  a.out

                also contains the symbol table from the assembly

                and relocation bits.  The output of the assembler

                is executable immediately if the assembly was

                error-free and if there were no unresolved exter-

                nal references.  The link editor ld may be used

                to combine several assembly outputs and resolve

                global symbols.



                The multiple location counter feature of PAL11R

                is not supported.



                The assembler does not produce a listing of the

                source program.  This is not a serious drawback;

                the debugger db discussed below is sufficiently

                powerful to render a printed octal translation of

                the source unnecessary.



FILES           /etc/as2        pass 2 of the assembler

                a.tmp1          temporary

                a.tmp2          temporary

                a.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 fol-

                lowed by a question mark is typed and assembly

                ceases.



                When syntactic or semantic errors occur, a

                single-character diagnostic is typed out together

                with the line number and the file name in which

                it occurred.  Errors in pass 1 cause cancellation

                of pass 2.  The possible errors are:



                )     parentheses error

                ]     parentheses error

                *     Indirection ("*") used illegally

                A     error in Address

                B     Branch instruction has too remote an ad-

                      dress

                E     error in Expression

                F     error in local ("F" or "b") type symbol

                G     Garbage (unknown) character

                M     Multiply defined symbol as label

                O     Odd-- word quantity assembled at odd ad-

                      dress

                P     Phase error-- "." different in pass 2 from

                      pass 1 value

                R     Relocation error

                U     Undefined symbol

                X     syntaX error



BUGS            Symbol table overflow is not checked.



OWNER           dmr