3.1 \UUnited Aircraft Corporation\u March 22, 1956 Note: This write-up cancels and supersedes write-up dated September 21, 1955. The effect of Addendum No. 1 is included in this write-up. \USHARE Assembler\u Reproduced at Lincoln Laboratory \U(UA SAP 1 and 2)\u \URoy Nutt\u 704 instructions to be assembled by this program are written with re- ferences expressed as arithmetic combinations of symbols and/or decimal integers. A variable field format is used in which the parts of the instruction are given in the order address, tag and decrement. In addition to instruction; data in decimal, octal or Hollerith (BCD) form may be assembled, and library routines written in the same symbolic form may be conveniently incorporated into the pro- gram being assembled. A program to compute \Ipage1pic.PNG\i is used as an example. (See last page). In order to describe the use of this assembly program, let us consider first a simplified explanation of symbolic assembly operation. The procedure is divided into two parts; - the first examines the pro- gram to be assembled in order to define each symbol used in writing the program. The second part prepares the actual machine language program, punches it in binary form on cards and produces a printed copy of the program in symbolic form together with the corresponding octal machine language program. During the first part a counter is used to specify the absolute location of each word in the program. Call this location counter L. L is set initially to an integer supplied to the assembly program by the program being assembled, hence- forth L is increased by one for each word to be used by the program. 1. 3.2 Simultaneous1y with this counting procedure a table is constructed. Each entry in this table defines a symbol used in the program as being equival- ent to some integer. Entries to the table are made in two ways: 1. A symbol appears as the "symbolic location" of a word in the program being assembled and is assigned the value of L. 2. A symbol is defined by a pseudo operation. It is important to note that the order of the absolute instructions preduced by symbolic assembly is determined solely by the order in which the symbolic instructions are read by the assembly program. During the second part of the assembly process L is computed in ex- actly the same manner as it was during the first part. In addition all sym- bols in the symbolic program are replaced by the integer equivalences given in the table formed during the first part, thus producing an absolute program. Note that this operation requires that each symbol be uniquely defined. For use in the assembly program the following definitions are made: \USymbol:\u Any combination of not more than 6 Hollerith characters, none of which is + - * / , $ and at least one of which is non-numeric. \UInteger:\u (with respect to instructions): Any decimal integer less than 1 000 000. The operation part of each instruction is specified by the standard "SHARE" abbreviation of 3 alphabetic characters. A symbolic instruction should be identified by a symbol ("symbolic location" \Uonly\u if it is necessary to refer to this instruction in the program. The address, tag and decrement parts of symbolic instructions are given in that order. In some cases the decrement, tag or address parts are not nec- essary, therefore the following combinations are permissible. OP OP Address OP Address, Tag OP Address, Tag, Decrement Examples of the last three types occur in the illustrative problem at P3, P3+2 and P3+3 respectively. 2. 3.3 Note the tag, if present, must be separated from the address by a comma and similarly the decrement, if present, must be separated from the tag by a comma. For the few instructions which require a tag bur no address, the address zero shoul be used, for example: PDX 0,4 Similarly where a decrement is required with no tag a zero should be used as in TXL A,O,B The following card form is used by the assembly 1-6 Symbol or blank 7 Blank 8-10 Abbreviated operation or blank: 11 Blank 12-72 Variable field 73-80 Not used Expressions defineing the address, tag and decrement are punched without blanks from column 12 on. The first blank to the right of column 12 defines the end of the instruction. All punching to the right of such a blank is considered to be a remark and has no effect on the assembly process. If an instruction requires a symbolic location, the symbol used is pun- ched in columns 1-6. \UAr1thmetic expressions\u Arithmetic expressions in terms of symbols and integers may be used with some pseudo-operations and to define address, tag or decrement parts of 704 in- structions. The following elementary operations may be used: addition, indicated by + subtraction, indicated by - multiplication, indicated by * division, indicated by / No parenthethical expressions may be written. 3. 3.4 Integral arithmetic modulo 2\S35\s is used, hence 1. Multiplication is not commutative with division: A*B/C<271>A/C*B except when C is a factor of A. Note that A/C*B implies (A/C)*B net A/(C*B). 2. Addition and subtraction are commutative: A+B-C=B-C+A 3. Multiplication and division are distributive with respect to each other but \Unot\u with respect to addition or subtraction: A+B*C/D<271>A*C/D+B*C/D Note that A+B*C/D implies A+(B*C/D) and not (A+B)*C/D If the result of an expression is to be expressed in n binary places, its value is computed modulo 2\Sn\s. If the residue is negative, its 2's complement is the result. Hence if v is the value of an expression, r is the result used and \Ipage4pic.PNG\i For example the instruction at location P3+3 in the i11ustration has a decrement part of -1. Here. m=1, v=-1, n=15 so that r=2\S15\s-1 Consider also the tag part of instruction on P4-1 where v=J+K=1+4=5 m=5, n=3 so that r=5 4. 3.5 \UPSEUDO OPERATIONS\u \U \u \UOrigin specification: ORG\u The location counter L is set to the value of the expression appearing in the variable field. Each symbol appearing in the expression must have been previously defined (i.e. appeared in the symbol field, columns 1-6, of some in- struction or pseudo-instruction preceding this origin specification.) If no origin specification is given for a program the initial value of L shall be zero. Origin specification instructions may be used at will. \UEquals: EQU\u They symbol appearing in 1-6 is assigned the integer value given by the expression appearing in the variable field. Each symbol used in this expression must be previously defined. Note that the pseudo operation EQU is to be used only in those cases where the symbol appearing in 1-6 specifies a preset program parameter such as the order of a matrix, the pegree of a polynomial, the number of items in a group, or any other quantity wheich is invariant with respect to the location of the program in storage. If the symbol specifies the location of a piece of data or an instruct- ion, the pseudo operation SYN should be used. \USynonym: SYN\u The symbol appearing in 1-6 is assigned the integer value given by the expression appearing in the variable field. Each s,ymbol used in this expression must be previously defined. Note that the pseudo operation SYN is to be used only in those cases where the symbol appearing in 1-6 specifies the location of a pi~ce ot data, the location of an instruction, or any other quantity whose value depends upon the location ot the program in storage. If the symbol specifies a preset program parameter, the pseudo operation EQU should be used. \UDecimal data: DEC\u The decimal data beginning in column 12 is converted to binary and assigned to consecutive locations L, 1+1, ... Successive words of data on a card are separated by commas, and the first blank to the right of column 12 indicates that all punching to the right of this blank is a remark. Signs are indicated by + or - (12 or 11 punch) preceding the number, the exponent or the binary scale factor. Howerer it is not necessary to use the + sign. The symbol appearing in 1-6 identities the first decimal data word on the card. Successive words are identified relative to the first word. If no symbol appears in 1-6, the data words are identified relative to that word most recently identified by a symbol. 5. 3.6 If none of the characters . E or B appear in a decimal data word, the word is converted as a binary integer with the binary point at the right hand end of the word. If either of the characters E or . or both appear in a decimal data word and the character B does not appear, the word is converted to a 704 type floating binary quantity. The decimal exponent used in this conversion is the number which follows inunediately after the character E. If the character E does not appear, the exponent is assumed to be zero. If the decimal point does not appear, it is assumed to be at the right hand end. For example, 12.345, +12.345, 1.2345El, l234.5E-2 and l2345E-3 are all equivalent representations of the same floating point word. If the character B appears in a decimal data word, the word is converted as a fixed point binary quantity. Tne binary scale factor used in this conversion is the number which follows immediately after the character B; - it being the number of binary places between the left hand end of the storage cell and the binary point of the fixed point binary result. If the decimal point does not appear in the decimal data word, it is addumed to be at the right hand end. The decimal exponent used in this conversion is the number which follows immediately after the character E. The order of B and E is not significant. For example, 12.345B4, +1.2345E1B4 and l2345B4E-3 are all equivalent representations of the same fixed point quantity. \UOctal data: OCT\u The octal data beginning in column 12 is taken in binary integer form, the binary point considered to be on the right hand end of a 704 word, and assigned to consecutive storage locations L, L+l,... Successive words are separated by commas and the first blank to the right of column 12 indicates that all punching to the right is to be considered a re- mark. The symbol appearing in 1~6 identifies the first octal data word on the card. Successive words are identified relativ~ to the first word. If no symbol is used, identification is relative to that word most recently identified bya symbol. In the case of 12 digit octal numbers, the following equivalences exist with respect to the high order digit: -0 <272> 4 -1 <272> 5 -2 <272> 6 -3 <272> 7 Either fom may be used in coding for the assembly. \UHollerith data: BCD\u Nomally the 10 six character wc:rrds of Hollerith information from col. 13-72 are read and alSsigned to locations L, L+l,...,L+9. If, however, less than 10 BCD words are desired, a word count v (0\