t^^J^^m^,#' ^ . • V L I E) R_ARY OF THE UN IVER5ITY Of ILLl NOIS 6(0-84 -mtStOS: The person charging this material is re- sponsible for its return on or before the Latest Date stamped below. Theft, mutilation, and underlining of books are reasons for disciplinary action and may result in dismissal from the University, University of Illinois Library AyS2 6 NOV 2 5 NOV 9 1<68 m 1ii95 OCT 0CT2 4199(> L161— O-1096 Digitized by the Internet Archive in 2011 with funding from University of Illinois Urbana-Champaign http://www.archive.org/details/illiacprogramnninOOuniv DIGITAL COMPUTER LABORATORY GRADUATE COLLEGE UNIVERSITY OF ILLINOIS ILLIAC PROGRAMMING A Guide to the Preparation of Problems ^ for Solution by the University of Illinois Digital Computer -0 URBANA, ILLINOIS March 1, 19 5^)- ■K 1^ PREFACE The Digital Computer Laboratory of the University of Illinois has a three-fold program which is concerned with re- search in the field of digital computers, with maintenance for University use of a high-speed digital computer, and with teaching of design and use of digital computers. The preparation of pro- grams for the Illiac is the responsibility of the person who wishes 3 his problem solved. But since each prospective user cannot always in at a attend the courses on programming offered by the University, it r ^ has seemed desirable to help make it possible for him to learn a: the elements of Illiac use by himself. The result has been this book, which makes use of a year's experience in operating the Illiac for University research and several years experience in the teaching of programming. Many of the chapters were used in preliminary form as supplementary material in Mathematics 3^5, the basic course on programming. The book, like most of the work of the Digital Computer Laboratory, is the result of a group effort by many different people, The chapters were written by S. Gill, R. E. Meagher, D. E. Muller, J. P. Nash, J. E. Robertson, T. Shapin and D. J. Wheeler. Other members of the laboratory staff read the material and offered valuable criticism. The typewritten copy was prepared by Natalie R. House and Caroline M. Brown; the drawings were made by George Ehrlich. Ill WKi i l'illHrKMlflHi'1'liii I- LU a. o UJ < LU a. LU < irraiTTit^a^n CONTENTS PREFACE iii PHOTOGRAPHS iv Chapter 1. INTRODUCTION 1-1 Chapter 2. THE ARITHMETIC OF THE ILLIAC . . , 2-1 2.1 Representation of Numbers 2-1 2.2 Fundamental Operations of the Illiac Arithmetic Unit 2-3 2.3 The Illiac Arithmetic Unit 2-5 2.k Additions 2-5 2.5 Subtractions 2-6 2.6 Absolute Value Addition and Subtraction. . 2-7 2.7 Increment Add Orders 2-8 2.8 Add from Q and Increment Add from Q. . . . 2-8 2.9 The Shift Orders 2-9 2.10 Multiplication 2-11 2.11 Division, 2-12 2.12 Precise Calculation of the Division Remainder 2-15 2.13 The Division Hangup. Special Cases of Division 2-l6 2.1U Memory to Q and Store Instructions , , . . 2-17 2.15 Illustrative Examples 2-17 2.16 Integer Operations 2-20 Vlll 2.17 Summary 2-21 Chapter 3. THE ORDER CODE 3-1 3.1 The Makeup of Orders 3-1 3.2 Execution of Orders 3-^ 3.3 Stop Orders 3-6 S.k Order Types 3-6 3.5 Order Variants 3-8 Left Shift 3-12 Right Shift 3-13 Unconditional Control Transfer ...... 3-1^ Conditional Control Transfer 3-I6 Store 3-17 Memory to Q 3-I8 Divide 3-I9 Multiply 3-20 Input-Output 3-21 Special Input-Ouput 3-23 Increment Add from Q 3-25 Add from Q 3_26 Extract 3-27 Increment Add 3-28 Add 3-29 Abbreviated Order List 3-30 IX '\\VX\V»Hi Chapter k. ROUTIKBS k-1 ij-.l Closed Subroutines k-2 k,2 Entering a Closed Subroutine k-^ U.3 Returning Control to the Master Routine . . U-3 k-.h Placing the Argument k-'^ ^•5 Program Parameters ^-7 h-.6 Interpretive Routines U-9 ^•7 Preset Parameters U-11 Chapter 5. THE DECIMAL ORDER INPUT 5-1 5.1 Relative and Fixed Addresses 5-2 5.2 Directives. 5-U 5.3 Assembling of Orders 5-^ 5.^ Decimal Addresses ....... 5-5 5.5 Starting the Program. 5-6 5.6 Input of Decimal Fractions 5-6 5.7 Pre-set Parameters. Modification of Orders. ........... 5-7 5.8 Example of Use of Decimal Order Input . . . 5-8 5.9 Use with Interludes. Retained Directive. . 5-11 5.10 Stopping the Tape. . 5-12 5.11 Placing the Decimal Order Input 5-12 Chapter 6. 6.1 6.2 6.3 6.1^ 6.5 Chapter 7- 7.1 7.2 7-3 7.i^ 7.i^ 7.6 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.1^ SCALING 6-1 Scaling by Shifting 6-1 Numbers with Binary Point Shifted 6-1 Scaling a Full Problem 6-5 Adjustable Scaling Factors 6-10 Continuous Scaling. Floating Point Routines. 6-10 MACHINE METHODS AND CODING TRICKS 7-1 The Summation of Products 7-I Reversing the Control Transfer 7-3 Binary Switches 'J-k Tests for and -1 7-6 Use of Orders and Addresses as Constants. . 7-7 Resetting and Starting of Cycles of Orders. 7-8 Use of the Quotient Register for Inter- changes 7-II Testing if Numbers are Greater than One- Half 7-11 Convergence Criteria 7-12 Marking 7-13 Remainder in Integer Division f-lk Binary Chopping , . , 7-15 Evaluation of Polynomials 7-I6 Shifting A Left Without Shifting Q 7- 17 XI Chapter 8, CHECKING METHODS. 8-1 8.1 8.2 8.3 8.li 8.5 8 • 7 8 .8 8 .9 8 .10 8 .11 8 .12 8 .13 Chapter 9. 9. 1 9. 2 9. 3 9. k 9. 5 9. 6 Common Blunders ............. The Discovery of Errors ......... Sources of Information. ......... Modifications to Programs ........ Blocking Orders. ..... ....... Types of Checking Routines. ....... Post Mortem Routines .... ...... Post Mortem Version of the Decimal Order Input ............... . . . The Address Search Routine. ....... Sequence Checking Codes. . ....... Control Transfer Check. ......... The Check Point Routine ......... Conclusion. . ......... TAPE PREPARATION , ............. The Tlliac Input. ............. The Illiac Output .............. The Perforated Tape. Sexadecimal Tape Code Characters ................. Classification of Operations. ....... Description of Equipment. .,......„ General Remarks ..... ......... 8-1 8-2 8-U 8-5 8-6 8-7 8-8 8-9 8-11 8-11 8-12 8-12 8-13 9-1 9-1 9-1 9-1 9-7 9-7 9-16 Xll Chapter 10. CALCULATION OF RUITOTWG TIME. 10-1 10.1 Order Times . . . 10.2 Example of Running Time Calculation. . . 10.3 A Simple Running Time Formula Chapter 11. 11.1 11.2 11.3 11. J^ 11.5 11.6 11.7 Chapter 12. 12.1 12.2 12.3 Chapter 13. Chapter li^. Index PREPARATION OF A COMPLETE PROGRAM . . . , General Statement of the Problem .... Trajectory Equations .......... Processing of Equations for Solutions by the Illiac ..... .......... Scaling of the Quantities for Illiac Solution. , Coding of the Problem. ........... Checking the Program Conclusion ................. TEE CATHODE RAY TUBE DISPLAY ........ General Description ..... ....... Orders Controlling the Cathode Ray Tube Display. .................. Programming for the Cathode Ray Tube Display. THE PROGRAM LIBRARY . ............ DEFINITION OF TERMS. ........ 10-1 10-2 10-i; 11-1 11-1 11-5 11-8 11 -10 11 -15 11 -36 11 -38 12- ■1 12- •1 12- 3 12- 5 13- 1 lk~ 1 Xlll CHAPTER 1 INTRODUCTION In 19^8 the University of Illinois "began to look into the possibility of acquiring an automatic digital computer. When attempts to buy one or to have one built failed, the University decided to build one of its own, and the Digital Computer Laboratory was organized in February 19^9- Shortly thereafter an agreement was made to build a second computer for the Army to be used at the Aberdeen Proving Ground . It was decided to build the two machines following the de- sign of a computer then being designed and built at the Institute for Advanced Study. While many modifications were later made, both machines built by the University owe much to the early designs ob- tained from Princeton. The two ma-chines were built more or less together so that advantage could be taken of the savings obtainable by paralleling the design and construction work, but work on the Army machine, called the ORDVAC, was emphasized, and it was finished first. It passed its acceptance tests in February 1952 at Aberdeen and i,t has been in use there since that time. Work on the University computer (later named the Illiac) was completed in September 1952 and the computer was first made available for University use when classes began on Monday, September 22, 1952. 1-1 The Illiac is an automEtic elect3ronic digital cou^juter. It is digital because it h:^r""-- -.v.rrfrs ss sexs cf digits which have discrete values, rather than as scale reading or measure- ments, which are contir ■i'aTia'ble. Apparatus for handling digits is :i'-" - ---li rrTff. ""r.T. t'::'" frr "-.".r.ilir.g rr-tlr.urus quantities, but it is capable of giving urlini-fi. accuracy by using suitable numbers of digits . The Illiac is electronic. In the last ten years electronic circuits for storing, transmitting, adding, subtracting, multiplying and dividing numbers in digital f :rt: at extremely high speeds have been devised. The actual addition cf tvc nonhers in the Illiac takes only accut Such speed is useless unless the machine can be made to go ahead cr. its CT."n vith t:ar.y thousands cf operations, vithout human inter- vention. The Illiac is therefore automatic, in the sense that it can be given orders telling it :-_:v tc proceed, and vill then act on these orde r s aut cmat i c a 1 ly . In r:-ir, ::- -'it";: rsr.'" ether compxiters of a similar type, the Illiac contains the fell; ."ir.r five essential features: c unit. {2 A tftrry cr store. I e vices for the input and output of information (e.g. n'-nbers) tc and frcn the machine. (- y.eans for the transfer of information between the various parts of the machine, (5) Means for the automatic control of the whole machine. The arithmetic imit carries out the individual arithmeticsl operations that make up every computation; it can be thcugit cf as the electronic equivalent of a desk calculating machine. It is described in detail in Chapter 2. The memory is needed because, in any lengthy calculation, numbers produced at early stages of the calculation are frequently required to be used at later stages; they must therefore ce recorded or "remembered". 'The memory is capable cf recording 102^ n'-incers . These can be recorded (i.e. transferred to the memory from the arith- metic unit) individually, as directed by the computer's control de- vice, and recalled again individually in a similar vay. The "encry may be thought of as 102t little boxes cr locations, each accomodating one number, and labelled with the numbers through 1023. The label of a location is called its addre s s . A number in the memory is identified by the address of the location containing it. Information enters and leaves the Illiac ceded in the form of a pattern of holes in punched paper tape; there is a tape reader for input, and an automatic punch for output. There is also a teletype'^/nriter which can be used to provide output from the machine directly in printed form. Several machines are available for pre- paring punched tape, copying it, comparing it, and producing printed versions of the information on it. 1-3 The problem of controlling the whole computer has been solved by stipulating that every individual operation that occiirs vith- in the machine must be one of a certain set of specified permissible operations, and that no two such operations can occur simultaneously. Thus the design problem was reduced to that of engineering the various permissible operations and arranging for them to be executed in any desired sequence. It is up to the user of the Illiac to specify the sequence of operations or program, which the Illiac must execute to carry out his calculation. Each permissible operation can be specified in a concise coded form called an order. The correspondence between the set of permissible operations and the set of orders which specify them is called the order code of the Illiac. It is given in detail in Chapter 3- A coded problem is called a program or routine. The machine's control unit has the task of accepting orders one by one, and of causing the machine to carry out the operations specified according to the order code. If each order were taken by the control unit directly from a punched tape, then to make full use of the speed of the rest of the machine the tape would have to pass throiigh the tape reader at about 200 miles per hour. Instead, the orders are recorded in the memory along with the numbers, so that the control unit merely has to take its orders from the memory, which it can do electronically at high speed. This is made possible by coding each order to look like a number. To be more precise, orders are 1-k stored in pairs, one pair to a memory location. The information contained in one memory location is often called a vord, meaning either a number or an order pair. Of course, the more orders there are in the memory, the less room there is for numbers. Both orders and numbers are fed into the machine initially on punched tape . Normally orders are obeyed by the control unit in the se- quence in which they are stored in the memory, e. g.: Left-hand order in location 6, Right-hand order in location 6, Left-hand order in location 'J, Right-hand order in location J, Left-hand order in location 8, etc. Sometimes, however, this sequence is broken and the control unit starts over at some new position in the memory; this is called a transfer of control. There are special orders which cause this. There is also special provision for making a transfer of control depend on the value of some number obtained by the machine during the calcula- tion. Thus the machine can be made to "choose" one of two or more alternative courses of action according to the way things happen to work out . If control is transferred a few locations back in the memory, the machine will repeat the operations specified by the intervening orders. It is possible to cause this repetition to occur any number of times, leading to a cyclic behavior of the machine. Practically 1-5 every calculation which the machine performs contains several such cycles, often one inside another. In this way it often happens that the same order gets carried out many thousand of times, so that a few orders suffice to keep the machine "busy for several minutes . If each order in the memory were to be carried out once only, the Illiac would get through them all in a quarter of a second (even if the memory contained nothing but orders). In practice, calculations vary in duration from a minute to a few hours . The occurrence of cycles is one of the things that com- plicates the programming of a calculation. Another is the fact that, since orders are stored in the memory in the same form as numbers, they can be operated on and altered during the coijrse of a calculation (at the behest of other orders) just as if they were numbers. All this makes possible some most interesting calculations; it can also make programming difficult. ^ Fortunately a coder can often, as described in Chapter h make use of bits of programming done by other people. Thus a typical program consists of a number of groups of orders, some written by the coder, others already available. The latter will be available in punched tape form, and can be copied mechanically onto the program tape along with the new orders. Tape preparation is described in Chapter 9. When the whole tape for a particular program has been prepared it can be placed in the tape reader of the Illiac, The Illiac reads the tape, forms the orders and numbers punched on it and stores them 1-6 in the memory. When the program is in the memory, the machine begins to execute the orders, continuing until it comes to some particular order which causes it to stop. If the programming is correct, this is the end of the calculation. If there is a mistake in the programming various things may happen; remedies are discussed in Chapter 8. Somewhere in the program will be some orders which cause the machine to punch some output tape. This carries the results of the calculation. The program may also contain orders causing the machine to read more input tape, carrying data for the calculation. The reading of most of the program tape is accomplished by the Illiac executing a particular set of orders called the Decimal Order Input (See Chapter 5) which is always punched at the beginning of every program tape and hence read into the machine before the rest of the tape. The Decimal Order Input not only assembles the program inside the machine; it also makes certain modifications and conver- sions, so that the way in which orders are represented when punched is somewhat different from their final form in the memory. The object is to make programming easier. It is important to remember that the written form of an order and the form which it assumes in the memory are not the same thing. The relationship between the two is determined by the Decimal Order Input. Remaining chapters of this manual are devoted to: The arrangement of calculations so that all the numbers encountered are the right size (Chapter 6); ways of programming certain types of 1-7 simple tasks (Chapter 7) J how to estimate the duration of a calculation (Chapter 10); an example of a typical program (Chapter 11); and how the program library is organized (Chapter 13 ) • Finally, concise descrip- tions of the principal contents of this collection are given. 1-8 CHAPTER 2 THE ARITHMETIC OF THE ILLIAC The construction of a computer involves a compromise between engineering economies on the one hand and ease and flexi- bility of use on the other. As a result, the details of the operations of arithmetic are often dictated by engineering design considerations. The following paragraphs describe the peculiarities of the representation of numbers and of the operations of arithmetic in the Illiac. 2.1 REPRESENTATION OF NUMBERS. The simplest device for storage of numerical information is an electronic element having two stable states in which one state is called "zero" and the other state "one". One such element is capable of holding one binary digit. In the Illiac registers composed of forty such elements are provided for representation of forty binary digit numbers. The Illiac is described as a binary parallel digital computer having a precision of forty binary digits -- roughly equivalent to twelve decimal digits . The Illiac is a fixed-point computer; the locations of the fixed binary point between the first and second digits is in- dicated in Figure 2.1. 2-1 / location of "binary point sign digit 7 ^ 39 non-sign digits Figure 2.1 The Forty Digits of a Word The leftmost digit of a number is the sign digit. If the sign digit is zero, the number is positive or zero; if the sign digit is one, the number is negative. For example, + 7/8 is represented in the Illiac as 0.11100 .. . 00 = + 1/2 + lA + 1/8 = +7/8 Negative Numbers. Negative numbers are represented in the Illiac as complements with respect to 2. The process of comple- mentation is carried out by forming the digitwise complement (re- placing ones by zeros and zeros by ones) and then adding a unit in the least significant (thirty-ninth) non-sign digit. As an example, - 7/8 is formed from + 7/8 by complementation as follows : + 7/8 ones replaced by zeros and zeros by ones 0.11100 . . 00 1.00011 . . 11 + 0,00000 . . 01 1.00100 . . 00 addition of 2 ^^ machine representation of - 7/8 It is sometimes essential to distinguish between the 2-2 machine representation of a number and its arithmetic value. Suppose we have a number whose arithmetic value is x and whose machine re- presentation has the sign digit x„ and non-sign digits x.(i = 1,2,..., 39) If X is positive; i.e., if x = 0, then 39 x = XI 2" X . (2.1) i=l If X is negative (x„ = l), then the relationship is 39 . X = -1 + ^2 X.. (2.2) Equations 2.1 and 2.2 may be combined in the one equation 39 . ^ = -^0+ YL 2 X.. (2.3) i=l If equations 2.1 through 2.3 are to hold, x must be restricted to the range -1 — x • • • > ^loy^ ^2,8' ^^39 ^^ "^ ^1' ^2' ^3' . . . , ^qQ' ^39' ^1 ^^ ^ and ^0^ ^) °^y • ' • > I38' I39' ^ i^ '^• The right shift (order type l) of one digital position replaces ^Q} ^-^) ^2' • • • > ^37' ^38' ^39 ^^ ^ and 2-9 by and Qq. q^, Qg' • • • ' ^^37' *^38' % ^"^ ^ ^0' ^C ^1' • • • ' ^36' ^37' ^38 ^^ '^ ^0' ^39' ^1' • • • ^ ^36' ^337' ^338 in Q. From the behavior of the left and right shift we see that we may consider the shifting to take place in a single regis- ter AQ of 79 digits consisting of A followed by Q with q^ deleted. Thus the left shift replaces Bq, a^, a^, . . . , a^^, a^g, a^^; q^, q^, . . . , q^^, q^g, q^^ by ^1' ^2' ^y ' ' ' ' ^38' ^39' ^1' '^' ^y ' ' '' ^3>Q' ^39' ^ While the right shift replaces a^, a^, ag, . . ., a^^, a^g, a^^; q^, q^, . . ., q^^, ^38^^39 by Eq, Eq, a^, . . ., a^g, a^^, a^gj a^^, q^,...,q^g, q^^, q^g. The number n of shifts can be specified in the address digits of the shift order by the programmer. A left shift of n 2-10 digital positions replaces AQ ty 2^" AQ. Similarly, a right shift of n digital positions replaces AQ hy 2 AQ; n lies in the range 1 £; n ^63. 2.10 MULTIPLICATION (Order Type 7). Initially, the multiplier lies in t'l- quotient register Q. At the beginning of the multiplication instruction, the multiplicand is transferred from a location specified by the address of the multiply order into the 3 number register R , where it remains throughout the multiplication. The multiplication then consists of a sequence of additions and shifts. More precisely, a multiplier digit in q is sensed. There are two cases. (a) If q _ = 1, the multiplicand is added to the partial product in A. A right shift in AQ follows which halves the number in A and moves a new multiplier digit into q as well as transferrering a product digit from a ^ to q . (b) If q = 0, only the right shift occurs, which transfers a _ to q and transfers the next most yy 1 significant digit of the multiplier into q^Q- After thirty-nine right shifts have occurred, the sign digit of the multiplier is sensed. If the multiplier is positive, the multiplication is complete, with a double precision product (sign digit and seventy-eight non-sign digits) in AQ. For a negative multiplier x, the process of thirty- nine shifts and conditional additions constitutes a multiplication of the multiplicand y by 1 + x (Equation 2.3) to form a product y(l + x) = y + xy. In this case the Illiac automatically subtracts the multiplicand y to produce the correct product xy. 2-11 A number of variations of the basic multiplication pro- cedure described in the previous paragraph are possible. The initial contents of A may be either 0, l/2, or some quantity previously calculated. If we designate the initial contents of A by a, the -39 final double precision product in AQ is xy •;- 2 a, where x and y are multiplier and multiplicand, respectively. For a = 0, the instruction specified is "clear multiply" and the result in AQ is the exact 78 digit signed product xy. For a - l/2, the instruction specified is "roundoff multiply" and the result in A is a rounded 39 digit signed product. If a is arbitrary, the instruction -39 specified is "hold multiply", and the result in AQ is xy + 2 a; the quantity a is thus added to the least significant part of the product in Q. In all multiplication instructions the sign digit q„ of the quotient register is set to zero. For each of the three types of multiplication instructions described in the previous paragraphs, four additional variations can be specified by the programmer. Either N(n), -N(n), j N(N) ' , or - |N(n)| can be used as the multiplicand, where N(n) is the number transferred from memory location n to the number register r3. 2.11 DIVISION (Order Type 6). Initially, the double precision dividend lies in AQ. The divisor is transferred at the beginning of the division instruction from a memory location specified by the address of the divide order to the number register 2-12 3 R . For positive divisor and dividend, the process is analogous to elementary long division. The divisor is suhtracted from a partial remainder in A and the sign of the difference (in the adder) is sensed. If the difference is negative, is inserted in q_Q 3" as quotient digit and AQ is doubled to form a new partial remainder. If the difference is positive, 1 is inserted in q as quotient digit and the difference in the adder is placed in A, and AQ is doubled to form a new partial remainder. At each doubling of AQ, q, is shifted into q„ as well as into a „. Thus after 39 steps q has the sign of the quotient. The dividend is used as the initial partial remainder; after 39 quotient digits have been generated, the process is complete. A similar procedure is employed if divisor or dividend is negative or if both are negative. The Illiac division has the following properties: (1) A rounded quotient Q is always generated. The roundoff is achieved by setting q_Q = 1 in all cases. (2) The thirty-ninth partial remainder is left in A and is called the residue r. The true remainder R corresponding to the rounded quotient is related to r approximately as follows: R = r + (2qQ - l) y, (2.i^) where y is the divisor and q„ is the sign 2-13 digit of the quotient. Thus if the quotient is positive R = r - y, (2.5) and if the quotient is negative R = r + y. (2.6) The equations given above for the true remainder are valid if the absolute value of the quotient is less than one, and they yield results in error by -39 not more than 2 . (3) The sign digit of the quotient replaces the least significant (78th) digit of the double-precision dividend. One effect is that the least significant digit of the residue (a ^) is the same as the sign digit of the quotient q . {\) If we have a priori knowledge of the true value q of the quotient (such as, for example, a division of qy by y), the relationship between the machine quotient Q and the true quotient q is Q = q + 2"39 (1 . q^^) (1 _ gy^) (2.7) where q is the least significant digit of q and yy Yq is the sign digit of the divisor y. Equation 2.7 is essentially a description of the division roimdoff . If q = 1, then Q = q and the machine 2-li+ L quotient is the true quotient. If q = 3" the nature of the roundoff depends upon the sign of the divisor. Suppose, for example, that q is 0.101; then Q is either 0. 101000. . .001 or 0.100111. . .111 depending upon whether the divisor was positive or negative, respectively. 2 . 12 PRECISE CALCULATION OF THE DIVISION REMAINDER. We define the remainder R in relation to a quotient Q, a divisor y, and a dividend d by the equation Qy + 2"^^ R = d. or R = 2^^ (d - Qy). (2.8) However, the exact relationship involving the Illiac residue r and including the replacement of the least significant dividend digit do by the quotient digit q is '78 Qy + 2"39 l^r + (2qQ - l)y] = d + 2"^^(qQ - d g). _ (2.9) Solving for R, we have R = 2^^ (d - Qy) = r + (2qQ - l) y + 2'^"^ (d^g - q^). (2.10) Equation 2.10 gives the exact expression for the remainder R which corresponds to the machine quotient Q. If the remainder R corresponding to the true quotient q is desired, then R is defined as 2-15 R = 2^^ (d - qy). (2.11) The value of R is found by substituting equation 2.7 in equation 2.9 and solving for R, which yields R = r + |2qQ - q^^ - (l - q^^) 2yJ y + 2"39(d^g - q^) . (2.12) 2.13 THE DIVISION HMGUP. SPECIAL CASES OF DIVISION. Circuits are incorporated in the Illiac for stopping the Illiac if the quotient resulting from a division exceeds one in absolute value. The sign digit of the quotient is predictable from the signs of divisor and dividend. The sign digit of the quotient is calculated in the Illiac by comparing the dividend and divisor arithmetically. Thus, by sensing the sign digits of quotient, divisor, and dividend, it is possible to detect the fact that the quotient exceeds one in absolute value, and stop the Illiac. The equations derived in Sections 2.10 and 2.11 rre valid only if the absolute value of the dividend is less than the absolute value of the divisor. When absolute values of dividend and divisor are equal, the Illiac generates a quotient -1+2 if the dividend is negative and the divisor is positive. The quotient is +1 - 2 if dividend and divisor are both negative. If the dividend is positive and equal to the absolute value of the divisor, the Illiac will stop. If the divisor is -1, the Illiac generates a quotient which is the digitwise complement of the dividend, except for the quotient roundoff. 2-16 2.lU MEMORY TO Q (Order Type 5) AND STORE (Order Type h) INSTRUCTIONS. Instructions are provided in the Illiac for trans- ferring a number from a specified memory location to the Q register, and for transferring a number in A to a specified memory location. The former instruction can be used to transfer the multiplier to Q before a multiplication; the latter instruction is used to transfer a result from A to the memory. If a result lies in Q, (e.g., a division quotient), it can be transferred to the memory by using two orders; the first is a variant of the add from Q orders and transfers the number in Q to A and the second is a store order, transferring the number in A to the memory. 2.15 ILLUSTRATIVE EXAMPLES. A. The Leapfrog I Division Test. In the Leapfrog I division test the product xy is formed and is then divided by y. The sum of the quotient in Q and residue in A is formed and stored. The sum of quotient and residue is then calculated independently and compared with the sum previously stored. The value of the machine quotient Q in the quotient regis- ter after division of xy by y is given by equation 2.7, with q = x. Thus Q = X + 2"3^ (1 - x^^) (1 - 2yQ). The value of the residue r left in the accumulator is fo\ind from equation 2.12 by setting R = 0, x = q, and solving for r: 2-17 r = [X35 + (1 - X35) 2yQ - 2Xq ] y + 2-3^ (x^ - x^^ y^^) The sum Q + r, after rearranging terms, is Q + r = X - 2'^^ x^^ y^^ - Xq (y - 2" ) + (l - x^) y + (1 - x^^) (2yQ - 1) (y - 2-39). The independent calculation of Q + r thus consists of forming x - 2" X Q y_Q and either adding y or (-y + 2 ) depending upon whether x is positive or negative; and finally, if x is 0, adding or subtracting (y - 2 ) depending upon the sign of y. B. The "Double Precision" Division. It is sometimes convenient to consider a single precision divisor y as exact and form a "double precision' quotient s + 2 t utilizing the double precision dividend d originally in AQ. The procedure used is as follows: / -39 -39 1. Form d/y, yielding s + 2 in Q and r + 2 s in A. 2. Shift right, forming r/2 in A and s/2 in Q. 3. Form r/2 + y leaving T in Q and a residue u in A. -39 k. Assemble s + 2 -'^t by setting t (the sign digit of T) to zero, inserting q/2 in A and shifting left once. -39 The precision of s + 2 t can then be calculated as follows: Step 1 yields s and r such that (by equation 2.9) (s + 2-39)y + 2-39 [-^ ^ 2-39 3^ ^ (2Sq - l)y] = d + 2-^Q(sq - d^g). 2-18 or sy + 2'^^ (r + 2sQy) = d - 2"^® d g. (2.13) Step 3 yields Ty + 2"3^[u + (2tQ - l)y]= r/2 + 2'^^^ , (2.li^) The following substitutions are made; (a) s_ = t , since the sign of r/2 is the same as the sign of d. (b) From step k, t = 2(T + s ) or T = l/2t - s . Substituting in equation 2.1^ and solving for r, we have .-38 r = (t - 2sQ)y + 2"^^ [u + (2Sq - l) y] - 2-7^ s. Substitution of the value for r in equation 2.13 yields sy + 2 •39 (t - 2sQ)y + 2sQyj + 2 •77 u + 2Sq - l)y 2--« =0 = a - .-^8 ,^^. We thus have ,-39. ^„ . ^-78 (s + 2'-^^t)y + 2"' [2u + 2(2s - l) y + d 78 - 2-38 ^ ]=d. It can be shown that u + (2s_ - l) y < 1 so that the quantity within square brackets is less than 3 in absolute value. We conclude that the quotient s + 2 t is in error by not more than 2 The program for forming a "double precision" quotient 2-19 from a dou"ble precision dividend and an exact single precision divisor is given in words 57 to 66 of library routine Ak entitled, "1.7 Precision Floating Decimal". A major difficulty encountered is the formation of r/2 from r (Step 2 above), for r may be as large as 2y and may therefore exceed range. It is therefore necessary to set the sign digit of r/2 to that of the original dividend d. 2.16 INTEGER OPERATIONS. It is sometimes desirable to use integers for computations in the Illiac. Suppose we have an integer a stored in the memory or arithmetic unit. In terms of the -39 formulation of previous sections, we would store 2a, where a 39 39 lies in the range -2 — a < 2 . If we wish to add or subtract two integers a and b, no difficulty is encountered, for 2 a + 2 b ■39 (a + b) indicating that the correct sum or difference lies in A after the instruction is performed. Multiplication of two integers a, b yields (2'35a) (2"^^b) = 2~'^ ab. The product ab lies in AQ and is in the range -2 ^ ab < 2 . If the programmer scales 39 ^ 39 all quantities so that the product remains in the range -2 — ab < 2 , then the hO digit signed product can be transferred to A by a left shift of 39 digital positions. It should be noted that the sign digit of Q is set to zero during the multiplication so that for positive products, N(Q) = ab, if ^ ab < 2^". Division of integers presents certain difficulties. An example is given here of a method of dividing a positive dividend a by a positive divisor b to yield a quotient f and remainder g. 2-20 The steps are as follows: (1) Place the dividend 2" a in AQ ::^ a < 2^^ , (2) Shift left one digital position, leaving 2a in AQ with (3) Divide by 2~^\ , leaving (2f + l) 2'^^ in Q and (2g) 2"^^ in A. i b -'. 2"^^, 39, [h) Shift right one digital position, leaving 2" f in Q -39 and 2 -^^g in A. It can be proved that bf + g = a by substitution of the appropriate quantities in equation 2.9, as follows: (2f + 1) 2-39 (2-39^) + 2-39 [2-39(2g) . 2-39^] = 2"7^(2a) which yields 2"'^ (2bf + b + 2g - b) = 2"'^ (2a) or bf + g = a. The ranges of f and g are — f < 23 and := g < 23 . 2.17 SUMMARY. In the Illiac arithmetic unit are two registers, A and Q, which are directly accessable to the programmer. A single arithmetic order of a program utilizes the initial numerical operands in A, in Q, and in a specified memory location, and trans- fonns these quantities to produce desired results which are left in the registers. The programmer must know where the operands are initially located and where the results are to be found. The functions 2-21 of the registers for the operations of arithmetic are indicated in Table 2.1. The Illiac has a fixed point arithmetic unit; the binary point is fixed so that any number x used in computation must lie in the range -1 — x < 1. The programmer must insure that all quantities remain within this range during a computation. The sign of a numerical quantity is indicated by the leftmost of the forty binary digits stored in a register or a memory location. The sign digit is for a positive number 1 for a negative number. 2-22 CO CD OJ OJ •H -P 1 <+H ^^~^ (i;""\ o Tl bD (D rH ^ rH (D H P ^ ,CI o W Ti C ra fH C 5h -p j:; CO S O cd o cd m >5 l4H E Oj u 4-> ^ CD ■h O 6^ u o o o ;3 s tD ^3 O ^5 Cd « (3? H O •H •H tj ON m 1 OJ OJ OJ X O (D i ^H 13 -P + (D 0) C (D CJ >. ;J R -p Q 0) 0) '^ ;3 X -d <; ra P h rH fl -ci 'H f^ •H M 0) CO 0) > >5 ^H X X X ^ u !h (U (P cd td •H -P ^ !h rH Of m -p +J PU z r •H •H •H •H r^ c M ,a ,o -P o o ^ ^ rH 3 •H •H CD B M EH 2 •H rcj CJ fl 0) 0) •H 0) OJ 4J Cd 1 cd +J C C PM -H Ph ^ - U TS cd o OJ -H +^ > 5 1— 1 -^ (U 0) c ■^ (L) i-H ^1 +j •H t>i O C ^ Pj o o tiH fn -H (U cd •H CD s •H O -P Td ^ +J Til r r; •H CVJ - u a nJ Tj -P rH C > OJ (U 0) u < ^ ;3 cd •H ai P^S q :3 S u n CO cn (-1 CO 4-> § >5 ;>3 >i <4H •H ^^ -P H -p iH TJ rH rH (U J3 ^ •H r—^ EH u !h P< (D pj t3 Pj "d CO ^ o 'ti cd cd -H tJ -h r-t -H •H CO t) -cf fn 0) -p C -P O -P > -p 1 <; +J rH rH ;:3 rH m rH •H Cm 4J rO '^ ^ O 13 5 P (D C tiD — - S s K S S P ^-' & CO •H H P5 S S ^A r- vo O ^ 2-23 CHAPTER 3 THE ORDER CODE The Illiac is a binary computer in which the storage capacity of each register or memory location is ^0 binary digits. The orders which the machine carries out are represented by numbers in the machine. The relation between the order types and the corre- sponding numbers is called a code, and the collection of all such numbers is called the order code of the machine. The order code is interpreted by the control circuits of the machine and completely determines what the machine does. The machine is designed so that any storage location in the memory may be used either for orders or for numbers, the only distinction being that the control must be in- structed properly so that orders and numbers will be treated appropriately. 3.1 THE MAKEUP OF ORDERS, An order for a digital computer consists of an instruction to say what to do and one or more addresses to say where to get the quantities to be used in carrying out the in- struction. In contrast to some existing computers, the Illiac uses what is called a one -address code. For a one-address code, the order is of the kind that says "add the number in memory location 12 to a number already in the arithmetic unit, leaving the sum in the arith- metic unit". Since a one-address code is used, it is not necessary to use ^0 binary digits to describe an order. The Illiac uses 20 digits and 3-1 packs two orders (an order pair ) into one location. These are the left-hand order and the right-hand order. Since many orders must refer to locations in the memory, each order contains an address . It is still called an address in those orders which do not refer to the memory. The electrostatic memory of the Illiac has 102^ locations and because 102^+ =2 we require 10 binary digits for the address. These are the rightmost 10 digits of the 20 digits assigned to an order . Of the remaining 10 digits of each order, eight are used for the instruction or ( function ) and the other 2 are unused. The digit makeup of an order pair is shown in Figure 3°1» 8-DIGIT INSTRUCTION 10-DIGIT ADDRESS 8-DIGIT INSTRUCTION 10-DIGIT ADDRESS LEFT-HAND ORDER DIGITS 0-19 f RIGHT- HAI^ID ORDER DIGITS 20-39 ^ Figure 3.I Order Pair Makeup The instruction digits are 8 in number because of the convenience obtained by using a base I6 (sexadecimal) number system 3-2 in which k binary digits may be represented by one sexadecimal digit. Thus each instruction may be coded as 2 sexadecimal digits. The symbols K, 5, N, J, F, L are used for 10, 11, 12, 13, ik-, 15 . As an example of an order pair, let us consider the fol- lowing UO binary digits . 1111010100000001110101000000000000000110 When divided into instruction and address digits, these digits look like this: nil 0101 00 0000011101 OlOO OOOO OO OOOOOOOllO INSTRUCTION L,H,. ADDRESS INSTRUCTION R,H„ ADDRESS The left-hand instruction is made up of the two ^-digit numbers nil 0101 which are the sexadecimal digits L5. The left-hand address is interpreted as an integer which may go from to 1023 if we use decimal notation or from to 3LL if we use sexadecimal notation. In sexadecimal representation the left hand address is IJ which corresponds to the decimal number 29- Thus the left hand order is L5OIJ where the has been supplied so that all 20 binary digits (including the unused 2) are accounted for. (We could have set the unused digits to I's and used N rather than if we had wished.) Similarly the right hand order is ^0006, and we have, in sexadecimal notation, the order pair L501J !4 0006 . 3-3 This order pair says, "Transfer the contents of memory location IJ to the accumulator; store the accumulator contents at location 6 of the memory , " It is quite inconvenient to have to write addresses in sexadecimal form, and it is imnecessary if the machine contains a program vhich will take addresses written in decimal form and con-' vert them to sexadecimal (i.e., binary) form for machine use, A program of this type is available for the Illiacc It is called the Decimal Order Input Routine (See Chapter 5)> 3.2 EXECUTION OF ORDEES, The Illiac operates by using orders which have been stored in the memory according to a plan deter- mined by the programmer. The program is begun with a particular order chosen by the programmer. Let us suppose that it is the left hand order at location 10. (We shall refer to addresses in decimal notation.) The control will put into R_ the order pair from location 10. Then, until something is said to the contrary the control will follow a fixed pattern in executing orders. It will do the left hand order and then the right hand order in R_. Then it will put the order pair at location 11 into R, and again do the left and right hand orders. It will continue to withdraw and execute order pairs from successive memory locations until one of two things occurs: (a) One of the orders brought out says "stop", (b) One of the orders brought out says "change the sequencing". 3-h Control Transfer Orders . The second kind of order, a con- trol transfer order , permits the programmer to change the sequencing of orders and provides the flexibility required for iterative processes, It works in the following way. Let us suppose that after the machine has executed the left-hand order at location I7 the programmer wishes to move to a sequence of orders beginning, say, with the right-hand order at location 35- Then the right-hand order at location I7 will say "Transfer control to the right-hand order at location 35"- The execution of this order will consist of arranging that the next order pair is brought to R from location 35 and that the left-hand order is skipped. Having done the right-hand order in R , the control brings out the order pair from location 36 and proceeds in the usual way. Conditional Transfer Orders , There are two kinds of con- trol transfer orders, conditional transfer orders and unconditional transfer orders . We have just described the unconditional transfer order. The conditional transfer order does the same thing as the unconditional transfer order provided that the nixmber in the accumu - lator is not negative . Otherwise it does nothing. In the example we have just used, if the right-hand order at location I7 had been conditional, then if the accumulator had held zero or a positive number the next order executed would have been the right hand order at location 35- But if the accumulator had held a negative number the next order executed would have been the left hand order at location 18, 3-5 3.3 STOP ORDERS . There are four control transfer orders, the right-hand and left-hand unconditional and conditional orders . These have heen fiurther combined with a stop or not-stop order, giving eight orders in all. If the programmer chooses one of the four "stop and transfer control" orders the machine will stop before transferring control and must be started again with a panel switch. The switch can be set so that these stop orders are ignored, which of course makes these stop orders into ordinary control transfer orders. This is often useful in programming, and when it is done the machine can still be stopped with another kind of stop order which cannot be ig- nored . 3.k ORDER TYPES . The number of orders which the Illiac can execute is quite large (more than 100 ), but not all of them are of general interest. What we shall do here is discuss the various types of orders, giving the variants of each. Following this dis- cussion will be a list of those Illiac orders which are of most use. This list is adequate for the coding of any problem, and beginners are urged to confine themselves to it. Experienced coders will find uses for other variants . The two sexadecimal instruction digits of an order give the order type and the order variant . We shall refer to them as the T- and V- digits, respectively. In the example L5 cited earlier the T- digit is L and denotes addition. The V- digit is 5 and chooses one of the variants of the addition order. 3-6 The order types are given in Table 3.1. T-Digit Order Type Left Shift 1 Right Shift 2 Unconditional Transfer 3 Conditional Transfer k Store from A register 5 Memory to Q register 6 Divide 7 Multiply 8 Input or Output 9 Special Input or Output K Increment Add from Q S Add from Q register N Not Used J Extract F Increment Add L Add Table 3-1 Order Types The meaning of the address digits of the different order types given in Table 3-2. 3-7 ORDER -TYPE 0, 1 2, 3 k 5 6 7 80, 82 ADDRESS SIGNIFICANCE Number of shifts (cannot exceed 63) Memory location from which next order pair will come Memory location at which storage will occur Memory location from which word is brought to Q register Memory location of divisor Memory location of multiplicand Number of binary digits to be input or output 92 Character to be punched and number of punchings K, S Address not used J Same as for 5 order F Memory location of addend L Memory location of addend Table 3^2 Meaning of Address Digits It will be seen from Table 3,2 that except for the 0, 1, 8, 9, K and S orders the address of an order always refers to the memory . 3-5 ORDER VARIANTS , Let us now consider the variants obtained by changing the V-digit. The sexadecimal V-digit is made up of the four binary digits V8, Vh, V2 and VI. There are I6 possi- ble combinations, giving V-digits from to L, but not all are used. The results obtained with different V-digits are as follows: 3-8 (a) Th£ Digi't Xi- ^^ VI - 1, A will always be cleared to zero at the beginning of any order. If VI = 0, A will not be cleared. Thus an odd V- digit means that A will be cleared. (b) The Digit V8, If VI = 1 and V8 = 1, the quantity l/2 will be put in A at the beginning of any order. This is how rounded multiplication is carried out. If V8 -1 and VI - 0, the Illiac will hang up . (c) The Digit V2 . This digit affects all orders except those of types 0, 1, 5 and J. See Table 3-3 (d) The Digit Yk . This digit affects all orders except those of types 0, 1, 5 and J. See Table 3-3 • The following notation is convenient for a more detailed description of the orders: A = accumulator register p = sign digit of A Q = multiplier-quotient register q = sign digit of Q AQ = the 79 binary digit double register formed from A and Q by omitting q < N(R) = contents of register R N(n) = contents of memory location n If no ambiguity is possible, the symbols A and Q will also be used to denote the contents of A and of Q. 3-9 On the following pages there are detailed descriptions of the results obtained by changing the V-digit of the 15 order types used in the Illiac. After the detailed descriptions is an abbrev- iated list of orders. The orders in the abbreviated list have been underlined In the detailed descriptions. 3-10 o Eh o W o EH W PL, o O >H pq o o EH O O EH CQ CQ CQ O Eh CQ O m Eh CQ ^ PL, Eh B EH t3 H O f^ PC o CQ ^ O 1-1 o O rH O O — > O EH O w o o Q Q o pq CQ ^ Eh O © CQ > O 'H O rH O r-l O &3 OJ 1^ VO CO ON CQ r- 3-11 OV n Left Shift (Double) 3 Orders Final Stop 1 Order If n = 0, the machine will stop. If not, repeat n times the operation which replaces the contents ^Q> s^, a^, ••• , a^Q, a^^; q^, q^, q^, ... , q^g, q^^ of AQ by ^1' ^2' ^3' '" ' ^39 '^l' *^2' ^^3' %' '" ' ^^39' '^ leaving q_ unchanged. The number n will be interpreted modulo 6U. Variants 0, 2, h, 6 Order as described above. 1> 3) '?) 7 Clear A and then execute as described. 8, K, N Illiac will hang up. Avoid these. 9, S, J, L Clear A, insert l/2 in A, and then execute order as described above. F Final Stop. Use only 00, 01, 09 for shifts Use OF with n = for final stop 3-12 IV n Right Shift (Halve) 3 Orders If n = 0, the machine will stop. If not, repeat n times the operation which replaces the contents aQ, a^, a^, . . . , a^g, a^^; q^, q^, q^ . . . , q^g, q^^ of AQ by Sq, Hq, a^, . . . , a^^, a^g; a^^, q^, q^, . . . , q^^, q^g, leaving q„ unchanged. The number n will be interpreted modulo 6h . Variants 0, 2, h, 6 Order as described above. 1^ 3 J 5 J 7 Clear A and then execute as described. 8, K, N, F Illiac will hang up. Avoid these. 9, S, J, L Clear A, insert l/2 in A, and then execute order as described above. Use only 10, 11, 19 3-13 2V n Unconditional Control Transfer 12 Orders Bring the next order pair from memory location n and choose the left or right hand order of this pair, stopping before- hand or not, depending upon V. Variants Stop. The first order after starting with the STAET switch will be the right hand order at memory location n. The stop can be ignored by setting a panel switch. 2 Transfer control to right hand order at memory location. k Same as except take left hand order. 6 Same as 2 except take left hand order. 1^ 3> 5j 7 Same as 0, 2, h, 6 except clear A first. 8, K, N, F Illiac will hang up. Avoid these. 9 S, J, L Same as 1, 3> 5j 7 except also make A = l/2 after clearing. Use 20, 21, 22, 23, 2^, 25, 26, 27, 29, 2S, 2J, 2L. Starting After A Stop . When the Illiac has been stopped by one of the control transfer stop orders, it is usually started again by moving the black switch to START, from which position the switch automatically returns to OBEY. The Illiac can also be started again by moving the white switch through EXECUTE to FETCH and then back to RUN. If this is 3-li+ done, the control transfer order which stopped the Illiac will be ignored. The normal sequencing will then follow unless the stop order is a right hand order transferring control to the right hand side of a word. In this case, the order first obeyed after starting will be the right hand instead of the left hand order of the new order pair brought out. For example consider the following orders: P L5 F 20 p+2 p+1 UO IF 2i+ p p+2 7J 2F LU 3F If we stop with the 20 order, the black switch will start with LU 3F and the white switch with 2^^- p. If we stop with the 2k order, the black switch will start with L5 F and the white switch with 7 J 2F. 3-15 3V n Conditional Control Transfer k Orders If A > 0, bring the next order pair from memory location n and choose the left or right hand order of this pair, stopping be- forehand or not, depending upon V. If A ^ 0, go on to the next order. Variants 0, 2, h, 6 If A > 0, do the same operation as for the corresponding 2V order. If A < 0, go on to the next order. 1> 3} 5, 7 Identical with corresponding 2V orders. 8, K, N, F Illiac will hang up. Avoid these. 9, S, J, L Identical with corresponding 2V orders. Use only 30, 32, 3^, 36. Starting After A Stop . The discussion given with the 2V orders applies here to the corresponding 3V orders. 3-16 UV n Store 9 Orders Copy into memory location n all of the contents of A, the contents corresponding to the address of a left hand order, or the contents corresponding to the address of a right hand order, depending upon V. Variants 0, h Replace N(n) hy A, 1, 5 Replace N(n) end A by 0. 2 Replace address digits of right hand order at memory location n by the corresponding digits of A. 3 Same as 2 except clear A first. 6 Same as 2 except take left hand order. 8, K, N, F Illiac will hang up. Avoid these. 9, J Replace W(n) and A by l/2 . S Replace A by l/2 and address digits of right hand order at memory location n by 0. L Same as S except take left hand order. Use only ko, Ul, kg, U3, k6, k^ , kg, kS, kh. 3-17 57 n Memory to Q 3 Orders Transfer N(n) to Q Variants 0, 2, h, 6 Transfer W(n) to Q 1, 3, 5, 7 Clear A and transfer W(n) to Q. 8, K, N, F Illiac will hang up. Avoid these. 9, S, J, L Put 1/2 in A and transfer N(n) to Q. Use only 50, 51, 59- 3-18 6V n Divide 3 Orders Divide AQ by r](n), placing the rounded quotient In Q (the least significant digit being 1 for the roui;doff) and leaving a residue in A. If A I ^> '^{n)! the Tlliac will stop after dividing. If JAJs= JN(n)| and if A ^ 0, the Illiac will stop after dividing; if I A = JN(n)| and if A v 0, the Illiac will not stop after dividing. Variants As described above. Make A = 0^ then proceed as above. Make A = l/c;, then proceed as above. Illiac will hang up Avoid these. These give incorrect results or results which are correct only under certain conditions = Avoid them. 6 7 L, S 8, K, W, F 0, 1, 2, 3 ^. 5, 9, J Use only 66, 67, ^L, 3-19 7V n Multiply 12 Orders Put Q X P(n) + 2'^" A into AQ, the least significant 39 digits being in Q with q = 0. Variants P(n) = - W(n) 1 P(n) = - N(n); A=0 2 P(n) = - |w(n)| 3 P(n) = - |N(n)| ,• A=0 k P(n) = N(n) 5 P(n) = N(n); A=0 6 P(n) = |N(n)| 7 P(n) = |N(n) I ; A=0 8, K, N, F Illiac will hang up. Avoid these, 9 P(n) = - W(n); A = 1/2 S P(n) = - |N(n)| ; A = 1/2 J P(n) = W(n); A = 1/2 L P(n) = |w(n)| ; A = 1/2 Use only 70, 71, J2, 73, 7^, 75, J6, TL, 79, lA, 11, 7L. 3-20 8V n Input -Output 9 Orders Transfer words between A and the input tape, output punch, or magnetic drum. The address n must be a multiple of k for the tape and punch orders and must be 11 for drum orders . . Variants Shift AQ four places left as in the 00 order and replace a^, a , an, a by the binary- digits corresponding to the sexadecimal character being read. This is done n/^ times, 1,9 Clear A and then do as in 80 order. 2 Pimch the digits a , a , a , a as one sexa- decimal character and shift AQ four places left as in the 00 order. This is done n/h times. 3 Clear A and do as in 82 order. 5 This is a i+O-digit order of the form 85 11 T\r p„ We distinguish two cases. (1) T is not 0, 1, 8, 9. In this case, A and Q are shifted left eleven places as in the 00 order and the word at drum location p is placed in A. Then the T order is executed using address p. Com- plete freedom is not available in drum addresses because p may interfere with V, 3-21 (2) T is 0, 1, 8, 9. In this case after the word at drum location p is placed in A the right hand order is skipped. This permits use of any drum address for p. 6 This is a ij-0-digit order of the form 85 11 TV p. We again have two cases: (1) T is not 0, 1, 8, 9. In this case A is transferred to drum location p, and A and Q are shifted 11 places left as in the 00 order. Then the T order is ex- ecuted using address p. Complete freedom is not availahle in drum addresses be- cause p may interfere with V. (2) T is 0, 1, 8, 9. In this case the right hand order is skipped after doing the left hand order as in case (l). This permits use of any drum address p. 7 Same as 86 except clear A first. S Put 1/2 in A and do as in 82 order. L Put 1/2 in A and do as in 86 order. ], K, N, F Illiac will hang up. Avoid these. h, J These are not useful. Avoid them. Use 80, 81, 82, 83, 85, 86, 87, 8S, 8L. 3-22 9V n Special Input-Output 2 Orders Variants 1 Five hole input. Shift AQ, four places right and re- place a g, a , a g, a by the binary digits corre- sponding to the four least significant holes on the tape. Place the contents of the fifth hole in posi- tion a . 2 Letter output. Punch on the tape a character de- pending upon the address digits n. Three quantities are defined by the 10 binary address digits: (1) The leftmost h digits define the usual h digit positions in the output tape. (2) The rightmost digit defines the 5th hole in the output tape . (3) The rightmost 6 digits determine the number b of times that the above-defined character is punched and also the number of right shifts executed. The number of characters punched will be found by dividing the number in the rightmost 6 digits by h and rounding up to the next integer. The address n may always be found from the following formula; n = 6Ua + 4b + c - 2 where a is the character punched, a = 0, 1, 2, . . . , J, F, L b is the number of characters punched, 1 fr. b ^ I6 c determines the fifth hole, c = 0, 1. 3-23 The niun'ber of right shifts executed is ^h + c - 2. Example . Punch the character 7 thirteen times. It will be found that the last 6 digits contain the number 50 which when divided by h and rounded up gives 13 . There will be 50 right shifts. Figure 3-2 shows the relationship between the tape holes and the address digits of the 92 order. The address shown will print the character 7 thirteen times. Figure 3.2 Address Digits of 92 Order 3-2k KVn Increment Add from Q 12 Orders These orders are identical with the FV" orders except that Q is used instead of N(n). Variants Add -Q - 2'^^ to A. (See note). 1 Put -Q - 2"^^ in A. 2 Same as if Q > 0; same as h if Q < 0. 3 Same as 1 if Q > 0; same as 5 if Q < 0. k Add Q + 2"^^ to A. 5 Put Q + 2"^^ to A. 6 Same as ^i- if Q > 0; same as if Q < 0. 7 Same as 5 if Q :^ 0; same as 1 if Q < 0. 8, K, N, F Illiac will hang up. Avoid these. 9 Put -Q - 2"^^ + 1/2 in A. S Same as 9 if Q > 0; same as J if Q < 0„ J Put Q + 2"-^^ + 1/2 in A. L Same as J if Q > 0; same as 9 if Q < 0. Use KO, Kl, K3, KU, K5, K6, PC7, K9, KS, KJ, KL NOTE: - Q - 2 is the digitwise complement of Q. 3-25 SV n Add from Q 12 Orders Q is added, subtracted, etc., to A. These orders are identical with the LV orders with Q used instead of N(n) . Variants Subtract Q from A. 1 Put -Q in A. 2 Subtract | QJ from A. 3 Put - I Q| in A. k Add Q to A. 5 Put Q in A. 6 Add I Q I to A. 7 Put I Q I in A . 8, K, N, F Illiac will hang up. Avoid these. 9 Put 1/2 - Q in A. S Put 1/2 - I Q| in A. J Put 1/2 + Q in A. L Put 1/2 + |q| in A. Use SO, SI, S2, S3, S^i, S5, S6, SJ, S9, SS, SJ, SL 3-26 JV n Extract 3 Orders If two corresponding digits of N(n) and Q are both I's, put 1 in that place of Q. Otherwise put 0. This order gives the logical product of N(n) and Q. Variants 0, 2, h, 6 As described above. 1, 3, 5, 7 Clear A and do JO order. 8, K, N, F Illiac will hang up. Avoid these. 9, S, J, L Put 1/2 in A and do JO order. Use only JO, Jl, J9. 3-27 FV n Increment Add 12 Orders Variants Add -N(n) - 2"^^ to A. (See note) 1 Put -N(n) - 2'-^^ in A. 2 Same as if N(n) rl 0; same as h if N(n) < 0. 3 Same as 1 if W(n) ^ 0; same as 5 if N(n) < 0. k Add N(n) + 2~^'^ to A. 5 Put N(n) + 2"^^ in A. 6 Same as h if N(n) > 0; same as if N(n) < 0. 7 Same as 5 if N(n) > 0; same as 1 if N(n) < 0. 8, K, N, F Illiac will hang up. Avoid these. 9 Put -N(n) - 2"^^ + 1/2 in A. S Spme as 9 if N(n) > Oj same as J if N(n) < 0. J Put N(n) + 2"^^ + 1/2 in A. L Same as J if N(n) > 0; same as 9 if N(n) < 0. Use FO, Fl, F2, F3, F^, F5, F6, F7, F9, FS, FJ, FL. -39 NOTE: -N(n) - 2 -^^ is the digitwise complement of W(n). 3-28 LV n Add 12 Orders N(n) is added, subtracted, etc., to A. Variants Subtract N(n) from A. 1 Put -W(n) in A. 2 Subtract |N(n)| from A. 3 Put - |N(n)| in A. k Add N(n) to A. 5 Put N(n) in A. 6 Add |N(n)| to A. 7 Put I N(n)| in A. 8, K, N, F Illiac will hang up. Avoid these. 9 Put 1/2 - W(n) in A. S Put 1/2 - |w(n)| in A. J Put 1/2 + N(n) in A. L Put 1/2 + lN(n)| in A. Use LO, LI, 12_, L3, LU, L5, L6, L7, L9, LS, LJ, LL. 3-29 00 n 09 n OF 10 n 19 n ABBREVIATED ORDER LIST ORDER DESCRIPTION Shift AQ left n places, 1 < n < 63. Make A = l/2 and then shift AQ left n places, 1 ^ n ^63. Final stop. Shift AQ right n places, 1 ^ n ^63. Make A = l/2 and shift AQ right n places so that AQ contains 2 , 1 ^n ^63. 20 n • Stop. The first order after START will he the right hand order at location n. The stop can be ignored by setting the panel switch to IGNORE. 22 n Transfer control to the right hand order at location n. Same as 20 except take left hand order. Same as 22 except take left hand order. If A ^ do as in the corresponding 2V order. If A < go on to the next order. Replace N(n) by A. Do not change A. Replace N(n) and A by zero. 24 n 26 n 30 n 32 n 3^ n 36 n 1+0 n 111 n 3-30 ORDER DESCRIPTION I|-2 n Replace address digits of the right hand order at location n by the corresponding digits of A. Do not change A. 46 n Replace address digits of the left hand order at location n by the corresponding digits of A. Do not change A. Replace N(n) and A by l/2 . Replace Q by N(n) . Divide A + 2"^^ (Q + q ) by N(n) . Put -N(n) Q + 2"^^ A into AQ, Multiply -N(n) by <^, putting result in AQ. Put - |N(n)| Q + 2"^^ A into AQ. Multiply - |N(n) by Q, putting result in AQ. Put N(n) Q + 2"^^ A into AQ. Multiply N(n) by Q, putting result in AQ. Put lN(n)| Q + 2"-^^ A into AQ. Multiply |N(n)|by Q, putting result in AQ. Put the rounded product -W(n) Q into A. Put the rounded product - |w(n)| Q into A. Put the rounded product N(n) Q into A. Put the rounded product |N(n)| Q into A. Input n/4 sexadecimal characters from the tape . Clear A and input n/k sexadecimal characters from the tape . 3-31 h9 n 50 n 66 n 70 n 71 n 72 n 73 n 7k n 75 n 76 n 77 n 79 n 7S n 7J n 7L n 80 n 81 n ORDER DESCRIPTION Punch n/U sexadecimal characters on the tape. Replace A by the word at driom location n. See page 3-21. Replace the word at drum location n by A. See page 3-22. Read one five-hole character from the tape. Close shutter. Punch one carriage return and line feed character. Punch one + sign (or K) . Punch one - sign (or S). Advance film and open shutter. Punch one space character. Kl n Put - Q - 2 -^^ in A. (This is the digitwise complement of Q). Add Q + 2~^^ to A. Put Q + 2"^^ in A. Subtract Q from A. Put - Q in A. Subtract |q| from A. Put -|q| in A. Add Q to A. 82 n 85 n. 86 n 91 k 92 1 92 131 92 6k2 92 706 92 769 92 963 Kk n K5 n SO n SI n S2 n S3 n Sk n S5 n S6 n Put Q in A. Add I q| to A. S7 n Put I Q I in A I 3-32 ORDER DESCRIPTION JO n Replace Q by the logical product of Q and N(n). Fl n Put -W(n) - 2 "^^ in A. (This is the digit- wise complement of N(n)). Add N(n) + 2"^^ to A. Put N(n) + 2'^^ in A. Subtract W(n) from A. Put - N(n) in A. Subtract |w(n)j from A. Put - I N(n)| in A. Add N(n) to A. Put N(n) in A. Add |N(n)| to A. Put |N(n)( in A. Fk n F5 n LO n LI n L2 n L3 n Lll n L5 n L6 n L7 n 3-33 CHAPTER k ROUTINES One of the first tasks in programming a computation is to break it down into a number of small or medium size operations, each of vhich forms a fairly distinct logical step in the whole calculation. Such a step may be the evaluation of a function such as a square root, logarithm or cosine. Each step must be carefully defined so that it fits correctly with all the other steps. Having decided exactly what is required of each step, it is possible to proceed with the coding of the individual steps. This proceduiB has three important advantages. Firstly, it enables the programmer to concentrate on one part of the job at a time. Secondly, the coding of each step can be tested separate- ly before incorporating it in the program. Thirdly, certain steps are common to a very large number of different calculations; these have been coded and tested once for all, and may be used by any one in the laboratory. The coding for one step constitutes a routine , The collection of routines for performing common operations in the Tlliac is called the library of routines. It includes routines for evalua- ting many simple functions like those mentioned above, also for printing numbers in various layouts, for integrating differential equations, for solving simultaneous equations, and for many other operations , k-1 A routine, when used to perform part of the work of another routine, is called a subroutine . The simplest type of subroutine is merely a string of order pairs which can be inserted in the appro- priate place among the other orders of a program. This is called an open subroutine. However, for various re as ore another type, called a closed subroutine, is more commonly used k.l CLOSED SUBROUTIl^S. A closed subroutine is also a string of consecutive words but these do not have to be placed among the other orders of the program. Instead, they may be put in any convenient place in the store. Each time the subroutine is to be executed, control must be transferred to it in a certain special way (the subroutine is said to be entered ) . It is so arranged that when execution is complete, control is automatically returned to the point from which the subroutine was entered, so that execution of the rest of the program may continue. In this way a program is seen to consist of several dis- tinct, self-contained blocks, namely the various subroutines and the part of the program (usually called the main program or master routine) which makes use of its subroutines by sending control to them. In- ternal rearrangement of a routine is usually difficult, but the routines comprising a program can be shuffled about very easily, and this fact makes the coding of large problems much simpler. It is not necessary to enter each subroutine directly from the master routine; there is nothing to prevent one subroutine being entered from another. A subroutine may itself have subroutines. h^2 U.2 ENTERING A CLOSED SUBB.OUTIME. The following two orders must be inserted in the master routine at the point from which a subroutine is required to be entered, k Any 50 k k+1 26 m Subroutine starts at m. Any These orders must be, as shown, in the right-hand half of one word and the left-hand half of the next (it may be necessary to waste an order to do this). The 50 order contains the address of the memory location in which it is itself contalnedc The 26 order contains the address of the memory location containing the first word of the sub- routine (it actually transfers control to the left-hand half of this word ) . The subroutine, after execution, automatically transfers control to the order following these, i.e., to the right-hand order in memory location (k+l), so that there is no break in the logical continuity of the master routine „ There is no need for the user to know how the subroutine does this, but it is not difficult to under- stand and it helps to complete the picture. Uo3 RETURNING CONTROL TO THE MASTER ROUTINE. It will be seen that the effect of the 50 order above is to place the order- pair, of which it is the right-hand half, in the Q register. Thus whenever a closed subroutine is entered, the Q register contains a pair of orders of which the right-hand order contains the address of the memory location from which the pair came. Control must be returned to the right-hand order In the memory location following this . The subroutine uses the Information In the Q register to set the address In a transfer of control order (a 22 order) called the link, which ultimately causes the transfer back to the master routine. It does this by means of the orders shown in Table h 1. Ill K5 These orders plant k2 m+n the link m-:l m+n 22 (0) link Table k.l Forming a Closed Subroutine Link The K5 order transfers the order-pair from the Q register to the A register, increasing the right-hand address by 1 as it does so. This address is now the address to which control Is eventually to be returned. The k2 order places this address in the link. The link is situated so that it will be encountered by con- trol when the execution of the subroutine is complete. Note that the link should be a right-hand order so that Its address may be inserted from the right-hand side of the A register. It may sometimes be convenient to use a 32 order as a link; k-k this order may then perform a test within the subroutine and return control to the master routine only if some condition is satisfied. Also the above procedure for "planting" the link may be varied if desired^ so long as the result is the same^ In particular note the variants in sections ^^5 and U.6 below. h.k PLACING THE AEGUMEMT. All subroutines operate on at least one number somewhere in the machine^ and there must be agreement between the subroutine and the master routine on the placing of these niimbers, and also on the placing of the results of the subroutine operation. If only one number is operated upon, it is convenient to use the A register to hold this number when the subroutine is entered (since the A register is not being used for anything else at this moment). Similarly, if only one number is produced by the subroutine it is convenient for the subroutine to leave this number in the A register. For example. Library Routine Rl is a closed subroutine that finds the square root of the number given in A, and leaves this square root in A, Suppose we wish the Illiac to find the largest root of X + 2x + X - c = , where c = N(lO) and satisfies _£: c _^ l/2. It can be shown that the root is X = -1/2 + /l/h + /T h^5 Suppose that the constants l/2 and l/h are given in 20 and 21 respectively, and that x is required in 11. Routine Rl will be used to find the square roots; let its first word be in 100. Then the master routine might contain the orders of Table 4.2 Put c in A Enter Code Rl to form a/ c Add l/^ to -\rc~ Waste order Enter Code Rl 50 L5 10 50 50 51 26 100 Ll+ 21 52 22 52 50 52 53 26 100 LO 20 5*^ ko 11 to form ~\nA + ifF Subtract l/2 to form x Put X in 11 Table k.2 Master Routine Using A Closed Subroutine The subroutine itself must use a slightly different method of link planting from that given in section 4.3> which would des- troy the argument in A before using it. It is here necessary to rescue the argument and hold it in a storage location until the link has been planted, as in Table U.3 m ho 2 Put argument in q K5 m+1 i<-2 m+n Plant link m+n 22 (0) Link Table i^-.3 Modified Link Planting k-6 4,5 PROGRAM P ARAMETERS. Sometimes a subroutine is made to carry out slightly different operations on different occasions, For example, one subroutine might be made to print numbers to any number of figures. Another might form the n root of a number, where n is any positive integer. The value of n, or the number of figures to be printed, is called a parameter of the subroutine. The value of a parameter must always be specified if the subroutine is to operate correctly. There are two standard ways of specifying parameters; parameters specified in the way now to be described are called program parameters , (The others are called "preset" parameters - see below, section h„'j)„ A program parameter is specified in the first half of the word containing the 50 order which is required on entering any closed subroutine. Let us take for example Library Routine R2, + Vi which is a closed subroutine for replacing N(A) by its p root. Here p is a program parameter, to be specified as follows' k 50 p Program parameter 50 k k+1 26 m Subroutine starts at m Any To illustrate this, suppose we wish the machine to com- pute the positive real root of 6 ^ k ^2 X - 3x + 3x + 2c = 0, (1/2 < c < 1) which is given by the formula -"Jl +'^ 1 - 2c . X = + K..-7 50 L9 10 00 1 51 50 3 50 51 52 26 100 LO 20 53 50 2 50 53 5h 26 100 UO 11 Suppose that c = N(10) and that x is required in 11; suppose also that N(20) = -1, and that Routine R2 starts at 100. Then the master routine might contain the program given in Table h .k W(A) = (1/2) -c W(A) = 1 - 2c Program parameter Link To Routine R2 N(A) = 1 + -n3/ 1 - 2c Program parameter Link To Routine R2 X to 11 Table k .k Use of Program Parameter It will be noticed in Table U.U that the order contain- ing the parameter (50 3 oi" 50 2) is actually obeyed by the machine before the subroutine is entered. This is just a waste of time which is not worth avoiding; it does no good and, provided the order containing the parameter is suitably chosen, no harm. It is usual to use a 50 order here; this pu"te rubbish in the Q register, but the latter is then immediately reset by the following 50 order and no damage has been done . A more elaborate example of the use of a program parameter is to be found in Library Routine PI which prints A as an integer or fraction. The entry is by means of the orders of Table U.5 lu5 k XT d 50 k k+1 26 m Table k.'y Multiple Program Parameters In Table ij-.5 x = 5 or J; if x = 5 and A is negative the printed number is preceded by a minus sign, otherwise it is preceded by a space. Also Y - or 2; if Y = 0, A x 2 is printed as an integer; if Y = 2, A is printed as a fraction (correctly rounded off). The layout of digits is given by d = lOq + s; q digits are printed with a space after the first s„ It will be noted that all combinations of X and Y form harmle ss orders. if. 6 IFTERPRETIVE ROUTIKES. There is a t3rpe of sub- routine which, instead of executing a single distinctive operation, carries out a whole series of operations. Each operation requires a parameter for its specification, so that the master routine contains a string of parameters, one for each operation. The string may be of Indefinite length. Such subroutines are called interpretive routines. Their use lies in programs that involve actual operations on elements which are not numbers stored in the usual form but may be numbers stored in some special form, or different mathematical entities altogether such as expansions in Boolean algebra. The commonest application is to numbers stored in the so-called "floating point" form (see Chapter 6). There are certain advantages in storing numbers in this k...9 form; however, such numbers cannot be added or multiplied in a single Illiac operation. A routine is required to handle simple arithmetic, and for this piirpose an interpretive routine is used (e.g. Routine Al) . Each parameter of the interpretive routine corresponds to one arith- metical operation, just as each Illiac order corresponds to one opera- tion in the Illiac. Thus, for example, to place in register 6 the sum of the niimbers in registers h and 5 we write the parameters 85 ^ 8k 5 8S 6, which act in a similar way to the Illiac orders L5 k Uo 6. Owing to the close similarity between the parameters and the ordinary Illiac orders, the parameters are themselves often re- ferred to as interpretive orders, or merely as orders, "orders", or orders , The "order code" of the interpretive routine may be des- cribed in a similar way to the order code of the machine; it involves reference to an "accumulator" which behaves, for floating point num- bers, like the A register of the Illiac An interpretive routine is entered in the same way as a closed subroutine, but the parameters (i,e., the interpretive "orders") follow the orders causing entry. Finally a special parameter may be used to cause control to the Illiac to be transferred out of the interpretive routine and back to the master routine. Thus if we U-10 imagine that the above example is a complete set of operations to be carried out by the interpretive routine, the master routine would contain the program of Table h.6 k Any 50 k Enter interpretive routine k+1 26 m 85 ^ Parameters (interpretive orders) k+2 8^1- 5 8S 6 k+3 8J k+ij- Send control of Illiac to L„ H. 00 ^^^^ °^ ^-^^ etc . Table h,6 Program for Interpretive Routine U.7 PRESET PARAMETERS, By making use of a library routine a programmer avoids not only the necessity of writing out the orders, but also the labor of punching them, since a master copy of the tape is kept on file in the Teletype Room to be copied when required. If the routine has one or more parameters associated with it, it can meet a wide variety of requirements. However, the use of program parameters consumes both computing time and storage space. A program parameter has the property that it can be varied from one application to another within the same program. Frequently it happens that, although the ability to choose a value of a para- meter to suit any particular program is desired, the ability to change U-11 the value diiring the execution of a program is not needed. The value can he set hefore execution begins; there is no need for the orders which, in the case of a program parameter, set the value afresh each time the routine is entered. A parameter whose value is set before execution begins is called a preset parameter. The master copy of a library routine must be valid for all values of any preset parameters involved. The fixing of a pre- set parameter for a particular program must therefore be done after (or diiring) the copying of the master tape; in fact it is done as the program is read into the Illiac. This operation is carried out by the Decimal Order Input Routine which is described in Chapter 5- lt-12 CHAPTER 5 THE DECIMAL ORDER INPUT The Illiac is a tinary machine intended for University research. Since it will be used by a large group of people with various scientific backgrounds, it is important that its use be made as simple as possible. To this end a library of subroutines has been organized and aids in using it have been devised. One of these aids is the Decimal Order Input, Library Code XI. This code has two principal purposes: (1) To make it possible for programmers to use decimal notation in coding, (2) To make use of the library easy. The use of subroutines is discussed more fully in Chapter k, but one way to characterize a subroutine is to say that it is essentially an extension of the order code of the machine. It is a group of orders used to carry out one or more operations which may be as simple as a square root or as complicated as a complete program for executing the details of floating point arithmetic. In any case the interior structure of a subroutine will depend upon its location in the memory. For example, the lefthand address of the second word in the square root routine (Library Code Rl) refers to the eighth word of the routine. If the routine begins at loca- tion 10, this address must be 18. But if the routine begins at lo- cation 97, this address must be IO5. The use of subroutines is very awkward unless problems of address changing can be easily 5-1 handled. Another principal nuisance in coding is the number system used by the Illiac. In the sexadecimal system using Illiac notation (see Chapter 2), the 102U addresses of the memory are represented by numbers between and 3LL. It is much more convenient if addresses can be expressed in decimal form with the Illiac doing the necessary converting to the binary system. With the Decimal Order Input every number corresponding to the address part of an order must be written in the decimal sys- tem. These decimal numbers are always converted to sexadecimal (i.e., binary) form by the Decimal Order Input. The Decimal Order Input overcomes the obstacles of chang- ing addresses in subroutines and of converting from decimal to binary form. It also provides certain other useful service. 5.1 RELATIVE AED FIXED ADDRESSES. If we can devise some way of using addresses in decimal form, we never need the 6 characters K, S, N, J, F, L in an address and can use them for other purposes. Let us consider a program beginning in location 11 of the memory, as shown in Table 5-1- 11 ho 1 S5 1 12 Ll| 13 he 20 13 51 1 10 1 Table 5-1 Program Beginning at Location 11 5-2 The same program, if begun at location 20, -would read as in Table 5o2. 20 kO 1 S5 1 21 L4 22 k6 29 22 51 1 10 1 Table 5=2 Program Beginning at Location 20 The second word has changed. But if we mark each address which de- pends upon the location of the routine with the symbol L and each address which is independent of the location of the routine with the symbol F, we have the program in Table 5'3- UO IF S5 IF 1 Ll+ 2L k6 9L 2 51 IF 10 IF Table 5„3 Program With Relative and Fixed Addresses The addresses ending in L are relative to the location of the first word of the routine. 5-3 We can now write each subroutine as if it begins at loca- tion zero provided we add to each L-terminated address the location of the first word of the routine when we store the routine. We shall do this by Introducing a new symbol K. 5.2 DIRECTrVES. Orders which are written for the Illiac use two sexadecimal function digits followed by an address. We follow this convention even in the case of pseudo orders. A direc - tive is such a pseudo order. When we want a group of orders to be placed in memory locations n, n+1, n+2, . . ., we punch on the tape the directive 00 nK -""^ The Decimal Order Input will recognize this as a directive and will place the orders following the directive in pairs in the locations n, n+1, n+2, . . ., starting with the left hand side of location n. It will add n to the address of any order terminated with L before placing it in position. The directive 00 nK is not placed in the memory. Thus if we have 00 IIK followed by the orders of Table 5.3 we will place in the memory the code given in Table 5.I, while the code of Table 5.2 would be obtained by using the directive 00 20K. 5-3 ASSEMELHTG OF ORDERS, Since each address ends with an alphabet character and since there are always two fiinction digits, the Decimal Order Input can distinguish between address digits and function digits. The Decimal Order Input uses the fixed storage We shall use small letters to represent decimal quantities and capital letters to represent sexadecimal quantities . 5-^ locations 0, 1, and 2 as temporary storage. After two function digits have been read and shifted to a right-hand order position in loca- tion 1 the routine converts the decimal address n to binary form n X 2 and adds it to the function digits , The order pair in lo- cation 1 is then stored. Next the contents of 1 are shifted left 20 places and the next order is formed as before. Again the order pair in location 1 is stored in the same address as the previous time, but now the correctly assembled order pair has been stored. The address of the store order which is assembling the program is increased every other time. Thus the left-hand 20 digits of location 1 always contain the previous order while the next 8 digits of location 1 contain the function digits of the order being put inc VThen the address ends in K (a directive) it is stored in location 2 and is added to each L terminated address in location 1 before the appropriate order is stored. 5A DECIMAL ADDRESSES o The address is converted one digit at a time as it is read from the tape. This kind of con- version makes it unnecessary to write non-significant zeros, so orders may have the form L5 7L, ko 1021F, 26 L, etc. Indeed, we are not restricted to addresses smaller than 102^1^ and may use anything we please. If the address exceeds V095 it will add to the function digits (remember that there are two unused digits between the function digits and the address), but even this may be made use of as we shall see below in Section 5'6. 5-5 5.5 STARTING THE PROGRAM. After the Decimal Order Input has placed a program in the memory we must start the pro- gram. This is done by using the terminating symbol N. The symbol N causes the order which it follows to be obeyed. It is used with a control transfer order which must appear on the tape as if it were a left-hand order. It will never be stored in the memory, other than as the right-hand order in location 1. For example, the order 26 pN will be obeyed and will trans- fer control to the left-hand order at address p. Any unconditional transfer order may be used. The order 20 qN will stop the computer, and when the computer is started again control will go to the right- hand order at address q. The addresses p and q are fixed addresses. Control can also be transferred using a relative address, for the previous order with its adjusted address is always in the left-hand side of location 1. Therefore the two orders 22 rL 26 IN will cause control to be transferred to address r relative to the last directive if 22 rL is the right-hand order of the last order pair, i.e., if the phase is correct. 5.6 INPUT OF DECIMAL FRACTIONS. In section 5.4 it was pointed out that an address is formed and added to the function digits. This address could be as large as 2 - 1 without getting into the sign digit, and any positive integer n could be input as -39 n X 2 by letting the left-hand order and the right-hand function digits be zero. For example, the "order pair" OOF OO2896F would appear as 2896 x 2 ■^^. Hence a 12 digit right-hand address smaller 5-6 39 11 than 2 (about 5-5 x 10 ) could then be converted to a decimal fraction by multiplying it by 2 /lO This is done when the terminating symbol J is used. For example, the characters OOF OO2969 0000 OOOOJ would cause the quantity 0,296 to be placed in the memory. Zeros at the end can- not be omitted, but preceding zeros can be omitted. Do not omit function digits. Remember that this is essentially an integer input. The range can be extended by using the left-hand function digits, for they are simply a number to which the right-hand address is added after being multiplied by 2 /lO . The left- hand function digits kO, 80, NO represent I/2, -1, -I/2. Thus numbers could be input as follows : -0.8888 8888 8888 as 80F 00 nil nil 1112 J, O.785U 3216 0000 as UOF 00 285J+ 3216 OOOOJ. This is not an efficient way to read decimal fractions into the machine, but it is convenient for occasional numbers scattered through the program. 5.7 PRE-SET PARAMETERS. MODIFICATION OF ORDERS. The remaining unused alphabetic sexadecimal character is S. This is used to modify orders by using pre-set parameters. The symbol S differs from the other terminating symbols in that it is always followed by another single character which may be any of the I3 sexadecimal characters 3 "to L. The termination SD on an address causes the content of location D = 3j ^j • • . , F, L, to be added to the order while it is in a right-hand position as 5-7 described in Section 5-3 and before It is placed in the memory. This is for either right or left-hand orders of completely assembled -39 order pairs. For example, if location J contains 7^2, the order pair L5 20SJ i+0 3OSJ will be modified to read L5 27F ko 37F before being stored. This facility is very convenient for using parameters with a program because the program can be written with orders of the form L5 S3, LU Sk, and if locations 3 and h have been previously set the parameters will be added appropriately as the program is read into the machine. Many examples of pre-set parameters can be found in the library. In Illinois Code P6, Single Column Print, the parameter OOF OOmF is used to specify the printing of m decimal digits and must be placed in location 3 before Code P6 is read. Thus if we wish to place Code P6 in locations beginning with 50 and to print 7 decimal places, the pertinent part of the program tape would read 00 3K Directive 00 F Place 7 x 2"^^ in 00 7F location 3 00 5OK Directive Code p6 Place Code P6 beginning with location 50. 5.8 EXAMPLE OF USE OF DECIMAL ORDER IKPUT, The deci- mal Order Input has 25 words and occupies locations 999 to 1023 in the memory. It is placed in these locations with its own boot- strap input which then transfers control to the Decimal Order Input 5-8 so that it can take over the control of program input. Let us con- sider the following simple example: Compute to 10 decimal places the square roots of n/lO and e/lO using the Square Root Routine (Code Rl and the Single Column Print routine (Code P6). We have the following data: (a) Code Rl - 9 words, closed, finds square root of argument placed in A and places answer in A. (b) Code p6 - lU words, closed, prints words in A to m decimal places followed by carriage return and line-feedo Con- tents of address 3 must contain m x 2 as Code P6 is input. In this program, the code for which is given in Table 5.^ on the following page, we have scattered the orders through the memory to indicate how directives are used. Notice that the arrangement on the tape is arbitrary after the Decimal Order Input except that the parameter in address 3 must be in place when Code P6 is being input. The parameter is used in word 6 of Code P6, this word being 19 63S3 50 F Thus the address of the 19 order was set to 9 (73 = 9 mod 6h) for counting the niunber of digits to be printed. Notice also that the directive 00 56OK can be changed 5-9 MEMORY LOCATION PROGRAM TAPE Decimal Order Input REMARKS 999 - 1023 Routine XI 00 lOK Directive 10 - 18 Square Root Routine Routine Rl 00 3K Directive 3 00 F Parameter 00 lOF 00 3OK Directive 30 - k3 Print Routine Routine P6 00 5OK Directive 50 00 F rt/lO 00 3l^l59265359J 51 00 F e/lO 00 2718281828U6J 00 560K Directive 560 L5 50F it/lO to A 50 L Link 561 26 lOF To Routine Rl 50 IL Link 562 26 3 OF To Routine P6 L5 51F e/lO to A 563 22 3L Waste Order 50 3L Link 561^ 26 lOF To Routine Rl 50 1+L Link 565 26 3OF To Routine P6 OF F Stop 566 22 6l Waste 26 L Start Program at 2k IN relative location after stop Tatle 3.k Use of Decimal Order Input 5-10 so that the words following it are placed differently but that no other change need be made to move these words because the program was started using a relative address. The waste order at location 566 is required so that 2U IN will have a left-hand location. 5.9 USE WITH INTERLUDES. RETAINED DIRECTIVE, An interlude is a computation performed during the input of a program, the input being interrupted and then resumed. A tape bearing a library routine may begin with an inter- lude which is placed in locations destined eventually to hold the routine itself. When the words of the interlude have been read control is directed to it, the interlude is executed, and then in- put is resumed. The next part of the tape carries the routine it- self which is written over the interlude. The purpose of the inter- lude is usually to prepare some orders or constants required for the routine. For example, a printing routine, where the number of digits printed is determined by a preset parameter, may use an interlude to compute the roundoff constant . Input is resumed after the interlude by transferring con- trol to the left side of location 999 (3F7 sexadecimal). Either the first word on the tape must contain the needed directive -39 00 mK or Q must contain m x 2 . If, upon resuming input, it is desired to retain the last used directive, control should be transferred to the right side of .on 1014 with m X 2 in A. The next words on the tape will be placed in m, m-!-l, . . . , retaining the previous relative address. The 5-11 interlude must not use location 2. 5.10 STOPPING THE TAPE. The order 20 IOI9N on the tape will stop the computer and will have no other effects Upon being started the tape will continue "being read from where it stopped. 5.11 PLACING THE DECIMAL ORDER INPUT. BOOTSTRAPS. Up to this point we have not said how the Decimal Order Input is itself put into the Illiac . It occupies locations 999 to 1023, the last 25 positions of the electrostatic memory, and it is placed in the memory with a bootstrap input routine . With panel switches we can clear the control counter to zero and place the order pair 80 i+OF kO F in the order register. The code in Table ^.h, which must be written with sexadecimal addresses, will then place the Decimal Order Input in the memory. 800028 kO 001 80 028 ho 002 19 026 26 000 80 028 X UO(OOO) ' ih 001 ho 001 80 028 ko(3F6) Table 5A Tape for Bootstrap Input Routine 2 Parentheses are often placed around addresses which change diirin^ the course of a program. 5-12 This bootstrap actually places the 3--word routine (shown in both sexadecimal and decimal forms) of Table 5 '•5 in the memory and starts it Lk 001 Lk IF kO 001 kO IF 80 028 80 UOF 1 1 Uo (3F7) iiO (999)F 19 026 19 38F 2 2 26 000 26 F Table 5.5 Memory Contents for Bootstrap Input Routine at location 1. Clearly it will take the next words on the tape and start putting them at location 999F- To stop the input we place the order pair 22 3LS 00 001 (That is 22 IOI9F 00 IF) on the tape so that it gets put into location 0, The control will be transferred to the right-hand side of location IOI9F and the Decimal Order Input will be started. This bootstrap input may be used with any code and it or something like it must be used to input programs whenever the Decimal Order Input has been overwritten. The term bootstrap start is often used for tapes which 5-13 are started by setting the order register to 80 i+OF kO F and the control counter to zero. 5-1^ CHAPTER 6 SCALING With the convention adopted for the Illiac (See Chapter 2), only numbers which lie in the range -1 < x <. 1 can be held in the registers. Since most problems require numbers outside this range, some scaling process is usually needed to fit a problem to the machine. It is necessary that each number at every stage of a calculation lie within the capacity of the machine. The organization required to assure this is sometimes trivial, but in many instances it is the very essence of the problem. 6.1 SCALING m SHIFTING. Although the number 2 lies out- side the range of Illiac numbers, we can multiply and divide numbers by powers of 2 by shifting. Thus the left shift order GO 5F will cause AQ to be multiplied by 2 = 102^. Similarly, the right shift 9 order 10 9F will divide AQ by 2 = 512. A knowledge of the use of the shift orders is essential to an understanding of scaling. 6.2 NUMBERS WITH THE BINARY POINT SHIFTED . Let us con- sider the problem of computing with numbers in which the binary point has been moved 10 places to the right of its Illiac position. We are then dealing with numbers in the range - 102U ^ y ^ 102^+ - 2 Let these numbers be designated by N _. Then we have N-_(m) = 2 N(m), We can formulate rules for doing arithmetic with the numbers N . Addition and subtraction are simple. If N(q) = N(m) + N(n), 6-1 then and 2^° W(q) = 2^° W(m) + 2^° W(n) Thus the Illiac addition rules hold. Multiplication requires a shift to the left of 10 places. We want N^Q(q) = N^Q(in) x N^qCh) . Thus we require 2^° W(q) = 2^° W(ia) x 2^° W(n) and N(q) = 2 N(in) x N(n) . We may consider several simple routines to carry out the multiplication. The method given by (b) is probably the best. (a) The shortest method merely multiplies and shifts. Notice that a 75 order must be used rather than a 'jk order because , , -29 -39 the least significant digit of N „(pj is now 2 and not 2 . -30 A bias of - 2 is introduced by the absence of a roundoff. The program is given in Table 6.1. (b) This method rounds off by adding 2~' to W (p), giving an unbiased result. The program is given in Table 6.2. 6-2 50 mF W(m) to Q 75 nP N(in) X N(n) to AQ 00 lOF 2^° N(m) X N(n) UO pF to p. Table 6.1 Multiplication with Binary Point Shifted 19 lOF 2"^^ to A 50 nF W(m) to Q 7^ nF N(m) x W(n) + 2"^° to AQ 00 lOF 2"^° N(m) x N(n) + 2"^*^ to A 40 pF to p. Table 6.2 Unbiased Multiplication with Binary Point Shifted (c) A roundoff similar to that of division is obtained with the program given in Table 6.3. 50 mF N(m) to Q 75 nF W(m) X W(n) to AQ 00 9F 2^ W(m) X N(n) to 50 tF 2"^ Q =1 00 IF This makes 2 -^^ A = 1; W(A) = 2''"° N(m) X N(n) i+O qF to q. Table 6.3 Division-Type Roundoff in Multiplication with Binary Point Shifted 6-3 In Table 6.3 the order 50 tF is used simply because the vord at location t has a 1 in the proper place. In division we also need an extra shift to restore the quotient to the proper range. But here the shift precedes the divide order and no special arrangements for roundoff are necessary. We want Hence and 2^°W(q) = W(m)/W(n), W(q) = 2"^° N(m)/W(n). The following program in Table 6 .h will carry out the required operations : L5 mF W(m) to A 10 lOF 2""^° W(m) 66 nF 2"'^° N(m)/W(n) S5 F to A 40 qF to q. Table 6.1+ Division with Binary Point Shifted It can be noted that by using such relations as 2^ 6-i+ where 10 < 2 we can use decimal scaling although it will be slower and clumsier to handle because of the factors 10 /2 , 6.3 SCALING A FULL PROBLEM . There are conceptually two ways in which we can approach the scaling of a problem; both give the same program. (a) We can alter the problem using such substitutions as x = lOOx or p = 32p, so that the modified problem has all its variables less than one but retaining full significance . (b) We can use scaled numbers inside the machine to represent the variables. That is, we can use x/lOO instead of x and p/32 instead of p. The final result must be such that the variables lie within machine range and retain sufficient accuracy. Constants greater than one can be represented by numbers less than one in conjunction with scaling factors. For example, multiplication by 5.63 can be done by multiplying by 5.63/8 and shifting left 3 places. Let us consider the following simple problem: Example 1. Program the Illiac to compute the quantities x e n 2 1 + X at Intervals of 0.01 from x = to x = 6. We note that we must scale x. Since the largest value of 6-5 X is 6, let us use x/8 inside the computer because this will minimize the loss of significant figures. What scaling factor is needed for y? A rough estimate shovs that y does not exceed e /(l + 36) '"^^ 11, so that we shall compute and store y/l6. Library Routine S2, the exponential routine, will give valid results only if x is negative. We therefore write x/8 -1 + x/8 e = e X e ' so that In X , x/8sO e = (e ' ) . y/16 : X e - 16 X 6h - X and e' X = (['^ 16 X 6k l/Sk + x^/6h ([(e-l^-/Sxe/^)2x2]2x2J2. We shall store the constants e/h and I/16. Each part of the computa- tion is within machine capacity. We proceed as follows: (a) Square x/8 and add l/6k, (b) Call the result R and store it, (c) Evaluate e ' with Library Routine S2, (d) Multiply by e/k and square, (e) Double and square. 6-6 (f) Double and square again. Call the result P. (g) Form y/l6 by dividing P by R. Accuracy in the Result. Let us now consider how much accuracy we obtain. If x/8 is near unity, numbers remain large during the calculation and we do not lose significance by sub- tracting nearly equal numbers or by other ill-conditioning. However, when x/8 is small we notice that we form e /0-6 X 6^) quite accurately and then divide by R -'Ny l/6^ which is about equiva- lent to a left shift of 6 places and loses 6 binary digits on the right. We can prevent this if we perform the division while the double- length P is in AQ. Acctiracy in the Argument. We should also consider the accuracy of the argiiment x/8. It can be formed either by successively adding the increment O.OI/8 = 0.00125 or by counting and multiplying. The adding method is not so good because the quantity 0.00125 will not be stored exactly and the accumulated roundoff error obtained by the time x is 6 (which requires 6OO additions) may be troublesome. The counting method avoids this trouble. Any x/8 is n X 0.01/8. Hence we have x/8 = n X 0.01/8 = (n X 2"3^) X 0.61+ X 2^° If we store 0,6h and count to get n x 2 -^ , we can use the following 6-7 set of orders to get x/8 (where we have used arguments in place of addresses) : 50 n X 2'^^ 75 0.6k 00 30 kO x/8. The program for the entire calculation of y/l6 is given in Table 6.5 on page 6-9 where we have again used arguments instead of addresses. Example 2: Solve the pair of simultaneous equations ax + by + c = dx + ey + f = where the coefficients are in absolute values less than I/2 and where the answers are known to lie within machine range. Retain as much accuracy as is reasonably possible. We can distinguish two cases: (a) If j a I > I d L then dc/a - f y = X = bd/a - e c + by 6-8 ORDER ARGUMENT F5 n X 2"^^ 1^0 (n + 1) X 2"39 50 (n + 1) X 2'39 75 .61+ 00 30 ko x/8 50 x/8 7J x/8 lA l/6h 1^0 1/6U + x^/6k L5 x/8 Ll^ -1 50 26 to S2 1^0 ^-1 + x/8 ORDER ARGUMENT 50 e-1 ^ -/8 7J e>c2"^ UO e^/^/U 50 e^/^/l+ 75 e^/8/1, 00 1 i+0 e^/Vs 50 e^/Vs 75 e^A/S 00 1 i+0 e^/2/32 50 e^/2/32 75 e-/'/32 66 l/6k + x^/6ii S5 ko y/l6 Table 6.5 Calculation of e /(l + x ) 6-9 (b) If I d I > I a I , then : - fa/d y = b - ae/d X = - ^ t ^^ In this program we shall follow the conventions of the Decimal Order Input (See Chapter 5)- Notice that divisions are always made using a full 78 digit dividend to retain as much accuracy as possible. The program treats the two cases (a) and (h) separately, distinguishing with the 36 order at IL. Locations and 1 in the memory are used as temporary storage . The program is given in Table 6.6 on pages 6-12 and 6-I3. 6.k ADJUSTABLE SCALING FACTORS. It is not always possible to arrange a program so that a single scaling factor can be used throughout the calculation. Then it is necessary to make tests at appropriate places to discover when variables are becoming too large or too small and to make proper adjustments in the scaling factors. For many problems it is advantageous to have the variable less than I/2. Then two numbers can be added or multiplied without exceeding capacity. By using the LL n order we place I/2 + |N(n)| in A. Hence A is positive if N(n) < l/2 and A is negative if |N(n)| > 1/2. 6.5 COFTimJOUS SCALING. FLOATING POINT ROUTINES. For calculations in which continual tests are required to maintain accuracy floating point routines (See also Section ^.7) may be used. These 6-10 routines represent numbers as y = a X 10 and store a and b. Thus they can represent accurately the nijinbers in some large range such as, for example, 10 £. y < 10 where y has 30 significant binary digits. There are two such routines in the Illinois Program Library, The first, Library Routine Al is as described above. The second. Library Routine a4 is a multiple precision floating point program in which numbers lies in the range 10 < y < 10 with y having 20 significant decimal places. Floating point routines are slow because numbers are scaled at each step of the calculation. Certain conveniences have been programmed in, however, and these to some extent compensate for the extra time required and also simplify the programming. 6-11 L7 L2 22L 25L 1 36 50 13L 27L 2 75 66 22L 25L 3 SI F 2i+L 1+ 1|0 50 F 22L 5 75 66 26l 25L 6 SI F 23L 7 1^0 L5 LF F 8 66 SI IF F 9 1^0 50 29L 29L 10 75 26L 27L 11 66 SI 25L F 12 1^0 OF 28L F 13 50 75 23L 25L ll^ 66 S5 22L F a < d h f to Q fa/d -fa/d + c to ae/d -ae/d + b to 1 (-fa/d + c)/(-ae/d + b) = -y y to 29L (ey + f ) -(ey + f)/d = X X to 28L STOP a I > I d|j b to Q bd/a Table 6.6 Solution of Two Simultaneous Equations 6-12 15 LO ko 26L F 16 50 75 25L 2Ul 17 66 22L SI F 18 Lk 66 27L F 19 S5 Uo F 29L 20 75 23L 2Ul 21 66 22L 22 IIL 22 23 2U 25 26 27 28 29 bd/a - e to d to Q dc/a (-dc/a + f)/(bd/a - e) = y y to 29L by (by +c)/a = -X Control to IIL a b Table 6.6 (Continued) Solution of Two Simultaneous Equations 6-13 CHAPTER 7 MACHINE METHODS AND CODING TRICKS There are usually a number of special techniques which can be used on any particular digital computer and which will simpli- fy programming. Some of these techniques are applicable on many different computers but usually, as is the case in those which follow, they result from particular orders or combinations of orders which are peculiar to an individual machine. This chapter is concerned with a number of unrelated sections having to do with operations which frequently arise in programming. 7.1 THE SUMMATION OF PRODUCTS . We often need to form sums of products, and on the Illiac this cannot be directly done in the accumulator. The accuracy can often be enhanced by performing a summation either exactly or with only one round-off error. This is comparatively easy to do using the 7^ order. All that we need ■to do is to place the least significant half of the partially summed products into the accumulator before performing the 7^ order. In fact, this can usually be done by an S5 order because the quotient register will usually hold the last single half of a summed product. Then, since fh n gives N(n) Q + 2 A, we obtain the double-length product in AQ. Of course, the most significant part of the pre- viously summed products needs to be added using an LU order. Using similar schemes we can also arrange to add or subtract products with double-length accuracy in a program. As a 7-1 first example we shall sum 50 double-length products, assuming we do not exceed capacity. Example 1: Place the rounded sum k9 y^ N(100 + i) W(150 + i) 1=0 in location 0, The program is given in Table 7-1 m Ul 26 F IL Clear location for siom Wasted order. m+1 50 L5 8L IIL Put 1/2 in Q- Set i = 0. IlH-2 1^0 S5 3L F Round off (See Section 7 nH-3 50 7k ( )F ( )F W(100 + i)vN(i50 + i) IIH-U 1^0 F F m+5 L5 Lk 9L 3L Increase i by 1. m+6 UO LO 3L lOL Test for 1 > I50 m+7 32 OF 2L F Re-enter loop. Stop. m^ ko 00 F F Roundoff constant = 1/2 m+9 00 00 IF IF Increment m+10 JO 7k I5OF 200F End constant mfll 50 lOOF I5OF Starting constant Table 7.I Program for Example 1 7-2 7-2 REVERSING THE CONTROL TRANSFER. FURTHER DISCUSSION OF EXAMPLE 1. There is a second coding trick in Example 1. The end constant, instead of being 50 I5OF 7^^ 200F has had -1 added to it, making the first order JO I5OF. The effect is to reverse the sense of the following 32 order (in location m + 7) so that we transfer control to re-enter the repetitive loop. If this had not been done a 22 order following the 32 order would have been required and the 32 would have transferred to OFF. Thus a half word was saved. This technique is equivalent to having a conditional transfer order act when the accumulator is negative. Another coding trick might have been used to save a full word. The left-hand order at m + 1 puts I/2 in Q so that it may be used to round off on the first step of the sum, this being the sole roundoff. Instead of storing l/2 in m + 8 we could have used the order pair in m + 2 as the roundoff constant. This order pair is 1/2 plus at most 2 and would serve quite well. As a second example we consider a summation of two products with a single roundoff. Example 2: Given cos 9 in 10, sin 9 in 11, X in 12, y in 13, place the rounded quantity (x cos 9 + y sin 9) in location 20 and the rounded quantity (-x sin 9 + y cos 9) in location 21. The program is given in Table 7.2. 7-3 m 50 7J lOF 12F m+l ko S5 F F IIH-2 50 7k IIF 13F nH-3 ko F 20F vM-h 50 79 IIF 12F ItH-5 ko S5 F F nH-6 50 7k lOF 13F IIH-7 1^0 F 21F -i^O X cos 9+2 Most significant half to location Least significant half to A y sin e + 2-39 (i.s. half of x cos + 2" °) -ko Add most significant half of x cos 0+2 Store X cos + y sin Q + 2'^'^ -ko -X sin 0+2 y cos + 2~^^ (I.s. half of -x cos 0+2" ) -ko Store -X sin + y cos 0+2 Table 7-2 Program for Example 2 . 7.3 BINARY SWITCHES. It is sometimes necessary to do two different operations alternately. This can be done by changing the sign of a number each time we pass it so that it will be alternately positive and negative. Usually it is not necessary to use a special number for this because some number or order pair in the rest of the program may be used. To accomplish the switch an LI order followed by a ko order is used to change the sign of the niimber and put it back in its location with sign changed. A conditional transfer order may then be used to decide which of two sequences will be performed. A variation is the requirement that an order (or order pair) take on two different values alternately. This can be accomplished by using the identities 7^^ b = (b + a) - a, and a = (b + a) - b. Thus if the current value of an order (or order pair) is subtracted from the sum the other value is obtained. Example 3= Arrange a program to alter the address of the left-hand order at (m+2) so that it takes on the values and 5 alternately. A program for this is given in Table 7-3 m iiH-1 LO 2L Form alternate address Store alternate address at (m+2) m+2 any L5 order pF LO ko 2L 2L L5 (0)F 12F FK F8 5F 2^F Put sum of orders in A Normal program order Sum of L5 OF Lh 12F and L5 5F L^i 12F Table 7-3 Binary Switch In Table 7-3 only a single address is taking on alternate values and it is also possible to carry out the switch using the program of Table 'J .h . In Table 'J .k the 50 5F order at location m is provided for the switch. If some order which needed address 5F could be used here, we should be very well-off indeed. 7-5 m 50 5F L5 mF DH-l LO (iih-2)F he CiiH-2)F nH-2 L5 (0)F LU (12)F Table J .k Binary Switch 7 A TESTS FOR AND -1. In order to test for a particu- lar number value held inside the machine it is generally necessary to use two tests. However, the numbers and -1 can be tested for using absolute value orders and a single test. In machine language is the only number whose negative absolute value is positive, and -1 is the only number whose positive absolute value is negative. Thus we can test for using an L3 order followed by a conditional transfer order, and we can test for -1 using an VJ order. Similarly, we can test for -2 and 1 - 2 by using F3 and FY orders, res- pectively. Example h: Transfer control to location 200 if A is zero but transfer control to location 3OO if A is non-zero. Two ways to do this are given in Tables 7.5 and 7.6. The program of Table 7.5 has only two words. The program of Table J .6 has four words but will be faster than the other if A is usually negative. 7-6 Moreover, the program of Table 7.6 can be used to transfer control to any of three locations de- pending upon whether A is positive, negative or zero. m UO F A to L3 F - N(0) to A m+1 36 200F To 200 if A 0, i .e . , if A = 26 3OQF To 300 if A ^ Table 7.5 Testing for Zero m 36 IL 26 3OOF To 300 if A m+1 LO pF A - 2"^^ 36 3OOF To 300 if A - 2"^^ 0, i.e., if A m+2 26 200F To 200 otherwise, i.e., if A = p 00 F Constant 2"^^ 00 IF Table 7.6 Testing for Sign 7.5 USE OF ORDERS AM) ADDRESSES AS COWSTAUTS. SV and KV orders do not use their addresses, so these addresses can often be used for other purporses. For instance, they may be used to store a starting address taken by a cycling order or an increment which is used to change an address. In such cases we naturally use h2 or ^6 orders to make certain that the function digits do not become altered. 7-7 In the following example the address of a K5 order is used as a counter = Example 5: Given the positive number a in A, write a closed subroutine which will furnish the positive integer m such that l/2 ^ 2 a < 1, The program is given in Table 7-7 m i+O F Store a at location K5 F Form link m^l k2 UL Plant link k^ L Clear counter nH-2 L5 F 00 IF Shift a nH-3 ^0 F 36 5L Test to see if 2^a m+4 L^ L Counter to A 22 ( )F Link m^5 F5 L Count kO L m^-6 26 2L Re-enter loop 00 F Waste order Table 7.7 Address Use in K5 Order 7,6 RESETTIEG AMD STARTING OF CYCLES OF ORDEES. In many cases we have cycles of orders, some of which are being modified by the same increment , In such cases the variable addresses can all 7-8 be modified by modifying one order and then deriving the other orders (or addresses) by adding the constant difference between the variable orders. When this is done it is economical to use the same orders to set these addresses when the cycle is begun. The following ex- ample with the program given in Table 7-8 illustrates this: Example 6: For i = 0, 1, . . . , 99 place in location 200 + i the sum N(10) + N(100 + i) + N(200 + i). m nH-1 nH-2 nH-3 IIH-5 irH-6 nH-7 nH-8 ittf9 L5 ""L 26 1+L L5 lOF L4 F lA F kO F L5 7L Li+ 2L i+O 2L LO 9L k2 IL 36 IL OF F 00 F Lh 2 OOF i^-O 200F 00 IF 00 IF 7U 3OOF 00 lOOF Set i = Form N(10) + N(100 + i) + N(200 + i) and put in 200 + i Increase i in m + 2 Increase i in m + 1 and test for end Stop Waste order Starting constant Increment End consteint Constant to change i in 2L Table 7-8 Resetting of Addresses 7-9 In Example 6 the addresses in location m + 2 have been changed and then that in m + 1 has been ohtalned from one of them. Notice that the end test has been combined with the second address change and that the end test constant is not ih but 7^ so that the 36 order at location m + 5 will cause re-entry to the repetitive loop. When two orders have to be varied in a single cycle, it is advantageous to let these form a single order pair as in Example 6 so that they can both be modified simultaneously by the same orders. This arrangement is not always possible and the second best arrange- ment is to place the variable orders on the same side of their res- pective order pairs so that the orders required to modify them will be as simple as possible. For very simple operations it is sometimes advantageous to do three or four operations in a single cycle. This saves time although the advantage is bought at the expense of more orders. This is illustrated in Example Y- Example 7- Add the numbers in memory locations 10 and 1^, putting the sum in location I5. It is simpler and faster, both in coding and in machine operation, to use the program given at the top of page 7-11 than to write a repetitive code which counts. 7-10 L5 lOF Ih IIF LK 12F Lk 13F ih m-F ho 15F 7 . 7 USE OF THE QUOT IENT REGISTER FOR INTERCHAN GES. In many programs we wish to replace the number in a certain storage location and yet use the value that is there to continue with the cal- culation. In such cases the old value can be placed in the quotient register before the new value replaces it in the memory. Thus, the old value is available in the quotient register for further computa- tion. Example 8: Store A in location 10, but use the old N(10) as a dividend to form N(10)/n(11) The program is then 50 lOF kO lOF S5 F 66 iiF 7.8 TESTING IF NUMBER S ARE GREATER THAN ONE- HA LF When scaling numbers it is very often necessary to test when numbers are larger in magnitude than one-half. This can easily be done with the appropriate L or S order. For example, the order LL n will cause the 7-11 acciimulator to be negative if the magnitude of N(n) is greater than or equal to l/2. Example 9: If |n(10)| ^ l/2 replace it by half its value. The program is given in Table 7-9» m LL lOF 1/2 + Jn(10) to A 32 (mf2)F m+l L5 lOF 10 IF m+2 UO lOF Table 7.9 Scaling by Testing for One-half 7.9 CONVERGENCE CRITERIA. When iterations or repetitive calculations are carried out we frequently want to stop when we have achieved the maximum accuracy. In some cases it is difficult to specify in advance the tolerances which can be used as end criteria because we have to compromise between achieving the greatest accuracy and yet assuring that we terminate the processes (i.e., don't loop). In such cases it is worthwhile to use more complicated criteria which will give us maximum accuracy but which will not loop. One such criterion is to terminate the process if e "> e ^ where e. ^ n ^ n+1 1 is some positive number which tends to zero as the process converges with increasing n. This criterion will terminate the process only when either e. is the same for two successive iterations or when the 1 roundoff error has actually caused it to increase . 7-12 7.10 MARK ING It is often possible to use marking techniques instead of the more usual counting processes . The simplest illustration of such a technique is Library Routine N3 where a se- quence of numbers read from the tape is automatically terminated by the mark N. In this code instead of counting up to some predetermined number we test each character as it is read from the tape until it is N. A binary digit is sometimes shifted as a marker; this is illustrated in the next example. Example 10: Using a print routine stored at locations beginning with 50 print the 7 numbers in locations 10-16. The program is given in Table 7-10 Q 19 7F 2" to IF. This is the marker ho IF 1 L5 IF 00 IF Advance marker by shifting 2 ho IF 32 3L Test for end 3 OF F Stop L5 lOF k 22 Ul „ 4. ^ I T Waste order 50 kL 5 26 50F Enter print routine F5 3L 6 ^0 3L Increase address of number to be printed 26 IL Re-enter loop Table 7-10 Use of a Marker In the program of Table 7,10 the marker is shifted into the sign 7-13 digit to indicate the end of the repetitive process. This technique can be used in a similar way for completely internal programs. For example, when we are dealing with a group of numbers in the memory we may arrange that the storage location following the group contains some \inique number such as or -1. Then the code merely has to test for the presence of one of these numbers rather than for a predetermined count . 7.11 REMAIEDER IN INTEGER DIVISION. In the general case it is difficult to compute the remainder from the residue that is left in the accumulator after a division. However, if we are dealing with positive integers less than 2 in magnitude we can do this quite readily. We place twice the dividend integer in the quotient register, clear the acciimulator and divide by the divisor integer. The accumulator then contains twice the integer remainder and the quotient contains twice the integer. We store an integer m as m X 2 . Example 11: Divide the positive integer in location 20 by 10. Place the quotient in location 11 and the remainder in location 12. The program is given in Table 7.11. 7-1^ m 51 20F m x 2"^^ to Q 00 IF m X 2"^^ to AQ m+1 66 Ul (m x 2"3^)/(lO x 2~^'^)x 2"^- ra/lO 10 IF in+2 ho 12F Store remainder S5 F m-'-3 il0 IIF Store quotient 26 pF vn-k 00 F 00 lOF Table 7.11 Remainder in Integer Division 7-12 BINARY CHOPPING- This is the method of repeated subdivision of an interval. It is easy to code although it may be wasteful of memory space and it is slow because it will usually take the full 39 steps to go from an interval of length unity down to one of length 2 ^ . If we use binary chopping to find the zero of a function, we proceed as follows. We choose bounds for the zero, perhaps -1 as a lower bound and +1 as an upper bound. Then we bisect the interval and compute the function at the midpoint. Depending upon whether the sign of the function at the midpoint agrees with the sign of the lower or upper bound, we substitute the midpoint for the appropriate bound. -39 After 39 steps the difference between the two bounds will be 2 and the zero will be determined. 7-15 The code will be simpler if the signs of the upper and lower bounds are known so that a comparison with the sign of the midpoint is not needed at each step. This is the case in Example 12. Example 12: Find the square root of a = 0.269^3 by using a binary chopping technique on the function 2 a - a. n B.'^re we choose initial upper and lower bounds of -39 1-2 and 0. Instead of counting 39 steps. 2 -37 a test has been included so that if a - a <' 2 n the code stops. The program is given in Table 7.12. 7.13 EVALUATIOM OF POLYNOMIALS. Polynomials are best evaluated by use of a recurrence relation. Given the polynomial n . -,/- N •'\~~ n-1 n n-1 f(xj = y a. X = a„x + a^x + . . . + a ^ x + a , "j^Q 1 1 n-1 n' we can express it in the form S. -, = X S. + a. , 1+1 1 1' So=o, S -, = f(x) n+1 ^ 7-16 L5 10 12L IF 1 1+0 L5 F 13L a/2 to location 2 10 IF F (a + a)/2 = a to ll+L 3 ilO 50 l^L l^L h 7J LO li+L IIL 5 Uo 32 15L 7L 2 a - a to I5L 6 L5 1+0 l^L 13L Change a 7 22 L5 8L li+L 8 1+0 12L 15L Change a 9 LO 36 16L L Test for a - a < 2 n ^ 10 OF 00 F F Stop 11 00 00 F a = O.269I+3 269'+30000000J 12 7L LL I+O95F I+O95F a . 1 - 2-39 13 00 00 F F a = ll^ 00 00 F F a n 15 16 00 00 00 00 F F F 1+F 2 a - a n 2-37 Table 7.12 Square Root by Binary Chopping -37 7-17 If, as is often the case, the coefficients a. are the quantities N(nH-i) the recurrence relation becomes S. = X S^ + N(iiH-i), Sq^O, S , = f(x) n+1 Example 13 shows how a polynomial may be evaluated. In practice the summation of products should be done with a jk order as in Example 1, but we do not wish to obscure the general idea here. Example 13: Given x in location k9 and coefficients in locations 50 through 67 evaluate the polynomial ^7 17.1 X ' N(50 -!-i). i=0 The program is given in Table 7-13- 7.11)- SHIFTING A LEFT WITHOUT SHIFTING Q. The contents of A may be shifted to the left (doubled) by adding A to itself. This is slower than using a shift order but it has the advantage that the Q register is not altered (as it would be by a shift order) The order pair ^0 nF lA Wf will shift the contents of A one place to the left for each use. 7-18 p i^l F Sq.O 50 U9F X p+1 7J F X S. + N(50 + i) L^ 50F p+2 1+0 F F5 IL Increase i P+3 ^0 IL LO 5L Test for end Ph4 32 L OF F 1^5 LJ F End test constan LU 68f Table 7-13 Evaluation of a Polynomial 7-19 CHAPTER 8 CHECKING METHODS To obtain a correctly working program from a written one the coder must find and remove all of the coding errors. To the person unfamiliar with coding it might seem that a careful inspection of a program before it is run on the Illiac would remove all of the coding blunders but unfortunately this is not true. It is necessary to check the program on the machine to remove the remaining blunders from a code, and it is unusual to find all blunders in one run on the machine. As a general rule it will be necessary to have several checking runs on the machine before a code is correct. The number of coding errors in a program depends upon a number of factors, including complexity, length of untested program, programmer, and the care with which the code was inspected. It is possible to remove most coding blunders from a program by carefully inspecting it and it is best to obtain a person other than the coder to inspect the code. In many cases this cannot be done, and then the code should be set aside for as long as possible before being inspected. This to some extent prevents a grooved mind from missing the flaws in the program, for the coder remembers the general nature of the pro- gram but not the details where most errors occur. 8.1 COMMON BLUNDERS o A great many of the coding mistakes made by programmers are familiar ones which are made over and over again. 8-1 The list given in Table 8.1 is one of common errors. It should be pointed out, however, that this list is not complete, and that programmers develop their own idiosyncrasies and should be on guard for their own pet blunders. 8.2 THE DISCOVERY OF ERRORS. Errors are found by running the program and comparing the actual performance with the designed performance. That is, to find an error it is necessary to obtain information about the way a program runs. It is almost useless to have a program run through a long calculation and then print out the result. If the result is wrong, no information is usually available to explain why. Therefore, when checking a program we have to print out more information about the intermediate results than is required in the actual running of the program. There are many ways in which this can be done and the remainder of this chapter describes some of them. Because we have to compare the intermediate stages of the calculation with those estimated by other means, it behooves us to choose parameters and variables so that the initial calculation is as simple as possible. Further trials will probably have to be run with more complicated calculations and with values designed to test the special cases and boundary limitations. Simple blunders should be detected and removed before an attempt is made to look for more subtle errors. Localization of mysterious errors can be effected by continually printing more and more information from smaller and 8-2 smaller parts of the program until the error is found. 1. L5 orders used instead of LU orders. 2. S5 orders omitted after divisions. 3. Orders terminated by L instead of F and vice-versa. k. The renumbering of a code not complete after a modification has been made. 5. Rounded multiplication used when dealing with integers . 6. Control transfers to the wrong address or wrong order of an order pair. 7. Accumulating storage registers not cleared before a cycle of orders is entered. 8. The end condition for a cycle of orders not correct. 9. Allowing the temporary storage of a subroutine to erase useful data. 10. Using a h6 order instead of a k2 order and vice-versa. 11. Omitting directives and starting orders on the program tape . 12. Incorrectly remembering the specifications of a subroutine . 13. Forgetting to reset addresses when coming back to a cycle of orders. l^J-. Making corrections incorrectly. 15. Using the same relative addresses on correction words although the preceding directive is different from that of the program. 16. Overlooking the digits shifted from the quotient register to the accumulator on a left shift, 17. Attempting to convert fractions greater than one- half by using the J terminating symbol. Table 8.1 Typical Blunders 8-3 8.3 SOURCES OF IKFORMATIOJJ . The Punch. The punch is the most effective way by which data can be extracted from the Illiac. However, there are other ways to obtain information, particularly when a program does not run far enough to punch any data at all. The Reader. If the input tape stops before the entire program has been read into the memory, then an examination of the characters punched on the tape just ahead of the place where it stopped will often provide an explanation. The Order Register and Control Counter. If the pro- gram is read in correctly but comes to a sudden unexpected stop, then the order register R will exhibit the order on which the program stopped while the control counter will contain a number one greater than the storage location from which the order pair came. With this information the programmer can often discover the cause of failure of his program. If the Illiac loops, observation of the slave tube will give an indication of how extensive the loop is. Then, if the machine is stopped and the contents of the order register and the control counter noted, we usually have enough data to identify the loop in our program. 8,U MODIFICATIONS TO PROGRAMS. Temporary modifications often need to be made to a program while it is b'eing checked. These may be for the purpose of correcting the program, for temporarily arranging the piinching of extra data, or for some other purpose. In 8-k such cases it is undesirable to repunch the entire program tape. The modification can be carried out by "overvrriting" the original program, that is by replacing some of the orders already placed in the memory by other orders . To do this a short extra tape is punched with suit- able directives and words so that, when it is read into the memory by the Decimal Order Input, the appropriate words of the original program are replaced by those on the tape. For example, 00 523K L5 iiF UO 2F will cause the word at 523 to be replaced by L5 h-F kO 2F. In order to be able to use this technique of modifying a program we must: (a) Prevent the original program from being started before the modification is made. (b) Transfer control to the Decimal Order Input so that the modification tape can be read into the memory . (c) Start the program after the modification has been made. This can be done efficiently if the original program ends with a stop transfer of control to the Decimal Order Input followed by a transfer of control to the program. An example might be 2U 999N 26 93N if it were necessary to transfer control to location 93 "to start the program. If we wish to modify the program before starting it, all this is necessary is to place the modification tape in the reader before moving the switch to STABT. This will cause the modification tape to be read instead of the 26 93N. The modification tape will 8-5 naturally have to end with 2.6 93N in order to start the program. If the original program ends with a stop transfer of control to itself instead of to the Decimal Order Input a slightly more com- plicated modification tape is necessary. An example might be 2U 93^. Then the sexadecimal order pair 26 3F7 00 000 is punched at the head of the modification tape. When this tape is placed in the reader the machine is completely restarted hy setting the order register to 82 UOF ^0 P and the control counter to zero without, however, clearing the memory. This results in the first order pair on the tape (namely 26 3F7 00 000) being transferred to location zero and being obeyed, so that control is transferred to 3F7 sexadecimal or 999 decimal (the Decimal Order Input), and the rest of the tape is read in the usual way. This is a bootstrap start. See Section 5-11- Corrections . As each coding blunder is found, a modifi- cation tape should be repunched to include all of the corrections. It is not worthwhile repunching the entire program tape until all or a large number of coding errors have been found. 8.5 BLOCKING ORDERS, This is the name given to control transfer orders which are used to replace normal program orders, so that some printing or checking can be done at the point of replace^ ment. Before control is restored to the program the replaced order of the program is executed and the contents of the arithmetic re- gisters are restored. Thus the original program is unaffected, but the extra orders that are obeyed can be utilized to do printing of 8-6 desired data. An example may illustrate this: Let us suppose that (a) we have a program in which we wish to print W(l9) after the left-hand order of the order pair kO 9F L5 29F at storage location 100, has been obeyed, (b) we wish to preserve the quotient register but not the temporary storage of the print subroutine, (c) locations 8OO-80U are lonused by the program, (d) the program print routine starts at 200, (e) the original program ends with 2U 999N 26 hN. We then prepare the following modification tape: MODIFICATION TAPE 00 lOOK ^0 26 9F 8OOF 00 8OOK S5 1^0 F ^L L5 50 I9F IL 26 2 OOF L5 29F 50 26 kL 10 IF 26 hN COMMENTS Directive Plants blocking order in program Directive Stores Q at SO^+F Enters print subroutine Does omitted order Restores Q Control back to program Starts program 8.6 TYPES OF CHECKING ROUTINES. There are several types of checking routines. One type prints out the contents of certain 8-7 memory locations after a program has stopped. We call this a post mortem routine. A second type takes a given program and allows it to be obeyed order-by-order while printing out information about the course of the program. It is often called a sequence checking code. A third type arranges for information to be printed out at specified points of a program. It is usually known as a check point or blocking order routine . 8.7 POST MORTEM ROUTIKES. Library Routines C3, Ck, C^. These are printing routines and have been arranged so that they can be used with little or no preparation on the part of the programmer. They are read into the memory with bootstrap input routines and are loca- ted in storage locations at the end of the memory, the longest occupy- ing locations from 986 to 1023 and using locations 0, 1, and 2, as temporary storage. The end of each of the post mortem tapes contains 100 two-decimal-digit numbers. These numbers are used to specify the locations from which printing will occur. Suppose, for example, that we wish to know the order pairs in memory locations 5^0 to 5^9- Then we read in Routine C5. When it stops we find the number 5^ on the end of the tape and place it in the reader. When the START switch is moved, the order pairs in locations 5^0 to 5^9 will be printed and then the Illiac will stop. If we start again we will get the order pairs in locations 550 to 559- Codes C3 and C^ perform similar functions for decimal fractions and decimal integers. The programmer should keep in mind the storage locations used by the post mortem routines so that he will be able to take full advantage of these important checking routines , 8.8 POST MORTEM VERSION OF THE DECIMAL OKDEE lUPUT. Library Routine CI. This is a very important checking routine and is usually the first one used after a program failure. It compares the contents of the memory with the contents of the input tape. Only discrepancies are printed out, enabling programmers to discover which orders of a program have become altered while the program was in the memory. This is an aid in making sure that orders which should have been modified have been modified correctly and that no order has become modified accidentally. ■ This routine is used in the following manner: The Post Mortem Version of the Decimal Order Input is read into the memory in the usual way with a bootstrap input routine. It occupies storage locations 962 to 1023 . The program tape is then placed in the reader after its copy of the Decimal Order Input, so that the Decimal Order Input is not read into the Illiac. Then when the machine is started the program tape will be read and the words created from it compared with the corresponding ones in the memory. When a discrepancy is found it will be printed on a line giving, first, the location at which the discrepancy was found, second, the word read from the tape printed as an order pair and, third, the word found in the memory, again printed as an order pair. Thus a typical line of printing might be 8-9 3^4-5 L5 000 ko 35ij- L5 '^kS ij-0 35U indicating that the left-hand address of the order pair in location 3ii-5 had become modified, taking the value 5^6. It should be pointed out that closed subroutines which have been used will usually have their links printed. This gives an indi- cation of the part of the program from which they were last called in. Interludes cause a large amount of printing because the contents of the interlude locations are changed twice in the course of input and are printed out both times. The Post Mortem Version of the Decimal Order Input causes the memory to be changed to the original state as it is being executed, so that if the program is started the original program will be per- formed again. If desired, only selected parts of the tape need be com- pared with the contents of the memory. However, when doing this it is necessary that all the preset parameters pertaining to that part of the program be input and that the selected part of the program begin with a directive. All post mortem codes occupy locations at the end of the memory and all of them use storage locations 0, 1, 2, as temporary storage, so that it is desirable when coding not to use these storage locations for constants or numbers which may need to be printed out. It is worthwhile to note that if addresses which are to be changed are initially read in with their final values then no printing will 8-10 take place on the post mortem if they have been modified correctly. 8.9 THE ADDRESS SEARCH ROUTIEE. Library Routine C2. Programs sometimes fail because of a transfer of control to an order which causes the machine to stop. The usual order causing the stop is a zero left shift order because the memory is normally cleared to zeros before a new program is read in. Under such circumstances the offending transfer of control order may be searched for with the aid of Library Routine C2. The search routine is read into the memory, occupying storage locations normally occupied by the Decimal Order Input. Next the address to be searched for is read into the machine as a three character sexa- decimal address. The routine then searches the memory (exclusive of itself) for order pairs containing this address. When foxind they are printed out (in sexadecimal form) together with their location (in sexadecimal form). The routine naturally has other similar uses. For example, if it is known that some number becomes modified but it is not known why, then the store order which does the damage can be sought for in the above manner. 8 . 10 SEQUENCE CHECKING CODES. Library Routines D2 and D3. These routines control a program order by order and print out suitable information about the execution of each order. This enables the action of a program to be traced order by order. They use a blocking order technique which enables a selected part of the program to be checked 8-11 in this manner. These codes are very slow on account of the printing involved and should not be used blindly. Routine D3 prints out the fuxiction digits of the orders which are actually obeyed, starting a new line of printing whenever a con- trol transfer order is obeyed. This enables the sequence of orders obeyed by a program to be traced. Routine D2 prints in full each order that is obeyed, having one order pair per line of printing. After each store order or address order, the number transferred to the memory is also printed. This enables every step of a program to be completely checked. However, the amount of printing is such that this routine is very slow. It should be used only in the final stages of tracking down an elusive fault . 8.11 COMTiOL TRANSFER CHECK. Library Routine PU. This routine takes charge of a program and allows it to be obeyed order by order. Each transfer of control that is obeyed is placed in a list kept in a specified place. The list is cyclic, that is to say, the later entries overwrite the earlier ones in a cyclic fashion. At the end of a program, the list can be printed, so that it can be dis- covered how the program reached its final end. There is no printing during the execution of the program, so that this routine allows the program to be obeyed at speeds much greater than those of the routines which print. 8.12 THE CHECK POINT ROUTINE. Library Routine Dl. This 8-12 routine is designed to print out intermediate information about some other program. It uses the blocking order principle, and the programmer prepares a specification tape to describe the kinds of information he wishes to obtain. It is possible to go through iterative loops and print results on various passages through the loops. Data can be ob- tained as an order pair, a right-hand address, a left-hand address, a 10 character sexadecimal word, a signed integer, a signed 12 decimal place fraction or a signed 5 decimal place fraction. Library Routine Dl is a very powerful checking routine be- cause of the great latitude given the programmer in choosing where and how he will obtain information and because it utilizes the pro- grammer's own knowledge of his code. 8.13 COWCLUSIOW. The fact that it will be necessary to check a program should be kept in mind when writing it. Its storage locations, including those of the temporary storage, should not inter- fere with routines likely to be used in diagnosing its faults. The program tape should end with a stop control transfer to the decimal order input as explained in Section 8.^. Occasionally a blunder turns up in the blind spot of the pro- grammer and it appears to be impossible to find it. It is not much comfort to him to point out that the blunder can be found by con- tinually narrowing down the section of the code in which it is known to be. This is tedious but eventually all blunders yield to this technique. A final word to this chapter might be that all programmers make mistakes but good programmers find theirs first, 8-13 CHAPTER 9 TAPE PREPARATION 9.1 THE ILLIAC INPUT. The input imit of the Illiac is a photoelectric tape reader that transfers binary digits from a punched paper tape to the A register. The tape preparation equip- ment is used to translate instructions and data from the programmer's manuscript into a binary-coded punched tape acceptable to the Illiac. 9.2 THE ILLIAC OUTPUT, Output from the Illiac is usually in the form of punched tape. This tape may be printed on any of the Teletype page printers that are a part of the tape pre- paration equipment. The page printer performs a conversion from the binary-coded representation on the tape to the sexadecimal or decimal characters on the printed page, 9.3 THE PERFORATED TAPE. SEXADECIMAL TAPE CODE CHARACTERS. The tape preparation equipment presently in use consists of Teletype equipment which has been modified to correspond to the Illiac tape code. This tape code is shown in Figure 9.I- The paper tape can be punched in any one of 6 positions across its width. One of these positions is always punched. This is the feed hole or sprocket hole position. Feed holes are smaller than the other holes. Four of the remaining positions are used to represent the 2 sexadecimal characters. There are 16 keys on the Teletype tape punch labeled through 9 and K, S, N, J, F, L. When one of these 9-1 0123^56789KSWJFL Figure 9.1 Sexadecimal Tape Codes Delay Space Carriage Return and Line Feed Figure 9.2 Format Tape Codes 9-2 keys is pressed a corresponding pattern of holes is punched across the vidth of the tape. Since a hole or absence of a hole is a binary- affair, we speak of the character pimched in the h positions across the tape as a binary tape code for the corresponding sexadecimal digit. If we speak of only the 10 sexadecimal characters 0-9 and their corresponding binary codes, we call the characters punched in a tape binary-coded decimals. The Illiac tape code for sexadecimal characters is very easy to memorize since the hole positions across the tape simply ^ correspond to powers of 2 from 2 to 2 . Page Printer Format Characters . Punched tapes are con- verted to a printed page by means of a page printer. Three additional tape codes shown in figure 9-2 are used to control the format of a printed page. These codes cause the printer to space, return the carriage and advance to the next line, and delay, i.e., perform one printing cycle without printing anything. The space function is similar to the space in an ordinary typewriter. The carriage-return and line feed must always occur together. If the carriage is to be returned from near the right-hand margin it should be followed by a delay code to allow enough time for the complete return to the left- hand margin. Otherwise the next sexadecimal character would operate the printer mechanism too soon, and print the character somewhere out in the middle of the line. If the carriage is within 25 characters of the left margin, a delay code need not be used after a carriage- return and line feed code . 9-3 Notice that these codes all have a hole in a position that is never punched for a sexadecimal. This is called the ^th hole position. When a piinched tape is placed on the Illiac tape reader the circuits cause any character with a 5"th hole punched to be skipped over, i.e., not read into the computer, when reading in the normal way. (However, a special input order will read such a character; see the order coda) This means that in the preparation of an instruction tape, these format codes can be interspersed with sexa- decimal order digits in any desired way. Then when an instruction tape is printed these tape codes will control the printer. The usual method in preparing instruction tapes is to follow each order pair with a carriage- re turn and line feed code. This produces a single column print of words . Tape Codes for Letters . The printer will also print all the letters of the alphabet for identifying headings and the like . Tape codes are provided for these and are shown in the complete tape code list, figure 9-3' To accomodate all of these symbols, there are also niJinbers shift and letters shift tape codes, analogous to the shift- lock on an ordinary typewriter. A list of instructions to be used with the Illiac and the Decimal Order Input (See Chapter 5) to produce any of the tape codes shown in figure 9-3 is given in Table 9-1- 9-h a? Oi W W es fe w u pq • • • ••• • •• • • • • • o\ CO fr^ -ee- -P u o H R CO H R m — (D 4J> •P Ch ■P -H 1-^ CO Csl X CO « -p •H Xi CO • m U 0) •• • • :3 — S •• o • • • •• CD • • • • • • •• X • • VO • ' • •• - • OJ • • • •\ • •• [^ • • LTN • • • 1 • J- c ^ Ti +-> d) (1) d) K 1=4 a) (1) tlO C tji •H •H 1-1 fH ;h T) cd C o cd EH e K m CO CO 13 a. CO ^ I CO CO PS w Eh C5 9-5 PRINTED CHARACTERS MACHINE ORDER (DECIMAL address; Space 92 963 Carriage Return and Line Feed 92 131 Delay- 92 515 Letters Shift 92 259 Numbers Shift 92 707 AFTER AFTER LETTERS SHIFT mJMEERS SHIFT A ) 92 387 B ( 92 195 C : 92 835 D $ or tab''*" 92 67 E 3 92 19^ F F 92 898 G = 92 579 H apostrophe 92 771 I 8 92 51^ J J 92 83^+ K + 92 6U2 L L 92 962 M , 92 6U3 N N 92 770 9 92 578 P 92 2 Q 1 92 ee R k 92 258 S - 92 706 T 5 92 322 U 7 92 ii50 V f 92 323 W 2 92 130 X 1 92 U51 Y 6 92 386 Z X 92 899 Table 9.I Coded Tape Operation of the Teletype Printer Only one printer has a tabulation mechanism. 9-6 9.^ CLASSIFICATION OF OPERATIONS, The operations in preparing tapes may be listed as follovs: 1. Punching a tape from a manuscript by- means of a keyboard tape punch. 2. Punching a tape from one or more previously punched tapes. This operation is called reperforating and is used for duplicating tapes, joining short tapes, and making corrections . 3. Printing a tape on a page printer. h. Comparing two tapes to see if they are identical, 5= Comparing the manuscript with a printed copy (proof-reading). It is necessary to punch the main part of the code from a manuscript by means of the keyboard. It is not necessary to punch routines that are in the routine library. When all the parts of the code that have been p\mched from manuscript are correct, obtain any necessary routine tapes from the routine library. Using the reperforator, these tapes can be assembled into one long problem tape. Every time a tape is reperforated it is wise to check the copy by comparing it with the original tape. 9.5 DESCRIPTION OF EQUIPMENT, Several Teletype vinits are provided for making instruction tapes. These include a keyboard perforator unit, a page printer imit, a reperforator unit, a combination unit, and a tape comparer unit. 9-7 BACKSPACE LEVER REPEAT BUTTON POWER SWITCH UNDER TABLE SPACE BAR ZERO BAR CARRIAGE RETURN AND LINE FEED BAR Figure 9.4 KEYBOARD PERFORATOR UNIT 9-8 Keyboard Perforator Unit. This unit is used to punch tape from a manuscript; see figure 9.k. Turn on the power switch under the table by pulling it forward. The power supply takes about a minute to warm up. The sixteen sexadecimal keys that will be used most are in the center of the keyboard and arranged to be operated with one hand. It is recommended that a touch system be learned both for maxi- mum accuracy and maximum speed. If a wrong key is pressed, operate the backspace lever and then the space bar. This will punch the space symbol (all five holes) over the incorrect symbol and so be skipped on the Illiac reader if the usual 80 instructions are used. Page Printer Unit. This unit is used to make a printed page corresponding to a punched tape; see figure 9- 5- Turn on the power switch. The power supply takes about a minute to warm up. In order to operate the printer mechanism the page printer motor switch should be turned on. The function of the transmitter-distributor is to read paper tape and translate the binary tape codes into electrical signals. These signals are sent to the page printer. The binary tape code is sensed by 5 pins which are periodically pressed against the tape. A hinged lid holds the tape down against the pins . The tape is moved by a sprocket wheel which engages the feed holes punched in the tape. Place a tape in the reader and close the lid. Then turn the start- stop switch to start. The tape will now be transmitted to the page 9-9 PAPER FEED CRANK POWER SWITCH (BEHIND PRINTER) TRANSMITTER DISTRIBUTER TIGHT TAPE STOP LEVER PAGE PRINTER PRINTER MOTOR SWITCH Figure 9.5 PAGE PRINTER UNIT 9-10 printer. There is an end of tape stop device that stops the transmitter- distrihutor when the end of the tape passes under the lid. A tight tape stop bar will also stop the unit and keep the tape from being torn should the tape become snarled or tight and raise the bar. Reperforator Unit. This unit is used to duplicate tapes; see figure 9-6. Turn on the power switch by moving it towards the back of the table. After about a minute, the power supply will warm up and the reperforator motor switch should be turned on. The transmitter-distributor has been described in the pre- ceding paragraph. Place a tape in the reader and turn the start-stop switch to start. A copy of this tape will be made by the reperforator. When a few corrections need to be inserted in a tape, punch a second tape containing only the corrections. Then use the reperfora- tor unit to duplicate the correct portion; stop; insert the second tape in the reader and reperforate the correction; then replace the first tape and continue with the correct portion. Combination Teletype Unit. This unit, shown in Figure 9.7, combines the functions of those units already described. Underneath the top of the table are two switches . Switch 10 turns on the d-c supply which must be on before any of the other units will operate. On some of the tables it takes about a minute for the d-c supply to warm up. Switch 9 turns on the motor of the transmitter-distributor. 9-11 LEVER FOR PUNCHING SPACES TRANSMITTER DISTRIBUTER POWER SWITCH BOX REPERFORATOR START-STOP SWITCH TIGHT TAPE STOP LEVER REPERFORATOR MOTOR SWITCH Figure 9.6 REPERFORATOR UNIT 9-12 CD 0) LU Q. >- I- UJ _J LlJ I- < Z 03 o o c iij * < a 3 a. o o o in cc o o z (E o I- < K O U. IT UJ a. UJ 0®00 ©©0© ©0© 0© 9-13 The transmitter-distributor has already been described. It sends signals to both the page printer and the reperforator and will operate either or both of these units if the corresponding motor switch is on. Turn on the reperforator motor by means of switch 13 . The reperforator will now duplicate any tape that is run through the transmitter-distributor . Pressing lever 11 will cause the reperforator to punch space tape codes. Pressing button 8 will cause the reperforator to punch zeros. However, one unpredictable character will be punched at the end of the zeros. Zeros are useful at the beginning of tapes to provide space for writing identifying Information. They should be followed by spaces to make it easy to set the tape in the Illiac reader. To operate the page printer turn on motor switch JB. The page printer will now print any tape that is run through the trans- mitter-distributor. The carriage may be returned manually by pressing lever 2. Crank 1 will turn the platen. It is possible to operate the page printer and the reperfora- tor at the same time. However, it is possible for the reperforator mechanism to make an error that would not appear on the printed copy. If the printed copy that is to be proof-read against the manuscript is prepared from the final tape, it is quite certain to show any errors in the tape as well as any possible errors in the printing mechanism. 9-lk Set switch 7A to tape . Tape can now be perforated from the keyboard . It is also possible to type on the keyboard, and perforate tape in the reperforator at the same time. To do this turn 7A to keyboard, 7B on, and I3 on. There is no way to back-space tape that comes from the reperforator. It is also more difficult to read the last character that has been punched on the tape than when the keyboard perforator is used for punching tape. The transmitter-distributor may be used to reperf orate correct portions of a tape. The tape should be stopped before the error by means of switch 5- Type the corrections from the keyboard. Then move the tape to the next correct section and continue reperf orating. It is also possible to print with the page printer at the same time a tape is being punched from the keyboard. To do this turn on the printer motor by means of switch 7B and set switch 7A to "keyboard and tape". A disadvantage of this method is that the keys cannot now be operated as fast as when punching tape alone. There is no way to change errors on the printed copy that are corrected on the tape with the backspace lever. Since the printed copy is made by a separate mechanism at the same time that the tape is punched, there is also a small possibility that it may not correspond to the holes in the tape. This copy should not be used for proof-reading. Switch 7B can be turned on and off without affecting anything being reperf orated if switch 7A is placed in the "tape" position. 9-15 before 7B is operated, and kept there while 7B is off. Comparing Tapes. A tape comparer consists of two tape transmitters connected to checking circuitry. Place one tape in each reader and turn the power on. The tapes will advance in syn- chronism as long as the binary tape codes in the two tapes agree and halt if a disagreement is detected. One of the present three tape comparing units will halt one row of holes beyond a disagreement. The otherg halt on the holes that disagree. The power should then be turned off and the tapes inspected visually. The tapes may then be marked if in error, re- placed in the readers, and the unit restarted. Two of the units have push-buttons for advancing either tape one step at a time while they are stopped on a disagreement. Short tapes may be checked more rapidly visually by super- imposing them and holding them up to a strong light. 9.6 GEUEEAL REMARKS. The misreading of even a single hole in a long tape can cause enormous changes in the behavior of Illiac. It is important to keep tapes clean. Dirt from tapes accumulates in the transmitter-distributor tape reading pins and causes errors. Worn or torn tapes will also cause errors. Do not mark tapes with a waxed pencil: use a lead pencil or ink. Library tapes and other tapes which need to be handled a lot are on a grey parchment stock which is heavier than normal tape stock. One of the reperforators is mechanically adjusted to 9-16 punch this heavy stock. It is generally more convenient to make corrections to be made on the tape itself, as well as on the printed copy. If corrections are needed at the end of a long tape, it is sometimes more convenient to reperforate the tape tail-end first, so that the corrections can be made at the beginning, and then the reperforator left running unattended. A hand punch is available and can often be used to change one or two characters and so avoid reperf orating a long tape. Holes punched with it should be inspected carefully to see that they line up with the other holes in the tape. If in doubt, it is better to have the extra hole slightly oversized so that it is certain to be read by the Illiac reader. 9-17 CHAPTER 10 CALCULATION OF RUKNING TIME Each programmer should estimate as well as he can the length of time his program will run. This information is needed for efficient scheduling of machine time and to enable the computer operator to decide whether a program may have failed to stop when it should have . The estimation of running time consists of summing up the times for executing all of the orders of the program, taking into account that many orders are executed more than once. Thus, the time is calculated for one passage through an iterated loop and then multiplied by the number of trips through the loop. The number of passages through a loop is not always known (as in the square root code where the number of passages depends upon the quantity whose square root is being calculated) and the programmer may have to make rough estimates for such cases. He can make use of the code checking periods to help him here. 10.1 ORDER TIMES o The programmer must know how much time the Illiac requires for each order. The order times are given in Table 10.1, the time required for getting the order from the memory being included. The values given in Table 10.1 are in some cases not exact. The 700 microsecond value for multiplication is a maximum, the time depending upon the multiplier. It could be as low as 625 10-1 microseconds , ORDER TYPE TIME On, In 16 n microseconds 2, 3, k, 5, J 55 microseconds 3 not executed I8 microseconds 6 800 microseconds 7 700 microseconds 80, 81 h milliseconds/character 82, 92 ^0 milliseconds/character in punch 1 millisecond/character on display K, S, F, L 75 microseconds Table 10.1 Order Times The time required to execute an 80 or 8I order so as to read one character from the tape is h milliseconds. Since most programs use conversion routines for input it will be found that the time is closer to U 1/2 milliseconds for decimal input, 10.2 EXAMPLE OF RUTOTING TIME CALCULATION, Let us con- sider a simple example. The program given in Table 10.2 will trans- fer the contents of memory locations 100 to 199 into memory locations 200 to 299. How long will it take? The program in Table 10.2 consists of 7 words. There is a loop consisting of the 9 orders beginning with the left-hand order at location and ending with the left-hand order at location h. 10-2 This loop is executed 100 times. Tliere are no other orders executed except the stop order. Thus we have the following orders: 00 50K L5 (lOO)F ko (200)F 1 L5 L LO 5L 2 32 Ul L5 L 3 L4 6l ko L k 26 L OF F 5 L5 199F Uo 299F 6 00 IF 00 IF 2k 50W Table 10.2 Repeti tive Program Five L orders at 75 microseconds. Two k orders at 55 microseconds. One 2 order at 55 microseconds. One 3 order at l8 microseconds . The time T is then given as 10-3 T = (5 X 75 + 2 X 55 + 55 + l8) 100 microseconds, = 53>800 microseconds, = .05^ seconds. 10.3 A SIMPLE RUITOIWG TIME FORMULA. A rule which is accurate enough for most calculations is the following one: Let N^ = number of orders obeyed, K = number of multiplication orders obeyed. N, = number of division orders obeyed, N = number of shifts , s Then the running time T, exclusive of input and output orders, is TT„ N N + N, m s , m d .^ ^ . T = rry— + -T—- ^ milliseconds, In the example given above N^ is 9OO while W = W = N^ = 0. s m d We thus have T = 9OO/16 milliseconds or about .O56 seconds. 10-4 CHAPTER 11 PREPARATION OF A COMPLETE PROGRAM The problems solved on the Illiac vary in complexity from programs requiring only the punching of parameters and datp for use with a library routine to programs involving hundreds of words re- quiring the entire memory capacity of the machine. There is, of course, no "typical" program; however, the problem described in the following sections illustrates features common to many problems. The problem described is one that arose in the electron tube research laboratory of the University of Illinois. The problem is first described qualitatively, and a general mathematical formu- lation is given. Approximations are then made to simplify the equations. The resultant equations are reformulated so that a library routine can be used for the solution, and reformulated again in terms of scaled variables so that machine range will not be ex- ceeded. The general organization of the program is then described, and the details of the coding are given. Those interested primarily in the programming may omit the introductory description. 11.1 GENERAL STATEMENT OF THE PROBLEM. The purpose of the problem is to solve for the trajectories of electrons in an The staff of the computer laboratory is indebted to Mr. Irving Kaufman of the electron tube research laboratory for permission to describe his problem and for his assistanos in the preparation of this chapter. 11-1 electron cyclotron. An electron cyclotron is a device that accelerates electrons to energies of several million electron volts. The accelera- ting mechanism is a radio-frequency electric field in a microwave cavity. According to the well-known Lorentz force equation, the force on a charged particle is given by: F=q¥+qv; which is reduced to a set of first order ordinaiy differential equations so that the solution can be obtained using library routine Fl. Using as variables 9 = v±, u = v/w, we can reduce equation 11.3 to the pair of first order equations: dx/d9 = u. du/d© = (eE^ / hIqW ) 1 - (w u j/c 3/2 sin ©. The sine function may be evaluated by using two additional equations with appropriate initial conditions : d(sin ©)yQ9 = cos 9 ■ or df/d9 = g d(cos 9)/d9 = -sin 9 or dg/d9 = -f The equation of motion of the electron in the gap has thus been reduced to the following set of four first order differential equations: dx/d9 = u du/d9 = (eEjm^ w^) ^ 2 2/ 2^ 1 - (w u /c ) 3/2 df/d9 = g dg/dO = -f Initial Conditions for Gap Trajectory Equations. An electron is introduced into the gap at x = with negligible velocity V = wu at a certain phase 9 = wt . The initial conditions are then. 11-8 for arbitrary 6„, X = 0, u = 0, f = sin 9 , g = cos 6_. The effect of variation of the parameter 0- will be studied. Motion of the Electron Exterior to the Cavity. The elec- tron is accelerated while in the gap and leaves the gap at x = 1 cm. with a velocity wu and phase 6 e,n It then follows a circular orbit at constant velocity and re-enters the gap at x = 0. The phase at the time of re-entry can be calculated by equation 11.^, in which & is equal to wu /c . Re-entry Conditions for Gap Trajectory Equations. The re-entry conditions for the gap trajectory equations are: x = 0, u = u jf= sin 9. -, . g = cos 9. ^, ' e,n' i,n+l' ^ i,n+l' 9 = i,n+l' where 9. ^ is calculated from 9 as indicated above. i,n+l e,n Information to be Printed. For a given value of the initial phase 9 , the following information is desired for each of ten orbits: (a (b (c (d (e (f The orbit index n. The phase 9 of the electron leaving the gap, e,n The phase 9. -i °^ ^^^ electron re-entering the gap. The relative velocity ^ of the electron in the orbit, The quantity 1-^' .1/2 The energy of the electron in the orbit. 11-9 The calculation is to be repeated with different values of the para- meter 9_. The parameter is printed for identification of results, 11. U SCALING OF THE QUANTITIES FOR ILLIAC SOLUTION. Magnitude of Quantities Involved. For the range of in- tegration (electron trajectory in the gap), the phase angle was known to be in the range 1 < 9 < 2.5 from a previous desk calculator solution. The design constants and physical constants are E , w, m e, m , and c, which are, respectively, the peak eletric field in- tensity in the gap, the angular frequency of the field, the charge of the electron, the rest mass of the electron, and the velocity of light. The gap length of 1 cm. is the maximum value of the variable X. The maximum value of u is easily calculated, since wu/c is the velocity of the electron relative to the velocity of light and is less than one. The variables f, g, and their derivatives are the well-known and well-behaved sine and cosine functions. The maximum value of the derivative du/dO is simply the constant eE /m^w . m' The ranges of the unsealed variables and the values of the constants are indicated in Tables 11.1 and 11.2. The scaling of the variables is indicated in Table 11.3. 11-10 SYMBOL DESCRIPTION MJMERICAL VALUES Min. Max. SOURCE Phase 1 radian 2,5 radians Previous desk calculator solution Distance 0.01 meter Design constant u 0.017 meter/radian w u < c f = cos 9 g = sin 9 dx/d9 dx/d9 = u 0.017 m/rad. du/d9 -0.02970i4- 0.02970J+ sin e , (1 - ^^y'^ ^ 1 df/d9 df/d9 = - sin 9 dg/d9 dg/d9 = cos 9 Table 11.1 Table of Variables and Derivatives 11-11 SYMBOL DESCRIPTION Ratio of charge to rest mass of an electron NUMERICAL VALUE 1.7592 X 10-^^ coulombs /kg. SOURCE Physical constant Velocity of light 2.99776 X 10' m/sec . 8 Physical constant E m Peak electric field intensity 5.2266 X lo"^ volts/meter Design constant w Angular frequency of the field (2,r)(2.8)(lo9) rad/sec . Design constant max Gap length 0.01 meter Design constant e E m V . 02970U Derived constant h \ 6.31599 0.092910 Table 11.2 Table of Constants (mks units) 11-12 SYMBOL y NUMERICAL VALUE Min. Max. 0.1 0.25 0.001 p 0.017 r 0.005 s 0.005 dy/d0 0.017 dp/d0 -0 .2970U 0.2970if ds/d0 -0 .05 0.05 dr/d0 -0 05 0.05 RELATION TO UNSCALED VARIABLE = 0.1 Q y = 0.1 X p = u r = 0.005 f s = 0.005 g dy/d0 = dx/dO dp/d0 = 10 du/dQ ds/d0 = 0.05 df/de dr/d0 =0.05 dg/dO Table 11. 3 Table of Scaled Variables and Derivatives The Scaled Equations . The scaled equations become dy/d0 = p. dp/d0 = E 1/2 - u^/G 3/2 (2s/0.0l), dr/d0 = -10s, ds/d0 = lOr. The quantity in brackets in the equation for dp/d0 has 11-13 been scaled by l/2. The constants G and E are: G = 2c^/w^ = 0.00058078; E = 2.Q1 M eE /m_w = O.8UOI6. V m' The scaling for dp/d0 and for the bracketed expression have been absorbed by the constant E. Scaling for External Orbit Recycling Equation. The time phase of an electron re-entering the gap is calculated as follows: ®i,n+l -\\}- ^^^ " ^^u2/c2)l/2/(wu/c)] [1 - (vu/c)^] '^'^ + 9 - (n + l)(2rt), where IC = 6. 31599 and K = O.O929IO, Since = O/lO and n can be as great as 10, ^i,n+l = (KiA°^^^/°-^) {E ■ ^2^^ ■ wV/c^)^'^^/(lOwp/c)] [1 - (wp/c)2] -1/2 - 2«(n + 1)/100| + 0^^^ where and p are values at the time of exit after the nth tra- '^e^n ^ jectory of the gap. After performing the indicated subtraction, the quantity within the brackets II is on the order of 0.01. Additional Calculation for Printed Results. The additional calculations below are to be performed. ^ = wu/c (relative velocity) 11-1^4- U /Uq = l/l -^ (ratio of total energy to rest energy) ^ = V (1 -/§■ V^/^ - 1 = (511.21+) (lo3) [u /u - 1 L n (electron kinetic energy) After scaling we have ^ = wp/c. 0.01 u /u^ n' 0.01 v/F 1/2 - pVg 1/2 10" T = 0.5112i| 0.01 U /U„ - 0.01 n' done: 11.5 CODING OF THE PROBLEM. Organization of the Program. The following steps are to he (1) Read parameter from tape and print. (2) Set initial conditions for integration in gap. (3) Perform one step of integration. (U) Test to see if last step has been performed; if not, repeat step 3* (5) Perform external orbit recycling calculation. (6) Calculate and print date desired for eacl; orbit. (7) Test for last orbit; if not, return to step 2. (8) Stop, then return to step 1. Use of Library Routines. The following library routines were used: 11-15 (1) Decimal Order Input XI (2) Constant Listing Auxiliary X3 (3) Differential Equations Fl (k) Sine-Cosine Tl (5) Decimal Number Input N3 (6) Print PI (7) Square Root Rl Use of Parameters . In order that the coding could be independent of the allocation of memory space, parameters in addition to those required by the differential equations Fl were assigned for memory locations of the subroutines. The assignment of parameters is as follows: S3 location of first variable, Sk location of scaled derivative of the first variables, 55 locatioi. of first word of temporary storage for differential equations routine, 56 number of differential equations to be solved, 57 location of first word of auxiliary subroutine, 58 temporary storage, 59 square root subroutine Rl, SK initial conditions setting program, SS main program, SN print routine PI, SJ decimal number input routine W3, 11-16 SF sine-cosine routine Tl, SL differential equations routine Fl. The parameters S3-S7 are those required for the differential equations routine. Use of Differential Equations Routine. In using the differential equations routine, a niomber of choices must he made, as indicated in the specification sheets. These include: (a) selection of increment length h and the parameter m, (b) method for handling the independent variable 0. It has been noted that two first order equations are required for solution of the second order differential equation of motion of the electron in the gap. Two additional equations were included to evaluate the sine fiinction required. The range of integration is from y = to y = 0.001 where y is one of the dependent variables. Since it is not possible to predict the relationship between y and 0, it is not possible to determine an increment h of in such a way that integrating over an integral number of equal increments h will result in y assuming its final value. The technique used is one of integrating beyond the range desired, then integrating in the opposite direction with a decreased value of h. The integration then oscillates around the end of the range, with decreasing values of h, until y lies within some predetermined interval containing its final value 0.001. The initial length of increment h is determined llrl7 from considerations of accuracy and time. The value of h chosen was 0.001. For this value of h, the estimated number of steps of in- tegration is 150 and the accuracy is on the order of 10 . The value of m selected is the largest possible such that none of the scaled derivatives exceeds range, namely m = 9, or 2 n = O.512. For homing on the final value y of the dependent variable y, the value of the scaling factor 2 n is changed in the following manner . y 0. = 0.+h '^i+l '^i i). ^= 0. ,+h' Figure 11. 3 Adjustment of Interval Length When y.,-,-y differs in sign from y.-y , 2 n is changed to a new i+1 •'e 1 e value 2\( 2^' = y -y ) i+l e^ y---y.,T X 1+1 11-18 The integration thai proceeds with the smaller interval h' (of opposite sign from h) until two successive values of y again lie on opposite sides of y . If, at any time, ^i - ^e -9 < 10 , the integration is complete . In the differential equations of motion of the electron in the gap, the independent variable does not appear. The value of is calculated by using a coiinter in the main routine, rather than integrating the equation 0' = 1. The mimber of equations used is thus k. Details of the Coding. The Initial Conditions Setting Program . Words to 9L of this part of the code are devoted to reading a value of the parameter ^^ from tape (using the decimal number input) and arranging the format and printing in both degrees and radians. (Print routine PI is used for printing). Since the scaling of 0^ is by a power of 10, printing is arranged so that the decimal point appears in the printed results to yield the correct values for the unsealed quantity . The remaining words are used for the following: (1) Set initial value of orbit index n, (2) Set initial values of p and y to zero, (3) Set temporary storage locations for differential equations routine (S5 ff.) to zero, (k) Calculate and set initial values of r and s. (The sine-cosine routine is used for the calculation). (5) Set initial value of 2 n. 11-19 (6) Set initial value of y._^-. - Y > (7) Transfer to main program. Details of the Coding. The Auxiliary Subroutine. The auxiliary subroutine is a closed routine whose function is the calcu- lation of the scaled derivatives from the values of the variables in accordance with the equations of motion of the electron. The variables y, p, s, and r are in locations S3, IS3, 2S3, and 3^3, respectively. The scaled derivatives 2 n y', etc., are to be placed in locations Sk and 33^- Constants necessary, such as G, E, and negative powers of ten, are obtained by using the constant listing auxiliary (Library Routine X3). Results of intermediate calculations are placed in temporary storage locations 1S8 through 1^S8, for reference in checking the program for errors. The calculations are arranged so that none of the intermediate results exceeds capacity; otherwise the program itself is self-explanatory. The a^axiliary subroutine uses the square root routine (entry from 6L), the first word of which is in location S9. Details of the Coding. The Main Program. The main program can be subdivided into three parts; the supervisory program for inte- gration in the gap, (words OL to 18l), the external orbit recycling calculations (words IBL to 30L), and the orbit counting and printing routine (words 3OL to 6IL) . The first part of the main program performs the following functions : 11-20 (1) The independent variable is increased by h. (2) Values for the ith step of the variables y, p, s, r and of [Y^-J^] are stored for future reference. (3) The i+1 step of the integration is performed by entering the differential equations routine; i.e., new values of y, p, s, and r are calculated. (^) yi+i'^e ^^ calculated and its sign is compared with the sign of y.-y . If the signs differ, 2\ is adjusted; if the signs agree, 2 n is left unchanged. (5) If 'y.,T-y^ • - 10' , another st-p of the inte- gration is performed. If y. -,-y < lO" , the external orbit recycling calculation is begun. The second part of the main program performs the calcula- tions indicated by the external orbit recycling equation in such a way that none of the intermediate results exceeds capacity. It should ~ p .1 /p be noted that the quantity 1 - p /G is necessary for this calcu- lation. To obtain this quantity, the auxiliary subroutine is entered directly from the main program. The auxiliary subroutine leaves the desired quantity in location 3S8, where it is then available for further calculation by the main program. It might be thought that the quantity could be obtained directly without re-entry from the main program; it should be noted, however, that the auxiliary routine was last used with intermediate values of the variables. For accurate results, it is therefore necessary to re-enter the auxiliary subroutine with the final values of y, p, s, and r in locations S3 through 3S3. 11-21 The last part of the main program, beginning with the right- hand order of word 30L, is devoted to orbit counting, and to calculations for the format of the printed results. The print routine PI is entered in such a way that decimal points are placed to correspond to the un- sealed values of the results. The format used is indicated in Table 11. U. 11-22 u^ o in V? •.-< c- c> C7- ^o c hotoinm^v£)ro-^vovo c •.-iC\ito-=f-*mV3r-{x) in o in o in o ir\ c in o c -^ ^ CvJ c\J ro to -=r -^ in C' o o o c o c c o o oj ^ ■* t^ r- -rH r~ c, (M to OJt~-VOin<7-, V3roO-^C\J ■JTCNJrO-.-t'^CiO-.-H-.-cCMO ajcxjcotot^ininininin <7 c^ o- a- c^ o- c^c^c^c^ --itVirO'^in^Ot— Ci0<7<0 c> c o o o o o c c, ^ £ a> ^ CO 0) •^i-tt^-tor-'rHintorO'T-i K)Cor- o Tl fe o o a; -d o in o CO VOOVO^CAin^CMt^^ OJ o^-^vjtotoo-^^in^tjo ooC^^-■•-^^-loc^l^^lnO oo-^>oint~tov?-*roin tOCOCA-r-iK^-^OCvJin-^ »-O OOOOOOOOO^ 11-23 LOCATION ORDER * 00 3K 3 00 F 00 32 OF k 00 F 00 32i|F 5 00 F 00 328F 6 00 F 00 1|F 7 00 F 00 200F 8 00 F 00 3I+OF 9 00 F 00 6kF K 00 F 00 22 OF S 00 F 00 25OF N 00 F 00 12 5F J 00 F 00 7UF F 00 F 00 95F L 00 F 00 I53F Auxiliary Subroutine 00 200K NOTES number of equations II-2U LOCATION ORDER K5 F U2 18L 1 50 1S3 p 7J 1S8 2"^ 2 1+0 Sij- 2%y 50 1S3 P 3 75 1S3 66n oof 005 8078 0000 J P k S9 F 40 2S8 5 32 5L 50 5L 6 26 S9 40 3S8 7 50 2S8 7J 3S8 8 Uo 4s8 50 ks& 9 75 2S3 66n oof 00 100 0000 0000 J 10 7JN i^•OF 00 314-01 6000 0000 J 1+0 F 11 50 F 75 1S8 12 00 IF 1+0 isi+ 13 50 SB L5 3S3 NOTES Set link 2 V' = 2% 1/2 - p7g Waste 1/2 - p^/G~| ^/^ at 3S8 1/2 - p^/g] 3/2 at 1+S8 0.01 E' 2%' = 2% (200s) E'f 1 3/2 11-25 LOCATION ORDER ll^ 66N oof 00 1000 0000 0000 J 75 1S8 15 1+0 2S4 50 S8 16 LI 2S3 66li OOF 00 1000 0000 0000 J 17 75 1S8 1+0 3S4 18 32 18L 22 ( )L NOTES 0.1 2% 2^15' = 2°^ (lOr) 2°hr' = 2% (-lOS; Waste By 0' 00 22 OK Ui s8 92 1U9F 1 92 513F 92 96 IF 2 1+0 5S8 50 2L 3 26 SJ L5 5S8 k 52 73F 50 l+L 5 26 SN L5 5S8 6 50 S8 66n 1+of 00 729 5779 5131 J Set initial conditions -^ D,N,I. Input Waste ->- Print routine. T -- ' Print (degrees ) 1.8/rt 11-26 LOCATION ORDER 7 S5 F 1+0 5S8 8 52 71^ 50 8l 9 26 SN 92 129F 10 92 513F 19 5F 11 1+0 6s8 1+1 1S3 12 1+1 S3 1+1 S5 13 1+1 135 1+1 2S5 Ik 1+1 3S5 L5 5S8 15 50 s8 00 2F 16 Ll+ 5S8 5 50 i6l 17 26 SF J ho 7S8 18 7JTJ OOF 00 100 0000 0000 J 1+0 2S3 19 50 7S8 7JN OOF 00 100 0000 0000 J 20 1+0 3S3 L5N OOF 00 5120 0000 0000 J NOTES Print in radians Set n+1 =2x2" Set p to Set y to -^ Sine cosine routine Set .starting values 0.01 s = 1/200 sin 10 ^ 0.01 r = 1/200 cos 10 2% 11-27 21 ko is8 LIN OOF 00 10 0000 0000 J 22 ko BsB 26 SS NOTES Set 2% 0.001 j'^-C'*^" Set (y^ - y^) MAIN ROUTINE 00 250K L5 is8 10 9F 1 ih 5S8 Uo 5S8 2 L5 S3 4o Us5 3 L5 1S3 i^o 5S5 1^ L5 2S3 ko 6S5 5 L5 3S3 ko 7S5 6 L5 8S8 Uo 9S8 7 00 9F 50 7L 8 26 SL L5 S3 9 LON OOF 00 10 0000 0000 J ko 8S8 2% h in A Replace ^ by + h Store old values of y, p, s, r Store (y^-Yg) ■^ Differential equations Routine Fl y =0.001 11-28 LOCATION 10 11 12 13 ll^ 15 16 17 18 19 '■ 20 21 22 23 ORDER 36 12L L5 9S8 36 I3L 26 I7L L5 9S8 36 17L L5 ^S5 LO S3 ko ios8 50 8S8 75 is8 66 ios8 S5 F 4o is8 L7 8s8 LON OOF 00 1000 J 36 L 50 18L 26 S7 L5N OOF 00 i<-^6 6080 0000 J 50 S8 66 3S8 S5 F ij-o iis8 LIW OOF 00 lOOOO 0000 J 50 S8 66 1S3 S5 F NOTES ^1 ^i+l 2«ih If y,.-y„ and y._^-,-y^ agree in sign, integrate again If y.-y and y. , -y disagree "^1 e "'i+l •'e ^ in sign, form 2 ti' 2%'=2%(y.^^-y^)/(y.-y..^^) Is ^i-^e <; 10"^? -^- Auxiliary subroutine C- -^ ff. M 10 Q --■ /! ,.•■■- /I 11-29 LOCATION ORDER 2h 1+0 12S8 50 6S8 (n+l)2"''' 25 7JT^ OOF 00 1000 0000 0000 J i^■0 F 26 50 F 75N kOY 00 1283 1800 0000 J 27 00 7F 10 11S8 28 LO 12S8 66N oof 00 1000 0000 0000 J 29 SI F 1;+ 5S8 30 UO I3S8 92 129F 31 92 513F L5 6s8 32 LOW OIF OOF 10 32F 33 JO 22F 50 33L 3^ 26 SN L5 5S8 35 52 6IF 50 35L 36 26 SN 5ON hO¥ 00 729 5779 5131 J NOTES -10"3/p 0.1 0.1 !^l,n+l -7 n X 2 ' Print n Print in radians 11-30 LOCATION 37 38 39 1+0 kl k2 ^3 kk he kQ h9 ORDER 7J 5S8 22 38L ' 52 63F 50 38L 26 SN L5 13S8 UO 5S8 22 lilL Waste 52 6 IF 50 i|-lL 26 SW 5OW UOF 00729 5779 5131 J 7J 13S8 22 kkh Waste 52 63F 50 i<-UL 26 SN 36 I4-6L Waste L5 1S3 50 S8 66n oof 00 170 ij-100 0000 J 7JN OOF 00 1000 0000 0000 J 52 7IF 50 1+8L 26 SK L5N OOF 00 70 7106 7812 J NOTES Waste Print in degrees e,n Set for next integration Print 0. -, in radian? '^ijn+l 1.8/rt Print 0. ^ in degrees '^ijn+l ^ Calculate and print 11-31 CATION ORDER 50 50 S8 66 3S8 51 S5 F iiO lUs8 52 52 72F 50 52L 53 26 SN L5 1^S8 J 5^ LOW OOF 00 100 0000 0000 J UO F 55 50W i^OF 00 112 UOOO 0000 J 7J F 56 52 82F 50 56L 57 26 SN L5 6s8 58 Li+N OIF Uo 6s8 OOF 59 LOW OWF 3k SK OOF 60 26 12SK 00 F NOTES Calculate and print 1-^' ■1/2 Calculate and print energy (mev. ) Increase n If n=ll stop, read in new If n < 11, integrate again Temporary Storage Starting at Memory Location 3^0 1 2% 11-32 LOCATION 2 3 h 5 6 7 8 9 10 11 12 13 li^ ORDER NOTES 1/2 "l/2 1/2 P^/G P^/G P^/G~ 1/2 3/2 (n+l) 2~'^ 1/2 cos 10 (y,-y,) ^1-^1+1 M 1/2 - vVg p •1/2 -10"3/ -1/2 Allocation of Memory Space . Memory space was allocated as follows : 3-I5 parameters (6-63 available for list of constants for constant-listing auxiliary 6^-73 square root routine Rl 7^-9^ decimal number input routine N3 95-12^ sine-cosine routine Tl 125-152 print routine PI 11-33 153-193 differential equations routine Fl I9I1-I99 unused 2OO-218 auxiliary routine 219 unused 220-2^2 initial conditions setting program 2ij-3-2U9 unused 25O-3II main program 32O-323 variables for integration routine 32^4—327 derivatives for integration routine 328-331 temporary storage for integration routine 332-335 previous values of variables for integration routine 336-339 unused 3^0- 3 5^^- temporary storage 355-9^0 unused 9^1-961 constant-listing auxiliary X3 / 962-998 available for post mortem D.O.I. (Library Routine Cl) 999-1023 decimal order input XI 0-2 temporary storage Tape Preparation. The tape was prepared in two steps . The non-standard parts of the program - namely the list of parameters, the auxiliary subroutine, the Initial conditions setting program, and the main program were punched, printed, and visually checked for 11- 3i^ errors. Using library routines, the tape was prepared as follows; Decimal order input XI 00 9lj-lK Constant listing auxiliary X3 00 3K List of parameters 00 6kK Square root subroutine Rl 00 T^K Decimal number input routine N3 00 95K Sine-cosine routine Tl 00 12 5K Print routine PI 00 153K Differential equations routine Fl 00 200K Auxiliary routine 00 220K Initial conditions setting program 00 250K Main program 2h 999W 26 220N 11-35 K06N K055W K05N The tape was then checked for reperf orating errors, using a tape comparer. The directive 2h 999N was placed on the tape so that a correction tape could be placed in the reader before the program was started. Initially, however, the stop of the 2k 999N directive was by-passed, and control was transferred to the initial conditions setting program by the directive 26 220N. The quantitites K06N, KO55N, and KO5W at the end of the tape are values of the parameter 0_ to be read from tape by the decimal number input. 11.6 CHECKING THE PROGRAM. The electron cyclotron pro- gram was typical in that a number of blunders in coding were made. A description of the sequence of events in checking the program follows, When the program was first read into the Illiac, the quantity 07680. 00000 00528 59832 06685 86693 ^983 was punched continually. The temporary storage was printed (P.M. routine C3) indicating that had been read from tape and stored (at 5S8). 0^ vas to be initially expressed in degrees scaled by 100 and was later to be converted to radians scaled by 10. Since the conversion had not occurred, the difficulty was isolated to the region 3L-7L of the initial conditions setting program. A subsequent printing of the orders of the print routine (with P.M. routine C5) 11-36 indicated an incorrect link and the difficulty was isolated to the print routine entry (word Ul) which was 52 73F 50 2L rather than 52 73F 50 Ul. When the program was read into Illiac again, noises in- dicative of integration were heard, and after an appropriate interval of time pimching occurred. The results were, however, not entirely correct. Values of 9 and 0. were incorrect, although some small e, 1 1 ,£? comfort was gained from the fact that 6 and n were printed correctly. The hehavior of the variables 0, y, p, s and r for the first ten steps of integration were then observed by using check point routine Dl with a blocking order placed at location 256 (6L in the main routine) ahead of the entry to the Runge-Kutta routine. The initial values of ^} 7} Vf s, and r were correct, exonerating for the moment the initial conditions setting program, but behaved peculiarly on successive steps. Rather than increasing uniformly by increments of 0.001, increased by 0.001, then by 0.02^+6, by O.OOO6, and eventually de- creased slightly. It was finally found that the location 5S8 used for storage of was also being used for temporary storage by the auxiliary routine. This blunder was ciired by replacing the orders kO 5S8 50 5S8 in words 10 and IIL of the auxiliary routine by 1^-OF 5OF. With a somewhat longer correction tape, the program was again checked on the Illiac. The results of the first integration and orbit cycle were correct, but the results for the second orbit were 11-37 all incorrect with the exception of the orbit index n« The re-entry into the initial conditions resetting program was checked and it was found that p was incorrectly being reset to zero; i.e., the program was robbing the electron of all the velocity it had gained during its first orbit. The correction tape increased in length; word 6lL of the main program became 26 12SK 00 F rather than 22 IISK 00 F. The orders for clearing q and p were interchanged in words IIL and l^L of the initial conditions setting program. After the following code check, the results for the first orbit were again incorrect. After mutterings of "something is wrong with the computer", it was discovered that a terminating symbol had been omitted on the correction tape. The correction process then converged and correct results were obtained. 11.7 CONCLUSION. The preparation of a problem for solution on a digital computer is by no means a completely objective process. No two programmers would prepare the same problem for solu- tion in an identical way. Furthermore, a second coding of the problem by the same programmer would differ from the first preparation. The personal preferences of the programmer affected the electron cyclotron program in a number of ways. Memory space other than locations 0, 1, and 2 was assigned for temporary storage; it was felt that such an arrangement might aid in code checking. The S terminating symbol was used for designation of the locations of first words of subroutines, so that the detailed coding could be 11-38 completed before memory locations vere assigned to the subroutines. Thus, the location of a subroutine affects only one of the S para- meters rather than the addresses of a number of orders in the program. Among the changes which might be made if the program were rewritten is a change in the handling of the variable 0. If 9 were expressed in revolutions, the overflow properties of the computer would simplify the recycling computation. 11-39 CHAPTER 12 THE CATHODE RAY TUEE DISPLAY 12.1 GEMERAL DESCRIPTION, Results of certain types of calculations may be most conveniently obtained from the computer by use of the cathode ray tube display. Whenever results of a calculation can be represented pictorially as a graph or diagram, the cathode ray tube output from the computer provides a rapid and elegant method for obtaining these results. If results would otherwise be graphed manually the cathode ray tube saves the human time required for this additional processing and also reduces the machine time required to present the results to the user. Another use of the cathode ray tube is to provide inter- mediate results in such a form that they may be analyzed subjectively during the course of a program. In this way the programmer may discover errors in his program at an early stage in the calculation. He may also obtain immediate results which may be used to determine the way the remainder of the program is to be r\in. Even if the final results must be presented with greater acciiracy than is possible using a graphical display, some advantage may be obtained by supplementing the digital results with a graph or diagram- The cathode ray tube output is called into use by turning the output switch on the input-output rack to the cathode ray tube position. When the switch is in this position the cathode ray tube is the only 12-1 form of output available to the user. The display on the cathode ray tube is limited to a 3" x 3" square area centered on the face of the tube. Within this square area, chosen points may be brightened on a 256 X 256 regular square raster. A finer raster is unnecessary because of the limited resolution of the cathode ray tube. This limited resolution makes the display of digital information such as numbers or figures somewhat unhandy. It has been found that no more than about 200 fully legible numbers or letters may be dis- played in a single frame. In general the requirements of the format will restrict it to somewhat less than this. This disadvantage, however, is somewhat offset by the possibility of using characters having any shape which the programmer desires and by the greater speed of output. A subroutine has been written which will display characters at the rate of about ^5 per second which compares favor- ably with the rate of 20 characters per second for the punch. In order to retain a permanent record of displayed re- sults it is necessary to photograph the face of the cathode ray tube. Two cathode ray tubes are installed in the rack. They are driven so they operate in parallel and hence display the same results. One is used for visual observation and the other is equipped with a semi-automatic camera to permit photographing the display. The film advance mechanism and the shutter are controlled by the program while insertion, removal, and development of film must be done by hand. 12-2 12,2 ORDEES COIilTROLLIWG THE CAIEODE RAY TUEE DISPLAY, Orders which would normally cause characters to be punched or printed will affect the cathode ray tute when the output switch is in the cathode ray tube position. The conventional output order to use for cathode ray tube display is 82 l6. When this order is executed it will cause one spot to be brightened on the face of the cathode ray tube. The position of the brightened spot depends upon the -15 contents of the l6 leftmost binary digits 2-2 of the accumula- tor- Let these digits be designated by the symbols a , a , , , . , a Assume an origin of coordinates in the lower left-hand corner of the square raster and let d represent the length of one side of the square raster (d = 3")» Then the coordinates of the brightened spot wi 11 be : y = d (a^ 2"^ + a^ 2"^ + . . . + a^ 2" ) 12 -8 X = d (ag 2 + a 2 -i- . , , -i- a^ 2 ) These formulae say, in effect, that the ordinate is obtained from the first eight binary digits of A, regarded as a number, and that the abscissa is obtained in the same way from the second eight digits. During the execution of the 82 l6 order the AQ register will suffer a left shift of l6 places. This output order takes BOO microseconds, A variation of this order permits a spot to be brightened in only ^00 microseconds. When an 82 8 order is executed the ordinate 12-3 is determined in the same manner as it is for an 82 l6 order, -1 -2 -8 y = d(a„ 2 +a, 2 +...+a2 ), but the abscissa will be the same as that of the spot produced by the last 82 l6 order which was executed. In this way time may be saved when several points having the same abscissa are displayed. Letter output orders are used for operating the semi- automatic camera. The following orders are used for this purpose: 92 769 Advance the film one frame and open the shutter. (These operations start at the same time.) 92 513 Advance the film one frame aaid close the shutter. (These operations start at the same time.) 92 1 Close the shutter 92 257 Open the shutter No effect results from ordering the Illiac to open the shutter if it is already open or to close it if it is already closed. After using the camera it is conventional to leave the shutter closed with an unexposed frame in place. Exposure of a single frame of the film takes place during the period of time that the spots that make up the picture are brightened. Amount of exposure is therefore controlled by the in- tensity setting of the cathode ray tube and not by the shutter which is left open during the entire exposure. Exposure of a spot may also be increased by multiple brightenings . If calculations are made 12-!+ while the frame is being exposed the resulting photograph will in no way be affected although the image on the visual cathode ray- tube may fade partially before the completion of the frame. Ad- vancing the film one frame takes one second and the Illiac will wait until this operation is completed before executing other out- put orders. If the orders following the film advance do not in- volve output, their execution will be begun after only 200 microseconds, Wo output orders other than those mentioned are of practical use in the operation of the cathode ray tube display. A 92 order having an odd address will affect the camera mechanism, while any other output order will brighten a spot. 12.3 PROGRAMMING FOR THE CATHODE RAY TUEE DISPLAY . As with typewritten output, the cathode ray tube display is usually programmed by means of subroutines. If digital results are desired the niimber of orders concerned with output will be greater when the cathode ray tube display is used than when the punch is used. In- formation needed to form a character (such as a letter or decimal digit) may be stored in a single word in the memory, but the mechanism required to decipher this information rapidly may take as many as 35 words. Such a device is used in library program CGI. This program uses 63 words to display iriiformation similar to that printed by library program 03 which has only 3I words. Graphical display is also most conveniently accomplished by means of subroutines. Program 01 is an example of a subroutine 12-5 which enables one to plot axes and points on the cathode ray tube. Any method of graphical display will almost inevitably require scaling of the coordinates of the points to be displayed. Since it is desirable to utilize the full screen area of the cathode ray tube, up scaling may be necessary in some cases instead of down scaling. The full screen is regarded as having a range of 1 for both coordinates when library routine 01 is used. The full range of all variables in this case should be scaled so as to correspond to 1. If more than one graph is to be displayed on a single frame, however, it is sometimes better to avoid entering the point plotting subroutines more than once. Consider the following example: The points (x-, , y, ) and (x , y ) are both to be displayed relative to the origin. Let us assume that axes have already been displayed by program 01. The quantities x_ and y have been supplied to program 01 when the axes were plotted so as to locate the origin. They represent the x and y coordinates respectively of the center of the screen in the coordinate system used. Let the necessary parameters be those given in Table 12.1; 12-6 LOCATION PARAMETER 10 ^0 > 11 ^0 12 ^1 13 ^l' ll+ 72 15 scaling 16 scalin; 17 1/2 Assume these coordinates have been properly scaled before being stored. Table 12.1 Parameters for Cathode Ray Tube Display A program to plot the two points might be the one given in Table 12.2: p 50 13 scale y. 7J 15 IH-1 JO 12 plot (x , y. ) by use of subroutine 50 p^-1 01 IH-2 26 (to program 01) 50 Ik scale y IH-3 7J 16 lA 17 prepare 2(y2 + l/2 - y^) IH-U LO 11 to be displayed 00 1 lH-5 82 8 plot (x , y ) without use of a subroutine Table 12.2 Program for Cathode Ray Tube Display 12-7 In the program of Table 12.2 the second ordinate y is first scaled and then translated so as to be present in the accumulator in the proper form for display purposes. It is then displayed by use of the 82 8 order, thus saving machine time and also saving the programmer the trouble of re -introducing the abscissa x^ . 12-8 G K .* • t I f Y '> * i '■■<. I V. N. -I LI +1 +2 ,...•_. ! c •••.12 TT •:?• ■• CHAPTER 13 THE PROGRAM LIBRARY The problem of planning and carrying out a large-scale computation is often almost entirely a matter of organization in which the detailed parts of the computation may be subcomputations which are common to many problems. Consequently, it is of great importance for the efficient use of a large-scale computer to have readily available to the programmer means for carry out these subcomputations. For example, it would be very wasteful if each programmer had to prepare his own routine for converting binary numbers in the machine to decimal numbers. The program library is a collection of routines which have been prepared to make coding easier. They have all been machine tested and copies punched on tape are kept available for use. All are prepared for use with the Decimal Order Input (See Chapters h and 5)- The library programs may be divided into several cate- groies : Input routines Output routines Functional routines Problem- solving routines Interpretive routines Checking routines 13-1 13.1 lUPUT ROUTDJES. These are programs for transferring data on ptmched tape to the machine. There are routines in the library which will input decimals or fractions, singly or in sequences, 13.2 OUTPUT ROUTINES. These routines convert the binary numbers in the machine to decimal fractions or integers and punch the results as determined by wide choices in parameters. 13.3 FUNCTIONAL ROUTINES ■ These are routines which eval- uate functions for specified values of the arguments. Included in the library are functional routines for finding the following quan- tities: square root, cube root, integral root, sine, cosine, arctangent, logarithm, exponential, legendre polynomial value. 13.4 PROBLEM-SOLVING ROUTINES. Problem-solving routines carry out more elaborate operations than functional routines. Those in the probram library include routines for carrying out the following operations . Solving a set of first order differential equations 13-2 Integration Solving a set of linear algebraic equations Fitting a least squares line Solving Laplace's equation Minimizing a function of n variables Interpolating Inverse interpolating Finding real roots of f(x) = Multiplying matrices Finding eigenvalues and eigenvectors Solving Poisson's equation 13.5 INTERPRETI^/E ROUTDffiS. These routines (see Section U.6) carry out more elaborate "orders" in their own order code by using many Illiac orders. The library contains interpretive routines for the following operations: Double precision arithmetic Floating decimal arithmetic Automatic coding Minimizing Boolean polynomials 13.6 CHECKING ROUTINES. These are routines designed specifically to aid the programmer in obtaining information about his program. They are discussed in Chapter 8 . 13-3 CHAPTER lU DEFINITION OF TERMS A 2-5'^ The accumulator register or the contents of the accumulator register . Access Time The time to get a number from the memory to a register or the time to get a number from a register to the memory. Accumulator 2-5 The register into which numbers can be put by addition; same as A register. Action Cycle The type of memory cycle in which the memory is connected to the arithmetic unit for the transfer of a number. . Addend 2-5 The number in the memory to be added to the accumulator. Address 3-1 The right-hand ten binary digits of a twenty digit order; usually the location of a number in the memory. Analog Indicates a continous operation (as opposed to digital). Arithmetic Unit 2-5 The part of the computer which is required to carry out arithmetic operations. AQ 3-9 The double-length register including A and Q but excluding the first digit q„ of the Q register. 'Numbers refer to pages. li+-l Augend 2-5 The number in the accumulator to which another number is to be added . ■B- Binary Svitch 7-^ A portion of a program which is used to cause two separate sequences of orders to be followed alternately. Bit 2-1 One binary unit of information or one binary "digit". Blocking Order 8-6 A transfer order inserted in a program to stop the "normal" sequence of orders so that some check can be made on the program. Blunder 8-1 A mistake in programming, or more usually a mistake in pro- gramming which is most obvious even without running the problem. Boolean Pertaining to the symbolic logic of George Boole, the mat he mat i c i an . Bootstrap Start 5-13 A routine which, with only the aid of the original order pair 80028 and ij-0000, makes it possible for the machine to continue inputing and storing under the control of orders brought into the machine from the tape . -C- Carriage Return 9-3 The paper tape code which will cause the typing carriage of a printer to go to the left-hand margin of the paper. lU-2 Cathode Ray Tube Output 12-1 The cathode ray tube unit which can be used to display results from the computer directly by output orders . Check Point 8-6 A point in a routine where some check is to be made. Clear 2-k The operation of changing all the digits of a register to a common state, usually 0. Code A group of more or less arbitrary symbols used to represent some other group of things . Coding Error 8-1 An error in the detailed preparation of a program. Collate 3-27 Digitwise logical product, same as extract. Comparer 9- l6 A device for checking the identity of two tapes. Complement 2-2 See one's complement and two's complement. Conditional Transfer 3-5 An instruction which will cause a transfer from the pattern of taking orders sequentially if the sign digit of the accumu- lator is 0. Control 1-k That part of the machine which serves to "control" the arithmetic unit, the memory and the input-output. Control Counter 8-U Usually the order counter. lli-3 Control Transfer 3-5 An instruction which may cause a transfer from the sequential pattern for handling orders; see unconditional control transfer and conditional control transfer. Counter Usually a short routine which counts the number of iterations carried out in some program. -D- Diagnostic Routine A routine for finding and diagnosing a machine fault. Digital 1-2 Pertaining to digits; discrete units. Digitwise-complement 2-2 Same as one's complement; a binary number is the digitwise complement of another binary number if and only if each digit of the number disagrees with the corresponding digit of the other number. Directive 5-^ An order, usually on a tape, which specifies the location at which a subroutine is to be stored. D.O.I. 5-1 The decimal order input routine. Library Routine XI; used as a general purpose input routine for almost all programs. Double Precision Pertaining to numbers of approximately two UO binary digit number lengths; hence requiring two registers or locations for a single number. Drum A rotating cyclinder with a ferromagnetic coating used as a memory . Ik-k -E- Error Mathematically the difference between the correct result and ■ the computed result; often used in place of blunder. Even Order 3-1 The left-hand order of an order pair, thus using digits 2 through 2" 19. Extract Order 3-2? An operation which puts a 1 in the Q register wherever the number in the designated memory location and the number in Q are both 1, leaving all other digirs zero; also called a logical multiply order because the resulting number in the Q register is the digitwise binary product of the Q register and the number in the memory; same as collate. -F- Fixed Address 5-2 The numerical address remains unaltered when put into the memory; usually in connection with D.O.I, where a fixed address is followed by an F. Fixed Point 2-1 The binary point is always in the same position of a register; Illiac is a fixed point machine. Floating Point Pertaining to operations in which numbers are represented by a number multiplied by a power of a base; thus numbers may have different multiplying factors; floating point operations in the Illiac must be obtained by programming. Fraction A number with an absolute value less than 1. 11^-5 Function Digits 3-2 The first eight binary digits of an order; the T and V digits -H- Hang up An unplanned stop of the machine due either to a machine fault or a coding error. ■I- Input Routine A routine for inputlng other routines, usually aiding in conversion from binary-decimal to binary. Instruction 3-2 The operation in the machine designated by the first eight binary digits of an order. Integer Pertaining to Integers; although Illiac is a fixed point machine with the binary point between the first two digits it is possible to carry out operations using integer numbers less than 2+^^ - i. Interlude 5-11 A routine which carries out operations and is then destroyed by overwriting as tht problem continues, usually carried out during Input of Information. Ia§truetlon Cods 3-1 Tht ordtr cods. Intargggtlve Routing k-$ A reutlni In whleh a igquenct of operations (instead of a ilnfli epgratlen) nay be earrltd out on a number, the sequence diiifnatid by paraattiri carried with the number. lk.6 Iteration A sequence of orders, usually to be executed more thaji once, and arranged to converge to some analytic result. -L- Leapfrog 2-17 An engineering routine which may be used to test the machine. Left-hand Order 3-1 The left-hand or even order of a pair of orders, thus using digits 2° through 2~^^ . Line Feed 9-3 The paper tape code which causes a Teletype to advance the paper one line; always in conjunction with carriage return. Link h-\ The part of the routine used to bring a subroutine into operation and designate the point of return. Location 1-3 The designation of a number location, address or position in the memory . Logical Product When applied to numbers of more than one binary digit, the digitwise logical product; the same as collation of two numbers and the same as extract. Loop 8-^ A sequence of orders which may be carried out more than once automatically. -M- Machine Error An error caused by a fault in Illiac. lU-7 Memory 1-2 A device which stores numbers; usually the cathode ray tube or Williams memory in Illiac . -N- ITumber Register 2-5 The temporary location in which the addend, subtrahend, multiplicand and divisor are automatically placed by the control while the corresponding order is being executed; R . • 0- Odd Order 3-1 The right-hand order of an order pair consiting of the digits 2 through 2" 39. One ' s Complement 2-2 Same as digitwise complement; each digit of a binary number is changed to get its binary complement. 20 Order A set of 20 binary or 5 sexadecimal digits which is used to define a machine operation. Order Code 3-1 A set of sexadecimal characters used to describe the operations in the Illiac . Order Counter 8-k The counter which keeps a record of the location of the next order pair if no transfer of control is required. Order Pair 3-2 Two orders which are stored together in one location of the memory . l4-8 Order Register 3-^ The register R^ into which an order pair is transferred from the memory just before either of the orders can be obeyed; R, Output A display by oscilloscope, paper tape or Teletype printer of the contents of some part of Illiac. Overflow Digits 2-3 The digits which, as a result of a computation, would require digits to the left of 2 in a register. -P- Page Printer 9-9 An automatic typewriter. Paper Tape The common II/16 inch width paper tape used for handling numbers in and out of Illiac . Parameter ^-7 A number which may be altered from one computation to another but is held fixed during a single run. Partial Substitution Order 3-1? An order which allows the address digits only to be stored in the memory; a k2 or k6 order. Plant k-k The act of putting some number into an order or routine; usually with reference to an address. Playback The number coming from the magnetic drum memory. li^-9 Position -39 Referring to one of the 2 to 2 places of the memory or of a machine register. Post Mortem 8-8 The checking of the routine in the memory after it has heen used, usually by an automatic routine which compares the contents of the memory with the original input tape. Program 1-k The plan of a calculation. Punch 9-1 A unit to punch holes in II/16 inch paper tape, usually the punch providing output from Illiac . -Q- Q or Q Register 2-5 The register which must be used for the multiplier during a multiplication; also the register into which the quotient is placed during division; the contents of the Q register. Quotient Register 2-5 Same as Q register. Quadrature The process of evaluating a definite integral by numerical means ■R- R3 3-^ The order register; bottom row of ^0 neon lights on Illiac. Range The set of numbers which may be handled in an Illiac register directly, from and including -1, up to and including 1 - 2"39. ll4-10 Raster The array on a memory tube . Read- around An index of the interference of one spot with another in the Williams memory. Reader 9-1 The device to take data from a punched paper tape for insertion into Illiac . Record The process of storing a number on the magnetic drum. Regeneration The process of refreshing the stored information on a Williams tube. Register 2-5 A row of 40 flip-flops which can hold a binary number. Relative Address 5-2 An address which is relative to a directive and hence must be added to the directive address to get the true memory location. Remainder 2-12 The quantity left from the dividend after a division process (without regard to Illiac). Reperforator 9-11 A standard Teletype machine for making paper tapes from electrical signals. Residue 2-13 The quantity in A after a division order has been obeyed (in the Illiac) . 14-11 Ri^ht-hand Order 3-1 -20 -39 The order using positions 2 through 2 ; same as odd order. Round- off 2-12, 13 -1^0 The process of adding 2 in multiplication and making qon = 1 in division when the term is used with Illiac . Routine k-1 A completed sequence of orders in coded form. -S- Scale 6-1 The adjustment of a number to come within range of Illiac, Sexadecimal 3-2 A number system with base l6. Shift The process of moving a number to the right or left in a register. Sijgn Digit 2-2 The first position in a register; 2 . Single Address Code A machine order code which has one address only with each order; Illiac has a single address code. Slave Tube 8-^4- A device for displaying the entire contents of one memory cathode ray tube . Store The memory, usually Williams memory. 1^4-12 Subroutine U-1 A routine arranged according to a standard pattern so that it can be easily used as part of other routines. -T- Tape Code 9-1 The hole patterns in a paper tape that are used to represent numbers and instructions . Tape Comparer 9-l6 A device to compare two paper tapes. T Digit 3-16 The first sexadecimal digit of an instruction. Temporary Storage Locations in the memory used briefly during a calculation and not assigned to any number to be retained for results. Terminating Symbol A symbol on the tape indicating the end of a section of code or tape . Two's Complement 2-2 The difference between 2 and the number whose two's complement is to be found: in the Illiac identical, 2, to reversing each digit and adding 2' is to be found; in the Illiac identical, because it is modulo -U- Unc ond i t i ona 1 Transfer 3-5 A transfer out of the ordinary sequential pattern of handling orders, regardless of the sign of A. ill- 13 -V- V Digit 3-6 The second sexadecimal digit of an instruction. Waste Order ^-3 An order that serves no computational purpose hut is inserted because of ease in coding or limitation of the machine because of odd and even pairing of orders . William s Tube A cathode ray tube used for storing binary digits . Word Forty binary digits in a register or a single location in the memory. Working Space See temporary storage . 1I+-II+ INDEX -A- A register, 2-5 Accumulator, 2-5 shifting without shifting Q, 7-I8 Accuracy, 6-7 Add from Q, 2-8, 3-26 Addend, 2-5 Addition, 2-5, 2-7, 3-29 Address, 1-3, 3-I digits, 3-8 fixed, 5-1 relative, 5-1 AQ, 3-9 Arithmetic unit, 1-2, 2-5 Augend, 2-5 ■B- Binary chopping, 7-15 -coded decimal, 9-3 digit, 2-1 point, 2-1 point shifted, 6-1 switch, 7-^ Blocking order, 8-6 example of use, 11-37 Blunders, 8-1 list of typical, 8-3 discovery of, 8-2 Bootstrap, 5-12 start, 5-I3 -C- Camera operation, 12-^ Cathode ray tube display, 12-1 orders for controlling, 12-3, ^ programming for, 12-5 example of result, 12-9 Checking, 8-1 of a particular program, II-36 Check point, 8-6 Coding tricks, 7-1 Combination Teletype, 9-11 Comparing of tapes, 9-l6 Complement, 2-2 Conditional transfer, 3-5> I6 Constants, orders and addresses as, 7-7 Control counter, 8-^ Control transfer, 3-5 reversed, 7-3 Control unit, 1-^ Convergence criteria, 7-12 Correction tape, 8-5 Cyclotron trajectories, 11-1 Decimal order input, 5-1 Definition of terms, lU-1 Differential equations, 11-17 auxiliary subroutine, 11-20 Digital, 1-2 Digitwise complement, 2-2 Directive, 5-^ Division, 2-12, 3-I9 "double precision", 2-]B hangup, 2 -16 remainder, 2-15, 7-1^ special cases, 2-l6 -E- Extract, 3-27 ■F- Fifth hole, 9-U Fixed point, 2-1 Format characters, 9-3 Fractions, input of, 5-6 -G- Glossary, 1^-1 ■H- Hand punch, 9-1? Increment add, 2-8, 3-28 from Q, 2-8, 3-25 Information sources, 8-^ Input, 9-1 Input-output orders, 3-21, 23 Institute for Advanced Study, 1-1 Instruction, 3-1 Integer operations, 2-20 Interchange of numbers, 7-11 Interlude, 5-11 Interpretive routine, U-9 -K- Keyboard perforator, 9-9 -L- Leapfrog, 2-1? Left shift, 2-k, 2-9, 3-12, 7-l8 Letter printing, 9-^ Library, 13-1 Link, k-h Location, 1-3 Logical product, 3-2? Loop, 8-ii- -M- Marking, 7-13 Memory, 1-2 to Q, 2-17, 3-18 Modifications to program, 8-U Multiplication, 2-11, 3-20 -N- Negative numbers, 2-2 Number register, 2-5 -0- One-address code, 3-1 Order, l-^l blocking, 8-6 code, 3-1 as a constant, 7-7 execution time, 10-2 pair, 3-2 types, 3-6, 7 variants, 3-8 Ordvac, 1-1 Output, 9-1 Overflow, 2-3 -P- Page printer, 9-9 Parameters, U-7 preset, U-11, 5-7 program, ^+-7 use of, II-I6 Polynomial evaluation, 7-I6 Post mortem routine, 8-8 Product summation, 7-1 Program, 1-1+ complete, 11-1 modification, 8-k -Q- Q register, 2-5 Quotient register, 2-5 for interchanges, 7"11 -R- R3, 3-^ R^, 2-5 Register, 2-5 Remainder, 2-12 in integer division, 7-1^ Reperforator, 9-11 Resetting of cycles, ^-Q Residue, 2-13 Right shift, 2-k, 2-9, 3-13 Routine, 1-^ address search, 8-11 check point, 8-8, 12 closed, k-2 entry to, h-3 exit from, U-3 interpretive, 4-9 post mortem, 8-8, 9 sequence checking, 8-8, 11 Running time, 10-1 simple formula, 10-4 ■S- Scaling, 6-1 adjustable, 6-10 continuous, 6-10 of a complete problem, 11-10 Sexadecimal, 3-2 Sign digit, 2-2 Starting a program, 5-6 Stop orders, 3-6 Store, 2-17, 3-17 Subtraction, 2-6, 2-7, 3-29 -T- Tape code, 9-1 complete, 9-5 orders for, 9-6 sexadecimal, 9-1 Tape preparation, 9-1 Teletype equipment, 9-7 Testing for and -1, 7-6 for 1/2, 7-11 Transfer of control 1-^, 3-5 -U- Unconditional transfer, 3-5> 3-1^ CHAPTER 16 THE DRUl-i STOR.'iriE UNIT 16.1 GENERAL DESCRIPTION . Auxiliary storage of 12,800 words is provided for the Illiac by the magnetic drum storage unit. Some knowledge of the physical characteristics and mode of operation of the drum storage unit is necessary for its most efficient use. The magnetic drum is, physically, a rotating cylinder whose surface is coated with magnetic material. Lengthwise, the cylinder is subdivided into 200 tracks; associated with each track is a re- cording and reading head capable of recording digital information on the magnetic surface and capable of reading data previously recorded (Page 16-2). The periphery of the cylinder is subdivided into 6/+ sectors; as a sector passes under one head, the digits of one word are recorded or read. Thus, the selection of any one of the 12,800 words requires a spatial selection of a track and a temporal selection of a sector; that is, access to one word requires selection of one of 200 heads and the selection of one of 64 time intervals during which the digits of the desired word pass under the selected head. 16.2 COmON DRUI4 INSTRUCTIONS . The record instruction 86 11 OOp places the contents of A in drum location p and performs eleven left shifts of AQ. The playback (or read) instruction 85 11 OOp performs eleven left shifts of Q and places tfie contents of drum location p in A. Either type of drum instruction must occupy a complete 40 digit word. CO V u VO ttJ o M Eh O The address p of either drum instruction is specified by the rightmost 14 binary digits (2~ to 2 ) of the 40 digit instruction and hence is obeyed modulo 2 = 16,384. It is restricted to the range £ p < 12,800 for playback and 2560 < p < 12,800 for record, with the interpretation in both cases being made modulo 2 , Of the 14 binary digits specifying p, the least significant six _T/ — 2Q (2 to 2 ) determine in which of sixty-four sectors the desired —PA — '^'^ word lies; the remaining eight (2 to 2 ) specify the track. Except in special circumstances, the programmer need not be concerned with the breakdown of the address p into track and sector addresses, since the track switching is autonatic and imposes no special timing restrictions on drum use. The section of the drum < p < 2560 is used for storage of the drum bootstrap and commonly used routines; no recording by drum instructions is possible in this range. If either the record or playback instruction has an address in the range 12,800 ^ p <( 16,384 (mod. 16,334), the instruction will cause the computer to stop. For most efficient use of the drum storage unit, the desired sector of the drum should be approaching the reading and recording head when a drum instruction is to be executed. Subroutines for transfer of blocks of words between the drum and electrostatic memories require time for execution of other Illiac instructions between successive drum accesses; to facilitate such use, sectors whose Illiac addresses differ by one are physically five sectors apart on the drum surface (Fig. 16, l). The circuits for switching from one track to another are so designed that all words on the same sector are equally accessible. For this to be possible, a delay of one word time precedes any drum consultation. As an example, suppose that the digits of word have been read from drum track 0, sector Oo As the drum rotates (Fig. 16, l), sectors 13, 26, and 39 pass under the reading heads » This interval of three word times is available for calculation and for address modification. The drum instruction requesting consultation of sector 1 should be in the Illiac order register before sector 52 begins to pass under the reading heads. The enforced delay of one word time occurs as sector 52 passes under the head, whereupon the digits of any word in sector 1 can be read into the Illiac accumulator as sector 1 passes under the heads. 16.3 CALCULATIOM OF ACCESS TIME . The timing data necessary for efficient use of the drum storage unit can be deduced from the following facts; 1. The time required for one revolution of the drum is 16.9 milliseconds. 2. Since the digits of 64 words are stored serially around the periphery of each track, the time required for the digits of one word (one sector interval) to pass a reading or recording head is 0,26/4. milliseconds o 3. The drum instruction must be in the Illiac order register at least one sector interval (0.264 milliseconds) before the digits of the word can be transferred between the drum and the Illiac accumulator. Thus, the minimum time required for execution of a drum instruction is two sector intervals or 0,53 ndllisecondso 4. Words corresponding to successive addresses in drum instructions are spaced five sectors apart on the dnun surface. An isolated drum instinction with no definite timing relation- ship to other drum instructions may be regarded as occurring when the drum is in a random position. In this case, the time taken by the drum instruction will be equally likely to lie anywhere in the range between the minimum of 0,53 milliseconds and the maximum of one revolution time plus one sector interval or 17o43 milliseconds. The average time would thus be 9oO milliseconds. A program does not usually have isolated drum instructions, but instead it will contain a sequence of drum instructions separated by other Illiac instructions. Under these circumstances, three timing calculations are of importance, 1. The time t between the completion of one drum instruction and the completion of the next drum instruction. 2. The time T required by all the Illiac instructions which come between the two drum instructionso 3. The maximura time T available for execution of Illiac instructions max if the second drum instruction is to be obeyed as quickly as possible after the first. The coimnonest case is that in which successive drum instructions have successive addresses. The time T is then equal to three sector max intervals or 0,79 milliseconds. If T < T , then the time t is — max' equal to five sector intervals, or 1,32 milliseconds. If the time T required for execution of Illiac instructions exceeds T , at least nax' one additional drum revolution will be required for each access, giving t = 18.2 milliseconds as the time between completion of drum instructions, A general calculation of t and T for arbitrary addresses max of two successively obeyed drum instructions can be made in the following way. If the address of one drum instruction is p, , and that of the next is p„, one first calculates 5(Pp ~ Pi ) - 2 - 3o8T and forms its residue modulo 64. (All times are in milliseconds =, ) Call this quantity R, In other words, R is formed by successively adding or subtracting 64 from the above expression so as to make R lie in the range < R < 64« The time t between completion of the two drum instructions is then given by the formula t = 0.53 "^ T + «264R. The time T is chosen as the max shortest time T to make R = 0, Thus one obtains T = .264 [Residue of {^(p^ - p-|_) - ^ (modulo 64 )J 16,4 CALCULATION OF TIME OF EXECUTION OF ILLIAC INSTRUCTIONS . If access tine to the drum storage is to be minimized, it is important that accurate calculations be made of the time of execution of Illiac instructions obeyed between successive drum instructions. The most accurate way of performing this calculation is to determine the number of clock periods of the Illiac electrostatic storage unit. The clock periods required for instructions commonly used in drum transfer routines are given in Table 16,4. Location Order 10 40 11 L L5 (n) F 2 readout order pair 4 order type L 11 12 13 14 86 11 F 00 F F5 11 L 40 11 L F5 10 L 42 10 L FO 35 L 32 10 L 2 readout order pair order type 86 2 readout order pair 4 order type F 2 order type 4 2 readout order pair 4 order type F 2 order type 4 2 readout order pair 4 order type F 2 control transfer 32 Total The time T required for the record loop is therefore 32 x 0,0187 = 0.598 milliseconds, which is less than the time of three sector intervals (0,792 milliseconds). Successive words will therefore be recorded at the rate of 1.32 milliseconds per word, after the first word has been recorded, 16.5 OTHEH TYPES OF DRUM UJSTRUCTIOMS . a more general type of drum instruction may be written in the form 8 V, 11 T V- p. If T is 0, 1, 8, or 9 the druia instruction will be obeyed as described in the first section. If T is any other di;^it type the right hand half of the instruction will be obeyed as a separate Illiac instruction after the drum instruction has been obeyed. In such a case the drum 1 c o 13 address is interpreted modulo Bjl92 = 2 while the drum instruction is being obeyed and for this reason no hangup is possible. The rightmost binary di,];it of Vp is uniquely determined by the drum address p but Vp is otherwise arbitrary. Possible choices for V, include 5, 6, 7, J and L. The playback instructions have V, equal to 5 or J and both produce the same result. It is customary to take V, = 5 for playback. The record instructions have V, equal to 6, 7, and L, and they record N(A), zero, and 1/2 respectively as may be deduced from the characteristics of the variant V., , X If V, is taken equal to 4 a playback is executed but since A is not cleared before carrying out the playback the result will also depend on the initial contents of A„ The result of this instrxiction is to shift A and Q, left eleven places but during the shift to insert zeros into right hand eleven digits of A rather than digits from Q. A. digit wise inclusive or (logical sum) of this shifted quantity in A is formed with the word taken from the drum. A number of other instructions exist which affect the drum but which also have little utility. They include the cases: a. Drum instructions with the left hand address different from 11. b. Drum instructions with the left hand type digit equal to 9 rather than 8., c. Drum instructions lying entirely within the right half of a word. (These instructions will produce the conventional effect only if the address equals eleven mod 64.) Since applications of these types of instructions to actual programs are so limited we give no description of their properties here. 16.6 MODIFICATION OF ILLIAC . The initial instruction pair 8002840000 which has been used to start the tape bootstrap was rewired so that the instruction pair 3500S40000 is used instead. This change will have no effect in the operation of the computer except when a bootstrap start is used, and even then the computer will usually respond in the same way now as it did with the original instruction pair. The differences may be noted as follows: 1, No D.OoIo is now required on the front of your tape since if the D.OoIo is omitted it is taken from the drum automatically and placed in locations 3F7 to 3LL<, The additional locations 3F5 , 3F6, 000, and 001 are used in this process. 2, If a tape bootstrap such as that appearing on the D.0,1. tape is at the beginning of your tape, the computer v;ill handle it in the same way as it has in the past except that locations 3L6 through 31jL will be used before the bootstrap is read, 3, If your program requires the reading of a jump instruction by means of a bootstrap start, it must be altered, A jump instruction written as 2406400000 must be replaced by 00K24100N, while if the instruction 263F700000 is to be read on a bootstrap start this instruction may be omitted entirely. In any such case, the locations 3F$, 3F6, 000, 001 will be used and the D.O.I, will be replaced in the Williams memory. The program which provides the facilities described above consists of a set of routines which are stored on the drum. The initial instruction pair 8500S40000 plays back a drum bootstrap v/hich occupies locations 000, 001, AOO, 401 on the drum and 000, 001 in the high speed memory. It, in turn, plays back routine 1 fro;;. 3L6-3L9 on the drum to 3L6-3L9 in the high speed memory. Routine 1 plays back routine 2 from 3LK-3LL on the drum to 3LK-3LL in the high speed memory. Routine 2 records the contents of the high speed memory locations 002-OlL at locations 31F2-31LL on the drum to preserve them and returns control to routine 1, Routine 1 plays back routines 3 and 4 from locations 002-013 on the drum to 002-013 in the high speed memory and jumps to routine 3« Routine 3 reads one sexadecimal character from the tape to determine which routine should be played back next and prepares routine 4 accordingly. If the character is read from the tape, routine 4 will play back part of the D,0,I, and routine 5 and will jump to routine 5» Routine 5 replaces the words in 31F2-31LL in locations 002-OlL in the high speed memory and then plays back the rest of the D,OoI» Entry is made to the D„0„I„ in such a way that the reading of the initial function digit of the directive is suppressed the first time. This is necessary since routine 3 has already read the initial 0, Routine 5 occupies locations 3F5, 3F6, 3L9-001, All except locations 3F5, 3F6, 000, and 001 are covered by the Do0,Io If routine 3 reads the character 8 from the tape a tape bootstrap is indicated and routine 1+ is prepared so that it plays back routine 6 into locations 3L8-3LL and jumps to routine 6= All words of routine 6 are contained in routine 5, but entry is made at a different point „ Routine 6 replaces the words in 31F2-31LL in locations 002-OlL and causes the next nine characters to be read from the tape and stored in 000 after faking the initial 8 which was already reado Routine 6 then jumps to 000 and the usual tape boot- strap sequence has been started = Other initial characters have been assigned as follows: (l) Leapfrog (3) Flying Leapfrog (F) Drum Post Mortem Routines (L) Store Post Mortem Routines 16,7 USE OF THE DRUM . The drum will most commonly be used by means of library subroutines, IVhen this is done no special knowledge of drum instructions is required, and all problems of reducing access time to the "minimum" of 1,32 milliseconds are handled automatically by the subroutine. Y-1 is a typical subroutine for transferring information back and forth from the drum„ It may be used to record a block of r words on successive locations of the drum starting at location q provided these words are present in successive locations in the Williams memory starting at location n. One must enter the subroutine by means of the instructions JO n P 50 p p+1 26 — 00 q p+2 00 r in order to cause the recording to occur. Control will be returned to the right hand side of p+2 after the recording. The same subroutine may be used to play back r words from successive locations of the drum starting at location q provided these words were previously recorded by the subroutine = They will be stored in successive locations of the Williams memory starting at any arbitrary location n. In order to perform this playback and store operation one enters the subroutine by means of the instructions SO n P 50 p p+1 26 ■— 00 q p+2 00 ro In addition to recording and playing back a block of words in minimum timej this subroutine computes a sum check for the block of words, which is stored on location q + r of the drum. Upon play- back this sum check is recomputed and compared with the recorded sum check o If any word has been recorded or played back incorrectly, the two sum checks will not agree and the computer will stop on the instruction FFOIO, In some complex problems one nay wish to play back words which do not occupy successive locations on the drum, and if this is the case library subroutines are not practicable,. For example, it may be desirable to record a rratrix in such a way that either a row or a column can be played back with minimum access timcc If the matrix has no more than 65 columns, one may achieve minimum access for either rows or columns by recording the elements of each row in successive locations but recording successive rows 65 locations apart. Thus, we see that T (as described in l6o3) is lo32 milliseconds ^ ' max ■ for both rows and columns and corresponds to the usual "rainimum" access time. If the number of columns N lies in the range 65 < N < 129 one must record the rows 129 locations apart, etc* If a technique of this sort is to be used with the drum, it is up to the programmer to write his own record and playback loops with due attention to access time and to sum checking.