LIBRA RY OF THE U N I VERSITY or 1LLI NOIS 510.84 F78d 1961 COP. 6 t-i Return this book on or before the Latest Date stamped below. University of Illinois Library * Each wheel represents a distinct digital position. A set of three such wheels can represent the three digit decimal numbers 000, 001, 002, ..., 999° Unlike the analogue computer, the accuracy here is limited only by the number of "wheels" we desire to use, In principle an arbitrarily high degree of accuracy can be attained with a digital computer.* The ILLIAC is a digital machine, its digits being binary (two discrete states) rather than decimal, which represents numbers to an accuracy equivalent to about twelve decimal places. With the exception of certain of the input and output equipment the ILLIAC is wholly electronic . Thus, the representation of numbers is by discrete voltage states and the sequence of logical operations that the ILLIAC performs is controlled by electronic switches, called flip-flops, the basic element of which is the vacuum tube or transistor. The flip-flop is an electronic circuit capable of two stable states* it conserves its last state until new information is presented to it. The flip-flop circuit contains at least two vacuum tubes or transistors™ A discussion of these circuits and their application can be found in reference k. The absence of mechanical movement permits the attainment of very high speeds of operation. The T,ime required to change the state of a flip- flop in the ILLIAC is about 1 microsecond (us) = 10 seconds."*" ; should be pointed out however, that as the number of "wheels" increases execution time for the elementary arithmetic operations also increases, Flip-flop circuits currently being developed at the University of Illinois Digital Computer Laboratory have switching times of about 15xl0~" seconds. The times required to execute various arithmetic operations by the ILLIAC are listed below. Each arithmetic operation is of course comprised of many switching operations. OPERATION EXECUTION TIME Add 9C us. Subtract 90 [is. Multiply 700 u s . Divide 8 00 u s . UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 2 PARTS OF A GENERAL PURPOSE COMPUTER It should be fairly clear that a device capable of doing arithmetic at the high speed indicated earlier for the ILLIAC cannot be operated efficiently if used like a desk calculator. Requiring the user to enter each number or operand into the machine by hand via a set of keys would result in virtually no change in the overall time to do a set of computations. Further, if the user must write down, or otherwise manually record, the intermediate and final results of each arithmetic operation, then the speed advantage gained by doing the arithmetic itself at high-speed is almost completely lost. In order to make efficient use of such a machine it is evident that the sequencing and control of arithmetic operations and the recording of results must proceed at speeds at least comparable to the arithmetic operation speed. Consequently the present computing machines are designed to meet these requirements by having the above functions performed automatically without human intervention. For the reasons cited above the ILLIAC and other modern high-speed computers consist of a CONTROL unit which controls the execution of the sequence of operations in a computation, a STORAGE unit where numbers can be "written" and "read" at high speed, and an ARITHMETIC unit where the arithmetic operations are executed. In addition there is an INPUT-OUTPUT unit which permits information to be communicated to the computer and permits information to be communicated to the outside world from the computer. The ILLIAC is described as a general purpose computer to distinguish it from a class of computers called special purpose computers designed to do computations on a very limited set of problems. The general purpose computer is designed to obey automatically very simple and basic operations } addition, subtraction, multiplication, division and a variety of strictly logical operations- The computer can be instructed to obey any desired sequence of these elementary operations, hence it is possible to solve an almost unlimited range of problems, storage space and computation time being the only limitations . The STORAGE unit of the computer holds information necessary to the computations, thus it holds both numbers and the sequence of operations in an appropriately coded form. This information is contained in blocks called "words". A single word may represent a number or an instruction to the control unit to perform one of the elementary operations . Actually in the ILLIAC there are two such instructions in every word. A word used to represent a number in the ILLIAC has about 12 decimal digits of significance. In the ILLIAC the storage unit provides space for 1,024 words . Reference to a word in the memory is made by specifying which of the 1,024 "locations" it occupies j for convenient reference the locations are numbered 0, 1, 2, . .., 1,023. "Address" is frequently used synonymously with "location". It is a feature of the ILLIAC in common with many other computers that words representing numbers are not distinguishable from words representing instructions and all portions of storage are available for either instructions or numbers . The inclusion of this feature in a computing machine was suggested by von Neumann and results in a more efficient use of expensive storage space. The ILLIAC storage unit is described as a random access storage. This implies that the time required to gain access to any location for reading or writing is independent of the location; the access time is about 18.6 u s° We will discuss the physical nature of the storage unit later, and say only now that it is an electrostatic storage device known as a Williams tube memory . The CONTROL unit contains as one of its basic parts a counter which keeps track of the location in storage holding the next instruction word in the sequence of instructions to be obeyed. The instructions are stored in a linear sequence in the memory so by advancing the control counter by units of one the control is provided with the proper sequence of instructions. The control "decodes" the instruction word and causes the computer to execute the operation specified by it. There exist instructions for setting the control counter to any desired address thus permitting alterations in the sequencing of instructions. It is in fact possible to thus alter the sequencing if and i specifiable number is positive. In this sense the ILLIAC can make "decisions" during the course of a computation. In the ARITHMETIC unit the operations of addition, subtraction, multiplication, division and certain logical operations are performed. There are three "registers" in the arithmetic unit, accumulator register (A), quotient register (Q), and number register (PT), which temporarily hold words brought from the memory preceeding the execution of arithmetic operations on them. Results of arithmetic operations are also held in these registers, and certain instructions cause the results tc then be returned to the storage unit. The function of these registers is analogous to the function of the three registers of a desk calculator ■ The INPUT-OUTPUT unit is responsible for all communication between the user and the computer. At the outset of a computation the user places the instructions and necessary numbers into the storage unit via the input unit- In the ILLIAC this consists of punching the information on teletype tape and placing the tape in a photoelectric device which then "reads" the tape. Information can be transmitted from the computer in several different waysj most commonly the information is punched onto teletype tape; it can be transmitted directly to a teleprinter this is slower and consequently not frequently used; or the results may be presented graphically as a plot on a cathode ray tube display to which a camera is attached for photographic recording. It is sometimes necessary tc have more storage space than the 1,024 words provided by the Williams Memcry (WM) unit, consequently an auxiliary : unit, a magnetic drum, with a 12,800 word capacity is available. The for the drum is considerably greater (average is about 9,000 u s.) and consequently it is used only when the (WM) capacity is exceeded. A machine of this type clearly places quite different and greater iemands on the user, than those placed on the user of a desk calculator. The primary difference is that all of the individual logical steps involved in problem must be completely specified in advance of doing the problem. The user must therefore anticipate in advance all of the possible outcomes of each operation and make the appropriate provisions . The user is inhibited, although not completely, from approaching the high-speed computer with just a hazy notion of every step in "che calculation as he might do with a desk calculator. Furthermore it is not easy to approach a computation with the philosophy - "I will see how the numbers go and then figure out what to do"j cases arise when it is virtually impossible to do otherwise but in general such an attitude should be discouraged. The process of laying out the set of logical operations to be performed in a computation is known as programming or coding . Most people prefer to reserve the term code to refer to the specific set of operations, comprising a computation, written according to the prescription required by a particular computer. The term program refers more generally to the set of logical operations, without reference to the detailed form in which they are to be presented to the computer „ The words program and code will be used in this sense here, 10 UNIVERSITY OF ILLINOIS DIGITAL. COMPUTER CHAPTER 3 TEE BINARY NUMBER SYSTEM The ILLIAC along with most other high-speed computers uses the binary (base 2) number representation rather than the more familiar decimal (base 10 ) number representation. The use of the binary system was strongly advocated by Burks , Goldstine and von Neumann (see Reference 1, Chapter 5). There are several reasons for advocating the binary system. Binary arithmetic is simple and the elementary operations can be performed at high speed. A computing machine is essentially a logical device containing many "yes - no" decision making elements and because homogeneity implies simplicity it is natural to desire a "yes - no" scheme for number representation. The binary system tends to provide a greater reliability since the unit elements are restricted to only two stable statesf these states being the two states of the flip-flop. Reliable decimal schemes really are basically binary and use a binary coded decimal representation which is wasteful of the information storage capacity of the computer. Actually the only argument that can be advanced in favor of the decimal system is simply that we are familiar with it. This, however, is not really a strong argument since the computer can be given the task of performing the necessary conversions between the two number systems, permitting the user to enter all numbers into the computer as decimal numbers and to obtain all answers as decimal numbers. Nevertheless s intelligent use of a binary machine does demand an understanding of the binary number system and binary arithmetic . By way of introduction to the binary number system and binary arithmetic let us discuss briefly some schemes for number representation. In a desk calculator a number is represented as the angular positions of a set of wheels . Each wheel has ten allowed positions representing the digits through 9 and each wheel corresponds to a distinct digit position. There is a wheel for the units place, the tens place, the hundreds place and In a high-speed computer s as mentioned earlier, the representation of i number is realized electronically. We will not be concerned with the physical 11 details of this scheme of representation but in order to have some appreciation of the logical ideas that are involved let us consider such a representation in a schematic way. To represent decimal digits we could, for example, have a device capable of having ten distinct states by the presence of a current in one of ten wires . Such a device is indicated schematically below. In this figure the switch is set to the output wire labeled J f and thus by the presence r CURRENT SOURCE TEN POSITION ELECTRONIC SWITCH P 1 1 2 • 3 4 m 5 • 6 | 7 8 1 9 of a current in this wire the digit 7 is represented. With a set of such devices we could represent the various digital positions; for example three such units could represent the decimal numbers 000 through 999° The scheme outlined above, although adequate for the representation of numbers, is actually very wasteful. Let us fix our attention on the ten output wires. To each wire we can assign two distinct states according as it does or does not carry a current. Since each of the ten wires has two possible states it is clear that there are 2 = 1,024 possible states for the ten wires (here we remove the restriction that only one wire at a time may carry a current). Thus, in principle the decimal numbers 0000 through 1023 could be represented on the ten wires, each number corresponding to a particular one of the 1,024 states; thus we obtain a considerable improvement in capacity over the first scheme. A device of this type leads us quite naturally to use the binary system. The base or radix of the binary number system is two and each digit can have only two possible values or 1 . Each digital position corresponds to a distinct power of two; thus, there is the units place, the twos' place, the four's place, etc. More precisely, a four place binary number is represented by an ordered sequence of four digits, a, a^ a., a , where a. can be either or 1 and the number, n, so represented is n = 2 x a, + 2 x a_ + 2 x a n + 2 x a^ 3 2 10 where it has been assumed that the binary point is located just to the right of a . If the binary point is placed between digits a and a , then the number, n', so represented is n' = 2 x a + 2 x a + 2~ x a + 2~ x a . To illustrate the representation of numbers in the binary system the integers zero through fifteen are listed below in the decimal system and the binary system. Decimal Binary 0000 1 0001 2 0010 3 0011 k 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 lb 1110 15 1111 13 The elementary rules for binary arithmetic are exceedingly simple. The binary addition table is + = , 1 + 0=0 + 1=1,, 1 + 1=10 . The multiplication table is 0x0=0, 1x0=0x1=0, 1x1=1 . To assist in a familiarization with binary arithmetic some examples are given below executed according to methods familiar in decimal arithmetic. The equivalent decimal arithmetic is performed alongside each example. In the examples of addition and subtraction below arrows are used to indicate carrys and borrows ( ^"^ carry, ^^ borrow). 10 110 1 h 5 + 11110 + 6 o 1101001 105 110 10 5 o -011001 - 2 5 1 1 I 2 5 Multiplication in the binary system is especially simple. Examples follow: 1 9 1 3 5 7 1 9 2 if 7 Ik 1 2 2 3 3 6 2 4 2 7 6 100010 I 00 Notice that in binary multiplication the product is formed by the following prescription. Examine the least significant digit of the multiplier: if it is zero write zero for the partial product; if it is one write the multiplicand for the partial product. In either case move the multiplicand one digital position to the left. Examine the next-most significant digit of the multiplier: if it is zero leave the partial product unchanged; if it is one add the shifted multiplicand to the partial product „ In either case move the multiplicand one more digital position to the left- Continue in this manner until all of the digits of the multiplier have been so examined. The small number of simple rules involved in this process indicates the relative ease with which a device can be designed for doing this automatically <. Examples of binary division follow. Ill 7 101 ) 1 ToT 5)37 3 3 2 )i -1 1 1 X T 1 :- 1 T_ 1 1 1 1 15 The convenience of the binary number system should now be apparent. In the device mentioned earlier one can regard each output wire as representing a distinct digital position in the binary number system. As a convention we might take the presence of a current as the representation of the digit 1 and the absence of a current as the representation of the digit 0. It is natural at this point to inquire why it is that we do not construct our device so that each wire has more than just two possible states and thereby increase its information capacity. For example if each wire has three allowed states (for example, corresponding to currents i =0, i', 2i') then the set of ten wires would have 3 = 59,0^9 distinct states. Note that here the natural number system would be the ternary (base 3) system. Such a scheme is entirely possible and in fact is used in some computing equipment. However , the simple binary on-off scheme is much more common. The binary system is still favored for the same reasons advanced earlier in favoring it over the decimal system though it is true that the simplicity of the ternary system reduces the strength of these reasons. Further, a simple and reliable tristable element is not yet available . A single binary digit's worth of information is called a bit. The information capacity of a 10 digit binary number is described as 10 bits. More generally a bit is an information unit and one describes quantitatively the information capacity of any scheme by the number of bits required to describe uniquely all possible "messages" (words, numbers, etc.) of the scheme. For example a single decimal digit has ten possible states (messages). It would take more than 3 bits to represent a decimal digit since with 3 bits one can uniquely distinguish just 2 =8 states. On the other hand k bits is more than enough since with k bits 2 = l6 states are distinguished. Regarding the number of states of the decimal integer expressible in the form 2 , p not necessarily an integer, we see that the information capacity of the decimal integer is p = log p 10 = 3-32 bits. Correspondingly, the information capacity of a letter of the alphabet is log p 26 = 4.70 bits. Of course a binary computer contains only an integral number of binary digits, consequently a decimal digit requires four bits in the computer for its representation. Correspondingly, in order to represent the letters of the alphabet by binary numbers in the computer one would need five binary digits for the representation. lb I VERS IT! OF ILLINOIS DIGITAL COMPUTER SHATTER k NEilATIVE NUMBEE REPRESEWTATIOM Let us now consider the representation of negative numbers. The customary scheme of using a symbol (.1 hit :f information) preceeding the absolute value cf a number tc represent positive and negative numbers turns out to be not quite so convenient in a digita_ computer „ A natural scheme for computers is the representation cf negative numbers by complementation ' : "» The complement of a number x with respect tc a base b is simply b - x; this is also called "th f b f s complement of x". Thus, the 10's comple- ment cf 6 is 10 - 6 = -> % the ;/ s complement cf 7 is -h , etc Representation of negative numbers by complementation means that each negative number x is represented by the b's complement of |x| (vertical bars mean absolute magnitude) where b is a suitably chosen base. Such a scheme turns out to be convenient because electronic circuits which affect complementation are relatively easy to construct and one can then bypass the problem of constructing the relatively complicated subtracting circuits (in which provision to "borrow" must be made) because subtraction is then achieved :y complementation followed by addition (since x - y= x * i-y) The use of this scheme in a base +.0 number system is illustrated below „ We fix our attention on a range of numbers restricted to -5.000 < x < : 5. 000. The negative numbers -C 00., -0.002, ..., -5-000 can be represented in an unambiguous way as follows z write the negative number x as x* = 10 -t x. The negative numbers are thus represented by 9-999, 9-998, ---, 5-000. This is the 10's complement representation. A few examples will monstrate that this representation is consistent with respect to the usual properties of negative numbers. Below are shown, side by side, examples of Some computers nevertheless ase a sign and absolute magnitude representation, e .g . IBM 704 , 17 additions and subtractions with negative numbers represented on the left by 10 's complement and on the right by sign and absolute magnitude. It is assumed in this arithmetic that carrys to the left of the most significant digit are "lost" just as they would be in a desk calculator with four wheels . 10 's COMPLEMENT SI ON AND ABSOLUTE MAGNITUDE 1.000 1.000 ( + ) 9° ooo (+) -1-000 0.000 0..000 3-015 3°015 (+) 7. 8m (+) -2.116 0.899 0, The arithmetic, in the left column where the left-most carry is lost so that there is a return to zero after counting up to 9»999 is called modular arithmetic and in this instance it is arithmetic modulo 10 (mod 10). This is the natural arithmetic of computers where the number of digits is fixed. In this arithmetic one equates numbers A and B modulo C, i.e„ A = B (mod C) if , when A and B are expressed as A=NC^A" B = M C - B f 18 with A' and B' less than C and N and M integral, then Thus, 10=0, (mod 10) 11=1, (mod 10) 12=2, (mod 10) 3=1, (mod 2) etc. Using the ideas just introduced notice that both the representation of negative and positive numbers is included when the rule for obtaining the representation of x (-5-000 < x < + 5-000) is stated simply as x* = 10 + x (mod 10) Demonstration that this representation is consistent with respect to addition is very simple. We must show that if X . + X . = X, i j k and if then x* = x. +10 (mod 10) x* = x. +10 (mod 10) x* = x k + 10 (mod 10) x* + x* = x* (mod 10) 1 J K To do this form 19 x* + x* = x. + x. +10 + 10 i J i J = x. +10 + 10 k = x* + 10 k (mod 10) (mod 10) (mod 10) (mod 10) as was to be shown. Now consider the representation of negative binary numbers by comple- mentation. Consider binary numbers x in the range -1 < x < 1. The representation for these numbers will be x* = 2 + x (mod 2) , The range on x* is < x* < 2 This representation is illustrated in the table below where we consider six digit binary numbers . x (DECIMAL) X * POSITIVE x NEGATIVE x 0-75 .110 1 .01000 0.50 .10 1.10 0.25 .01000 1 .110 0.125 .00100 1 .1110 0.96875 ( n ) .11111 1 .00001 1.0 1 .00000 1 .00000 20 Notice that the leading digit of negative numbers is always 1 and that the leading digit of positive numbers is always zero (except for 1.0 which is discussed below); that this must always be so is immediately inferred from the rule x* = 2 + x modulo 2. Thus, with a 2's complement representation of negative numbers, positive and negative numbers can be discriminated just as easily as with a sign and absolute magnitude represen- tation. In each case just a test of one bit is required. The decimal numbers +1.0 and -1.0 lead to an ambiguity since they are both represented by 1.00000. To maintain consistency with the rule that the leading digit is 1 for negative numbers only, it is the practice to take 1.00000 as the binary 2's complement representation of -1. It is sometimes helpful to think of this number system in the following way. Let the range of x* be mapped onto the circumference of a circle as shown by the 3 digit binary numbers on the outside of the circle below. As x* is increased by counting we proceed clockwise around the circle. The positive and negative numbers represented by x* are shown on the interior of the circle. 1.10 -!- 0.10 21 It is convenient to generate -x by a slightly different prescription than forming 2-x in the straightforward way. This prescription requires that the digitwise complement of x he taken (i.e., replace each 1 by and each by l) then add 1 into the least significant digit. The result is just the 2's complement of x . This logical procedure for constructing the 2's complement of x is used by the ILLIAC. (it should be easy to infer from this that circuits to affect complementation are not very complex, as pointed out at the beginning of this chapter.) The proof of this result follows immediately from the fact that 2 = 1.11 ... 11 + 0.000 ... 01 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 5 ILLIAC WORDS AS NUMBERS AND INSTRUCTIONS, AND BINARY-DECIMAL CONVERSION Earlier it was pointed out that information in the ILLIAC is handled in blocks called words. An ILLIAC word is composed of ^0 binary digits: v = w w l w 2 w 3 * " w 39 ' where w. = 0, 1 for I = 0, lj • .., 39» This is a typical word length for present day computers but the trend in new computers is toward longer words . ILLIAC is described as a parallel machine. This means that operations, arithmetic or logical, performed on a word are carried out simultaneously on all digits of the word . Thus when a word is transferred from the storage unit to a register in the arithmetic unit all digits are transferred simultaneously- When two words are added all digits are added simultaneously. In some computers these operations are performed serially, the computers being called serial computers . They have the advantage of requiring less equipment but they are slower than a parallel machine with equivalent equipment. Some computers are hybrids, operating partially in the parallel mode and partially in the serial mode . The ILLIAC word may be used to represent fractions in the interval -1 < x < 1 just as we described fractions earlier in the six bit example. Specifically the binary point is located between bits w and w with x* = 2 + x (mod 2) -1 -? -^Q x* = w Q 2 + w± 2 + w 2 2 " + . . . + w J9 2 ^ and we note that x = -2 + x* (mod 2 ) so -1 -2 -^Q x=-w 0+ w l2 + w 2 2 +... + v 39 2^ Since w = if x is positive and v = 1 if x is negative, w is called the sign digit. The use of the asterisk to denote ILLIAC representation of numbers will be adopted throughout the remainder of these notes. The assignment of the location of the binary point is completely- arbitrary. All arithmetic performed by the ILLIAC on a word is independent of the location of the binary point, just as it is in a desk calculator. Thus w might equally well represent y = 2 x, then y* = 2^ + y (mod 2 P+1 ) 39 E i=0 y* = S w i : p-i The assignment of a value to p is strictly up to the programmer. Although the placement of the binary point is arbitrary it is convenient to treat numbers as either fractions or integers, thus "placing" the binary point between bit positions w and w (fractions) or immediately to the right of bit position w, (integers) » The maximum and minimum magnitude integers and fractions, excluding zero, which may be represented are listed below. + FRACTIONS - FRACTIONS + INTEGERS - INTEGERS Max Min 1 - 2-59 2-59 -1 -39 -2 Jy 2 59 -l 1 - 2 5 g - 1 In the decimal system 2 _ 59 = 1.818 989 i+03 5^5 856 475 830 O78 125 x 10 -12 2 59 = 5A97 558 138 88 x 10 11 With a binary computer it becomes necessary to convert numbers from the binary system to the decimal system and vice versa. Schemes for doing this are discussed below. First let us consider the conversion of a binary fraction to a decimal fraction. The number x is represented as a fraction (we temporarily neglect sign) by 2h 59 x = Z w. 2" 1 (w. = 0, 1) . i=l x Alternatively x can be represented in the decimal with N digits by N x = Z v 1 « 10 _1 (w. 1 = 0, 1, 2, ..., 9). i=l The binary to decimal conversion requires that we generate the set of digits \ v s' } from the given set |w. \ . We have the equality N • 39 Z w. » 10" 1 = Z w. 2 _1 i=l X i=l x Multiply both sides of this equation by 10 to obtain N 39 Z v ' 10 1 " 1 = 10 x Z w. 2 _1 i=l X i=l X The integer part of the quantity on the left, namely w ', must be equal to the integer part of the quantity on the right; i.e. 39 _ ± w ' = integer part of 10 x Z w. 2 i=l X The first decimal digit of the fraction has thus been obtained. The fractional parts must also be equal V 1-i ?i -i ^ w. ' 10 = fractional part of 10 x Z w. 2 i=2 X 1=1 X Multiplication by 10 again yields the next decimal digit w ' as the integer part of the resulting expression on the right. Proceeding in this fashion, successively multiplying by 10, the decimal digits of a fraction represented in the binary system are obtained. An example, using six fractional bits for simplicity, is worked out below. x = Ool 1 1 1 10 x : 0.1 1 1 1 1 10 1 1 1 10 10 11 T_ 1 1 1.0 1 10 L 10 1 1 11 1.1 1 1 10 1 1 1 1110 1 0.1 1 1 10 1 1 110 1 1 1.1 1 o ; o 1 10 V =7 V =1 1 1.0 w*=5 5 Hence x = 0.71875 (decimal). Conversion from decimal to binary is effected in a completely analogous way. The binary digits are here obtained from successive multiplication of the decimal fraction by 2. When negative numbers are involved it is simplest to convert first to sign and absolute magnitude representation- Next we consider integer conversion . Let x be represented as a p digit binary integer 26 x . Z v 2P" 1 , (v = 0,1) i=l p x can also be represented as a q digit decimal integer 1 x = Z w'_. 10 q_1 , (v« -0,1, ..., 9) ■ i=l Suppose that we are given the binary integer, i.e. the number set w ., and that we wish to obtain the decimal integer, i.e. the number set w' . . We have 1 „ ■ P r-> -i Z v , lo^" 1 = = Z w . 2 P - X i=l I- 1 i=l P - X Now divide each side by 10. This will give an integer quotient plus a remainder. The remainder is obviously w ' , i.e. w ' = remainder t— ■ Z w . 2 P 10 ._, p-i The next digit, w ', can be obtained by dividing the quotient obtained above again by 10, the remainder being just w ' . Repetition of this process until the quotient is zero generates all the digits of the decimal integer. Conversion of a decimal integer to a binary integer is done in an analogous fashion. An example follows. We wish to convert the decimal integer 2,963 into a binary integer. 27 2 1 2 2,963 2 l,48l 1 7^0 2 | 370 2 | 185 2 | 92 2 | k6 2 1 23 2 1 "■ + I w o = x 1 + 2 V l = X w 2 = w„ = 3 1 , + 2 \ = 1 w c = v 6 =0 1 + ?r w„ = 1 2 "7 2 U_ + I v 8 = X 2 Li + I w 9 = X 2 1 w„„ = 10 *11 o + h v,, = i Hence x = 101110010011 (binary) An alternative scheme for integer conversion consists of first converting the integer to a fraction and then obtaining the digits by successive multiplications as described above for fraction conversion. For example, if x is the p digit binary integer representation of a q digit decimal integer, then form , a binary fraction. The most significant decimal digit is obtained io q by forming 10 ( ) and taking the integer part. If the remaining fractional io q part is again multiplied by 10 the next digit is obtained, etc. Care must be exercised in applying this method because of the possible error generated by the division. The techniques described above for the conversion of numbers from the decimal system into the binary system and vice versa are commonly employed in computer programs but they are usually not the most convenient ones for hand computations. For hand computations it will usually be found most convenient to 28 use the "Table of Powers of 2" in Appendix 2, p. 2^9, when converting binary numbers to decimal numbers. This conversion is achieved by simply summing the decimal equivalents of the appropriate powers of 2. One can also use the table to convert from decimal to binary, though it is not as convenient for this purpose. Supposing x is the positive number to be converted, the table is inspected for the power, p, of 2 such that 2 C x and 2 > x to obtain the most significant binary digit of x. The next digit is found by repeating the process for x - 2 and so on for successive binary digits of x. It is inconvenient to have to write out explicitly all kO bits of an ILLIAC word. For this reason another number system, a base l6 number system, is usedj it is called the sexadecimal number system^ . Each digit of a sexa- decimal number obviously contains 4 bits of information. The sexadecimal number system uses the characters 0, 1, 2, 3* ^-, 5j 6, 7* 8, 9 to represent the numbers zero through nine. To represent the numbers ten through fifteen, new characters must be introduced and these are K, S, N, J, F and L, respectively. Using the sexadecimal number system it clearly takes just 10 characters to specify an ILLIAC word. An example is given below. 1 1 ' : i . l '. 1 1 1 L 1 1 : l : : i D D 1 :■■ . l l 1 . 1 i — 1 — K The groups of four bits which have been indicated by the heavy lines are called tetrads. The binary word is thus written relatively simply as K38LNS2li7F Since we are dealing now with three number systems the subscripts B, S and D will @ Sometimes also called the hexadecimal number system. 29 be used to identify numbers as binary, sexadecimal or decimal if the base is not already clear from the context. A table which is helpful for number conversion between the sexadecimal and decimal number systems is in Appendix 3, p. 250. r^g num b ers within the boxes of this table are decimal integers, the corresponding sexadecimal integer is given by the sexadecimal characters which label the row and column of the box; the most significant sexadecimal characters being given by the row label on the left if the decimal number is in a box lying in the left half of the matrix (i.e. to the left of the heavy verticle line) or by the row label on the right if the decimal number is in a box lying in the right half of the matrix; the least significant sexadecimal character is given by the column label. To illustrate, the decimal number 750, which lies in the left half of the matrix is represented sexadecimally as 2FF; the decimal number ^70, which lies in the right half of the matrix is represented sexadecimally as lj6. This table covers decimal integers in the range to 1,023- This table is used especially for converting the address digits of an order from sexadecimal to decimal or vice versa. In addition to numbers the ho bit ILLIAC words are also used to specify the orders or instructions to be executed. There are two instructions in each ILLIAC word: the left-hand (LH) order comprising the first five tetrads of the word; and the right-hand (RH) order comprising the second five tetrads of the word. The first two tetrads of every instruction are called the function digits. They completely identify the instruction type: multiply, divide, add, etc. The last ten bits of the remaining three tetrads of each instruction are called the address digits. In most cases they refer to a location in the storage holding one of the operands for the operation specified by the function digits. Since there are just 2 = 1021+ word locations in the ILLIAC storage unit the 10 bit address just permits reference to every word in storage. The remaining two bits of the instruction are not used and in fact may contain any bit configuration without effect on the instruction. Thus, if V = W W l W 2 * ' ' W 39 ' 30 then for the LH order w w . . . w are the function digits, w w.^ . .. w are the address digits and ¥„ w are not used« For the RH order w w . .. w are the function digits, w w . .. w are the address digits and w „ w are not used. Let us review briefly now the logical sequence of events taking place in the execution of a set of orders in the ILLIAC= The words containing the order pairs are placed in the storage unit. The control counter is set to the location in storage (address) of the word holding the first order to be obeyed. An indicator is set telling which crder LH or PH is to be obeyed. The specified word is brought into the instruction register. The control counter is now advanced by one to designate the address of the next order pair. Assuming that the indicator has been set so that the first order to be obeyed is the LH order, the LH order of the order pair in the instruction register is executed, then the RH crder of this order pair is executed. The next order pair at the storage address indicated by the control, counter is now brought into the instruction register, the control counter is again advanced by one and so on. This process continues until a transfer order is encountered, or until an order to stop the computer is encountered, A transfer crder causes the control counter to be reset to the value specified by the address digits of the transfer order,, Thus, it is possible to alter the sequencing of the instructions » Later we will discuss in detail the ILLIAC order code but before doing this we will examine the operation of the ILLTA:? arithmetic unit, 31 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 6 ADDITION AND SUBTRACTION Having discussed the representation of numbers in the ILLIAC ve now discuss the operation of the arithmetic unit. A block diagram of the arithmetic unit and connections to the memory is shown below. The paths along which numbers may be transferred are indicated ?S < MEMORY U^|Q ADDER -■» COMPLEMENT GATE Figure o-l Block diagram of the arithmetic unit showing connections with the Williams Memor . by the lines. These lines actually represent a set of wires, one wire for each binary digit of an ILLIAC word, thus permitting the digits of a word to be transferred between these parts of the arithmetic unit simultaneously, i.e. in parallel fashion. 32 To facilitate the subsequent discussion it will be convenient the following notation: A the i (i = 0, 1, „.., 39) digital position of A. :.c use A. i e Q i a a. q i the quotient register the i (i = 0, 1, ..., 39) digital position of Q. the number rigister the contents of A the contents of A. l the contents of Q the contents of 0. i 3 the contents of R if an operation changes a, a., q, q., the new value is designated by the superscript ' multiplying a by 2 is written -.hus the operation of 'da. In general, capital letters indicate locations for holding digits and small letters represent the contents of these locations. Let us first note the links between the memory and the arithmetic unit.. There is just one entry into the memory and that is via the accumulator register. On the ether hand words may be read from the memory into either the quotient register or the number register. Addition in the ILLIAC always takes one operand, the augend, from A and the other operand, the addend, from R ; the addend coming originally from Q or the memory. The sum is always placed in A. As the addend is brought from R to one of the adder inputs it passes first through the complement gate,, In addition the complement gate is not activated and consequently it has no effect on numbers transmitted through it. (We will see later that the complement gate is used in the subtraction process) In the adder the sum of the two inputs is formed, the result is transmitted to A completing the addition operation.. 33 The ILLIAC addition instruction may cause A to be cleared to zero before the addition takes place j this is called a "clear add" instruction. If A is not initially cleared the instruction is called a "hold add" instruction. The addition instruction takes the addend from R , but the addend is actually first taken from a memory location M, specified by the address of the instruction, and I j ,3 placed in R before the sum is performed, or the addend is first taken from into R' The preceeding remarks are summarized below. The steps comprising the add instructions are indicated. The ILLIAC order representation, two sexadecimal function digits followed by an address M, appears in the parentheses . A. Clear add (L5 M) (1) a' = (2) r = m (3) a' = a + r The net effect is a ' = m Clear add (S5 M) (1) a' = (2) r 5 ' = q (3) a' = a + r 5 The net effect is a ' = q c. Hold add (lk M) (1) r 3 ' = m (2) a 1 = a + r 5 The net effect is a ' = a + m 3^ Hold add (si [ M) (1) y r = q. (2) a' = a + r 3 The net effect ; is a' = a + q. Four subtraction instructions correspond to the above. When a subtraction is executed the complement gate is activated and takes the digitwise complement of the number transmitted through it. Also a circuit is activated to add 1 into the least significant digit of the adder. This appears as a -ho carry digit from the non-existent 2 position. It will be observed that these operations have the effect of taking the 2 f s complement of the number brought 3 from R . The nature of these instructions is listed below. E. Clear subtract (LI M) digitwise comple- carry insertion ment from comple- into right-most ment gate position of adder. The net effect is (k) a ' = -m ( remember in the machine -m is represented by 2-m) F. Clear subtract (SI M) (1) a' = (2) r 3 ' = q (3) a' = a + (2 - 2~ 39 - r 3 ) + 2 -39 The net effect is (M a' = -q 35 G. Hold subtract (LO M) (1) r 3 ' = m (2) a' = a + (2 - 2~ 39 - r 3 ) + 2~ 39 The net effect is a ' = a - m H. Hold subtract (SO M) (1) r 3 ' = q (2) a' = a + (2 - 2~ 39 - r 3 ) + 2~ 39 The net effect is a ' = a - q The above outlines should give some insight into the nature of the elementary operations of addition and subtraction performed by the ILLIAC <■ The execution of all instructions will not be outlined in detail as above but the logic involved should be reasonably apparent from the above introduction to addition and subtraction. Other operations of addition and subtraction involve the manipulation of absolute magnitudes . A list of these operations follows . a ' = a + |m | |m | a ' = a + |q | a ' = a - |q | These operations may be performed with or without initial clearing of A. These operations can easily be performed by testing m (the sign digit) and activating or inhibiting, accordingly, the complement gate and carry insertion circuit to yield the above sums and differences. 36 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 7 SHIFTING Registers A and Q are called shifting registers because it is possible to translate their contents to the right or to the left according to the following rules . Let a = a a l a 2 ■*■ a 39 ( 6_1) q = q Q q x ^ ... q^ then after one right shift a ' =a a 3 1 a 2 "• a 5 8 (6 " 2) q ' =q O a 39 ^^ ■- q 38 In the right shift notice that (1) a' = a.^ , q!_ = q ± _ 1 except (2) q^ = a (5) a = a W *6=\ (5) q, g is lost. A left shift of (6-1 ) yields 37 a< = ai a 2 ... a 39 q x (6-3) q' = Oq -.. q 59 In the left shift notice that (l) a! = a , q| = q l l+l ' i H i+1 exce £l (2) a 3Q = % (3) q.4 g = zero CO ^ = q Q (5) a is lost. Thus in the shift operation A and Q are connected (this connection is not indicated in Figure 6-1 ) in the sense that digits may be transferred between A^„ and Q n . The position £3 does not take part in the shifting. The transfer 39 1 of bits in the shift operations is illustrated in the figures below. •PROPAGATE SIGN THIS BIT IS LOST \ Cr \r\r*_ r\r\r\f I 2 QlQl 37 36 39 I 2 r\r\ r\r\ 37 38 39 A Q Figure 7-1 Illustration of the transfer of bits when 1 right sir! '1 Ls ex :u1 L. 38 /■ THIS BIT IS LOST THIS BIT IS ZERO, V \f\ f\f\f\/ I 2 f\f\ 37 38 39 I 2 Q j\f\rc 37 38 39 Figure 7-2 Illustration of the transfer of bits when 1 left shift is executed. One can regard a and q as representing a single number, a being the most significant part and q being the least significant part, namely, aq = a_ x 2 + a x 2~ + ... + a x 2 ■39 (6-k) ko -kl ^-78 + q x x 2 + q 2 x 2 + . . . + q^ g x 2 Now if aq is positive and less than l/2 (i.e. a = a = 0) then it is obvious that a right shift yields aq' = 2 aq (6-5) and a left shift yields aq 1 = 2 aq (6-6) These relations remain true even if aq is negative provided that |aq| < - (i.e. a Q = a = l). Let aq be the ILLIAC representation of a number x aq = x* = 2 + x . (mod 2) (6-7) 39 Consider a right shift when a = 1; that is, x negative. aq' = | X* + 1 = 1 + |+1 (mod 2) (6-8) t / from a ' = a = 2+| . (mod 2) X X But 2 + — is the representation for — , thus aq' = ( | )* (6-9) It is seen that the condition a' = a_ insures that negative numbers ,are correctly- halved by a right shift. Now consider a left shift when a = a =1 aq" = 2x* -2=k+2x-2 (mod 2) (6-10) t t Because a n is lost = 2 + 2x . (mod 2) (The -2 could be omitted since we are doing arithmetic mod 2.) But 2 + 2x is just the representation for 2x, thus aq' = (2x)* . (6-11) One important detail in the above remarks concerning the right shift has been overlooked . In a rig? do not have precisely overlooked . In a right shift q is lost and if q^ q = 1 it is clear that we but (aq)' = ( | )* (aq)« = ( | -2" 79 )* ko -79 An error of 2 has thus been generated. If q, n = no error is generated by the right shift. Our considerations have been restricted to |x < — to guarantee that a left shift will always yield a number that does not exceed scale; we can permit x = - ^ without exceeding scale with one left shift. The violation of this condition is a common source of overflow error. It should be mentioned here that an ILLIAC shifting register is physically composed of two registers, designated in the case of A as A (A lower) and A (A upper). A temporarily holds a during the shifting operation, thus the left shift consists of the logical events (1) (2) ' = a. i -i — a . l-l l The flow of digits is indicated schematically below. A right shift is achieved i-1 i i+1 i+2 1 i-1 l\ / k / k / k i+1 i+y Kh PORTION OF A PORTION OF A Figure 7 - 3 Showing the flow of digits in a left shift operation. in in a corresponding fashion. The necessity for this arises from the difficulty- encountered when one tries to transfer information into a position already holding information which itself must be transferred. There are of course other ways of handling this problem but this is one of the most common. Unless specifically noted otherwise we will always mean A when we refer simply to A. The above remarks apply to Q as well. UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTEP 8 MULTIPLICATION The operations of multiplication and division are composed of a sequence of addition and shift operations. Multiplication, being somewhat simpler, will be discussed first. The multiply instruction always assumes the multiplier to be in Q and the multiplicand to be taken from location M in the memory. The location M is specified in the address portion of the multiply instruction. Before the multiplication process is initiated m is brought into R . The product at the completion of the multiplication operation appears in AQ as a double length number. Notice that provision for a double length number is necessary for maximum accuracy since two 39 digit numbers (omit sign) yield a 78 digit product. We consider first the formation of the product xy where x is called the multiplier and y the multiplicand g and both are positive. The logical steps follow: 1. x is in Q, and we assume A is clear 2 . Bring y from the memory into R 3° Sense Q (i.e. sense x ) .3 h. If x,q = 1 form a ! = a + r (i.e. a + y) 5. If x = proceed to step 6 6. Execute one right shift of AQ 7» Sense Q_,_ (i.e. sense x, D ) 39 3o - 8. If x^n = 1 form a* = a + r 9- If x n = proceed to step 10 10. Execute one right shift of AQ and so on until all digits x,qj x xQ' ' " ' x i have "been sensed. The product then resides in AQ. ^3 Referring back to the example written out in Chapter 3 it is seen that the above process corresponds exactly with the conventional process carried out there. To further illustrate this process the successive stages of AQ for an example (the second one executed in Chapter 3) are shown below. We assume 6 bit registers for simplicity. A Q R 5 0.0 0.1 1 1 1 0.0 1 1 0.0 1 1 0.0 1 1 1 0.0 1 1 0.0 1 1 0.0 1 1 0.1 1 0.0 1 1 0.0 1 1 0.0 1 0.1 1 Sum and Shift Sum and Shift Sum and Shift Shift Sum and Shift The product in AQ is .0 1 1 1 . It is possible for overflow to occur at an intermediate stage of this process, just before a shift, and since a 1 in a will propagate with a right shift a special provision is made to inhibit the propagation in this instance. Multiplication involving a negative multiplier is somewhat more complicated. Suppose x < and y > , then y* = y x* = 2 + x . The number x* is in the quotient register at the outset of the multiplication operation, and the digits of this number are successively shifted into Q, and tested during multiplication except for the sign digit of x* (because the digit in Q is not affected in a shift operation). Hence the product that is actually formed by the machine is (x* - 1) y* = (l + x) y = y + xy (8-1) The desired result is, of course, (xy)* = 2 + xy (mod 2) (8-2) The result shown in Equation (8-1 ) can easily be corrected to obtain the correct result by simply subtracting y: (x* - 1) y* + (-y)* = (1 + x) y + 2 - y = y + xy + 2 -y = 2 + xy Consequently, to insure a correct product, the sign digit of Q, Q~, is sensed after the 39 step shifting and adding process described above is complete and if q n = 1, then the multiplicand (i.e. y) is subtracted from the "product" to obtain the correct product; if q = no correction is necessary. It is to be understood that the sensing of Q and correction of the product, if necessary, takes place automatically as a part of the multiplication order. After Q is sensed its contents are set to zero (i.e. qi = 0). This step is necessary to give the correct algebraic representation to the least significant part of the product. The double precision number, N, expressed in terms of the contents of A and Q at the completion of the multiplication is where N = a + 2" 39 q (8-3) 39 a = -a_ + S a. 2 ° i=l X 39 i q = -q Q + Z q ± 2 i=l ^5 It is important to recognize that q^ must be zero for Equation (8-3) to be -78 correct; e.g. the double precision number -2 is correctly represented in a and q when a = a l = a 2 = ••' = a 39 = 1 for then q = 0, q x = q 2 = . . . = q^ = 1 a + 2" 59 q = -2" 59 + 2" 59 ■ (1-2- 59 ) = -2" 78 There are a number of variations of the basic multiply instruction, for example ILLIAC will perform (aq)' = q m + 2 a ,q V with A initially not \ cleared, cleared to zero, (aq)' = q |m| + 2 a J or set equal to l/2 as desired. In connection with multiplication, a common coding error is to forget that the multiplier is to be placed in Q not in A at the outset of a multiplication. U6 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 9 DIVISION For positive divisor and dividend, the ILLIAC division process is analogous to elementary long division. At the outset of the division process the dividend, call it x, is in AQ, and is thus treated as a double length number. This feature provides consistency with the precision of the double length product obtained from a multiplication. The divisor, call it y, is brought from the memory, the location being specified by the address of the divide instruction, the following rules : 3 divide instruction, and placed in R . Division then proceeds according to (1) Form a - r in the adder (i.e» [most significant part of x]-y) (2) q' = if a - r 5 < 0, or q' = 1 and a' = a - r if a - r J > 5 jy — a - r is called the partial remainder ; (3) (aq)' = 2(aq) and q! = q , i.e. a left shift with q shifting into q n as well as a ; (k) Form a - r and so on until 39 such tests and shifts have been executed j (5) q4q = 1 5 hence, when the shifting is completed a one resides in Q^ n *° jy At the completion of (5) above the rounded quotient resides in Q and a quantity called the residue resides in A. Step 5 provides the rounding. The first digit entered into q , step 2, is the sign digit of the quotient. Since q^ shifts into q it is seen that on the last shift the sign digit will enter q Q . When divisor or dividend or both are negative the rules are similar. one is actually placed in Q at the outset of the division process. The quotient digits generated in step (2) above are placed in Q and get gated into Jy Q on the left shift operation in step (3). The contents of Q Q are held to 1 during the shifting process, ^7 To further illustrate the division process we will follow the states of A and Q and the tentative partial remainder in a sample problem (the first division problem of Chapter 3) • The registers are shortened for simplicity. Tentative , A Q Partial FT Remainder 0.1 0.1 1 0.1 1 1.1 1 1 0.1 0.0 1 1 q 3 ° 1.0 1 1.0 and shift S = 1.0 0.0 1 and shift q 3 " 1 0.1 1 0.1 1 and shift round 0.1 1 0.1 1 1 An important difficulty encountered in division is that unlike addition, subtraction and multiplication, it produces a result that in general cannot be held in a register of finite length. The quotient is therefore rounded to provide a more accurate result than would be obtained by a simple truncation at the 39th digit of the quotient. This rounding scheme is discussed in Chapter 26. The fact that the remainder is not directly avail- able on completion of the division, but must be generated from the residue somewhat complicates this operation. The relationship between the dividend x the divisor y, the quotient z and the remainder r is x = y z + r . (9-1) ILLIAC division yields a quotient z', the "machine quotient", and a corresponding remainder r' satisfying the relation x = y z' + r' . (9-2) k8 In general z' £ z and r 1 £ r. z 1 is in fact related to z according to z + 2" : ' (1 - z 59 )(l - 2 y Q ) (9-3) From which we see that z' = z if the true quotient has least significant digit i x -59 -59 1, z = 1. If z = then z' is in error e ( = z - z' ) by +2 ^ or -2 according as the divisor was positive or negative. Now consider the remainder. We represent the residue, the number in A at the completion of the ILLIAC division, by r . We have for r 1 (see Eq. 9-2) ■39 ■78 (r + (2 es i) y) + 2" (x ?8 - z Q ) ■78 Thus, except for a possible error of 2 -39 r' ~2 ' (r - y) for positive quotient es ■39 r' = 2 (r + y) for negative quotient tb When the dividend exceeds the divisor in magnitude, or when their magnitudes are equal, the results described above do not apply. The special situations that result are listed below. Quotient |dividend | > | divisor i- hangup* |dividend = |divisor| and dividend + T- hangup* dividend -, divisor + - 1 + 2" 59 dividend -, divisor - 1 - 2- 59 * ILLIAC stops with the divisor in V,' J , k 9 If the divisor is -1, the ILLIAC generates a quotient which is the digitwise complement of the dividend except for the quotient roundoff. The programmer must exercise caution in scaling his problem to avoid the generation of a f hangup. Some computing machines do not stop under the above conditions but set an indicator when an improper division has taken place. A special instruction tests the state of the indicator and thus permits the programmer to rescale the numbers and do a proper division automatically; the IBM 70^- has this feature. It remains, however, generally more efficient to scale properly at the outset to prevent such a situation from arising. Aside from improper scaling leading to a ~ hangup, one of the most common coding errors in connection with division is to forget that the quotient is in Q not A. Another common error is to forget that the dividend is in AQ not just in A alone. 50 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 10 THE ILLIAC ORDER CODE - I In Chapter 5 the structure of the ILLIAC instruction word was discussed. The significance of the digits will now be examined in more detail. A ^0 digit register is drawn below showing the significance of the digital positions for an order pair. c 2 3 4 5 6 7 6 9 10 II '2 ? 4 15 .6 17 18 19 20 21 22 23 24 25 26 27 28 29 3031 32 33 3435 36 3738 39 • T h L V _ . T rl V NOT USED 1 FUNCTION NOT ADDRESS FUNCTION 1 1 ADDRESS DIGITS n USED Dl SIT S LH ORDER 1- RH ORDER ^ The function digits are grouped into two tetrads; the first is called T and specifies the order type ; the second is called V and specifies the one of the possible variants of the order type. T has sixteen possible k values, 2 . These values with the order type they specify are listed below. 51 T 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 N Not used J Extract F Increment add L Add LIST OF ORDER TYPES There are also sixteen possible values for V but not all are used. The individual binary digits of V have in many cases, but not all, a unique significance independent of the other digits of V and T. This feature is a considerable help to the memorization of the order code. The various effects of V will be illustrated in the following examples . In this chapter and the five succeeding chapters the use of various ILLIAC orders will be illustrated by a number of examples*. In these examples the address will always be written as a decimal integer, it being understood that in the machine this number is a binary number. The function digits T and V will always be written as sexadecimal characters. Parentheses will indicate the contents of a memory location; (100) denotes the word in memory location 100 , (101) denotes the contents of location 101 , etc. It will be assumed that the order pairs are stored sequentially beginning at memory location 10 . * The complete order code is in Appendix k, pp. 251-270. 52 Examples of the use of order types k and L . Example: (102)' = (100) + (101) 5 i.e. add the number at location 100 to the number at location 101 and place the sum in location 102. The sequence of instructions, written as order pairs is listed below. The WM location of the order pair is in the left-most column. WM Order Pair Comments 10 L5 100 Lk 101 a' = 0, a' = a + (100) a' = a + (101) 11 kO 102 OF 000 (102)* = a STOP The least significant V digit, V, , causes A to be cleared or not according as V. = 1, V. =0. This clearing is always done first before the remainder of the operations of the instruction are executed: this property of V, is true for all order types . Thus in the LH order at 10 the variant digit V = 5, having V, = 1, causes a' =0 first. This is a clear-add order. Notice that the EH order at 10 has V, = so the contents of A are not initially cleared. The iA order thus achieves the sum (100) + (101 ) with the result residing in the A register. The Lk order is a hold -add order. In an L order the state of VY (V = Vn VY V p V, ) indicates whether or not the number brought from the R register into the adder is to be complemented as it passes through the complement gate and a carry added into the least significant digit in the adder (see Chapter 6). Thus, if VY = the number from R is subtracted from the contents of A, and if V, =1 the ,3 , k number from R is added to the contents of A. Above we see that V. = 1 for both L orders to specify that the desired additions are to be performed. The LH order at 11 is a store order. It places the contents of the accumulator into the WM at location 102 . We might notice here that if V were equal to 1 in this order, then A would be cleared first and then the contents of A would be placed in the WM at 102 ; the net effect being to put zero in A and WM location 102 . 53 The last order at the RH position of location 11 is an order causing the ILLIAC to stop. Any order in which Vo = 1 and V = independent of the state of the other digits of T and V causes ILLIAC to stop; in this case we note V = F so Vo = 1 and V, = 0. A read from the memory for an operand does not change the state of the location consulted. In the example above locations 100 and 101 are unchanged when the addends are read from them. (The store order (h-O) does change local: 102 but not A. ) This also applies to the reading of the instructions by the control unit. In the above example the control unit must read locations 10 and 11 which hold the orders it must execute. This reading does not change the state of these locations. In fact if after the STOP (OF 000 ), the control counter was reset to ten and ILLIAC was restarted these very same orders would be exe- cuted again and would give exactly the same result as before. Example 2: (102 )' = (100) - (101). The instructions are listed below. WM Order Pair Comments 10 L5 100 L0 101 a' = 0, a' = a + (100) a' = a - (101) 11 kO 102 OF 000 (102)' = a STOP Here just Vi of the RH order at lp is changed from 1 to 0. Otherwise the instructions are just as they were in example 1. V> = causes the subtraction to be executed., It is perhaps obvious but nevertheless take particular notice of the effect that a change of one binary digit has in this computation. One cannot emphasize too strongly the need for writing every order with great care, since the slightest error can completely change an instruction. The ILLIAC does not execute what you "meant" but what you "wrote". This same calculation can be done with a slightly different sequence of instructions. This alternate scheme is shown below- 5- WM Order Pair Comments 10 LI 101 lA 100 a' = 0, a' = a - (lOl) a' = a + (100) 11 1+0 102 OF 000 (102)' = a STOP In the LH order at 10 V. =1 causing A to be cleared first; V, = causing the subtraction a - (lOl), the net effect being to put - (lOl) into A. The hold -add instruction at the RH of 10 has the effect of placing (100) - (lOl) in A. Example $ ; (102)* = (100) + | (lOl) | ; the vertical bars denote absolute magnitude. The instructions are listed below. WM Order Pair Comments 10 L5 100 L6 101 a' = 0, a' = a + (100) a' = a + |(101) | 11 kO 102 OF 000 (102)* = a STOP In the L order the variant digit V p specifies whether or not the absolute magnitude of the number from R is to be added to the contents of A. If V = 1 the absolute magnitude is added to a; if V ? = a normal addition is performed. The adding of the absolute magnitude of a number is effected by simply testing the sign digit of the number in R^ and then setting the gates for an addition or subtraction according as the outcome of this test yields or 1 for the sign digit of the number in R . Because of this technique for producing the absolute magnitude of a number it should be noted that the absolute magnitude of the machine representation of -1, namely 1.00 ... 0, is -1. This is a peculiar situation which can cause difficulty if overlooked. Example k : (102)' = (100) - |(lOl)|. The instructions are listed below. 55 WM Order Pair Comments 10 L5 100 L2 101 a' = 0, a* = a + (100) a' = a - | (101) | 11 hO 102 OF 000 (102)' = a STOP The RH order at 10 has V, to cause a subtraction and V,. 'h - -2 the absolute magnitude of the operand to be used. An alternate sequence of instructions producing the same result is given below. 1 to cause WM Order Pair Comments 10 L3 101 L4 100 a' = 0, a' = a - | (101) | a' = a + (100) 11 40 102 OF 000 (102)' = a STOP The negative of the absolute magnitude of (101) is here brought into A with the LH order at 10; V, = 1 causes the initial clearing of A. Example 5 ; (102)' = i + (100) - (101 ). Just as V = 1 causes A to be initially set to zero it is also possible, via the variant digit, to set A = ^ initially. This is effected by setting Vq = 1 and V = 1. The sequence of instructions below illustrates the use of this feature in doing the above computation. WM Order Pair Comments 10 LJ 100 LO 101 a' •= | , a' = a + (100) a' = a - (101) 11 UO 102 OF 000 (102)' = a STOP 56 The variant digit J in the LH order at 10 has V n = V = 1 and thus initially causes — to be put into A; V, = 1 signifying addition. The ability 1 to thus preset the accumulator to p , which now seems unimportant will later be seen to be quite useful. Example 6: We have discussed two forms of the store order, namely UO and kl. The store order can also be used to effect a partial substitution} the left or right address digits of the accumulator may be placed in the corresponding position of a word in the memory leaving tl nainder of the word in the memory unchanged. This type of order is used most commonly to change the address of orders in a code. An example is giver, below. Suppose that in some part of a program we want to form the sum z= x + y, where the memory location of the number x and the memory location of the number y have themselves been computed by the program. Let. us assume that the computed memory location of x has been placed in the LB address digits of the word at 215; thus it is stored as the fraction (x -address ) -2 . Let as a ssume that the computed memory location of y has been placed in the RH address digits of the word at 230; thus it is stored as an integer or alternatively as a fraction -■50, (y-address) »2 ' . The instructions below will produce z = x + y at location 100. Square brackets indicate that an address is altered by the program and if the word at location L caused the alteration we write "by L" in the comments column alongside the altered address. WM Order Pair Comments 10 L5 215 a' = (215) he 12 Plant LH add. at 12 11 L5 :• 50 a' = (230) h2 12 Plant RH add . at 12 12 L5 [000] By 10; a ' = x L^ [oco] By 11; a ' = x + y 15 ^0 100 (100)' = x + y = z OF' 000 STOP 57 The k-6 instruction at RH of 10 puts the address of x into the address digits of the instruction at LH of 12. Variant digit V = 1 identifies the kG order as a partial store order. Variant digit V> = 1 identifies the h6 order as a left-hand address store order. The \2 instruction at RH of 11 puts the address of y into the address digits of the instruction at RH of 12. Again, variant digit V = 1 identifies the h2 order as a pa rtial store order. Variant digit V. = identifies the k-2 order as a right-hand address store order. Thus, we see that at the time of execution of the orders at 12 these orders have been given the desired addresses . We have assumed in the above example that the x address and y address are held "clean" in the left and right address positions of the words at 215 and 230; "clean" here means that all other bits in the word are zero with the exception of these addresses. This simplifying assumption was completely unnecessary since the partial store orders affect only the 10 address digits, left or right according as ?i = 1 or V, = 0, respectively. It is important to recognize that the two unused digits are not affected by the partial store order. Neglection of this fact is the source of a common coding blunder. In a h order V = 1 causes an initial clearing of A. Thus a U3 order first clears A and then puts the right address digits of A into the right address digits of the specified memory position. It is thus possible to clear just the address portion of a word. The order k2 m, if located at the LH order position of m itself, will alter the address of the RH order at location m in the memory . But at the time of execution of the \2 m order the RH order at m is already in the instruction register and is unaffected by the te order. Consequently in the order pair p-1 p U2 p L5 [0] p+1 the \2 p order will not change the address of the next order to be obeyed, namely the L5 [0] order, although it will change the word at location p in the memory in the usual way. Overlooking this is a not uncommon source of headaches . 58 UNIVERSITY OF ILLINi DIGITAL COMPUTER CHAPTER 11 THE ILLIAC ORDER CODE - II Examples of the use of order types 2 and 3 . Type digits 2 and 3 signify transfer orders. The type 2 order is called an unconditional transfer order and the type 3 order is called a conditional transfer order. The word "jump" is frequently used synonymously with transfer. The use of the un- conditional transfer order is illustrated in two examples below. Example 1 ; Let us suppose that at location 10 we have a block of orders to perform x+y=z; xisat 100, y at 101. and z is to be stored at 102. Further let us suppose that following this calculation we want to perform u + v = w; u is at 105, v is at 10k, and w is to be stored at 105° We assume that the instructions to do this latter calculation are stored in a block at 20. Using the notation of Chapter 10 we have to perform, (102)' = (100) + (101) (105)* = (105) + (10M WM Order Pairs Comments 10 L5 100 LU 101 a : = x a ' = x + y = z 11 kO 102 26 20 (102)' = z Jump to 20 20 15 103 Lk 104 from 11, a' = u a ' = u + v = w 21 ^0 105 OF 000 (105)' = w STOP 59 After execution of the ho order at 11 the unconditional transfer order causes the control counter to be reset to 20. The V. digit is 1 in the 26 order indicating that the next order is to be taken from the left side of the word at 20. Notice that like the store order (T = h) V, = 1 refers to an operation involving the left half of a word, and V. = (22 is a jump to the right side of a word) refers to an operation involving the right half of a word. It is customary to write "from m"' in the comments column (see word at 20) opposite the word to which the transfer has been made, with m being the location of the transfer instruction. Example 2 ; An example of the use of the 22 instruction is given below where it is assumed that the block of orders executing u + v = w begins at the right side of 20. WM Order Pair Comments 10 L5 100 Lk 101 a ' = x a ' = x + y = z 11 kO 102 22 20 (102)' = z Jump to 20 20 L5 103 from 11, a' = u 21 Uo 105 a ' = u + v = w (105)* = w 22 OF 000 STOP Here the 22 order at 11 causes the jump to the right side of 20. Every program worthy of a high-speed digital computer has at least one "loop" in it and frequently it contains many "loops". A loop is a set of orders which are executed more than once, commonly with modification of some 60 of the orders. Thus, to perform z = Z x. (11-1) i=l X one uses a loop containing one add order (and certain other orders,) which is executed repetitively just n times. The necessity for enabling a high-speed computing machine to execute such a loop is immediately evident when we consider the alternative way of computing this sum by simply writing explicitly every add order into the code when n is 4,000. It would be impossible to get all of the orders in the memory at one time. Furthermore, the time needed to write out each add order could just as well be taken up in executing the sum on an adding machine. Finally, let us observe that the time required to execute 20^-8 instructions, the maximum that can be held in the IL1IAC memory, is about 0-3 seconds (assuming 150 u sec. per instruction) while the time taken to read 20^8 orders into ILLIAC is at least yh seconds 5 consequently, without loops a considerable portion of time would be consumed in a long program in the relatively slow process of reading new instructions into the memory. One can recognize immediately two necessary properties of the loop for the calculation of the sum (ll-l) - First, on each pass through the loop a new addend x. v is required; therefore it will be necessary to alter the address of the add order on each pass through the loop. Second, the program must somehow automatically determine when the required number of passes through the loop has been achieved, and then arrange to stop executing the loop and proceed to a new set of orders. The second feature of the loop, the end test, requires as a necessary part the conditional transfer order which is perhaps the most valuable single order in the computer since it does make the loop possible. Examples of the use of the conditional transfer order are given below. Example y °. First we consider a set of instructions to perform the sum (ll-l) above, assuming n = 100 and that the x.'s are stored in a block at 201 (x, in 201, x in 202, etc.) and the sum z is to be stored at 500. We further ■J- c. assume that the x's are sui scaled so that the sum is in machine range, To perform the sum we use the iterative scheme z =0 Z. = X. + Z. -, 1 1 1-1 Z 100 " z The program for this calculation follows 61 WM Order Pair Comments 10 ki 500 partial sum = L5 [201] by 13, from 15; a' = x ,x . '• X l 11 l4 500 4o 500 a' = x. +z. , =z. l l-l i 12 L5 10 Lk 16 Modify address 13 k2 10 (10)' = (10) + 2 -5 ' L5 17 step end counter Ik LO 16 ko 17 (17)' = (17) - 2' 5 - 15 32 "10 transfer when (17) > OF 000 Stop. Here when (17) = -1 x 2^9 16 00 000 00 001 = 1 x 2" 59 17 00 000 by lUj = 99 X 2" 5 ' 00 99 end counter (C , ) end A "flow chart" of the logical operations for this calculation is given below. 62 START Clear Sum Box; z = Sum; M y 1 i f y Addend Address I 1 = i + 1 > z. = x. + z. . 1 X 1 " 1 No Step End Counter end end C J > ? end — STOI Yes The order at LH of 10 clears the memory location in which the sum is to be located; it executes z = 0. The following three orders execute the actual summation; they do z. = x. + z, . Next,, beginning at the LH of 12 are three orders which modify the address at RH of 10, namely the addend address, so that on the next pass through the loop the next addend, x. , , will be summed. 1 -r L Notice that in this modification the order pair is treated just as a number, -39 the effect of adding 1x2 to this number being simply to advance the address of the RH order by 1. The modified address is placed back in the memory via the k-2 order. A ^O order could just as well have been used for this purpose" however, for reasons which will become clear later it is best to use the partial substitution order for this purpose. Following the address modifi- cation orders there is a set of orders used to count the number of passes through the loop and test for the end. For this purpose location 17 is used as a "counter". On the very first entry the counter is equal to 99 x 2~ . _ . -39 This counter is reduced by 1 x 2 on each pass through the loop. The conditional transfer is executed as a transfer to RH of 10 so Long as the counter remains positive (including zero) ana it will not be so executed as soon as the counter 63 becomes negative. After 99 passes through the loop the counter will be equal to zero, the transfer will be executed and one more pass, the 100th, will be made after which the counter is reduced to -1 x 2 . At this point, since the counter is negative, the transfer is not executed and the next order is taken from RH of 15 . Thus 100 passes have been made through the loop and the desired sum is in location 500 when the OF order is encountered „ V, = on the conditional transfer order prescribes a transfer to the right side of the location specified by the address, just as with a type 2 order. In fact, all V digits have the same significance for type 2 and type 3 orders. The flow chart above which illustrates the logical sequence or "flow' of events in a pictorial fashion should be self explanatory. Many programmers find these charts to be helpful in laying out the logic of a program. For complex programs they are almost essential prerequisites to writing the code. Example U ; There are many sets of orders which could be used to achieve the same result as above. An alternative code is given below, WM Order Fair Comments 10 kl 500 partial sum = L5 [201] by 13, from l^j a - x 1 ,3C g " x ic 11 ho 500 500 a • = x . + z . . = l l-l (500)' = z. z . l 12 L5 Lk 10 16 modify address 13 \2 10 L0 17 end test 14 36 15 transfer if end 22 10 here if not end 15 OF 000 from Ik i Stop 16 00 00 000 001 by L2 17 hi 500 end constant L5 301 by 13 v, The difference between this code and the previous code is the manner in which the test for the end is carried out. Here the order pair ax 10 is itself used as a counter. Notice that this order pair represents a positive -3 Q number which increases in units of 1 x 2 " with each pass Through the loop. After 100 passes through the loop, including the 100th address advance, the order pair at 10 will be precisely kl 500 L5 301. Now in this co.ie the maximum value of location 10 is subtracted from the current value of location 10 on each pass through the loop to see if the maximum value has been achieved. If it has not been achieved, then the result in the accuinuli 1 t will be negative and the conditional transfer will not cause a transfer; instead, the 22 order at RH of 1^4- will be executed for a new pass through the Loop, But when 10 contains kl 500 L5 301, then the subtraction will yield zero, a positive number, in the accumulator and the transfer to the OF order will be executed to terminate the loop. In this code a half-word has been wasted, named ■ RI of 15° Example 5 ' The code below shows still another slightly i liferent scheme for computing the above sum. WM Order Pair Comments 10 in 500 Partial sum = L5 [201] by 13, from lk- a' = x, ,x , " x l( 11 ih 500 a ' = x . -!- z . , = z . 1-1 l ko 500 500' = - 12 L5 I> 10 15 modify addre. 13 k2 10 L0 16 end test Ik 36 15 transfer if end 22 10 here if not end 15 OF 00 000 1 from Ik-, by 12} STOP 16 kh 500 end constant L5 301 by 13 65 Here the word at 15 is used to effect the unit increment of the right address at 10. However since 15 contains the non zero digit F in the left order the increment of 10 will cause F to be added to the variant digit of the left order at 10. The partial substitution order (LH of 15) insures against this alteration of the variant digit being put into the memory; this would not be the case if a kO order had been used instead of a h2 order. It is clear that a different end constant than that used in the previous example must be used here. In the present case the accumulator will contain a = kL 500 L5 501 (1 + F) after the 100th address advance; consequently the end constant used here (see location l6) will just give zero on the subtraction (RH of 15), a negative result always being obtained before the 100th pass. The variant digit V p = will cause the ILLIAC to stop before a transfer is executed with either the type 2 or type 5 order. The operation of the ILLIAC can be resumed with the setting of a switch called the black switch on the control panel of the ILLIAC. When V. = 1 for either the type 2 or type 5 order the accumulator will be cleared. The accumulator is cleared before the sign digit of the accumulator is tested in the type 5 order and consequently V = 1 will always cause the transfer to be executed in a type 5 order. 66 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 12 THE ILLIAC ORDER CODE - III Examples of the use of order types 0,, 1 and F . The shift instructions, types and 1, are used for multiplying by powers of 2 and also for strictly logical operations. Examples of each use are given "below,, The increment add order, type F, is used primarily for counting and incrementing addresses. It can be used to replace the L5, L^ combination used previously as will be seen in the following examples . Example 1 ; Let us suppose that a list of numbers x. (i = 1, 2, ..., 50) is stored in a block at 200 and another list of numbers y. (i = 1, 2, ..„, 50) is stored in a block at 250. It is desired to compute a third list z. = x_. + — p y. (i = 1, 2, ..., 50) and store it in a block at 300„ The flew chart and code follow. Plant x address y address z address x. + r y. =2. 1 h J i i end end a 5Q .-.a 59 » (x address ) + 1 ( 1 C „ > ? end - No 1 Y'es r STOP 67 WM Order Pair Comments 10 LI 20 ko 21 Set initial value of end counter to -50 11 L5 19 k2 15 From 18 Plant x address 12 iA 20 h2 lk Plant y address 13 Lk 20 00 20 lk k6 16 L5 [o] Plant z address By 12; a' = y. 15 10 2 IA [0] 1 by ii; n y,- + x -,- = z , H- 1 1 1 16 1+0 [0] F5 21 by lk% store z. 1 end end 17 UO 21 36 19 Jump if done 18 F5 15 22 11 Jump to compute next z 19 OF 000 00 200 From 17; STOP By 11 20 00 000 00 50 By 10, 12, 13 21 [00 000 00 000] By 10, 16, 17;C end The "working part" of this code, that is the part which does the actual arithmetic computation of z, is composed of the orders in the RH of lk to the LH of l6 . The remainder of the code is devoted to "bookkeeping", or "housekeeping" as it is sometimes called- In the working part of this code it 68 is seen that a right shift of two places is used to multiply y. by l/k. (Similarly a left shift of two places would have effected a multiplication by 4- . ) The left shift is also used in the housekeeping orders, RH of 13, to position the address of z . When the z address is computed it is held in A as a RH address, it must i i then be shifted to the LH address position since the z. reference is made by a LH order (LH of l6). This example also illustrates the use of the increment add order, type F. At location l6 the F order is used to increase the end counter; it advances -39 / \ the end counter by 1 x 2 (or integer 1) on each pass through the loop. At location 18 the F order is used to advance the x address on each pass through the loop. The other addresses are generated by adding 50 to the x address, to form the y address, and then adding 50 to the y address to form the z address. The modified addresses in the loop and the counter are "preset", that is at the very beginning the initial value of the end counter, the x address, y address and z address are stored in the proper positions in the ^ode. In the earlier examples it was always assumed that the addresses which were modified in a loop were stored in the memory with their correct initial address. However it is generally good coding practice to preset such addresses as in the above example. One reason for this is that frequently the loop is part of a larger program and is to be used again at some later point in the program. Presetting the addresses will always guarantee that the loop will always have the right starting addresses on entry into the loop no matter how often the loop has already been used. It is of course possible to "post-set" the addresses; i.e. store them in the memory with their correct initial value and then reset them to their initial value upon exit from the loop. This procedure is susceptible to coding blunders, one reason being that there is frequently more than one exit possible from a loop and one forgets sometimes to post-set addresses on all possible exits. In this example one should also notice the efficient use that is made of the address planting orders. They are used both in the presetting part of the routine and in the address-advance part. Another illustration of the use of the shift order, a strictly logical use, is given below where the sum of the digits in a word is computed. 6 9 Example 2: Let us suppose the word w in location 100 is w = w W l w 2 * * ' V 39 (w. = 0, 1) and the following sum is to be computed, 39 Z w. = S ; i=l X thus, we desire the sum of the digits of w excluding the sign digit. The sum is to be stored in location 200. The flow chart and code appear below. Set end counter C end " -39 Clear sum box, i.e. S, w ' = 2" 59 (acj (aq) right shift 39 w- (aq) 1 = 2(aq) with initial clearing of A S. = w. + S. ., l l l-l Yes 70 WM Order Pair Comments 10 11 17 Set end counter ko 18 C . = -39 end 11 4i 200 Clear sum box L5 100 a ' = w 12 10 39 w into Q 01 1 -39 From 15; a' = w. x 2 J7 13 L4 200 S. = w. + S. , l i l-l 40 200 14 F5 18 c' = c „ + 1 end end 40 18 15 36 16 Jump if done 22 12 return for next iteration 16 OF 000 From 15; STOP — Waste 17 00 000 End constant 00 039 By 10 18 [00 000 By 10, 14; C eQd 00 000] The order at LH of 12 moves the digits w w Q W 39 int ° Q i Q 2 Q 39' At the completion of this shift A will contain all O's or all l's depending on whether w was positive or negative, since a 1 in the sign position propagates on a right shift. (See Chapter 7, page 36, item (3) of the right shift description.) The order at RH of 12 clears A, since v = 1, and then shifts a binary digit from Q 1 into A . Notice that this initial clearing of A before the shift is essential for proper operation of the code. 71 In connection with the shift orders a property which is frequently forgotten is the fact that the address of the shift order is always interpreted modulo Gk . The maximum number of places that aq can be shifted by a single shift order is 63. If a shift of more places is desired, then two shift orders must be used. In the preceeding example we could alter the word at 12 to read 10 103 01 129 without affecting the answer. An address of Gh x n (n = 0, 1, 2 ... ) on a shift, order will cause the ILLIAC to stop. This condition is called a zero left shift cr zero right shift hangup, and is probably the most common type of unexpected machine stop. This property of the ILLIAC is a very desirable safety feature for the coder. The locations of the WM which are not to be used in a program normally contain zero (the memory is "cleared to zero" as a part of the normal starting procedure). A common coding blunder is to transfer to an incorrect memory position and we see that such a blunder will cause ILLIAC to stop immediately on a zero left shift if the transfer is to a location containing zero. This prevents the possibility of proceeding to do a series of nonsense computations after the erroneous transfer and thereby increase the difficulty of an error diagnosis. The increment add order is a frequent source of confusion when VY = ("increment subtract"). At least part of this confusion is removed if one considers the logic involved in the execution of a type F order. The F order is a simple modification of the L order, the modification being simply this 2 if the variant digit indicates addition, then do not complement the number brought 3 from R into the adder but do insert the carry into the least significant digit of the adderj if the variant digit indicates subtraction, then complement the number as it passes through the complement gate but do not insert the carry into the least significant digit of the adder. Recall that the carry is inserted into the least significant digit of the adder when a subtract instruction (LI, LO) is executed in order to correctly form the 2's complement after digitwise complementation in the complement gate (see Chapter 6). We see therefore that F5 3 -59 and FU have the effect of incrementing the number brought from R by 1 x c 72 It is frequently erroneously assumed that Fl and FO correspondingly decrease the -39 number by 1 x 2 " — this is not so as one can clearly see from the above discussion. Fl and FO will in fact cause the digitwise complement of the -39 number m in memory to be added to a: thus FO M does a' = a -m -2 . 73 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 13 THE ILLIAC ORDER CODE - IV Examples of the use of order types ^> , 7 and S . Below, several examples of the use of the multiply instruction, type 7j a^e given. The type 5 instruction (read a number from the WM into Q) normally accompanies the multiply instruction since the multiplier must be placed in Q before multiplication. Notice that a shift instruction is, in general, not suitable for this purpose since the sign digit will not be transferred into Q by shifting . The S order is identical to the L order except that it takes the addend from Q rather than from the memory. It sometimes occurs with the type 7 order as a means for transmitting the least significant part of a product into A. Example 1 ; Suppose that we wish to compute z = c (bx + y ) where the fractions c, b, x, y are in locations 100, 101, 102, 103, respectively, and z is to be stored in location 200. It is assumed that all numbers are scaled so that overflow will not occur. The flow chart and code follow. Form bx (rounded) Form bx + y Form c(bx + y) i i STOP 7^ WM Order Pair Comments 10 50 102 7J 101 q' = x a' = "bx (rounded) 11 Lh 105 40 000 a ' = bx + y Temporary store 12 50 000 7J 100 q' = bx + y a ' = c (bx + y ) (rounded ) 15 kO 200 OF 000 Store z = e (bx + y) STOP The 50 order at LH of 10 places the multiplier in Q in preparation for the multiplication- The variant digit on the multiplication order is J, producing a rounded product in A. Let us now consider how the rounding of the product is brought about. Since variant digit J implies Vq = V, = 1, the fraction l/2 will be placed in the accumulator before multiplication is initiated. From our earlier consideration of the multiplication process (Chapter 8, see the example on page kj) we observe that the initial contents of A are always added _ into the product such that the number actually formed by an ILLIAC multiplication is (aq) 1 = q x r- 5 + a x 2 ; i.e. the initial contents of A are added into the least significant part of the product . Now observe that if a = l/2 the above relation becomes (aq) 5 o-^0 q x r + 2 It is easy to see that this yields a rounded product in A: if the least _1)_0 -4l -78 significant part of the unrounded product, digital positions 2 } 2 , . . . 2 , -ko is greater than or equal to 2 then the above procedure will cause the most •39 if the least significant part of the product to be incremented by 2 significant part of the unrounded product is less than 2 " s then the above procedure will have no effect on the most significant part of the product. 75 The variant digit J also implies V. = 1. This variation causes the contents of R to be added successively to the contents of A, or not added depending on the multiplier digits; i.e. the process would be just as out- lined on page k2. When V. = the contents of R are subtracted from the contents of A rather than added so that a negative product is formed; i.e. -39 / \ - m«q + 2 a = (aqj 1 . Notice that this effect is analogous with the effect that this variant digit has with the type L order. In a similar fashion the V p digit causes multiplication by the absolute magnitude of the number in R when V p = 1 . In the RH order at 11 the partially formed result is temporarily stored in order to properly place it into Q for the next multiplication via a 30 order. Had the number bx + y been positive, a right shift of 39 places would have served this purpose, but had bx + y been negative this shifting would not produce the correct multiplier in Q. It is certain that q = when the order at RH of 11 is executed because the previous multiplication will have produced a zero in Q ; multiplication always produces q = 0. In this example we come upon, for the first time, a thing called temporary store. In most programs it is necessary to have a portion of the memory designated as "temporary storage" wherein numbers are held for a few fleeting moments during the course of the calculation as in this example. It is very common to use locations 0, 1, 2 etc. for this purpose. Example 2 ; In this example a code for the evaluation of a polynomial will be considered. The polynomial is n , n-1 , , y=b x +b , x + . . . + b, x + 0. J n n-1 1 and it is to be evaluated by the iterative scheme y i+ i = y i x + Vi (* = 1 > 2 > •••' n) with y-, = b . Combining the steps of this procedure it is clear that y is expressed 1 n in the form 76 y = f ( (b x + b . ) x + "b _ ^ x + b ) x I V v n n-1' n-2 X n-3 y + t>- which is readily seen to be identical to the above expression for the polynomial when the indicated multiplications are executed. There are of course a number of logical schemes one could use for the evaluation of the polynomial. The above iterative scheme is selected because it is possible to code this logic into a relatively simple loop. Actually, this is not the only reason for selecting this scheme; the other reason is based on an error analysis. A discussion of errors is given in chapters 25, 26, and 27. The flow chart and code follow. As before it will be assumed that the numbers have been appropriately scaled so that no overflow problems arise. For definiteness let us take n = 12, and assume that the coefficients b 12' b ll' b 10' . , b are stored as fractions in a block at 500 (i.e. b is in 500, b in 501, b in 502, etc.), and that x is a fraction stored in location 100, and finally that the result, y, is to be stored at 200,. Initialize Coefficient Address •» 1 ; end v x + a _!__. „i?:i 1st entry only b. Q Step end counter end end C . > 13 7 end - Form y. x Yes 77 WM Order Pair Comments 10 L5 17 Plant address 42 11 of 1st coefficient, b 11 41 18 Clear end counter L4 to] By 10, Ik, 15; a' = a + b -i From l6 12 40 200 Store y i+1 F5 18 13 40 18 C , = C , + 1 end end LO 19 end 14 36 17 Transfer if END (C , = 13) end F5 11 Advance coefficient address . 15 42 11 50 200 i' = y ± 16 7J 100 y. ■ x 22 11 17 OF 000 From l4| STOP 00 500 By 10 18 [00 000 By 11, 12, 13; END counter 00 000] 19 00 000 By 13: END constant 00 13 The first three orders in this code do the initialization or pre-setting of the polynomial coefficient address and the counter which is to keep track of the number of iterations. Notice that the code has been written so as to permit , the hold add order at RH of 11 to serve two purposes. When this order is first executed it sets up the initial condition for the iteration process; that is, it makes y = b . This results from the fact that the 4l order clears A just before 78 this hold add order is first executed. On subsequent executions of this hold add order A holds y. • x, as a result of the 7J order at 16, and the hold add order forms y. • x + b, p . in A. The 22 order following the "J order does not affect Aor Q. It should be observed that by simply changing the end constant at 19 one can use this code to evaluate polynomials of arbitrary degree, including zero degree polynomials. 'The relationship between the end constant and the degree of the polynomial, n, is (treating all numbers as integers) END Constant = n + 1 . The above may seem like a trivial observation and it may appear unnecessary to write the program to handle the unusual special case of n = Oj however, it will be found by painful experience that many codes which are supposed to handle "all" cases fail in the limiting case. To avoid such possible future difficulty the coder should try to make codes applicable even in the limiting or extreme cases within, of course, the bounds of common sense, A common coding error in writing loops is to give an incorrect value to the end constant such that a loop which is supposed to be executed just k times is actually executed k-1 times or k+1 times . A good check on the formula for computing the end constant is to consider what happens when just 1 or 2 passes through the loop are desired. To check the above formula for the end constant it is suggested that you consider the operation of this code when n = and when n = 1 . It sometimes occurs that either or both of the operands in a multiplication are represented in the machine as integers. Such cases require special attention. It is always simplest in these considerations to regard all ILLIAC numbers as having the binary point at the extreme leftj thus, the integer x is represented -39 m the machine as x-2 . Suppose we are to form the product of the integer x -59 and the fraction y. The product formed by the xLLIAC is x • y • 2 . Thus the -59 product, treated as a double length number in AQ, is "scaled" by 2 just as -59 the integer x was scaled by 2 ' . When speaking of a number in this form it is common to call the portion of the number residing in A "the integer part", and the 79 portion residing in Q 'the fractional part". Multiplication of two integers -39 -39 -78 x • 2 ' by y • 2 ' yields a product in AQ of xy • 2 . The product is thus — 7ft scaled by 2 .In this case the least significant digit of the integer product resides in Q . When doing multiplication involving both integers and fractions it is frequently desired to retain both the fractional and integral parts of products. In such cases unrounded multiplications are necessary . Example 3 s In this example we consider the code for computing z = e(bx + cy + d) where it is assumed that e, b, c and d are integers stored in memory locations 100, 101, 102, and 103, respectively; x and y are fractions stored. in locations 10 1 ! and 105; z is to be computed to a precision of 78 binary digits; the integer part of z is to be stored at 106 and the fractional part of z is to be stored at 107 . The code follows. WM Order Pair Comments 10 50 10*f q' = x 75 101 (aq) ' = bx 11 ^0 106 (106)' = int. (bx) S5 000 a* = frac. (bx) 12 50 105 q.' = y <]h 102 (aq) ' = cy + frac (bx) 13 Lh 106 a' = int. (bx + cy) Lh 103 a ' = int.- (bx + cy + d) Ik Uo 106 (106)' = int. (bx + cy + d) 75 100 (aq) ' = e frac . (bx + cy + d ) 15 ho 000 Temp, store int. part. S5 000 16 ^0 107 (107)' = frac. e(bx + cy + d) L5 000 a" = int. (e • frac. (bx + cy + d) (Continued on page 80) 80 Comments int » (bx + cy + d) int . e (bx + cy + d ) a' = int. e(bx + cy + d ) (106)' = int. e(bx + C y + d) At the RH of 10 the multiplication order first clears A., since V i and then produces the product bx as a double Jength number in AQ. The integer part of the product resides in A and is stored at 106. The fractional part of the product resides in Q and is brought into A via the S 1 } order. The fractional part of bx is retained in A for the execution of the next product cy. When cy is formed it is done with a hold multiply order, 'jh, in which the fractional part of bx becomes added to the fractional part of cyj remember, the order -39 7^- m produces (aq)' = q x m + 2 ' a . Following this multiplication the integer part of bx + cy f d is assimilated into location 106 . The fractional part of bx + cy + d remains in Q and the product, e. frac (bx + cy + d) is formed. The integral part of this product is temporarily stored so that the fractional part of z = e(bx + cy + d) which is in Q may be transmitted to memory location 10b . Finally the integer multiplication, e. int (bx + cy + d), is executed with a hold multiply order so that the integer part of (e. frac. (bx + cy + d)), which was temporarily stored at zero and then returned to A. will be added into this produc I , This is the first time an example using the S order has been considered; however, the order type should not need special discussion because of its close similarity to the L order which has already been extensively discussed by examples. Since the operand is taken from Q, in an S order the address of an S order is irrelevant and indeed may have any value without affecting the operation of the S order. Because of this feature of the S order its address digits are 81 frequently used for storing constants; for example, the initial address of an order in a loop which is to have its address modified is frequently stored in the address digits of an S order. It should be observed in this example that the S order rather than a shift order must be used for transferring the least significant part of the product from Q into A. A shift order would not guarantee proper treatment of the sign of the least significant part. Notice however in the order at location 18 a shift must be used to get the product of the two integers into A with proper sign. 82 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER. 1^ THE ILLIAC ORDER CODE - V Examples of the use of order types 6 and J. In this chapter we will consider examples using the divide order, type 6, and the extract order, type J. Recall from the discussion in Chapter 9 that the dividend in ILLIAC division is assumed to be in AQ. Consequently before a divide order there must be given orders for proper placement of the dividend;; for this one might use the sequence L5* 50- ILLIAC division produces a rounded quotient in Q and a residue (Chapter 9, page k&) in A. It was seen in Chapter 9 that rounding of the quotient was effected by "stuffing" a 1 into the least significant digital position of the quotient. The extract order, type J, is perhaps most easily remembered by noting that it produces the digitwise (or logical) product of the contents of Q and a number in location m of the memory^ the location is specified in the address of the J order. Representing the digital positions by the conventional subscript notation, the effect of the J order is described precisely by the relation q i = q i X m i ' ^ = °' lj •"' 59 ^ Thus, the resultant digit in Q. is 1 if and only if q. and m. are 1. The type J order is commonly used for extracting portions of words. Example 1 ; In this example the function x + y w = *- z will be computed. It is assumed that the fractions x, y, z are properly scaled so that |x + y| < |z | . Suppose x, y and z are in locations 100, 101, 102 and the quotient w is to be placed in location 103 . The code follows. 83 WM Order Pair Comments 10 L5 100 a ' = x Lk 101 a ' = x + y 11 50 lk q' =0- Set least sig. part of dividend = . 66 102 q T = — — , a' = residue z 12 S5 000 a« = X+y z ko 103 (103)' =££ 13 OF 000 STOP 00 000 Ik 00 000 By 11; constant zero 00 000 to clear Q This code is quite simple and its operation should be self-evident. Two points are worthy of special attention. Notice that Q is cleared by the LH order at 11 just before the division. This operation guarantees that the least significant part of the dividend is indeed zero. If this is not done, then the contents of Q, which in general will be some arbitrary number left there by an earlier sequence of orders, will be treated as the least significant part of x + y and consequently will cause the quotient to be slightly in error. The clearing of Q could have been effected by the order 11 39 (a* =0 right shift 39 places) which would have been more efficient of memory space since in the above example a word identically equal to zero (the word at ik) is needed in addition to the 50 order. However the right shift order would require a longer execution time (62k usee, as opposed to 55 usee, for the 50 order). The choice of which scheme to use will be dictated by the problem at hand. Frequently the constant zero is available anyway for the above purpose because it is commonly needed by many parts of a given program. The second point to notice is that in transmitting the quotient to the memory it must be first brought from Q into A (the S order at LH of 12) and then to the memory. There is no instruction which provides for 8+ writing into the memory directly from Q< One could use a shift to transmit thp quotient into A, though it would be slower, and have a properly signed result. This may seem odd since q does not take part in the shifting operation but let us recall a peculiarity of ILLIAC divisions in step 3 on page ^6 (Chapter 9) it should be noted that the digit shifted into Q is also shifted into A , consequently after the last step in the division process the sign digit cf the quotient resides in A as well as in Q , Example 2 ; In this example let us again consider a calculation of w = x+y but this time it will not be assumed that |x + y| < |z|. Here we require the code to properly scale the sum x + y so that this condition is satisfied . This is to -s be achieved by shifting x + y to the right s times, and thus scaling x + y by 2 where s is understood to be the minimum number of shifts required. Again suppose that x, y and z are in locations 100, 101, 102 and the scaled quotient w-2 is to be placed in location 103- 'The scaling parameter, s, is to be placed in location 10+. The flow chart and code fellow. j Special START Set initial value of scale parameter to zero i.e. s 1 = a - Store (x+y)- 2" s=0 on first entry Increment scale parameter l -e. s + 1 Shift x+y to -form (x+y)°2" s 85 WM Order Pair Comments 10 4i 104 s' = 50 104 q' = 11 L2 102 a ' = - |z | 32 17 jump if z = 12 L5 100 a ' = x a 101 a ' = x + y 13 40 000 from 20; temp, store (x+y) - 2 L7 000 a' = |x+y|-2~ S Ik L2 102 a ' — 1 1 r\~ S I 1 a - |x+y | *2 - |z | 36 18 jump to scale 15 L5 000 here when |x+y|*2 < |z| 66 102 q ! =( (x+y)'2" S )-r z = w 16 S5 000 a ' = w 4o 103 (103)' = w 17 OF 000 Normal Stop OF 001 from 11; Special Stop; z = 18 F5 104 from 14 40 104 s' = s + 1 19 L5 10 000 1 a' = (x + y) • 2 20 26 13 Jump to test again __ — The operation of this code is fairly straightforward. Notice that absolute value operations are used in making the test for numerator less, in magnitude, than denominator. Observe that a test for |z| = is made. This technique of testing for zero is standard, and is based on the characteristic of ILLIAC that -|x| is positive if, and only if, x = 0; in particular — |0 J =0. That this is to be expected in ILLIAC is evident from the remarks made earlier in 86 Example 3 of Chapter 10. It is absolutely essential that this test be made. If the test is omitted and z happens to be zero, then the program will go into a loop that will not end until the computer is turned off since the condition |x+y| - |z| < 0, which is necessary for emergence from the scaling loop, can never be satisfied. This program executes a transfer to a STOP order when the condition z = is found. This is a different STOP order than the one that is encountered when the program does not find z = and does compute a quotient. The special stop order is a signal to the user that the situation z = has occurred. It is not necessary, of course, to stop the machine at all in this circumstance, Most likely the programmer will have some special thing to do when this situation arises (for example write the quotient as the largest possible number which can be represented) and will make provision in the code to transfer to a routine for executing this whenever it is found that z = . Another feature of this code which should be noticed is that the least significant digits of x+y, which become shifted into Q as a result of the scaling, are not lost and do indeed properly appear in the dividend at the time of execution of the 66 order. Certain problems arise in the division of integers which require some attention here. The division round-off is one problem; clearly all integer quotients will be odd integers because the division round-off guarantees that the last binary digit will be a 1. The nature of the ILLIAC division process itself causes the error in the quotient to be dependent on the sign of the divisor. Integer division in the case of positive divisor and positive dividend, however, can be easily programmed. This is the situation one normally meets in practice. When other sign combinations for divisor and dividend arise it is best to make all the integers positive, do positive integer division, and then appropriately adjust the sign of the quotient. When positive integers are divided according to the procedure used in the following example, it can be shown that the exact quotient and remainder are obtained. 87 Example 3 : Suppose the quotient, z, and remainder r of x f y are to "be computed where x and y are positive integers, x, y, z and r must satisfy x = yz + r -39 -39 We assume x»2 ' and y-2 ' are stored in locations 100 and 101, respectively - The quotient, z.2 '' > is to be stored in location 102 and the remainder, r-2 - -'^ is to be stored in location 103- START a' = q' = x-2 i.e. x»2 in AQ •39 -78 2 . x . 2 -78^ yo2 -39 (aq)« = 2»x°2 i.e. multiply dividend by 2 -78 (aq)' \ (aq) i.e. halve the quotient and residue Store quotient and remainder STOP 88 WM Order Pair Comments 10 51 00 100 1 (aq)' = x.2 -78 (aq)' = 2-X-2" 78 11 66 10 101 1 q' =2.(z.2- 59 ) + 2" 59 a' = 2-r-2~ 59 q' = z-2 -39 , a' = r-2 - ^ 12 ho S5 103 -39 Store remainder, r-2 " a' = z-2 -59 13 J+o OF 102 -39 Store quotient, z-2 STOP Notice that the dividend is brought into Q with an initial clearing of A ( T.H order at 10). This is necessary for proper representation of (aq) ' = X'2 . The right shift at RH of 11 causes the division round-off digit to be dropped from the right end of Q. Notice that one need not worry about a 1 entering Q from A, Q with this shift because A holds the sign of the quotient which is guaranteed positive. After the right shift at RH of 11 the quantity in A is the correct remainder. Now let us consider the use of the logical multiply or extract order, type J. The extract order arises in computations where data is "packed" into a word} an example of this type of computation is given below. Example h i Let us consider a problem in which one must store in the WM the coordinates (x, y and z) of a set of points in a three dimensional space. There are 500 points to be so represented and therefore there are not enough locations in the WM to use a separate one to hold each coordinate of all 500 points. However, suppose that the requirements on accuracy in this problem are of such a nature that no more than 13 bits for the representation of each coordinate are necessary. Then it is possible to "pack" the three coordinates of each point into a single word. Thus, representing a word in memory as w = w w w 1 2 w 39 ' 89 the digits w to w may be divided into three groups of 13 bits wherein the 2's complement binary fractions x, y and z, the three coordinates of a point, are held; in particular x = w x w 2 ... v 13 , y = w u w 15 ... w 26 , z = w 2? w 28 ... w 59 . In this representation the sign digits are w , w . and w and the binary poin~c is assumed to be located immediately to the right of the sign digit. Let us suppose that the coordinates of those points which are contained in the "box" o < y < l , - £< z <5 > are to be transformed according to the rules x' = -x , Y % = -Y , where the new coordinate has been indicated by the primes . Points that are not inside the above box are to remain unchanged. The flow chart and code follow. It is assumed that the list of 500 words holding the coordinates x, y, z of each point (call them the point words) begins at location 200 in the WM. 90 Set initial point word address *>* Read point word and peel off x,y and z 91 ® 'K*- Pack new x, y, z into point word Advance address of point word 8 Yes Have the 500 point words been tested? STOP i No i NOTICE: The round boxes containing Greek letters are used to indicate common points when it is inconvenient to join them by a line; e.g. the line leading to (ot) on the first page of the flow chart is understood to be continued on the second page at the point marked (cO . 92 WM Order Pair Comments 10 L5 32 plant initial 42 11 address of point word 11 42 34 from 37 50 [0] by 10, 35 q' = point word 12 01 13 a" =0, shift x into A 40 temp, store x 13 01 13 a' = 5 shift y into A 4o 1 temp o store y 111 01 40 shift z into A as 4o o £1 fraction and temp, store 15 1.5 00 27 position x as fraction 16 40 temp store x 52 18 jump if x > 17 L4 38 a' = x + j^ ; here if x < 32 19 .- . 1 jump if x > - jj- 18 26 35 1 jump if x < - -jj LO 38 from 16 j a ' = x - r- 19 56 35 .„ . 1 jump if x > £ i L5 1 from 17 20 00 27 position y as fraction 4o 1 temp, store y 21 36 22 jump if y > 26 35 jump if y < 22 L5 2 from 21; a' = z 32 24 jump if z > (Continued on page 93) 93 WM Order Pair Comments 23 L4 39 32 25 a'= Z+ § jump if z > - 77 24 26 35 LO 40 5 jump if z < - 77 from 22 | a" = z - i 25 36 35 LI jump if z > 7T from 23, here if point is in the box 26 10 1 4o (0) 1 (0) 2 ... (0) 13 = -x 27 LI 1 10 l4 28 ko 1 LI 2 (D l4 (D 15 ... (D 26 = -y 29 10 27 kO 2 (2) 2? (2) 28 ... (2) 59 = -z 30 50 JO kl extract x 31 S5 50 l pack x into A 32 JO k2 Sk 200 extract y pack y into Aj address used by 10 33 50 2 JO 43 extract z 34 s4 40 [0] pack z into A by 11, 36 store new point word 35 F5 11 42 11 From 18, 19, 21, 24, 25 advance point word address (Continued on page ' >'; ) WM Order Pair Comments 36 42 3^ LO kh end test 37 32 11 jump if not end OF STOP- 38 20 1 constant = ^ 00 by 17, 1.8 39 30 3 constant = jy 00 by 23 ho 10 constant = 77 00 by 24 hi 7L ^032 extractor for 00 \ w 2 • • • v ? by 30 42 00 63 extractor for LF v l'4 w i 5 • • ■ w 26 ; by 32 h3 00 extractor for 01 4095 w 27 w 28 * ' * w 39 5 by 35 44 H2 3h end test 50 700 constant The first part of this code, namely the orders at RH of 11 to LH of 25, determine whether or not the word called into Q (the point word) by the order at RH of 11 represents a point that is in the box. First the x coordinate is examined to see if x satisfies the condition - -r- < x < 1- » if this condition 4 — 4 is satisfied then the y coordinate is tested; if this condition is violated the point must fall outside of the box so a jump is made immediately to the part of the program which advances the address of the point word (address at RH of 11 and RH of 34) and tests for the end of the loop. Trie y and z coordinates are similarly tested. If, after testing ail coordinates, it is found that the point 95 does lie in the box then a sequence of orders beginning at RH of 25 executes the transformation x -» -x, y -* -y, z -» -z. The orders beginning at LH of 30 take the transformed coordinates and "pack" them into a new point wordj this is where the J order enters. Consider the order pair at 30, the LH order places the word holding the new x into Q| specifically the digits of x are in locations Q Q . .. Q , . The remaining digits of Q are of no interest so far as x is concerned, but for the packing which is about to begin it is necessary that these remaining digits of Q be cleared to zero. This is done via the J order at RH of 30. The address of the J order is 4l and the word at Ul is 7I> ^032 00 0, which expressed as a kO digit binary number is 0111 1111 1111 1100 0000 0000 0000 0000 0000 0000 Thus digital positions 1, 2, ...,13 are 1 and the remaining positions are zero. Recalling the rule cited earlier (page 82) for the construction of the logical product it is evident that the J order at RH of 30 will not change the state of Q Q^ ... Q but all other digits of Q will be made zero. This result is transmitted to A by the S5 order at 31* Then the word holding y is brought into Q| specifically y is in Q , Q ... Q ^ • The J order effects a logical multiplication with the word at 42, which written in binary is 0000 0000 0000 0011 1111 1111 1110 0000 0000 0000 . This logical multiplication leaves Q , Q ... Q ,- unaffected but all other digits of Q are set to zero. The hold add from Q order at 32 then adds the y coordinate digits to the word in A which at present only holds the digits of x. Thus the digits of y are packed into A. Notice that the use of the J order is necessary otherwise this addition of the y digits into the accumulator could cause "hash" to be added to the digits of x. In a similar way the digits of z are extracted and packed into A. When the digits of z have been packed into A the new point word, the word now in A, is stored in the memory by the order at RH of 5^ • In addition to illustrating the use of the J order there are several other new features illustrated here. The words at 38, 39 and ^0 are used as 13 1 constants, t- , 77 , and ■$■ , respectively. That these words do indeed represent 96 these fractions is evident when they are written out as a binary number! ^--Binary Point at 38 we have 010 0000 . . . = j- ; at 39 we have Oil 0000 . . . = 4 ", at kO we have 001 0000 ... = g The end test is somewhat different than the ones used earlier. Notice that the test constant can be regarded as the sum of two order pairs, namely N2 3U 80 \2 3^ + 50 700 00 50 70c This test constant is subtracted from the word at 11, k2 3U 50 [x] , for the end test. Consider these order pairs as numbers and let us look at this subtraction. k2 3h N2 3*+ 50 [x] 50 700 positive if x < 700 negative (= -1) if x = 700 = k2 3U 1+2 3^ 80 000 l 50 [x] 50 700 00 000 / \ ■ — - negative if x < 700 zero if x = 700 The first two terms en the right side of the above equation yield a negative result so long as x < 700, This negative result has sign digit equal to 1 hence the subtraction of 80 000 00 000, the last term on the right, generates a 97 positive number as the final result for the right side of this equation. Consequently the conditional transfer order at LH of 57 will cause a jump to be executed so long as the right address (x in the above equations) at 11 is less than 700. When this address becomes equal to 700 the jump is not executed and the stop order at 57.> OF 0, is reached. The trick to the above form of the end test is the addition of sexa- decimal 8 to the left digit of the end constant. Without this addition an extra order is necessary, for the test would become WM Order Pair Comments 55 F5 11 U2 11 56 k2 3h LO kk End test 57 56 58 22 11 jump to stop if end jump if not end 58 OF from 57| STOP where the end constant is kk 1+2 5^ 50 700 end constant The addition of the sexadecimal 8 thus reverses the "sense" of the transfer: the conditional transfer causes a jump so long as the end of the loop has not been completed and the jump is not obeyed when the end of the loop is reached; but when the sexadecimal 8 is not added to the end constant, the reverse is true for then the conditional transfer causes a jump only when the end of the loop has been reached. 98 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHATTER 15 THE ILLIAC ORDER CODE - VI Examples of the use of order types 8 and 9 • In this chapter we will consider the input-output orders; order types 8 and 9° Certain forms of the input-output orders, namely those connected with the use of the CRT display and the drum, will not be discussed here. In this chapter the operations involved in reading information from teletype tape and punching information onto teletype tape will be the primary concern. With regard to output the 82 or 92 order will either punch the indicated character, or characters, onto teletype tape or they will print the characters directly via a teleprinter. The mode of output, punch or printer, is specified by a 96 order; if the address of the 96 order is 1 (i.e. if the order is 96 IF) then the output will be on the punch; if the address of the 96 order is 129 (i.e. if the order is 96 1291') then the output will be on the teleprinter.* Once the mode of output has been specified by a 96 order all succeeding output will appear on the unit designated until a new 96 order is executed. The mode of output can also be set manually; there is a set of toggle switches on the control panel of ILLIAC for this purpose. Since the punch operates at a considerably greater speed than the printer (the times are indicated below) it is customary to use the punch for output. The data on the punched tape may later be printed by putting the tape into the reader of a teleprinter. Punch Speed - 60 characters/sec. Printer (slow) Speed - b characters/sec. Printer (high) Speed - 10 characters/sec. Another 96 order, 96 65F is used to connect the Cathode Ray Tube display unit, t.n TT.T.Tflf 1 fm~ r-ml--rm + unit to ILLIAC for output 99 tape, Let us now consider briefly the physical appearance of the teletype The figure below shows a section of this tape. A hole in the tape is Special Sprocket holes t 2 1 • • • • • • • 9 • • • • • • • • • • • • • • • • • • • • • 1 2 3 J156 ?8 9KS N ..carriage return and line feed Figure 15-1 Sample of paper tape code. indicated by a dot. One set of holes, the smaller ones, is used to control the movement of the tape by the various equipment which reads and punches this tapej these holes are called the sprocket holes. Associated with each sprocket hole, reading across the width of the tape, is a 5 digit binary number! three digital positions are below the sprocket hole and two are above. The weight assigned to each position is indicated by the numbers at the left end of the tape in this figure. The tape is "read" by sensing for the presence of a hole in each digital position; a hole represents the binary digit 1, no hole represents the binary digit 0. The tape reading equipment reads the 5 positions across the width of the tape simultaneously (i.e. in parallel) and the tape is mechanically advanced to read successive groups of five digits. The appearance of the sexadecimal numbers 0, 1, 2, ..., L when punched on the tape is indicated in the above figure. The firs four digital positions, having weight 1, 2, k and 8, are thought of as representing a single tetrad or sexadecimal character. The fifth digital position or "fifth hole-position" is regarded separately and does not truly have a weight of l6 as the fifth binary position ordinarily would have. The fifth-hole position is used to identify some letters of the alphabet, special symbols, and certain printing 100 operations such as "carriage return and line feed " (the punches for this are indicated in this figure). The complete tape code is given in Appendix 6, P. 272. Let us now consider the orders which cause the ILLIAC to read information from the tape. The 80 and 8l orders are used for reading sexadecimal characters from the tape. They are identical except that the 8l order causes an initial clearing of A. The 80 order causes the execution of the following operations (1) (aq) 1 = 16 (aq) ; i.e. left shift k places (2) a^ 6 a« a^g a^ = tetrad on tape (3) repeat n/h times, where n is the address of the 80 order; n should be a multiple of h . In the above, the tape is advanced on each repetition so that the next tetrad may be read. If the fifth-hole is punched the tetrad is ignored by this order. Example 1 . Below is given a very simple code which reads the tetrads on the tape of Figure 15-1- The tetrads will be read two at a time and the tetrad pairs will be stored in a block at location 200 of the WM. It is assumed that at the time the first instruction of the following code is to be executed the tape of Figure 15-1 is in the reader and in proper position for reading the first character, namely the character 0. This operation causes the teleprinter to move the carriage into position for printing a new line. 101 WM Order Pair Comments 10 L5 lk Set initial 1+2 11 block address 11 81 8 from 13, a' = 0, read 2 tetrads ko [o] by 10 12 F5 li advance store k2 li address 13 LO 15 End test 36 11 transfer if not end 1* OF STOP 00 200 by 10 15 01 8 End constant ko 208 The reading is done via the 8l order. The variant digit 1 indicates initial clearing of the accumulator, and the address of the 8l order, namely 8, specifies that 2 tetrads (8/4 = 2) are to be read from the tape upon execution of the 8l order. The digits read from the tape are shifted into the low order end of A and then are placed in the WM via the ko order at the RH of 11. Thus, when the above program reaches the stop order (LH of lk) the block at 200 appears as follows . LOCATION WORD 200 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 201 0000 0000 0000 0000 0000 0000 0000 0000 0010 0011 202 0000 0000 0000 0000 0000 0000 0000 0000 0100 0101 203 0000 0000 0000 0000 0000 0000 0000 0000 0110 0111 204 0000 0000 0000 0000 0000 0000 0000 0000 1000 1001 205 0000 0000 0000 0000 0000 0000 0000 0000 1010 1011 206 0000 0000 0000 0000 0000 0000 0000 0000 1100 1101 207 0000 0000 0000 0000 0000 0000 0000 0000 1110 1111 102 Example 2. Let us now consider a simple code which will read a block of positive 3 digit decimal integers from the tape,, convert these integers into their binary equivalents } and store the result in a block at 200 . The last decimal integer of the block on the tape will be indicated by punching the sexadecimal character N as the terminating character on the tape. Suppose the list of decimal integers to be read is that shown in Figure 15-2. 010 039 lk6 237 599 Figure 15-2 Three digit decimal integers. The tape on which these numbers are punched for subsequent reading by the code is shown in Figure 15-3- Notice that the line feed and carriage return characters have been included. • • • • • • • • • • • • • • • • • • • • • » • ••••• • • 9 • • Figure 15-3 Tape with data of Figure 15-2, 103 An N has also been punched as the terminating character on the tape. If the tape of Figure 15-3 were to be put into the reader of a teleprinter, then the list of numbers shown in Figure 15-2 would be printed (an N would be printed immediately after the last digit so that the last line would appear as 599N). The decimal to binary conversion is achieved by an iterative procedure, Let the decimal digits be indicated by d . (i = 1, 2, 5j a three digit number is d^ d d,), then the iterative scheme is described by S, = 10 S. . + d. i l-l i S Q =0 S, = final binary representation of the three digit decimal number. The flow chart follows: START Set initial store address - 200 Read 1 tetrad = T Store T as S 1 Is T = N ? Yes STOI Wo Set end counter = 1-2 -2 -5 - Read 1 tetrad , d . l S. = l 10 S. , + d. l-l l integer hold multiply Is end counter = 1? (end counter)' =-end counter + 1 x 2 -5 ' No Yes Store number Advance store address 104 WM Order Pair Comments 10 L5 16 42 19 Set initial store address 11 81 4 from 21; read T ko store T as S 12 LO 23 T - N 40 1 temporary store T - N 13 L3 1 -|t - n| 32 21 jump if T = N ll+ L5 24 Set end counter = 1-2 -2~ 59 40 1 from 18 15 81 4 read d . 1 50 ** = S i-1 16 74 22 (aq) 1 = 10 x S. ., + d. (integer) S5 200 by 10 17 40 store S . 1 F5 1 advance end counter 18 32 14 j ump i f not end . 50 waste 19 Lo 40 [0] "by 10, 20 3 Store S 20 F5 19 42 19 advance store address 21 26 11 jump to read next integer OF from 13; STOP when T = N 22 00 constant = 10 x 2 Jy 00 10 by 16 23 00 constant = 12 x 2~ Jy 00 12 by 12 24 7L 4095 -59 constant = 1-2 »2 LL 4094 by 14 105 The order pair at 10 plants the initial address of the store order which stores the numbers read from the tape into the block at 200. The orders at LH of 10 to RH of 13 test for the termination symbol, N, to determine whether or not all of the data has been read from the tape. The next block of orders up to LH of 18 reads the number from the tape (the first digit of the number is read by the LH of 11 ) and converts it to a binary number. The order at RH of 19 stores the integer in the list which begins at location 200. Notice that the multiply order at LH of 1.6 is a hold multiply orderj consequently the tetrad just read at LH of 15 is added as an integer to the integer product to form 10 x S . , + d . . The characters having the 5~th hole punched, namely the line feed and carriage return characters have no effect on the operation of this code, since the 8l order (and the 80 order) completely ignore any character having the 5"th hole punched . It is possible to read the 5th hole with the 91 order (and the 90 order). The use of this order is indicated in the example below. Example 3 ° In this example we consider a code which will read positive integers from the teletype tape and store them in a block at location 200 of the WM. Here the number of decimal digits in the integer will be arbitrary , rather than a specified number as in the previous example. The data tape (i.e. the teletype tape on which the decimal integers are punched) is required to have a line feed and carriage return character following each number and the character N following the very last line feed and carriage return to indicate termination of the data. Let us assume the data consists of the following integers 10 5 329 Ik 1,1+56 then the data tape will appear as follows: Assuming, of course, that the number remains in the scale of the machine, 39 namely less than 2 io6 • • • • • • • • • •#••**•••••»•**■ B • • • • # * • © • • • • • • ft • ft • • ft ft ft • • The flow chart and code follow. Set initial store address Read tetrad = T" 91 read -»•♦ S\ Read one tetrad = T 81 read Store T as S 1 Is 5"th hole punched ? lea No S. = j. 10 S No . -. + d. l-l 1 Is T' = If. and cr.? No Yes Store S. in 1 integer list Advance store address 107 WM Order Pair Comments 10 L5 42 18 20 from 21; plant store address 11 81 ho 4 Read T 12 LO 40 23 1 Test for T = N 13 L3 36 1 22 jump if T = N Ik 91 32 4 17 Read T" ; from 19 jump if no 5th hole punch 15 LO 40 24 1 test for T" = If. and cr. 16 L3 36 1 20 jump if T ! = If. and cr. 17 26 14 50 o jump if T' / If. and cr. from 14 18 74 S5 25 200 S. = 10 S. . + d. l l-l i by 10 19 40 26 14 store S. l jump to read next digit 20 L5 40 [0] from 16 by 10; store integer 21 F5 22 20 10 advance store address jump to read next integer 22 OF 00 from 13; STOP ^ (Continued on page 108) 108 WM Order Pair Comments 25 00 00 12 Constant by 12 2h 80 00 2 Constant by 15 25 00 00 10 Constant by 18 This code is similar to the one in example 2 except that here there is no counter to keep track of the number of digits read, but instead each character is tested to determine whether or not it is a line feed and carriage return (if* and cr.) character indicating the end of the number., Notice how the test for If. and cr. is made . First the sign digit is tested at BH of lU; a = 1 if the character read from the tape with the 91 order has a 5th hole punch. If this test finds a = 1 then a second test is made to determine whether or not the character just read was actually a If. and cr, character <, If this test shows that the character just read was not a If. and cr. then the jump at LH of 17 is executed, and the next character is read from the tape; this feature makes it possible to "erase" errors on the tape by punching out the fifth hole since any character with a 5 th hole punch with the exception of a If. and cr. character is ignored by this program. Having discussed some examples of the use of the tape input orders, let us now consider examples of the use of the output orders, namely the 82 and 92 orders . Example k . The following is a very simple code for printing the contents of locations 200, 201, . .., 209 as sexadecimal numbers. The numbers are to be printed in a column, each number on a separate line. At the head of the column the word SEXADECIMAL is to be printed. The code follows. WM Order Pair Comments 10 92 151 92 515 If. and cr. delay 11 92 259 92 706 letters shift S 109 WM Order Pair Comments 12 92 92 19^ 1+51 E X 15 92 92 58? 67 A D ik 92 19k 92 855 E C 15 92 92 514 645 T M 16 92 92 587 962 A L 17 92 92 707 155 numbers shift If. and cr. (2) 18 92 L5 515 2k delay 19 1+2 LO 20 25 from 25 end test. 20 52 L5 25 [0] jump if end bring number from WM into A 21 82 92 40 151 print 10 sexadecimal digits If. and cr. 22 92 F5 515 20 delay advance number address 25 26 OF 19 from 20; STOP 24 52 L5 25 200 constant by 18 25 52 L5 25 210 end constant by 19 110 The first part of this code comprising the orders at LH of 10 to RH of l6 is used to print the heading. The order pair at 10 punches a If. and cr. character followed by a delay character. It is always best to precede any printing with a If. and cr. character to insure that the teleprinter is properly set to begin printing a new line. A delay character should always follow a If. and cr. character. The delay character provides the teleprinter enough time to properly shift the carriage into position for a new line of printing; omission of the delay will usually result in an uneven margin on the left side of the page. The order at LH of 11 punches a letters shift character. This character causes the carriage of the teleprinter to shift into position for printing letters and special symbols (just as the shift key on a typewriter causes capital letters to be printed). The letter shift character causes the carriage of the teleprinter to be "locked" into the letter printing position so that all subsequent characters will be printed in the letter printing mode until a number shift character appears; the carriage will then be locked into the number printing mode . One can compute the necessary address for a 92 order to print a given character from the rules given in Appendix h } p. 26k. A complete list of 92 orders for printing teletype characters is given in Appendix 7> p. 273. At RH of 35 we have the order 92 135 (= 92 [131 + M) which will cause two line feed and carriage return characters to be punched. If kn (n = 1, 2, 3, - "3 1*0 is added to the address of any 92 order in the list in Appendix 7> P- 273> then n + 1 characters will be punched; thus, 92 135 causes the punching of two line feed and carriage return characters. Similarly the order 92 395 will cause the punching of three A's (after letters shift) or three )'s (after numbers shift); the order 92 9^ will cause the punching of nine Q's (after letter shift) or nine l's (after number shift). The 82 order at LH of 21 causes the entire contents of A, 10 sexadecimal characters, to be punched (ho -jr k = 10). Ill Example 5 . As a final example in the use of the input-output orders let us now consider a code for printing a list of twenty positive "binary fractions as decimal fractions. The list begins at location 200 of the WM. The decimal fractions will be printed to six digits and for simplicity roundoff will be neglected. The binary to decimal conversion is effected by successively multiplying the binary fraction by ten, the integer part of the product at each stage being the desired decimal digit (see Chapter 5, page 25). The flow chart and code follow. Set initial address of fraction list Form F x 10 x 2 -k Advance digit counter by 1 x -T\ /V •39 Print If and or. 3 delay ■-*« Enter fraction F into Q Set digit counter = ,-6 x 2-39 **- Shift integer part of product into A A., A A and print Is digit counter - •] ? » '{es y\ Kg Ad va r. c e f ra c t i o n call address Save remaining fractional part as new F Have 20 fractions I " -n print - :'. 112 WM Order Pair Comments 10 L5 19 k2 12 plant initial fraction address 11 92 131 92 515 If . and cr , , from 18 delay- 12 50 50 [o] waste fraction into Q 13 L5 21 40 set digit counter from 16 14 75 22 00 1 F x 10 x 2"* position Int. part in A n A A A^ 15 82 k 10 40 print a Q a^ a.^ a put fractional part of product into Q* 16 F5 32 13 step digit counter jump to print more digits 17 F5 12 k2 12 advance fraction address 18 10 20 36 11 end test jump for next fraction 19 OF 00 200 STOP by 10 20 JO 50 220 end test constant by L8 21 71 4095 LL U090 i-6x 2~ 59 22 50 00 10 x 2 constant 113 The multiplication at LH of ih produces the product F x 10 scaled -k -h by 2 since the multiplier is itself scaled by 2 . Consequently the integer part of the product will be held in A, A A, A. ; it is just this tetrad then that holds the decimal digit which is to be printed. Since the 82 order prints the contents of A A A A it is necessary to execute the left shift of one place at RH of 1^ in order to put the just generated decimal digit into proper position for printing. This chapter completes the discussions of the use of the various ILLIAC orders . The complete ILLIAC order code is given in Appendix h } pp. 251-270. 114 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 16 SUBROUTINES Most programs can be divided inxo a number of parts which are distinguished by their function in the program. A given program might have one block of orders which performs the read-in of data, another block to execute a square root and some other block might compute another special function, for example the logarithm, and usually a program will have a block of orders responsible for printing results . One calls such parts of a program "subroutines". Commonly one portion of the program is designated as "master" or "main pert", its duty being to control the sequencing of the execution of the subroutines. From the standpoint of simplicity and ease of checking the program it is a wise practice to attempt to make each subroutine as self-contained as possible. There will of course necessarily be cross references between sub- routines, but one should try to minimize them. There is another important reason for following this practice. Many times after a program is thought to be completed, even after it has been used for some time, it will be found desirable to change a part of the program. It is hard to make substantial changes after a program has been written (and some of the details forgotten) without spawning an error, and usually many errors. This spontaneous generation of errors can be greatly inhibited if the cross references between subroutines are reduced. This practice will usually result in a slight decrease in the efficiency of a program from the standpoint of utilization of memory space and time but unless economy of these items is critical the above practice is a good one to follow. We distinguish two classes of subroutines called "open" subroutines and "closed" subroutines. The distinguishing characteristic of a closed subroutine is that it may be entered via a jump from any location., say p, of the memory and the subroutine will "remember" the origin of the jump| after the orders of the closed 115 subroutine have been executed, then a jump to a location relative to p, say p+m, will be executed. On the other hand, an open subroutine is entered from just one position in the memory and after execution of the subroutine exit is made to one fixed position in the memory. The desirability of the closed subroutine should be fairly evident. A particular function, let us say the square root, may be desired at many different points within a program. It is wasteful of memory space to write out a new set of orders to execute a square root at every point that a square root is needed in the program. Instead the square root subroutine is written as a closed subroutine. It is then possible to obtain */~x at any point in the program by simply transferring to the closed subroutine, wherein *{~x is computed, followed by a transfer back to the main program to resume the course of the computation. One can think of this jump to and from the closed subroutine as equivalent to a single hypothetical order -- extract square root. Entry and exit to a closed subroutine is indicated schematically in Figure l6-l. On the left of this figure there is indicated a block of orders WM Order Fair WM Order Pair QJ 100 - ~--**~~ 500~~3^— — — — - — ENTRY ) "£ 101 — — — — = 3^^ ^^501' 8 o -p 102 — — — — =I ^" y" / 502 103 '" ^ '" /* 503 ic* \ ^ / 50k 1Q 5 = \ / ^/ 505 106 - \ y / 506 107 ===== / X / 507 108 - / /*\ 508 109 / / ^-^> ZZ7~ a •H % O u % -a (U ca o H O 1; / 110 - ^^-^ / ^-'/ /""**' — ^ ___ Jump _^~--" / — — — — - / — - - / 112 - / ^.^ 113 - 3\2EP^ -"" " Figure l6-l Schematic representation of jumps to and from a closed subroutine, 116 ■beginning at location 100, representing a portion of the main program; each horizontal line represents one order. At locations 103, 109 and 113 a compu- tation of 'fx is needed . On the right of this figure there is indicated a block of orders at 500 which represents a closed subroutine to compute the -J~~xj x is taken to be the fraction in A at the time of the entry to the subroutine and Vx is the number in A at the time of exit from the subroutine. At location 103 the number whose square root is desired is entered in A and a jump is executed from the LH side of 103 to location 500 where the square root subroutine begins . A record is kept of the fact that entry was made from location 103 -- exactly how this is done will be seen shortly. When the square root has been computed it is placed in A and a jump from location 508 to the RH side of location 10 3 is executed. Again at locations 109 and 113 this process is repeated. If a closed subroutine was not used but instead an open subroutine to compute Vx was used, then this open subroutine would have to be inserted at the three points in the program where -Vx is needed. To establish the link between the main program and the closed subroutine certain entry rules are necessary. The customary rule with ILLIAC programs is to enter the subroutine via a jump from the left side of a word. If this word is at location p+1, then the order immediately preceding the jump (this would be the order on the right side of location p) must be 50p. Thus to enter the subroutine we have a sequence of orders that appears as shown in Figure l6-2. WM ORDER PAIR P 50 p p+1 26 (address of subroutine) -- Figure l6-2 Typical entry to closed subroutine. 117 Notice the consequence of the 50 order. It places the word at p into Q, thus the 50p order itself resides in the right half of Q at the time that the jump is executed. The address p residing in Q is used by the closed subroutine to establish the link for exit. In most cases the custom is to set the link so that the return jump will be made to the order at the right side of p+1. To illustrate the setting up of the link in the closed subroutine an example is given below. This subroutine sums the digits in a word except w and therefore it resembles very closely the program given in Chapter 12, example 2, where the same computation is done without the program being written as a closed subroutine. It is assumed in this example that entry to the closed subroutine is made by the order sequence shown in Figure 16-2. It is further assumed that the word, x, whose digits are to be summed is in A at the time of entry; the sum of these digits is to be in A at the time of exit from the subroutine. The code follows. WM | Order Pair Comments 10 ho temp . store x K5 a' = q + 2~ 59 (p -*p+l) 11 k2 16 plant link kl 1 clear sum box 12 50 q* = x L5 17 set end counter 13 ko 2 from 15 01 1 move bit into A Ik Lk 1 add to sum box Uo 1 restore sum box 15 F5 2 advance end counter 36 13 jump if not done 16 L5 1 a " = sum of bits 22 [0] by 11 17 7L 4095 1 - 39 x 2~ 59 LL ^057 = initial value of end counter. 118 In this code the increment add from Q order, type K. is being used for the first time. This order is exactly like the type F order, which was discussed in Chapter 12, except that the addend is taken from Q rather than the memory. After the K5 order at 10 is executed the right address digits of A. contain p+1 and the k2 order at LH of 11 plants this address into the address digits of the 22 order at l6 . (Remember that upon entry to this subroutine the Q register will contain p — See Figure l6-2 -- in the right address digits -- Q Q ... Q_ n .) The link for the exit has now been established. After the subroutine has been executed the 22 p+1 order at RH of l6 will cause a return to the order following the transfer order which executed the entry into this closed subroutine. 119 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER .CHAPTER 1? SADOI - PART 1 In describing the programs in the preceding chapters it has always been assumed that the orders were already in the memory, In this chapter some of the steps are discussed which are involved in getting a program written en a sheet of paper, into the memory of the ILLIAC. Information which is to he read into the ILLIAC must first be placed onto teletype tape. In particular the orders which make up the program must at some time be transcribed from the printed page onto teletype tape. This tape containing the program must then be read into the ILLIAC and the instructions inscribed thereon placed in the memory. In order to get this program tape into the ILLIAC a special "input routine" must first be put into the ILLIAC; the input routine then reads the program tape and places the orders into the proper locations in the WM. But of course the input routine itself must get into the ILLIAC and this is done by a set of orders known as a "bootstrap" which essentially reads itself and the input routine into the ILLIAC. The properties of the input routine prescribe the rules for the transcription of the program onto the teletype tape » It is natural to expect that the input routine would permit, the programmer to put the program onto tape using a simple and convenient notation - For example it would be inconvenient if every order pair in the program had ti be placed on the tape as a ten character sexadecimal number; it would oe simpler if the address digits of the order- could be written as a decimal integer-. The input routine permits the programmer to do this. In addition to this, the input routine has many other features designed to permit the programmer to write toe orders onto the tape in a simple and convenient form, One might regard the i oput routine as a kind of language translation program which translates the instructions on the tape;, written in the "language" of the programmer into instructions in the "language" of the 120 ILLIAC, namely the binary words which have already been described. The input routine used with the ILLIAC is known as the Symbolic Address Decimal Order Input -- or more simply SADOI . Let us now consider some of the rules which must be followed by the programmer in writing a program for SADOI. First, SADOI must be told where the orders on the program tape are to be placed in the ILLIAC memory. This is done with a directive j if a list of order-pairs are to be placed in the memory starting at location m, then the characters 00 mK are punched on the tape just preceding the list of order pairs ; m is written as a decimal integer. Thus if the first order pair of the list is to be placed in location thirty nin , then the characters 00 39K are punched onto the tape preceding the order pairs. The form of this directive is as follows: 9 (1) the first two characters are zero] (2) the following characters represent a decimal integer which is the location of the first order -pair in the list following the directive! (3) the sexadecimal character K follows the address*. There are other special forms for this directive which will be discussed in a later chapter. The T and V digits of every order are written as sexadecimal characters on the tape just as we have been writing them in the pastj thus a clear add order would be indicated by the characters L5 on the tape. There are essentially two different forms in which the address may be written: one is the decimal address form and the other is the symbolic address form. In this chapter the former, namely the decimal address, will be considered. The decimal address, as the name implies, is written as a decimal integer. The decimal address is always followed by a single sexadecimal character K, S, N, J, F or L which signals SADOI that the address digits are terminated and "directs" The sexadecimal character K is actually printed as a "+" by the teletype equip- ment. Similarly, the sexadecimal character S is printed as a "-" by the tele- type equipment. All other sexadecimal characters are printed properly, i.e. N is printed "N", J is printed "J" and so forth. 121 SADOI on the interpretation of the address digits. It was already seen above that the termination symbol K is used to direct SADOI on the assignment of memory locations to the subsequent order pairs. The termination symbol F indicates a fixed address; that is the address digits are interpreted directly as the location in the memory referred to by the function digits. Thus if the word in memory location 175 is to be brought into the accumulator with a clear add order, one would write the order as L5 175F on the teletype tape. Addresses which do not refer to memory locations, for example shift orders , normally have the address terminated by F; thus, a left shift of ten places would be written on the tape as 00 10F. The termination symbol L indicates a relative address, that is the address is interpreted relative to the address specified by the K directive preceding the list of orders . By this means words within a block of orders may be referred to according to their relative position in the block. For example, if there is a clear add order in the block for which the addend is the forty-third word in the same block one would write L5 ^3L on the tape for this order. If the first word in this block is at location 100 in the memory then this clear add order would appear in the memory with the address digits equal to 1^3 n » SADOI achieves this transformation by preserving the "base" address for the block (the directive in this example is 00 100K and the "base" address is 100) and adding it to the address digits of each order terminated by the character Lj the base address is also called the relativizer. The relative address feature makes it possible to write a program without explicit reference to the absolute memory location of the orders in the program. After the program is completed the absolute address assignments are made via the 00 mK directives. This is a great convenience which can only be fully appreciated after a little coding experience. The termination symbol N is used to direct SADOI to relinquish control so that execution of the orders it has just read may begin. The program tape normally ends with an unconditional transfer order to an address, m, where m is the address of the first order in the program, and m is terminated by the letter K„ Thus if 26 25N is written at the end of a list of order pairs on the tape it will cause SAD01 to relinquish control and a transfer of control to the LH order at location twenty-five will be executed -- this location presumably holding the first order of the program just read by SADOI . 122 To illustrate the use of the termination symbols K, F, L and N a program is shown below in three stages: (l) as it would be written by the programmer on a sheet of paper; (2) as it appears on the teletype tape; (j) as it appears in the memory of the ILLIAC. This program is the one already discussed in example 3 of Chapter 11. The program would be written on paper by the programmer as follows: Address Order Fair Comments 00 10K in L5 500F [201]F partial sum = by 3L, from 5L; a ' = x^x^ . . .,x 100 1 Lk ko 500F 500F a' =x. + z . , = z. 1 l-l 1 2 L5 L Lk 6L Modify address 3 k2 L5 L 7L (10)' = (10) + 2~ 59 k LO 1+0 6l 7L End counter (17)' = (17) - 2" 39 5 32 OF L F Transfer when (17) > STOP. Here when (17) = -lx2~ 59 6 00 00 F IF - l x 2- 5 9 7 00 00 F 99F -39 = 99 x 2 = end counter by kL 26 ION Figure 17-1 Sample code showing the use of termination symbols K, L, F and N, a at •H ft cd a -p (D > (U •H ft -p 0) 0) Tj H O CD O -P 0) rH A 1 -P t- H bO C CD •H fn § a .£ -H CO P4 12h W.M. Location (Decimal) 10 11 12 13 14 15 16 17 Contents (Binary) 0100 0001 0001 1111 0100 1111 0101 0000 1100 1001 1111 0100 0001 1111 0100 0100 0000 0001 1111 0100 1111 0101 0000 0000 1010 1111 0100 0000 0001 0000 0100 0010 0000 0000 1010 1111 0101 0000 0001 0001 1111 0000 0000 0001 0000 0100 0000 0000 0001 0001 0011 0010 0000 0000 1010 0000 1110 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 0110 0011 Figure 17-3 Showing the code of Figure 17-1 in the Williams Memory after it has been read from the tape of Figure 17-2 by SAD0I. It is to be observed that only the information contained in the column headed "Order Fair" is typed onto the tape. Leading zeros of the address, relative or fixed, need not be written explicitly; see the order at LH of 2L, and LH of 6L, Figure 17-1- The remarks made in the comments column vary from programmer to programmer according to personal taste. The use of the word "by" to describe modification of the order by some other order is conventional. Also it is common to use the word "from" to indicate that a transfer from some other part of the program to the point at hand is made. In general, one should try to make the remarks in the comments column descriptive. A good guide rule here is to assume that you had to read and understand the program five years after you had written it (in other words, after you had forgotten most of it) then put down those comments which you think would be most helpful for this purpose. Certain features of the tape should be pointed out. At the very front of the tape is a portion called the "leader"; 2-hole delay characters are punched on this part of the tape. The leader should be about eight inches long. If the leader is too short it will not properly fit into the photoelectric tape reader. On the leader the coder should write his name and the name of the code. It is 125 sometimes helpful if the date on which the tape was prepared is also written on the leader. At the end of the tape there is a "tail" which also should be about eight inches long and contains 2-hole delay characters. The If. and cr., delay (2 hole or 1 hole), and space characters are ignored by SADOI. It is seen in Figure 17-2 that the If. and cr. is used to separate order pairs; although the two orders of a pair are written on different lines, as in Figure 17-1* it is not the custom to separate them by a If. and cr. character on the tape. This is only a custom and since the If. and cr. may appear anywhere without affecting the SADOI "translation" of the code on the tape the programmer may insert If. and cr. characters on the tape wherever he pleases. It is not customary to follow the If. and cr. character on a program tape by a delay character, although again this is a matter of taste since the delay character is ignored by SADOI. A delay character is not really necessary in this instance since the length of each line of print is usually so short that there is adequate time for the teleprinter carriage to return to the left margin position for printing the character immediately following the If. and cr. character. The space character is a convenient one to use for "erasing" tape errors since all five holes are punched out in the space character (hence any character can be changed to a space by simply punching out the remaining holes) and a space character is ignored by SADOI, In Figure 17-3 it should be observed that the relative addresses have been translated into the proper fixed addresses. Thus the LH order at 2L (or 12 fixed) which is L5 L does indeed have the address digits equal to 10 when it is in the WM. The directive 00 10K at the head of the tape and the transfer of control directive 26 ION on the tail of the tape do not actually get placed in the WM as a part of the program. This is natural since they exist only for the purpose of giving certain directions to SADOI and they have no further utility after SADOI has ceased operation and relinquished control to the program. 126 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 18 SADOI - PART 2 In this chapter the termination symbol J for fraction input, schemes for integer input, and the use of symbolic addresses are discussed. With the J termination it is possible to write fractions, which might be constants in the program, in their decimal form, leaving the task of decimal to binary conversion to SADOI. The fractional digits are written as the digits of the right address of an order pair. Excepting leading zeros, 12 digits of the fraction must be written. Examples appear below in Figure 18-1. Decimal Fraction Form for writing decimal fraction to be input by SADOI \ = 0.333. 00 F 00 3333 3333 3333J | = 0.666. 00 F 00 6666 6666 666 71 ^ = 0.08333. 00 F 00 833 3333 3333J 250 = °- 00 ^ 00 F 00 ho 0000 0000J Figure 18-1 Examples of the use of the J termination symbol for writing positive decimal fractions. 127 To write negative fractions the sign digit of the order pair is set equal to 1 to make the LH order read 80 F. The sign digit is interpreted to have weight 80 F -1 and the fraction -x is written as ^ t _ where x 1 = l-x„ The same fractions 00 x'j displayed in Figure 18-1 now written as negative decimal fractions are shown in Figure 18-2. Decimal Fraction Form for writing decimal fraction to he input by SADOI - \ = -0.333- 80 F 00 6666 6666 6667J - 1 = -c.666- 3 80 F 00 3333 3333 3333J - ~ = -0,08333- 80 F 00 9166 6666 6667.3 - 250 = ~ qM 80 F 00 9960 0000 0000J Figure 18-2 Examples of the use of the J termination symbol for writing negative decimal fractions. Notice that the decimal point is always assjmed to lie immediately to the left of the first digit of the right address, except when leading zeros are omitted: more generally, the right address x when terminated by J is understood to represent the fraction x-10 . Leading zeros may be written explicitly if desired; for example , 00 F 00 833 3333 33330" and 00 F 00 0833 3333 3333C are interpreted identically by SADOI 128 Two common coding errors with regard to writing fractions are: (1) neglecting to write down the proper number of digits in the fraction; remember 12 digits must be written with the exception of leading zeros, which may be omitted; (2) improper entry of negative fractions, writing them in sign absolute magnitude form rather than 2'b complement form; remember , in order to write -x, one sets the sign digit equal to 1 and puts 1-x in the right address digits. Since fractions which terminate in the decimal system generally do not terminate in the binary system, the fraction x is not exactly represented when converted by SADOI into the ILLIAC fraction, x . In the SADOI conversion -ko of decimal fractions to binary fractions the maximum error is e = 2 , i.e. -kO . + ^ -kO * -2 < x - x < 2 Integer constants are easily written for input by SADOI. If the integer x (positive) is desired, then one writes the order pair 00 F 00 xF where x appears as the address of the RH order. The function digits of the LH order and RH order and the address digits of the LH order must all be zero. The 39 \ address of the RH order can be any integer within machine range (0 < x < 2 -1; and SADOI will properly make the decimal to binary conversion to obtain the correct ILLIAC representation of the integer. For example the order pair 00 F 00 5U97 5581 3887F will be read by SADOI and converted to the binary word 0111 1111 1111 1111 1111 1111 1111 1111 1111 1111 which is indeed the correct integer representation of 5^9,755,813,887 = 2-1. * The superscript will be used to mean "the number represented by the ILLIAC" which ingeneral is not identically equal to the number one is attempting to represent because of errors which arise from a variety of sources . The error is frequently denoted by e and the relationship between x, the number that ILLIAC is attempting to represent, and x + , the number ILLIAC is actually representing, is x + + e = x. 129 Negative integers may be entered using the complement representation, thus, -x is written as 80 F 39 00 2 jy -x F In particular, if -x = -10, then 2T* - x = 5^9, 755, 813, 878 and one writes 80 F 00 5^97 5581 3878F SADOI will convert this to the binary word 1111 1111 1111 1111 1111 1111 1111 1111 1111 0110 , which is indeed the ILLIAC representation of the integer -10. This technique is possible because of the way SADOI constructs the binary program words from the code on the tape. This discussion is reserved for the next chapter . For small negative integers and large positive integers a slightly simpler scheme can be used. First let us notice that certain order pairs have a simple numerical significance; Fractional Integer Value Value -1 -2 59 1-2- 59 2 59 -l Order Pair 80 F 00 F TL 1+095F LL U095F LL 4095F LL to95F -1 x 2" 59 39 We immediately see that the large positive integer 2 -p can be obtained from 39 39 39 the representation for 2 -1 by subtracting p-1 from it; 2 -1 - (p-l) =2 -p. Now if p does not exceed K096 this subtraction is easily executed since only the address digits of the RH order need be considered; if p does exceed k-096 then one has to be careful in handling the borrows from the digits to the left of the RH address digits. In a similar manner one can easily generate the order pair 130 representations for small negative integers from the above representation for -1. Some examples of the order pair representations for integers are given below . Integer Order Pair 2 59 -10 7L U095F LL koQbF 39 2-500 7L 1UD95F LL 3596F -10 LL 4095F LL koQ6F -500 LL il095F LL 3596F One of the most important features of SADOI is that it permits symbolic address references whereby one can assign a "name" to a word of the program quite independent of the address of the word in the Illiac memory. We have seen in preceding examples, that the operand specified by the address digits of an order is usually a word of the program (this may be an order pair, a constant, a parameter, etc.). We have also seen that the operand is referred to by giving its location in the memory, either fixed (if we use the termination symbol F) or relative (if we use the termination symbol L). However with the symbolic address convention we can "name" any word of the program which must be referred to as an operand and then always refer to this word by its "name" -- i.e. its symbolic address — writing it as the address portion of the order. This ability to refer to words in the program independent of their specific location in the memory, relative or fixed, provides a great convenience in writing the code which can only be appreciated after a certain amount of coding experience has been gained. The symbolic address scheme also facilitates the making of alterations in a code, as we shall see. A symbolic address is always identified by being enclosed by parentheses; thus, (l), (Al), (HOOTS), (Z39) are examples of symbolic addresses. The symbolic address may include up to five characters, letters, figures or symbols; 131 specifically, any character which is actually printed is considered a part of the symbolic address. The characters If. and cr., delay and space are not regarded as part of the symbolic address and are in fact completely ignored by SADCIo Below the four symbolic addresses just cited are shown as they might appear in a section of code: L5 (1) ko (Al) LC (BOOTS) 36 (Z39) Here the symbolic addresses appear in the address portion of the order to indicate the operand referred to by the order. Now the symbolic address (l) is the "name" for a certain word of the program^ let us say that this word is 00 F 00 10F. When the code is written the word 00 F 00 10F is given this name, (l),by writing the word as follows. (1) 00 F 00 10F SAD0I loads the words of the code sequentially into blocks in the memory as specified by the directives mentioned in the last chapter. When SAD0I reads (l) 00 F 00 10F from the tape it recognizes the (l) as a symbolic address name for this wcrd and associates (l) with the actual memory location, say m, into which this word is loaded., Every address reference to (l), as in the L5 order above, is now interpreted by SAD0I to mean a reference to memory location m (since the word called (l) in the code has been placed in location m) and the binary address m is inserted for the address digits of the order by SAD0I. The same remarks apply to the other symbolic addresses above, (Al), (BOOTS), and (Z39) • Let us consider a short example: 132 00 10K L5 (1) 14-2 (2) (2) LO (3A) 36 F (1) OF F 00 100F (3A) OF F 00 200F This portion of the code would be printed as follows on the teletype tape: / 9 • • • / 133 After SADOI reads these orders from the tape they will appear as follows in the memory: W.M. Location Order Pair (Sexadecimal) (Sexadecimal) 00K L500N J+200S 00S LOOOJ 36000 00W 0F000 00064 00J 0F000 000N8 When the symbolic address appears in the address portion of an order it is called an inside symbolic address. In the first order pair of the above example (l) and (2) appear as inside symbolic addresses. When the symbolic address precedes the order, thus "naming" it, we call it an outside symbolic address. In the second order pair of the above example (2) appears as an outside symbolic address and (3A) appears as an inside symbolic address. Notice that a letter shift character precedes A (in the symbolic address 3A) since A can only be printed when the teleprinter carriage is in the letters position. SADOI recognizes the letter shift character and accordingly properly distinguishes the characters following it as "letters". Following A a numbers shift character appears. Again, SADOI recognizes the numbers shift character and accordingly distinguishes the characters following it as "numbers". Characters which are the same in either mode, letters or numbers, namely F, J, L and N are likewise regarded as the same in either mode by SADOI. The letter shift character and number shift character are not counted among the five characters which may be used to specify a symbolic address . In general one can say that only those characters count which the teleprinter actually would print. 13^ UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 19 SADOI - PART 3 In this chapter additional features of SADOI and some of the logic connected with the operation of SADOI are discussed. The library subroutine write-up of SADOI is contained in Appendix 9, pp. 275-329. The SADOI program is stored permanently in the auxiliary drum memory of the ILLIAC When a program tape is to be read into the ILLIAC a series of preliminary routines are first executed which eventually read SADOI from the drum and place it in the WM. Control is then transferred to SADOI and it begins read-in of the program tape. A discussion of the preliminary routines is presented in Appendix 10, pp. 330-337- For the present discussion let us just assume that SADOI can be automatically called forth from the drum, placed in the WM, and control transferred to it . The program tape must begin with a directive, which is of the form 00 mK where m signifies a decimal integer. This directive instructs SADOI to store the order pairs which follow in locations m, m+1, m+2, ..., of the WM. This directive also sets a number known as a relativizer which is added to the relative address to form the real address of an order. The orders are assembled in location 1 of the WM. Let us consider now an intermediate stage in the assembly of a program, where SADOI is ready to read a new order from the program tape. Before read-in of the function digits of an order begins the WM location 1 holds the last two orders read by SADOI; the next-to-the-last order is in the LH order position of location 1 and the last order is in the RH order position of location 1. When the function digits for the new order are read the contents of 1 become shifted 20 places to the left so that now the last order resides in the LH order position at 1, and the function 135 digits of the new order are in the function digit positions of the RH order at 1; namely, digital positions 20, 21, ..., 27. The remaining digital positions of the RH order contain zero at this stage of the read-in they eventually will hold the address of the order now being assembled. After the function digits have been read, read-in of the address begins. The address is assembled in WM location 0. The address, as has been seen, may be either numerical or symbolic. Let us consider the treatment of the numerical address first. As the digits of the numerical address are read they are converted to form a binary integer which is stored at location zero. This decimal to binary integer conversion proceeds until the termination symbol is read. This computation is executed in such a way that it is possible to write any decimal integer within machine range on the tape and it will be properly converted to the binary integer and stored at zero- Different things will now happen, depending on the termination symbol. If the termination symbol is K , then SADOI interprets the order as a directive. So far only one form for the directive has been cited; actually there are four. They are listed with their meaning below. Directive Meaning 00 mK Load the following order pairs at m, m+1, . . . and set the relativizer to m. 00 K If m is the location of the last instruction pair then set the relativizer to m+1 and load I following order pairs into locations m+1, m+2, . . . 01 nK If m is the value of the relativizer then the following instruction pairs will go into m+n, m+n+1, ... . The relativizer is not changed. 136 Directive Meaning 02 nK Set the relativizer to the address m of the preceding instruction and load the following order pairs into locations m+n, m+n+1, ... . The effect of these different directives is illustrated in Figures 19-1 and 19-2. If t he termination symbol is S , then one sexadecimal character which must follow S, and must be 2, 3, ^ ... or L, is read from the tape. This character causes the word, called the S parameter, at the corresponding WM location (2, 3, h, or L) to be added to the integer at location 0. The resultant sum is then added to the word at location 1. Assembly of the new order is now complete. The effect of this termination symbol is illustrated in Figures 19-3 and 19-4. If the termination symbol is N , then the integer at location is added to the word at location 1. If the integer at zero is less than 999, then the program being assembled is read from the drum, where it is stored during the assembly, into the assigned locations in the WM and control is transferred to the order at the RH of location 1. This order is the last order read, namely the order whose address is terminated by No If the integer at location (i.e. the address of the order terminated by N) is 999* then SADOI comes to a stop on the order 2^ 05J C » A black switch start will cause SADOI to resume reading the program tape. Thus, if a program is on two separate tapes, the first tape is terminated by 2k 999N to cause a stop so that the second program tape may be put into the photoelectric reader. Other addresses above 999 which are terminated by N are used in connection with interludes and drum loading^ the reader is referred to the SADOI write-up for a discussion of their use. 137 ORDER PAIR ORDER PAIR ORDER PAIR 00 10K 00 10K 00 10K L5 8l 15 81 L5 8l h-0 2L 40 2L 40 2L 1 L5 9L I L5 91 1 L5 9L 40 3D 40 3L 40 3L ! 00 2L 00 K 01 4K 02 2K LOO F If L5 2L 2 L5 L 00 F] 14 IOL L4 8L 1 [00 F C 40 2L 3 Jj-0 L 00 F] F5 3L F5 1L 2 L5 L 6 ij-2 ;»L 4 42 1L 14 8l LO UL ID 9L 3 40 L 7 36 2L c 2 56 L F5 1L OF F OF F 4 42 1L 8 L5 100F 6 L5 100F LO 9L l-o- 200F L4 200F 5 36 L 9 50 F 7 50 F OF F 40 300 F 40 300F 6 L5 100F 10 00 1 P 8 00 IF L^J- 200 F 00 IF 00 IF 7 50 F 1.1 .JO F ' JO F 40 300F 40 ^OOF 40 400F 8 00 LF 00 IF 9 JO F 40 400F Figure 19-1 Three forms of the same code illustrating the eft', t lirect Each of these is loaded into the WM by SADOI Lgure 19-2. 138 WM LOCATION CONTENTS OOK L5012 4000N OOS L5013 UOOOJ OON 00000 00000 OOJ 00000 00000 OOF L500N lAOlU OOL A+OOON F500J 010 ^200J L0015 Oil 3600N OFOOO 012 L5064 LU0N8 013 50000 i+012N Oik 00001 00001 015 JOOOO 40190 Figure 19-2 Each of the codes shown in Figure 1 Q -1 is loaded into the WM by SADOI as shown here. All characters are sexadecimal. 139 WM ORDER PAIR 00 3K 3 00 F 00 100F Parameter S3 k 00 F 00 200F Parameter S^ 5 00 10F 00 30F Parameter S5 6 L5 F 26 6kF Parameter S6 00 10K 10 L5 S3 i+0 2SU 11 L5 2F 40 S*+ 12 L5 1S5 i+0 6l 13 L5 2S5 i+0 3S5 Ik 00 F oo is6 Figure 19-3 A portion of a code designed to illustrate the effect of the S termination. The contents of locations 10, 11, 12, 13, and Ik, after this code is read by SADOI, are shown in Figure 19-^. 140 WM LOCATION CONTENTS OOK L5064 400NK OOS L5002 400N8 OON L501L 40010 OOJ L502K 40021 OOF L5000 26o4l Figure 19-4 The contents of locations 10, 11, 12, 13, and 14, after the portion of code shown in Figure 19-3 has been loaded into the WM by SADOI. All characters are sexadecimal. Sometimes it is desired to jump to a word in the program identified by a symbolic address, say (A) . Rather than figure out the real address, call it 769^* corres- ponding to (A) in order to terminate the tape by 26 769N one can terminate the tape with the pair of orders 26 (A) 26 IN and achieve the desired effect. It is important to take notice of the fact that the word in which the order terminated by N is located is never actually assembled as a part of the program. Thus, if the tape ends with the order pair OF F 24 100N 141 then the order OF is not actually loaded as a part of the program. To get the order OF into the memory in this instance it is necessary to use a waste half- order as follows OF F 00 F waste 2h 100N If the termination symbol is J , then the following computation is done : &) , . (1) 1 j (0) - , X 10 11 x 2-» + , x 10 11 X 2^ 6 , + 1 5 x 10 x 2"^ where (l) means the contents of location 1 and (0) means the contents of location 0. This calculation converts the integer, (0), to a fraction and adds the result to (l). We see now the reasons behind the rules given earlier for the use of the J termination symbol. Assembly of the new order is now complete. It is perhaps worthwhile to digress for a moment to illustrate how the above calculation does in fact produce the desired result. The number preceding the J termination is read by SADOl just as any other address and therefore is held as an integer in location zero when the J termination is read. To convert this number to a 12 digit fraction it is of course necessary to divide it by 12 10 . However, it is to be noted that if the number preceding the J was 5^9 755 813 888 (= 2?^) or larger (suppose we wanted to store -999 999 999 999 by writing the order OOF 00 999 999 999 999J) then there will be overflow of the number into the sign digit. Consequently the integer at location zero is brought into ILLIAC range by first subtracting 5 x 10 to form a = (0) - 5 x 10 x 2 Jy . -ko In order to provide for a rounded quotient with a maximum error of 2 the 11 -39 number 5 x 10 x 2 is placed in Q before division thus making the dividend a + 2" 39 q = (0) - 5 x 1Q 11 x 2~ 39 + 5 x 1Q 11 x 2~ lQ . 1U2 11 -59 Division by 5 x 10 x 2 Ms then executed to form 5 x 10 x 2 -^ (where 5 = or 1 according as the true quotient does or does not have a 1 in the hit position.) This quotient is then shifted to the right one place to drop off the division roundoff digit and produce q . -in = 121 i + 2-^ ^ "^ 10 12 x2- 59 2 Next this result is added to l/2 to form (in the accumulator) a _ (0) + 2"^ 10 12 x 2^9 The term on the right provides the desired roundoff error |e| < 2 . Finally, this number is added to the number at location 1 to form a' - (1) + a - (1) + 1 p ( ° ) , Q + 2' k0 10 x 2 Jy permitting the sign digit to be picked up if the fraction was negative. If the termination symbol is F , then the integer at is added to the word in 1 and the assembly of the new order is complete. If the termination symbol is L , then the integer at is added to the relativizer (which was set by the directive) and the resultant sum is added to the word in location 1. The assembly of the new order is now complete. Let us now consider the action taken by SADCI when a symbolic address follows the function digits} this would be an inside symbolic address. First it should be noted that an integer may precede the symbolic address; that is the order may have the form TV n( ) where n is a decimal integer. This form for the address is interpreted to mean that the real address for the order is given 1^3 "by n + (the address represented by the symbolic address). SADOI reads the integer n and stores it at location 0, as described earlier for the numerical address. Notice that during this read-in of n SADOI does not "know" what kind of an address is present, it may be numerical or symbolic; only when the left parenthesis, which follows n, is read is the existence of a symbolic address recognized . The characters of the symbolic address are read, and encoded into groups of six binary digits. Five bits are used to specify the tape character and the sixth bit specifies whether the character was printed in the letter shift mode or the number shift mode; since the print mode is thus encoded it is not necessary to specifically encode the number shift and letter shift characters. These six bit groups which represent the letters of the symbolic address are formed as the symbolic address characters are read from the tape and they are shifted into a word from the left hand end. This process proceeds until the right parenthesis is read and then the word is stored temporarily so that after read -in of the symbolic address characters this word contains, when read from left to right, the last 5 coded symbolic address characters in w w ... w . The right-most ten bits of this word are set equal to zero; later they may hold the real address corresponding to this symbolic address . Notice that because the actual symbolic address is composed by this reading and shifting procedure, a cycle which is stopped only when the right parenthesis is detected, the symbolic address written on the tape may be composed of an arbitrary number of characters but only the last five, reading from left to right, will actually be used by SADOI for the symbolic address: thus, (13A2Z) (1I13A2Z) (WXYZ16U15A2Z) are interpreted by SADOI as identical symbolic addresses. As was cited earlier a symbolic address may contain less than five characters. Having read the inside symbolic address, SADOI begins a search through a list, known as the symbolic address list in an attempt to find the real address which corresponds to this symbolic address. This list contains symbolic 1 address words . Each distinct symbolic address used by the program is represented by a word in this list; the symbolic address represented is located in digital positions w w ... w according to the encoding scheme described above. The words in this list have two origins . An entry is made in this list each time an outside symbolic address, call it X, is read from the tape. In this case the real address corresponding to X is known; by definition the real address is just the WM location assigned to the order having X as an outside address. The real address is put into the rightmost ten bits of the symbolic address word. The other origin of entries to this list will be seen presently. In the search of the symbolic address list a symbolic address word holding the "looked-for" symbolic address and the associated real address will be found if the necessary outside symbolic address has already been read from the tape. In this event the real address is extracted from the symbolic address word and is added to the integer at location 0; the resultant sum is added to the word at location 1 to complete the assembly of an order having a symbolic address. Now it may be that the outside address has not yet been read from the tape. In this instance the symbolic address of the order being assembled is referring to a word of the program whose location has not yet been assigned? such a reference is known as a forward address reference . (in the previous case where the location had already been assigned at the time of the inside symbolic address reference we had what is known as a backward address reference .) The real address will now not be found in the list. As a consequence of this, the symbolic address word which was formed on read-in of the symbolic address is now added to the symbolic address list? recall that the right most ten bits of this word are zero. This is the other origin of entries to the symbolic address list. It may be that the present symbolic address has already been used as a forward reference in which case the symbolic address will have already been entered in the list; the fact that the right-most ten bits of this word are zero indicates that they do not represent a real address . When an entry from such a previous forward reference is found no new addition to the symbolic address list is made. Remember that location holds the integer preceding the symbolic address; i.e. (0) = n where the order is of the form TV n ( ). 145 One can readily see that the forward address reference calls for special attention because the assembly of the order using this forward reference cannot be immediately completed. Provision is made for SADOI to "remember" that the real address of the order is absent so that later after the real address has been obtained it may be substituted in the order., Provision is also made for SADOI to remember the increment that must be made to the address represented by the symbolic address to obtain the real address of the order; this increment is the integer at location 0, earlier designated by n. These provisions are made as follows. If n = then the order being assembled is given an address equal to the memory location of the word in the symbolic address list holding this order's symbolic address. The fact that the address of this order has this special meaning is remembered by SADOI in a special block of 52 words called 2 bit registers. Each binary digit in this block corresponds to an order and if the digit is 1 it means that substitution of the real address in the corres- ponding order is necessary; if the digit is it means that the corresponding order already contains the real address. As each order is assembled this digit is appropriately set. On the other hand if n / then the increment to the symbolic address must also be remembered. This is done in another block of words called the additions list. In this case a word, called the additions word, is constructed according to the following prescription: the left most 30 bits hold the right most JO bits of the word at location zero (i.e. they hold 30 the integer n, provided n < 2 ); the remaining 10 bits on the right hold the location of the associated symbolic address word in the symbolic address list. This additions word is stored in the additions list. The address portion of the order being assembled is set equal to the location of the corresponding additions word. The 2 bit registers are used as described above to indicate that the real address is still to be substituted. Whenever an outside symbolic address is read from the tape a search of the symbolic address list is made to determine whether or not it has already been entered in the list. If an entry is found it should have been placed there because of a forward address reference, as described earlier; the real address is now inserted in the right most ten digits of the symbolic address word. It is li+6 possible that the programmer has made an error and given two different words of the program the same outside symbolic address. This situation would also cause an entry to be found in the list but it can be distinguished from the above case by examination of the right most ten bits of the symbolic address word: these will be zero if the entry resulted from a forward address reference; they will be non-zero if the entry was due to the earlier use of this symbolic address as an outside address — this situation causes SADOI to produce an error print (see Appendix 9, pp. 287- 3 Liscuosioii of error stops). In the latter case the "new" real address is substituted into the address digits of the symbolic address word. Thus the real address corresponding to the symbolic address is always the last one assigned if the same symbolic address is used as an outside address more than once. The operations connected with the reading and assembly of an individual order have now been described. Let us now consider briefly how SADOI assembles these orders into a program. SADOI must keep track of whether it is working on a left hand order or a right hand order during assembly. In doing this SADOI assumes that the order following a directive or an N termination is a left hand order. After each right hand order is assembled, the word at location 1 which then holds an order pair is added to a list in the WM that can hold k^ order pairs. When this block becomes filled the order pairs are transferred to the drum memory. Each order pair is stored on the drum in a location that uniquely corresponds to the assigned location of the order pair in the WM (i.e. the location it will occupy in the WM after the assembly is completed); this correspondence is WM location + 11,756 = Drum location The assignment of locations in the WM is controlled by a counter which is set by the directive orders. Whenever the directive or the N termination is detected the word at location 1 is not added to the order pair list, even though it may occur in a RH order. Orders which are directives or are terminated by N are never considered as truly orders of the program, rather they represent instructions to SADOI for the various purposes we have cited. Because of this feature it is important to remember that if such an order does appear in the RH order position, then the preceding order which is in the LH order position also will not get stored as part of the program. 1V7 Whenever the K directive or the N termination, with address less than 999 is detected or, as cited above, when the assembly block of V? words in the WM is filled, the words in the assembly block are transferred to their proper locations in the drum memory. In the event of an order with an N termination and an address less than 999 the program is then read into the assigned locations in the WM and any necessary substitutions of real addresses are made (determined by examination of the two bit registers) and finally control is transferred to the word at the RH order position of location 1 (this being the last order read from the tape) . The available memory space puts a limitation on the size of the symbolic address list and on the size of the additions list. These limits are as follows : a) The number of words in the symbolic address list (which is equal to the number of different symbolic addresses) must be less than 325; b) The number of words in the additions list (which is equal to the number of addresses of the form n( ) where the symbolic address is a forward address reference) must be less than 315. The foregoing two chapters and the present one have been presented as an introductory survey to some of the main features of SADOI. Not all features have been discussed; indeed, we have not talked about input of library subroutines from the drum- -this will be discussed through examples in a later chapter. For specific details of the SADOI properties the reader should consult the library subroutine write-up. 1U8 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 20 PROGRAM ERROR DIAGNOSIS There is a variety of errors that can be made in setting up a problem to be run on a computer, and a programmer will frequently make at least one error, or perhaps more, in a program of reasonable length. Good programming technique includes knowing how to properly check a program for possible errors and knowing how to locate the source of any errors detected. The kinds of errors that occur fall roughly into two general classes. There are errors due to mistakes in the coding logic -- the programmer thinks that he has told ILLIAC to do one thing when in fact he has told it to do some- thing quite different. There are errors due to incorrect methods — ILLIAC does exactly what the programmer thinks he has told it to do but he has not told it to do the correct thing. The former type of error is commonly referred to as a blunder and in comparison with the latter type of error it is relatively easy to detect. This is so because the blunder will commonly cause the machine to stop, to loop (execute a block of orders repeatedly without end), or produce "answers" that are so far from the correct answers that one is immediately aware that something is wrong. The second type of error on the other hand will usually produce "answers" which appear to be reasonable, and consequently the errors are more likely to go undetected. Furthermore, since the latter type of error results from a conceptual error on the part of the programmer it is still more likely to be hidden. When a program has been written, the testing of it for possible errors is known as code checking. The specific procedures to be used in code checking a problem of course depend on the problem at hand. One good practice is to check the individual parts or subroutines of a program by themselves first. Generally this requires the preparation of a set of "dummy" data to be used as input data for the subroutine. Furthermore there must be some way of independently checking 1U9 the response of the subroutine to this data 5 e.g. by a hand calculation or from already tabulated values. In doing this it is important that an intelligent choice of input data to the subroutine be made, since it is impossible to test the response of the subroutine to every conceivable set of input data. If the subroutine is supposed to be able to accept a range of values of an input parameter then the response of the subroutine to the limiting values of the parameter should be checked. One should try to pick input data which will give a response by the subroutine that is easy to check by a hand calculation; for example one check is to provide input data which will always give zero's as output data, then it is easy to scan the output data for errors because they will stand out against the background of zerosj another help is to provide sets of input data which yield an output by the subroutine which changes in a simple and consistent way with successive sets of data . After each subroutine is completely checked then they should be assembled together into the final program. Following this a second series of code checks should be made to guarantee that the individual parts of the program have been properly linked together. Although on the surface of it the assembly of the parts into the whole would seem to be a fairly simple task, a little experience will show that great care must be exercised to avoid errors in performing this operation. If one does not follow the practice outlined above or one similar to it, but tries to check the entire program as a whole without any preliminaries, then errors will usually be difficult to localize and remove. This of course is not true for very short programs . If one intends to separately test the parts of a program this should be kept in mind while the program is being written so that it is not too difficult to test each part as an independent unit. Some remarks concerning the organization of the program for easy code checking follow. One should minimize the number of cross references between subroutines (for example, subroutine A should not have many orders which refer to specific words in subroutine B as operands). Mini- mization of cross references will generally result in a somewhat longer program (i.e. more words) but the resultant simplicity is worth the length if memory space is not at a premium. 150 Another procedure for organizing a program that seems to provide for relatively easy checking is the following . Let the various subroutines be numbered 1, 2, ..., n; i.e. (l) is the outside address of the first word in subroutine number 1, and so forth. Write a master control routine which has the form shown in Figure 20-1. ORDER PAIR COMMENTS (0.1) 2h (1) 00 IF (0.2) 2k (2) 00 2F (0.5) 2k (3) 00 3F (0.4) 2k (k) 00 kF to "Read Data Subroutine" to "Initialization Subroutine" tc "Initial Print Subroutine" Jumps to subroutines in main part of the program (O.n) 2k (n) 00 nF OF F \ Final stop OF F ■> ) FF IF | 2 (or more) 26 (— ■) -1 ' special stops . FF 2F 26 (— J Figure 20-1 Suggested form for master control routine. 151 When exit is made from each of the subroutines a jump is executed to the appropriate transfer order in the master control routine. In code checking the program the black switch stops provide simple blocks between the subroutines, permitting easy individual checking of each one. The right half of each transfer word is designed for easily determining which 2k order causes a stop during a code check, by reading the right address digits of the order register. After the parts of the program have been checked the 2k orders can easily be changed to 26 orders (notice that a k can be changed to a 6 by simply punching out the 2's hole on the tape). It is usually convenient to have all stops in the program in the master routine, as indicated in Figure 20-1. Another procedure which seems to be quite helpful is to have all constants used in the program located in a single block of storage. This is to be preferred over putting constants in unused space scattered through- out the program (unless memory space is at a premium) because one is then less likely to cause errors when making corrections in a program during the code checking procedure, or when making changes in the program after it has been checked j e.g. it is easy to forget that the address digits of some order are being used as a constant, say to set a base address. Furthermore from the discussion below it will be seen that this procedure permits one to easily post-mortem all constants of a program. For similar reasons it is usually best to put all data or parameters for a program into a separate storage block. It should go without saying that the program should be very carefully prepared in the first place| this includes writing it carefully and reading it over very carefully, at least twice, before it is even put onto the computer. The two readings of the program should be separated by a space of time of at least 2k hours to reduce the chance of overlooking the same mistake twice in a row. Also, the printed copy produced by the teleprinter in making the program tape should be carefully compared against the handwritten copy. In general the programmer should take every possible precaution against errors so that he is as certain as possible that there is no error even the first time the program 152 is put onto the machine -- unfortunately, there usually will be some errors anyway but hopefully, if all of the precautions have been taken, they will be small in number . The recommendations expressed in the foregoing paragraphs are not always followed . A number of people feel that one should be moderately careful in preparing the program and adopt the philosophy that any errors that exist in the program can be found and removed during the code check. They claim that the computer will turn up the errors faster than the programmer will by reading the program over and checking it carefully. It is no doubt true that most errors, will be found automatically during the course of a code check, if it has been well designed- Nevertheless, no code check is perfect since one cannot test the output of the program against every conceivable input (if this were possible the program would not have been necessary in the first place) . Therefore the probability that an error in the program will get by all code checks without detection is not zero, though it may be small . If the programmer is sloppy, relying on the code checks to turn up his blunders, and his more subtle errors, then the probability of an error getting by all code checks is much greater than for the careful programmer since the careful programmer has fewer errors to begin with. When a code of one hundred instructions is checked and ten errors are found a careful programmer should be very concerned about the possibility of still more errors which were undetected. An experienced programmer should average fewer than one error per one hundred instructions . When a program is being checked and a failure is found there is a great tendency to blame the computer. After a little experience it will be found that virtually all failures are due to program errors . The programmer should adopt the attitude that every failure is due to the program and then take the necessary steps to find the error in his program. It is of course possible for computer failures to occur. If a program has failed and the programmer has thoroughly checked over his program and still cannot find the error then he may try to run it again on the computer. If it fails again, as before, then it is almost certain that the failure is due to an error in the program and the programmer should look into his program again. On the other hand, if a second running of the 153 program yields a different result than the first running then the programmer can assume that a computer error was the source of the failure; this conclusion is only safe if the same physical program tape is used in both attempts to run the program . The methods used by programmers for checking the various parts of their program differ in detail.. Generally a short routine known as a "driver" must be written. The function of the driver is to supply data to the subroutine being cheeked and to print information about the operation of the subroutine. These drivers vary in degree of elaborateness . Sometimes a dynamic check of the subroutine is made. In this the driver program interrupts the running of the subroutine under test at various points, known as check points, and prints out specified information about the contents of certain memory locations and certain registers; following this the driver lets the subroutine resume its computations until the next check point is reached. When the master routine is as shown in Figure 20-1 the addresses of certain of the transfer orderg are altered so that a jump to the "driver" is made instead. Commonly the altered transfer orders and the driver are on a second tape (an overwrite tape) which is read in after the main program. To facilitate the reading of an overwrite tape the main program tape should end with the following sequence of orders: 2k 999N 26 (0.1) 26 IS Here the 2k 999N stop permits one to put the overwrite tape into the reader and read it in with SA.D07. Alternatively, if no overwrite is desired then a black switch start will cause execution of the program to begin. A subroutine in the ILLTAC program library, program Dl, permits a very flexible dynamic checking procedure. A description of the properties of this subroutine is in Appendix 11, pp. 339- 3^3- Another cheeking procedure is commonly used in which the driver simply stores the results -btained from the test data in an unused portion of the memory. After the subroutine has processed the test data, the driver causes a STOP to occur. 15* The results which have been stored away are then read by one of the post-mortem routines available in the ILLIAC library. They permit a desired portion of the memory, WM or drum, to be printed in different forms; the words may be printed as decimal integers, decimal fractions, order pairs with sexadecimal function digits and decimal address, etc. When a program is being checked the most common occurrence is an unexpected stop, a zero left shift, a f hangup, or the program goes into a loop (i.e. it executes a set of instructions over and over again without termination). To locate the cause of this failure a post-mortem of the program is made. This involves running one or more of the post-mortem routines while the "dead" program (i.e. the program that has just failed) is still in the TLLIAC . A description of the post-mortem routines that are avail- able is provided in Appendix 12, pp. 3**- 58 and Appendix 13, pp. 359-63. In using the post-mortem routines a common oversight is to neglect to get all of the desired information printed outj for example the programmer may have the block of words at location 100 to lUO printed as integers only to find out later, after his program has been erased from the ILLIAC, that he also needs the integers in locations 1^0 to 150, To avoid wasting time, and to insure getting the maximum amount of information out of each code check the programmer should carefully write out in advance the memory locations of all of the words he might want to print out in a post-mortem. Finally a remark about removing errors from a program. When a program failure occurs, the programmer, usually with the assistance of information gained from a post-mortem, begins a sleuthing job which should ultimately locate an error, Now it may be that the error found does not appear to entirely explain the failure. Before proceeding, however, it is generally worthwhile to remove the error just found and repeat the test, it will frequently be found that this one error just removed does indeed completely explain the failure, and if not it is usually the case that the remaining errors will be found more easily. In other words it is usually best to remove the errors one by one, repeating each code check after removing the suspected error. When errors are located one should be very careful in removing them for it is amazing how easy it is to create more than one new error by the removal of one old error. 155 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 21 ILLIAC STORAGE UNITS In this chapter the two memory units of the Illiac, the Williams memory and the drum storage unit, will be discussed „ The use of the Williams memory (WM) has already teen thoroughly discussed on the preceding pages, so that the following brief description will involve only the physical characteristics of the WM* The reader Is referred to references (2) and (3) (Chapter l) for a more detailed discussion of Williams Tube storage devices . The major part of our attention in this chapter will be directed toward the drum storage unit. The basic element of a Williams memory unit is the cathode ray tube. One end of the cathode ray tube holds an electron "gun", an emitter of electrons, and certain elements for focusing the emitted stream of electrons on any point at the other end of the tube which has a coating of phosphorescent material. When the electrons strike the phosphorescent material they give up energy to it and cause the material to emit light. The Williams memory device does not make use of the light emitting properties of the phosphor. A small positively charged spot is created on the phosphor when the electron beam strikes it and this charge will 2 remain for a short while even after the beam is turned off. A bit of information can be stored on the phosphor surface by assigning two close-together points on the surface to one bit and letting a 1 be represented when one of the points is positive relative to its neighbor and letting a be represented by the inverse situation, I.e. the neighbor relatively positive. The stored information is "read" in the following way. A conducting screen is attached to the outside of the tube The Williams Tube memory belongs to the class of storage devices known as electrostatic storage devices. 2 One might think a negative charge should be created insteadj however, when the electrons strike the phosphor they cause electrons to be emitted (secondary emission) by the phosphor leaving a net positive charge. 156 at the end having the phosphorescent coating (which is on the inside surface of the tube). To read a bit the electron beam is directed at one of the two points (always the same one) representing the bit and a pulse of current (caused by the redistribution of charge at the surface of the phosphor) is sensed in a wire connected to the conducting screen; the polarity of the pulse depends on whether or not the point at which the beam was directed was the point of the pair that was relatively positive. Reading is destructive; that is, the infor- mation that was there may be destroyed by the act of reading, so it is necessary to write the old information anew after reading. Writing information into storage is achieved simply by directing the beam at one of the two points associated with a bit depending on whether a 1 or a is to be written. The WM of the Illiac is comprised of ^0 of these tubes, one tube corres- ponding to each digital position. The surface of the tube is divided into 102^ point-pairs, one point-pair for each memory location. The point-pairs are arranged in a regular pattern — a square lattice with 32 point-pairs on a side. With this arrangement it is possible to write or read information by aiming the electron beam in each of the ^0 tubes at the spot corresponding to the memory location involved! it is thus possible to read or write digits in a parallel manner. Wow the small charged spots will change with time because of leakage of the charge; therefore the spots must be periodically refreshed. There is a unit in Illiac which keeps the memory continually refreshed; this is done in a systematic way, reading the information in each memory location and writing it back, thus keeping it fresh. 'This process is known as regeneration. The time taken to regenerate the information in one location is sometimes called a "clock period" or a "basic memory cycle" and it is equal to about 18.5 usee. Whenever access to the memory for reading or writing is necessary (e.g. for reading order pairs, writing information via a type h order, etc.) the current memory cycle must be completed before access to the memory is permitted. When the same location in the memory is referred to repeatedly the points in the neighborhood of the point representing this location get sprayed with a small amount of electric charge and the information in these neighboring points may 157 be destroyed as a result. The number of times a specific location may be thus referred to before information in a neighboring point is changed is known as the read-around-ratio! this is a statistical quantity and the average value is quite high, about 350- This ratio is so high that before information is lost in a neighboring location because of read-around a complete regeneration of the memory is usually executed and the neighboring points are refreshed. This is not true for all computers . In many computers having the Williams tube memory read-around is a serious problem? in writing codes the coder has to be careful not to refer to the same region in the memory too frequently during the regeneration period for the whole memory. From the standpoint of high read-around-ratio the Illiac is one of the most reliable computers with a Williams tube memory . It has been mentioned several times previously that the Illiac has an auxiliary memory device, a drum storage unito Let us now turn our attention to it. The fundamental parts of this unit are a cylinder (length = 15 inches, radius = 4.25 inches) coated with a magnetic material and mounted so that it can be rotated at high speed by a motors a se "t ? writing heads, devices mounted in a framework around the rotating cylinder, which can induce a small magnetized spot on the surface of the cylinder | a set of reading heads, devices also mounted in a framework around the rotating cylinder 5 which can sense the magnetized spots on the surface of the drum created by the writing heads. The reading and writing heads correspond to the devices which perform a similar function in a tape recorder. The writing heads of the drum create a magnetized spot on the surface of the drum with the direction of the magnetization having just two possible values corresponding to the writing of a 1 or » The reading heads can sense the direction of the magnetization and thus detect whether a 1 or is stored , Unlike the WM, reading the drum does not destroy the information stored there. The surface of the drum is subdivided into 200 tracks | each track can be regarded as an imaginary circle drawn around the surface of the cylinder as shown fcelow in figure 2i-l. The tracks are numbered 0, 1, 2, .. .., 199° Associated with each track is a writing head and a reading head. Each track is divided into 64 sectors. Each sector comprises enough space to record ^0 magnetized spots along 158 the track by the associated writing head; thus, each sector represents one Illiac word. A drum location or drum address corresponds to a particular word position on the drumj that is, it corresponds to a particular track and sector, fourteen "binary digits are necessary to represent all possible drum addresses; 2 = 16,38^. The following addressing scheme is adopted: the least significant six digits of the fourteen digit address specify the sector number and the remaining eight digits specify the track number. It will be noticed that the sectors are not numbered consecutively along the track. Consecutively numbered sectors are separated by four sectors. The order pattern for the numbering of the sectors should be obvious from Figure 21-1. With this arrangement of consecutive drum locations it is said that the locations are interlaced. The reason for the interlacing will soon become clear. A type 8 order is used to read (playback) information from the drum and write (record) information onto the drum. The drum orders require a complete h-0 digit word rather than just a half word as required by all other kinds of orders. The structure of the drum orders is as follows. Let w = w Q w x w 2 ... w be the usual representation for an ILLIAC word. To record the contents of the accumulator onto drum location p the order has the form v w w . . . w_ = 1000 0110 = 86 V ~J LH function digits Wn w are ignored as usual W 10 W ll W 12 " ° ' W 19 = °° 000 ° 101L = 13 D v v— 1 LH address digits 159 co M o CM CD •H CO nJ -p ■p O C O •H -P oj -P a) ■H O -P Ml C •H o CO CD -P Ch O O •H ■p o CO ,1 ix! CO i6o w 20 w 21 w 22 ' ' " W 25 = 00000 ° (normal form) RH function digits except V, and V w ■/■ w „ w q ... v = p, drum location into which 25 2 ' 2 information is recorded .* Thus, the order pair to record the contents of A into location 2,500 of the drum is written in SADOI notation as 86 11F 00 2500F To playback the contents of drum location p into the accumulator the order has the form ww w ... v = 1000 0101 = 85 U _l_ tL. ( o LH function digits Wo w are ignored as usual W 10 W ll W 12 ' " " W 19 = °° 000 ° 10U - = -^n k ~ ' LH address digits W 20 W 21 W 22 " * * v 2*> = 00000 ° (normal form) _^ RH function digits except V, and V p W 26 W 27 W 28 *** W ^Q = p ' drum location from which playback is to be made* Thus , the order pair to playback the contents of location 2,500 on the drum into A is written in SADOI notation as 85 1LF 00 2500F If 12,800 D < p c 16,383 D , ILLIAC will stop. l6i There are several points to be made about the structure of these orders. Notice that the left-hand address digits are equal to 11 (decimal). This must he so for proper operation of these orders (there are certain unusual cases in which the left-hand address digits may he different than 11 hut they are of no practical use). Notice that the two least significant function digits of the right half-word, namely V, and V , are used as the most significant digits of the drum address . Finally, observe that digits w □ w , which in all other orders are ignored, are here used as part of the drum address digits. Execution of the record order causes eleven left shifts of AQ. Thus, unlike storing information in the WM, where the contents of AQ are not altered by the store operation,, the storing of information on the drum does cause an alteration of the contents of AQ. Similarly the execution of the playback order involves 11 left shifts of AQ| so, on completion of the playback instruction, the contents of Q will have been shifted 11 places to the left. (in this left shift the digits shifted out of the left end of Q do not go into A, as is also the case with the other 8 orders ) Certain variations of the form of the orders given above are permitted » The most important variation Is the following; if w_, = 1 or w = 1 then the right half-word will be executed as an order immediately following the execution of the drum order. In this case the drum address is interpreted modulo 13 8192 = 2 . For example the word 5 written in SADOI notation, 85 11F k) 250CF when executed as an order will first cause a playback of the contents of drum location 2,500 « Following this the right half-word will be executed as a normal k-0 order, and the contents of A will be stored in the WM location 2500 (mod 1024) = 452. The net effect of these two operations is then to transfer the contents of location 2,500 on the drum into location 452 in. the WM. The right half-word will always be thus executed as an order except when the T digit is 0, 1, 8 or 9 (i.e. except when T = T; = 0). Thus^ the following pairs of orders are equivalent 162 to each other and to the above orders wherein the store order is combined with the drum order in a single word. 85 11F 00 2500F U0 ^52F 85 11F 80 2500F k0 i+52F In making rise of this feature one must be careful to take into account the fact that w 9 „ plays a double role; it is the least significant variant digit of the RH order and also the most significant digit of the drum address. Other acceptable variations in the form of the drum order include V, = 7, J, L. 87 and 8l are record orders, like 86, but 87 first clears A (V, = l) and 8l first sets A = l/2 (Vn = V = l). 8j has exactly the same effect as the 85 order. Some other variations are possible but appear to have little utility. When using a drum storage device the timing of memory references becomes an important consideration. It should be fairly evident from the preceding physical description of the drum that recording into a given drum address or playing back from a given drum address can only occur when the rotating drum is in a certain phase of its rotation, namely when the sector on the drum surface corresponding to the address in question is under the recording or reading heads for the track corresponding to this address. If an order to record is given^the ILLIAC waits until the drum is in position for recording into the proper address., Now the time required for one revolution of the drum is 16.9 milliseconds | consequently, if the order to record, say 86 11F 00 pF 163 is given just after location p has passed under the recording heads, the ILLIAC must wait one revolution time, namely 16.9 ms., until the location p is again in position for recording . On the average, for a location selected at random, the waiting time is just half this, i.e. — (16.9) = 8.45 ms . These times are long on the ILLIAC time scale since 16.9 ms . is enough time to execute many standard orders (187 add orders can be executed in 16.9 ms . ) . It therefore becomes desirable to attempt to minimize the waiting time when executing drum orders. This is achieved by transferring words between the drum and WM in blocks rather than one at a time in a random fashion. Elock transfers are efficient because it will be observed that successive sectors and thus successive drum addresses follow each other closely -- thus shortly after sector passes under the recording heads, sector 1 passes under the recording heads and so forth. Consequently, if we do a series of record operations, say record into drum address 1000, record into drum address 1001, record into drum address 1002, etc, we may have to wait 16.9 ms . for location 1000 to come under the recording head but after this the waiting time is short because location 1001 closely follows location 1000 under the recording head, and similarly for 1002, and so forth. Let us now be more specific about these waiting times . The time required for the digits of one word (one sector interval) to pass a reading or recording head is 0.264 ms . (Notice that 64 x 0.26k- ms = 16.9 ms = the time for one revolution of the drum. ) Let us consider now a particular drum address d and let d correspond to sector s, track t. The connections between the ILLIAC and the drum require that an instruction to read from d or write into d must be given one sector interval before sector s is to pass under the reading or writing head for track t -- thus there is an enforced delay of 0.264 ms . Once sector s comes under the reading head it takes .264 ms for all of the digits of this word to pass the head. Immediately after the digits of s have passed under the head the execution of the drum order is complete. Consequently the minimum time taken for the execution of a drum order is two sector intervals or O.528 ms . If the drum order is given just after the sector preceding s has started to pass under the head then a complete revolution of the drum must take place before s will be in proper position to initiate the execution of the drum order. Thus the maximum time for execution of the drum order is 1.6. 9 + 0»53 = 17*^3 ms. i6k It will be observed in Figure 21-1 that successively numbered sectors are separated by four sector intervals . Suppose we wish to record into sector s, s + 1, and s + 2 of track t. The time taken to record into s will be at least 0.53 ms and at most 17*^3 ms ■ a s observed above . Let us assume that recording into s has just been completed . If the order to record into s + 1 is given within the next three sector intervals then this recording can take place with- out waiting for a full revolution of the drum| if this is done then completion of recording into s + 1 occurs just five sector intervals, or 5 x 0.264 = 1-32 ms, after completion of recording into s . Similarly, after recording into s + 1 one can execute recording into s + 2 without waiting for a whole drum revolution if the order to record into s + 2 is given within three sector intervals after recording into s + 1 has been completed. Notice that the time within which the next record order must be given is three sector intervals rather than four sector intervals % this is because of the enforced delay of one sector interval, mentioned earlier. It is thus possible to record words into successive drum locations at a rate of 1.32 ms . per word (5 x 0.264 = 1.32). The time delays between successive drum locations are the same as just described even when successive drum locations are on different tracks . The foregoing remarks apply to playback as well as recording. The three sector intervals, 0.792 ms., which may occur before the next record order must be given to achieve the maximum recording rate, are free for executing any ILLIAC orders that may be desired. For example it is common to use this time for bookkeeping operations which must take place between successive drum record operations . The only requirement for achieving the maximum recording rate is that the successive record orders be given within three sector intervals of each other. Because of this requirement it is clear that one must know how to compute the operation time for a sequence of ILLIAC orders. For the computation of operation times for these purposes it is best to compute the time in units of the basic WM regeneration cycle (18.5 ms ) or clock period. The times in these units for the various ILLIAC operations are listed below. 165 OPERATION Readout of each order pair Order types K, S, F, L Order types 2, k, 5, J and 3 when control is transferred Order types 85, 86 and 3 when control is not transferred TIME 2 k Notice especially the first entry in this table » The act of reading out the order pair must be allotted a time equal to 2 clock periods. The times listed are maximum times . The use of these times in computing the operation time for a section of code will be illustrated in examples which follow. Example 1 . Let us assume that a list of 200 numbers x_, x, , x , ..., x 1QQ is stored on the drum in location 3,500 to 3,699 and that this list is to be read from the drum and placed in the WM locations 500 to 699. The code follows. WM Order Pairs Comments 00 10K L5 8L Initialize drum ko 2L read (x. address = x^ address) v 1 ' 1 L5 7L Initialize WM k2 3L x. address. 1 © 2 ^5 00 iif~ 3500F from 6l read x. from drum 1 by L, k-L © 3 50 F waste 1+0 [500]F store x. in WM, by 1L, 5L ~©~ h F5 2L advance x. drum 1 ho 2L address (Continued on Page l66) 166 WM Order Pairs Comments © 5 F5 3L k2 3L i« = i + 1 © 6 LO 9L end test 36 2L transfer if i < 199 7 OF F STOP. (i = 200) 00 500F R.A. to initialize 3» 8 85 11F Constant to initialize 00 3500F drum read. 9 JO 1+0 F 700F End Const The order at 2L (i.e. 12F) reads an x. from the drum. The order at 3L (i.e. 13F) stores the x read from the drum into the WM. The addresses of both of these orders are modified. Notice that in the modification of the drum play- back instruction the modified address is restored with a ho order rather than with a k2 order. In the present example a k2 order would have worked just as well but in general a k2 order will not work for this purpose because the address being modified involves the digits v^ v w 2g ... w , not just w w ... w , which are the only ones changed by a k2 order. It is therefore good practice always use a kO order in this instance even though in certain particular cases it may not be needed. A computation of the time between successive drum read instructions has been made. The time for the execution for each order pair is given by the encircled number to the left of the order pair. This time includes the read- out time for the order pair. Thus for the order pair at 3L the time is 6 clock periods 1 2 for readout of the order pair, 2 for execution of the 50 order and 2 for execution of the kO order. The total time between successive drum read instructions is seen to be 2+6+8+8+8= 32. This time must be less than three sector intervals, or .792 ms.j .792 ms = +2.8 clock periods — a safe approximation to three sector periods is then k2 clock periods. Since 32 < k2 we conclude that readout of the x's will be executed in the optimum time. 167 It is common in transferring lists of numbers between the drum and WM to include a self checking feature known as a check sum computation which will indicate whether or not the transfer of digits has been executed correctly. Examples showing the use of this self checking feature follow. Example 2 . In this example we consider a code which will transfer a list . x.,qq from the WM locations 500 to 699 into the drum locations 3,500 to 5,699. The check sum (CKS) is computed according to the following iteration procedure: of 200 numbers x_, x , S. = x. + i 1 i-1 and the l's complement of S,q Q is stored at the end of the list, location 5,700. WM Order Pairs Comments 00 10K L5 ko 12L 5L Initialize record instruction 1 L5 k2 11L 2L Initialize WM x. 1 call address © 2 ki L5 IE [500] clear CKS box from 8L a' = x. j by 1L, 7L © 3 ko L6 F IF temp, store x. 1 x. + |S. _ 1 1 ' l-l ' © k ko L5 IF F store partial CKS = S a' = x. 1 © 5 -86 .00 11F 5500F. record x. by L, 6L (Continued on page l68) 168 WM Order Fairs Comments © 6 F5 ko 5L 5L increment x. l drum address © 7 F5 U2 2L 2L increment x. l WM address © 8 LO 32 13L 2L End test transfer if not end 9 50 Fl F IF waste a 1 = l's complement of CKB = -CKS - 2 _ 59 10 86 00 11F 3700F record "CKS" at end of the list. 11 OF 00 F 500F STOP RoA. equals initialization const. 12 86 00 11F 3500F initialization constant for record instruction 13 Nl L5 IF 700F End constant The orders at 2, 3 and k (relative) are used to compute the check sum. After recording of the list is complete the orders at 9 and 10 (relative) are used to record the digitwise complement of the CKS on the drum. There is a serious defect in the above code . Notice that the time between successive executions of the record instruction is k8 clock periods, greater than the permitted maximum (42) for optimum execution time. Therefore the execution of the above orders will be significantly slowed down, since a full drum revolution will occur between each recording. An alternative code is given below which will achieve the same result as the above code but the recording is performed in optimum time. 169 WM Order Fairs Comments 00 10K L5 i4l 1L initialize x J l call address I 4i L5 F [500]F Clear CKS box by L, 3'L§ from 4l Form CKB 2 l6 1*0 F F X i + l S i-ll = S i Store S. l 3 F5 42 1L 11 Advance x. i call address 4 LO 32 16L CKS end test transfer if CKS not complete 5 L5 15L 4o 8l here when CKS formed initialize record order 6 L5 42 14 L ?L initialize x. call address » © 7 50 15 F [500]F waste from 111 a« = x. % by 6L, 10L © 8 [86 [ 00 111 " 3500F_ record x. ^ 51y 9L © 9 F5 4o 81 8l advance record address » © 10 F5 42 7L 7L advance x call advance © 11 10 32 17L 7L end test transfer if recording not done (Continued on page 170) 170 WM Order Pairs Comments 12 50 Fl F F waste a' = l's complement of CKB = -CKS - 2 _ 39 13 86 00 11F 3700F -39 record -CKS - 2 y Ik OF 00 F 500F STOP initialization const . 15 86 00 11F 3500F initialization const, for record order. 16 Nl L5 F 700F end const . in CKS calculation. 17 JO L5 F 700F end const . for recording. In the foregoing code it is seen that the check sum calculation is done separately, in advance of the recording. Now there is sufficient time in the recording loop (namely 32 clock periods) to perform the recording in optimum time. Suppose we now wish to read the list of x.'s back into the WM, then the CKS is used to check that the x.'s played back are the same as those recorded. The playback of the x 's with checking is executed in the following example. Example 3 . Here we present a code to read the list of x.'s stored on the drum in the preceding example. The x.'s are read into locations 500 to 699 to the WM. A check sum test is made. The code follows. 171 WM Order Pair Comments 00 10K L5 13L *K) 3L initialize drum read order 1 L5 2L ^2 kL initialize x. store 1 order 2 50 500F clear new CKS box initialization const, in R.A. © 3 85 UF _00 350OF from 8L playback x. by L, 6L 1 © It 50 F 40 [500]F waste store x.j hy 1L, 71 © 5 L6 f ko p form new CKS © 6 F5 3L ^0 3L advance x playback address © 7 F5 ^L advance x store address © 8 LO lAL 36 3L end test jump if playback not done 9 85 11F 00 3700F -39 read old -CKS - 2 ^ 10 Yk F hO F ^CKS - 2~ 5 ^ + CKS + 2~ 59 old new (Continued on page 172) 172 WM Order Pairs Comments 11 L3 F 32 12L jump if old CRK = new CKS 12 FF F OF F CKS Error STOP Normal STOP 13 85 11F 00 3500F initialization const, for reading. Ik JO F ^0 700F end test const . In this example it is observed that a new check sum is computed? the orders at 5L do this. When playback of the x.. : s is complete then the old CKS is played back, the order at 9L, and it is compared against the new CKS. If the two check sums differ then the error stop FF (this order stops the computer) is encountered. If the two check sums agree then the normal OF stop is encountered. Agreement of the two check sums does not guarantee that an alteration of the x i 's has not occurred between the recording and playback operations. How- ever the probability is very small that the x. 's would be changed without an alteration of the check sum. The reason that the digitwise complement of the CKS is stored rather than the CKS itself is to provide a safeguard against the possibility that all the numbers, including the CKS, are cleared to zero. The reason for the absolute magnitude addition is that it makes a single digit error tend to affect the check sum in all digits. With a conventional summation, for example , + x. CKS = x + x + 199 1 pair of digit errors, in the same digit position of numbers x. and x . can compensate each other and cause no alteration in the CKS; for example, if a 1 changes to a in digit position k of x. and if a changes to a 1 in digit position k of x., the CKS is unaltered. However, with the CKS computed as it is in example 2 such "compensating" errors can affect the CKS. There are subroutines in the ILLIAC program library for transferring information between the WM and drum in optimum time with computation of the check sum. These routines are Yl and Y5; a description of Y5 is in Appendix 20. 173 UNIVERSITY OP ILLINOIS DIGITAL COMPUTER CHAPTER 22 LIERARY SUBROUTINES Many routines, for example routines to compute sin x, ~/x", etc., are used so frequently that it is worthwhile to write them once and for all and save them in a central place so that anyone who later needs to use one of them in a program may simply copy it. At the Digital Computer Laboratory, there is a large collection of these frequently used subroutines known as the ILLIAC Program Library. An index to the subroutines currently available in this library is in Appendix Ik, pp. 36^-367. Associated with each routine in the library is a write-up describing the properties of the routine and how the routine is to be used; an annotated copy of the code is included with this write-up. A teletype tape copy of the code is also available in the library. (These items may be secured from the secretary in the tape preparation room of the Digital Computer Laboratory.) Some of the routines in the library are actually comp lete programs. For example, K3, the "Least Squares" program, is a complete program; the user must only prepare a tape on which the experimental data is punched and K3 will "read" this data tape and compute and print the coefficients of the "least squares polynomial". Another example of a complete program in the library is J2, a program for computing the roots of a polynomial; here again the user need only prepare a data tape (as specified in the program write-up) which contains the coefficients of the polynomial and J2 will "read" this data tape and compute and print the roots of the polynomial. The library tape copies of closed subroutines are in a form in which they may be directly copied onto the users' program tape by means of a tape reperforator. There are certain general rules which apply to the use of the library subroutines. A standard closed subroutine entry, as described in Chapter 16, is always to be used unless it is explicitly stated otherwise in the subroutine write- up. If only one item of data must be supplied to the subroutine (e.g., x for the 17** square root subroutine to compute fx) then it is to be in the accumulator at the time entry is made into the subroutine. If only one item is generated by the sub- routine (e.g.Vx") then it is in the accumulator at the time the exit from the subroutine ie made. Variations from these general rules are always explicitly stated in the write-up of the subroutine. Let us now consider the write-up of a particular library subroutine, namely T^, the Arctan x Subroutine. A copy of the write-up appears on the follow- ing page as Figure 22-1; a copy of the code itself is not included. The format for this write-up is typical of most subroutines in the library. The TYPE of routine is specified in the second line, just below the TITLE, and the word "closed" means that this is a closed subroutine. The NUMBER OF WORDS in the subroutine is given on the third line; this subroutine occupies 25 words of the WM. The next line is labeled TEMPORARY STORAGE; it gives the WM locations used by the routine for temporary storage; here It is seen that locations 0, 1, and 2 are used for temporary storage by the program. An error commonly made in using library sub- routines is to stor'e ^ word in a location used as temporary storage by the sub- routine and then assume that the word is still there after the subroutine has been used; the word is, of course, no longer there because the subroutine will have overwritten it in using the location for temporary storage. The next line, labeled ACCURACY, describes the precision of the arctan x computed by this subroutine; -35 we see that the maximum error in arctan x is + 2 . The next line, labeled DURATION, gives the execution time for this subroutine (i.e., the time between entry and exit); we see that it takes 20 milliseconds to do the arctangent calcu- lation. Following this, a brief description of the method employed by the subroutine is given. It is understood, since there is no statement to the contrary, that the standard closed subroutine entry is to be used. When entry to the subroutine is made, x is in the accumulator, and upon exit from the subroutine, arctan x is in the accumulator. UNIVERSITY OF ILLINOIS DIGITAL COMPUTER 175 LIBRARY ROUTINE T k - 1*4-0 TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE ACCURACY DURATION DESCRIPTION Arctan x Subroutine Closed 25 0, 1, 2 Maximum error + 2 20 milliseconds -35 Computes arctan x for -1 < x < 1 by means of a power series involving Tchebyscheff polynomials, arctan x 27 £ a.Tjfx), where a. = for i even or 1-0 u where a. = (-±) i+3 ^ (2/i ) {f^ -l) 1 for i odd. (See Hahn, Tables d' Integrates Definis, Table 370,7,8), Combining coefficients of corresponding powers of x yields 14 arctan x = L C . 1=0 21-1 In use, this routine replaces A by arctan A. Figure 22-1 176 It is not always necessary to copy a needed library subroutine onto the program tape. Certain of the most commonly used library subroutines are permanently stored on the drum, and it is possible to punch a set of characters on the program tape which will instruct SADOI to read the subroutine from the drum and assemble it into the program. The first *K) tracks of the drum, that is the first 2,560 drum locations, are used for permanent storage. (This is achieved by disconnecting the writing heads for these tracks — after the desired "permanent" programs have been written into these tracks. The reading heads remain connected, of course.) Certain of the frequently used subroutines are stored on these tracks; also certain of the engineering test programs, and post-mortem routines are stored in this "blocked- off" portion of the drum. If a program erroneously tries to execute a record order having a drum address in this region (0 to 2,559)> nothing will be written on the drum; the ILLIAC will not hang up when such a record order is attempted. SADOI is instructed to assemble into the program one of the library routines on the drum by giving an outside symbolic address to a directive where the symbolic address is the label of the program [e.g., (Pl6), (Yl), etc .J, and the directive specifies where the subroutine is to be loaded; this is called a modified directive. For example, if the library subroutine INFRAPRINT is to be assembled into a program at location 100_, one would write the following characters on the tape: (Pl6) 00 100K The library subroutine label for INFRAPRINT is Pl6, hence, one writes the outside address (Pl6). The directive will cause Pl6 to be assigned to a block in the WM beginning at location 100 . Furthermore, the first word in this subroutine will be treated as if it had the outside symbolic address (Pl6). Thus, entry to Pl6 can be written as follows in the program: p 50 P p + 1 26 (Pi6) The library subroutines currently on the drum are: Pl6, Yl, Rl, S^, T^, T5, Fl, S5, N12, A6, Al, A3, RA1, TA1, SA2, SA3, TA2, a6 (except XA^). 177 In fact, any word in Pl6 can be referred to in the usual way; thus, one can refer thv to the n — word of Pl6 by writing the address, n(Pl6) A problem that comes up in assembling a large program composed of a num- ber of subroutines is the assignment of the various subroutines to particular portions of the WM. This assignment is made most efficiently if all of the sub- routines and the master routine are assigned to consecutive locations in the memory — that is, there are no "holes" between parts of the program. If small holes are left between parts of the program, then it may not be possible to get all parts of a long program in the WM when, at the same time, if the holes were closed up, it would be possible to get the entire program into the WM. To achieve this efficient packing, one can carefully count the number of words in each part of the program and assign these word blocks to consecutive regions of the memory by giving the necessary directive address at the start of each part of the program. This assign- ment process is tedious and subject to error, but fortunately enough, it can be circumvented with SADOI. Consider a program composed of 8 parts: 6 subroutines, a master routine and a block of constants. We will assume that three of the sub- routines are library subroutines, namely Pl6, T^ and Rl. The other three subroutines will be labeled simply 1, 2 and 3« If we begin the program at location 100, an efficient packing is achieved by writing the programs on the tape as indicated schematically below. 178 00100K Constants (Pl6 ) OOK (Tk ) OOK (Rl) OOK OOK Part Master OOK Part 1 OOK Part 2 OOK Part 3 2^999N 26(0.1) 2k IN From the earlier discussion of SADOI it will be recognized that the directive OOK achieves the desired result of packing the parts of the program into successive blocks of the WM. The block of constants and the subroutines are given first on the tape in order to reduce the number of forward address references. 179 In the above example, one must, of course, be careful not to exceed the capacity of the memory. Only for programs in which the total number of words falls very close to the total capacity of the memory does one need to be careful about an exact word-count. It should be remembered in this connection that SADOI only automatically assembles the program into locations 2-998> inclusive, of the WM. Words assigned to WM locations beyond 998 will be assembled onto the drum according to the usual correspondence rule, drum address = 11,756" + WM address, but these words will not be read back from the drum and placed in the WM when the N termination symbol is read. Library subroutines and, in fact, all standard closed subroutines require the specification of at least one parameter, namely the link address; thus, the standard entry has the parameter p p + 1 50 p 4r -Link address 26 (address of subroutine) Many subroutines require more than this one parameter. The parameters which are required fall into two classes, called program parameters and preset parameters. The former is a number which appears in the body of the program and which may be modified while the program is mnriing . An example of the use of such a parameter l/a is provided by the library subroutine R2 which computes x ' where a is an integer and x is the number in the accumulator at the time of entry to R2. The parameter a is supplied to the subroutine by making the entry in the following way: 180 p 50 a 50 p p + 1 26 (R2) Thus, at the time of entry a is in the left-hand address digits of Q upon entry to R2. After entry, R2 "reads" the left address digits of Q to mean that the (— ) root of the number in A is to be computed. Now suppose that the above entry to R2 occurs as part of a loop and that on successive entries to the loop we want different roots: — , — j- , —7-7- , etc., then on each pass through the loop the left-hand address at location p is successively modified to read a, a', a' 1 , etc. A parameter which is thus specified within the program (it does not have to be an address; it may be an entire word, or a single bit) and may thus be modified while the program is running is called a program paramter. The other type of parameter, the preset parameter, does not explicitly appear within the program. It commonly occurs as a parameter for a subroutine which remains constant during the running of the program, but it may be changed from one running of the program to the next. An example of the use of a preset parameter is provided by library routine VI which computes a table of Legendre polynomials, P (x) , P (x), P p (x), ... P (x), storing them in a block of n + 1 locations of the memory. The location of the first word of the table, i.e., the location of P (x), is specified by a preset parameter. In the subroutine, the table addresses are referred to by an S termination symbol; in particular, the first polynomial P Q (x) has address S3 in the program. The real address, m, of P n (x) is set into location 3 by preceding the VI subroutine on the tape by 00 3K 00 F k m = address of P n (x) 00 mF ° By this means it is possible to write the subroutine in a general way so that the polynomial table will be stored at any specified position in the memory. The location of the table is preset by a parameter during the read-in of the program. The parameter is not used during the running of the program to change the location 181 of the table. A parameter used to thus preset things during the read-in of a program is called a preset parameter. Further examples of the use of preset parameters will appear later. 182 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 23 A COMPLETE PROGRAM AND THE USE OF INFRAPRINT In this chapter a short program to compute and print a table of square roots of the integers 1 to 99 is presented. This program is used for public demonstrations of the Illiac . The program is presented on the following page. Two library subroutines are used in this program, namely Rl and Pl6. Rl is the square root subroutine and Pl6 is a printing subroutine known as INFRAPRINT! write-ups of these sub- routines are in Appendices 16 and 17. Both of these subroutines are among the subroutines permanently stored on the drum and we see here the modified directive appear at the start of the program for instructing SADOI to read a library subroutine from the drum and assemble it into the program. The Pl6 sub- routine will be loaded into a block beginning at location 100 and the Rl subroutine will be loaded into a block beginning in the memory location immediately following the last word of Pl6. Rules for use of Rl are straightforward. Entry is made in the standard way p — --- 50 p p + 1 26 (Rl) __ ,_ from Rl with x in Aj upon exit ~]~x is in A and control is transferred to the right hand order at p+1. Rules for the use of Pl6 are considerably more involved since Pl6 is a very flexible subroutine permitting a variety of output modes . The entire word at p is used for program parameters to specify the mode of output. In this A discussion of the numerical procedure used by Rl is presented in Chapter 2k. 183 SQUARE ROOT DEMONSTRATION PROGRAM LOCATION ORDER NOTES t 00 10K (Pl6) 00 100K (Rl) 00 K 00 K (1) hi (N) from 16 N = 92 131F from 12 cr . and If . 1 92 515F delay 92 967F 2 sp. 2 50 F L5 (N) waste 3 (1.1) J2 2F 50 (1.1) k 26 (Pl6) Print N 92 979F 5 sp. 5 in f 50 (N) least sig. part = -39 N-2 Jy 6 75 (1.5) (.01).N.2~ 59 00 59F (.01)°N 7 (1.2) 50 F waste 8 50 (1.2) 26 (Rl) , p— — rj (-01) N = 4§ 50 F • waste 9 j4 111F (1.3) 50 (1.3) 10 26 (P16) F5 (N) Print a/IT 11 ho (n) LO (1.4) N' = N + 1 (Continued on page lQh) 184 LOCATION ORDER NOTES 12 32 (1) 92 135F 2 If. and cr. 13 92 515F delay- 92 259F letters Ik 92 19^F E 92 770F N 15 92 6JF D 92 707F Nbr. 16 OF F STOP 26 (1) START OVER 17 (1.4) 80 F 00 100F END CONST. 18 (N) 00 F 00 F by 11 19 (1.5) 00 F 00 0100 0000 OOOOJ 26(1) 26lN square root demonstration program two entries are made to Pl6j on the first entry an integer N, < N < 99, is printed; on the second entry *[~N is printed. The first jump to Pl6 takes place at the left hand order of location k (relative), and the word at location 3 (relative) is used for program parameter specification. The left hand order at location 3 (relative) is J2 2F. The first function digit, J, is used to instruct Pl6 that the + sign is to be omitted on positive numbers; instead of + a space character is printed. If this function digit had been 5 instead of J, then the + sign would have been printed. The second function digit is 2 indicating that the number in A at the time of entry to Pl6 is to be printed as an integer without decimal point. The number of integer digits printed is specified in the address of this order which is seen to be just 2. Leading zeros are suppressed, the zero being printed as a space character; thus, the two digit integers 185 07 08 09 10 11 are printed as 7 8 9 10 11 On the second entry to- Pl6, at location 9 (relative), the '(n is printed . When this entry to Plo is made the number in the accumulator is the fraction -y-s- • Notice that the left hand order at 9 (relative) is jk 11 IF. The V digit equal to h specifies that the number in A is to be printed as a fraction, with decimal point. The address 111 specifies that the decimal point is to be located after the first digit (p = l) and the fraction is to be printed to 11 digits (n = ll)*. Placement of the decimal point after the first digit in effect multiplies / J~N r — 'iN -rr-r by 10 so that v N is indeed correctly printed^ had the number in A been ■ — -r , 10- 5 then we would have written the address 311 (rather than 111) to place the decimal point after the third digit of the fraction thereby achieving a multiplication by 10 5 . Let us now make some remarks about the number in A at the time of entry to Rl (jump at left side of 8, relative). The number in A is the fraction yr-r- and upon exit from Rl the number in A is j^— = ■— _■ . Notice that Rl is not entered with N in the accumulator as an integer, i.e. with N-2 ' in the accumulator. If this had been done then the number in A upon exit from Rl would have been * See the Pl6 write-up in Appendix ±6, pp. 372-378. 186 •I -19 N-2 -39 fT T .o 2 _ r= 2 = |n-2 2 = />Tn • ^TT 2 ° ( — 'tTn This result would then have to he multiplied hy — — V 2 to get -y-r for printing hy Pl6. This of course is inconvenient. Furthermore, and much more important, is the fact that the error in "VN would have "been considerately greater -39 i if N«2 had heen taken, as will he seen in Chapter 24. The first few lines of output from this program are given helow. SQUARE ROOT DEMONSTRATION PROGRAM NUMBER SQUARE ROOT .0000000000 1 1.0000000000 2 1.4142135624 3 I.7320508076 4 2.0000000000 The lettered headings were achieved hy "beginning the program tape with the letter J followed hy the desired letters; when the tape is thus headed hy a J, a routine is called forth from the drum (not SADOl) which reads and causes a duplication on the output tape of all of the characters following the J until a 1-hole delay character is read . After the 1-hole delay is read, control is relinquished to another routine which reads the next non-fifth -hole character, called the key character, and depending upon this character one of a number of different things may happen; in particular, if the key character is (the first character of the directive 00 nK) then SADOl is called into operation*. The first directive, 00 10K, is necessary to get SADOl started. The directive address could have any value since it is immediately changed hy the next line (Pl6) 00 100K which causes Pl6 to he loaded at 100. A program can- not begin with a directive having an outside symbolic address, - e.g., this pro- gram could not begin (Pl6) 00 100K. A copy of the first portion of the program tape is given below to illustrate how the desired lettering is specified on the program tape. See Appendix 10, pp. 33O-338. 187 • • • • » • • •e • • «•• • ft • •• • • • • • ft • •••••• • •• • • • • • •• • • • •• • ft • ft ft • • •• • •• • • • • •• • • •• • • ft • • • • • ft • • • • ft ••»•*• • • • • • • • •• «•©• • • • *• •••••• •••••ft •••••• •••••ft • ••••ft •••••• •••••• •••••ft •••••• •*»•## •••••ft • »*#»« • ••••• •••••ft •••••ft •••••• • • • • • 9 • • • • • • • • • • • • • • • • * ft • • • • • • • • • • • • • • • • • • • •• • • •• ••• OJ CD U 3 bO •rl 0) & -P q o •H P cd P CO q o S (24-3) v i+1 i'2 v x. i- v ->/ l to within the precision of the machine representation. This procedure for the computation of /IT is characterized by the fact that the error in the i iterate e = x - /~&~ "t* Vi is always positive and the correction applied to the i iterate to generate the , st i+l iterate is approximately 2 e i ' _€ + 2%: (e sma11 )- The truth of these remarks is proven below. It is assumed everywhere that we are considering numbers within machine range. 189 First it will be shown that the initial x., namely x , is greater than »fa : squaring both sides of eq.(24-l)we have 2 a 2 a 1 X = ~T + 2 + £ ' 2 now let x n = a + 6 . Then 2 a a 1 6 = S ~ 2 + IT 5 - ( 2li )2 Hence & is positive (vanishing only when a = l) and x > /fa. Since x > -va it may now be shown that all of the subsequent iterates are greater than '\f~a", i.e. x. > .ya"" for all i while each iterate is closer to '\J~a~ than the preceding one; thus, the sequence of iterates x., x. , x. , ... approaches ij~a "from the right". To prove the preceding statement let us note, from eq. (24-2) that the correction term added to each iterate in order to generate the next iterate is e. = rr ( — - x. ) l 2 v x. l l We can write this as 1 € i = 2 (a - x. 2 ) X. l or 1 (V~a - x )(Va~ + x. ) € i - 2 X i Now e = x - /fa is just the error in the i iterate and substituting this into the above expression for e. one finds e - _ 1 ( £I + i ) . 6 (24-10 1 2 v x. ' v ' l 190 Now if x. > ^"sTtheii 1 and 1 lej <€ ; th thus, we see that the correction to the i iterate is less in magnitude than the error in the i iterate, consequently the i+1 iterate, x. , , will also he greater than Va , although closer to Va~ than x. since e. is negative. Finally, since we have already shown that the very first iterate, namely x_, is already greater than Va it follows that the sequence x , x , x ... does indeed approach x. "from the right". If in eq.(2U-% we replace x. by x. = e + /Va then this equation becomes i Va + e ^ a and for e small we have 2 e. ?- 6 + ^- . 2^ It is to be observed from this result that if the approximant x. is accurate to p digits, then the approximant x. is accurate to about 2p digits. This process is illustrated graphically in Figure 2^-1. Three curves are shown: the straight lines with slopes -r*- = -1 and -^- = -2, both passing through the point x = /fa ; and the curve y = — - x, which also crosses the x-axis at x = *fa . The latter curve falls between the two straight lines, dx = dy dx ' dx ( -T- = -2, -^ = -1 ) for x > V~a since 191 CM *|3 Tj H I H I OJ u 3> •H P-4 192 dx dx x 2 x that Is < 21 = -I - S < -1 . a < 8 < I dx 4-T— _j_ and we have 5=1 just -when x = /J~a „ The i and 1+1 iterate are indicated ■> Since the curve y = — - x always lies between the two straight lines for x > n[ a X st it is immediately evident that the i+1 iterate will never fall to the left of the point x = /{~~a (because the curve lies above the -r*- = -2 straight line)? st furthermore the error in the i+1 iterate will be less than half the error in the i iterate (because the curve lies below the -7*- = -1 straight line)o The iterative formula (2^-2) is most easily derived using calculus and Taylor's series. Let us consider the function f(x) = x —a. The positive root of this function is Va: f( //a) = 0. Let x. be a positive number approximating Va. Using the first two terms in a Taylor series we have f (x. + A ) = f (x.) + f (x.) A , where f'(x ) is the derivative of f with respect to x at x.. We regard A as an i i unknown which is chosen to make f (x. + A ) = 0, for then x + A will be a new approximation to Va. Putting f(x. + A ) =0 and solving for A we have -f U.) A = f (x t ) so 2 - (x. -a) A= — . 2 x. l and if we put x. = x. + £±. , formula (2^-2) results. If all numbers were held to an infinite degree of precision, then the condition (2U-3) would never be satisfied; however, since only a finite number of digits are preserved at each stage of the iteration this condition will be satis- fied when the two iterates agree to within the precision permitted by the machine representation. -39 Referring to Rl, we see that in the special case of a = 1 -2 a difficulty is encountered because in this case x = a, and a-j-x results in a division hangup. Also, when a is negative |x |<|a| and a -j- x yields a division hangup. 193 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 25 ERRORS IN NUMERICAL COMPUTATIONS - PART 1 In general, numerical computations are accompanied by errors and it is the intention of this chapter and the two succeeding chapters to give some consideration to the kinds of errors which arise and an outline of how they are estimated. The errors discussed here do not include blunders or accidental errors such as saying 1+2=^, 2x3=7 or other such mistakes . In principle blunders are avoidable if one is sufficiently careful, but the errors discussed here are a necessary evil of numerical computations and though they may be made small by following proper procedures it is in general not possible to eliminate them entirely no matter how much care is taken ° A nice general discussion of errors in compu- tation may be found in Chapter 1 of reference (8) (see Chapter 1 of these notes). Errors arise in numerical work for essentially two reasons: it is necessary to represent numbers with a finite number of digitsj the numerical procedure employed in solving a problem is necessarily limited to a finite number of steps. Errors of a different sort, which we might call "physical" errors, to distinguish them from the fundamentally "numerical" errors above are also present! "they include errors from inaccurate data, because the precision of a measurement is necessarily limited! also the mathematical "model" used to represent the physical problem under consideration is in general not completely accurate. Our attention here is directed at the numerical errors. Let us again consider the representation of numbers in the ILLIAC. Regarding the binary point between digits w and w, of an ILLIAC word (w = w^ w.. w ... w,„) we have said that one can represent fractions x in the J- d yj interval -1 < x < 1. Now all numbers in the interval -1 < x < 1 are represented by the totality of points on the line segment of the x axis shown in Figure 25-l! it is understood that this line segment includes the left end point (-1) but not 19^ -1 Figure 25-1 Points in this interval represent the numbers -1 < x < 1. the right end point (+l). The ILLIAC word cannot of course represent all points on this interval but only a discrete set of them and in particular just 2 points -39 -39 -39 are represented; namely, -1 -1+2 , -1+2-2 , . .., 1-2 . One could represent the numbers in this interval to a greater precision by assigning two ILLIAC words, w and w 1 , for the representation} w would represent the most significant part of the number and w* would represent the least significant part. With this 79 double precision representation we represent 2 points; namely, -1 -l+2~' , -1+2-2 ,+...+, 1-2 . It is of course possible to thus improve the accuracy of the number representation by assigning still more words to the representation but there is a limit to this since there are only a finite number of words in the ILLIAC. The nature of ILLIAC is such that usually numbers are represented "single precision", that is by just one ILLIAC word. Arithmetic operations involving multiple precision numbers are not "natural" for the ILLIAC and require some considerable amount of programming. The error involved in representing an arbitrary x in the interval -1 < x < 1 to single precision is given by the neglect of the digits beyond the 2 ' binary digit. Thus, if the exact value of x is °° i x = -w + Z w 2" (25-1) i=l x where 2's complement representation is understood, neglect of the digits beyond the 2 ' yields a possible ILLIAC representation 195 + 39 i x = -w + E v 2 (25-2) i=l The error in this representation, namely e = x - x is do € = Z v 2" 1 . (25-3) 1=^4-0 Clearly the range on e is < e < 2~ 59 ; The lower limit is achieved when w = for all i, in which case the ILLIAC representation is exact; the upper limit is achieved when w. =1 for all i. The representation of x in eq. (25-2) has heen achieved by "truncation" (chopping-off ) of the exact series representation in eq. (25-1) at the 39 digital position. The error, e, which has resulted is positive , and x is algebraically less than or equal to x, in particular x = x + € The error in this representation of x contains one very undesirable property it is biased, tending to make all numbers somewhat smaller (algebraically) than they actually are. An unbiased error, that is an error which is distributed uniformly over positive and negative values, is preferred because there is some hope that in a sequence of computations there will be some cancellation of errors with the result that the total error in the computation is reduced. An unbiased representation of x is achieved if we represent x by the -ko truncated value of x + 2 or in other words 39 x + = -w + Z w 2 _i if w^ = u 1=1 196 and 22 x + = -v + Z w 2 _1 + 2~ 39 if w, = 1 i=l Now the error interval is centered on zero, for we nave -2 40) ; the upper limit is achieved when w._ = and w. = 1 (all i > 40).* It is sometimes helpful to represent this round-off procedure in a pictorial way. The figure below, Figure 25-1, represents a very small sub- interval of the interval (-1, l) on the x axis. Values of x which may be exactly represented in the ILLIAC are represented by short vertical marks} -39 this subinterval includes just three such points, x = -1 + n«2 , -39 -39 x = -1 + (n+l)>2 and x = -1 + (n+2)>2 . Any x represented by a point on the interval between these vertical marks, as for example the x represented by the dot between points -1 + n»2 and -1 + (n+l)»2 , cannot be exactly represented. The x represented by this dot, x (•) must be represented in the ILLIAC by x , a number associated with one of the vertical marks. Since the + -39 x (•) lies closest to the mark for x = -1 + (n+l)»2 it would be natural to use this value of x for representation of x j the error e is shown', and is seen to be negative. The long dashed vertical mark divides the interval (-1 + n-2 Jy , -1 + (n+l)-2 Jy ) in half, at the point x = -1 + n*2 Jy + 2 If now, numbers in the half-interval to the right of this dashed mark are + -39 represented by x = -1 + (n+l)«2 (as with x(*) below) and numbers in the * If one desires to be completely rigorous it should be recognized that N _ ± _^ Q iSji^oo £ 2 " = 2 , consequently the representations a, _ = 1, a =0 iJU w 1 ( all i > 1+0) and a^ = 0, s = 1 ( all i > kO) are equivalent. 197 .! + n . 2 -39 + 2 -hO -1 + w2 -39 -1 + (n+l).2 -59 -1 + (n+2)-2 •39 Figure 25-2 A small subinterval of the interval ( -1, l). + -39 left ha If -interval are represented by x = -1 + n-2 and similarly for every other such interval, we have just the rounding procedure described above. This scheme of rounding x to form x is clearly unbiased, since for every x represented by x with e negative (an x in the right ha If -interval) there corresponds an x 1 represented by x' with positive e of the same magnitude (the "mirror image" in the left half -interval). The root-mean-square error of numbers represented by this rounding scheme is given by * * The bar above a quantity indicates the average value of the quantity; thus e is the average value of e. 198 J" -n2 ( € - ef »4 e - (i) ■39 ■to 2 , - 2 e dg - e 1/2 -39 3 +2 40 ,-40 1/2 1 ■40 (25-4) In general any problem to be run on the ILLIAC will have associated with it certain parameters, constants and perhaps data. Representation of those numbers in the ILLIAC introduces errors into the calculation known as the initial error . This error will be propagated through the calculation and contribute an error to the final result. The error which is thus propagated through the problem, assuming only the initial error to be present and every- thing else exact, is called the propagated error . In practice one cannot easily separate out this error but in certain considerations of error analysis it is convenient and useful to distinguish this error from others. For example, numerical procedures which cause a rapid growth of the propagated error are clearly undesirable. Desirable procedures would show a "damping" effect on the propagated error tending to make any contribution of the initial error to the final error negligibly small. At each stage of the calculation new errors are introduced because the arithmetic is not done exactly and because results of arithmetic operations are not always saved with full precision (for example the product may be rounded off to a single precision number )j errors thus introduced during the calculation are called generated errors . The generated errors are propagated through the calculation and thus appear in the final result as a propagated error. Generated error and propagated error are discussed in the following chapter. 199 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 26 ERRORS IN NUMERICAL COMPUTATIONS - PART 2 During the course of a calculation new errors are generated which propagate through succeeding calculations and contribute to the final error in the result. Let us consider now how these errors are generated and propagated in the elementary arithmetic operations . Additions and subtractions do not generate errors unless there is overflow- Overflow is a gross error which can be avoided by proper scaling and it will not concern us here. It should of course be noted that these + + operations propagate errors: thus if ILLIAC numbers x and y have errors e + + and e , respectively then the error in x 4- y is just e + € , y x y + + z = x + y = x + y +€ + e x y + = z + e + e x y + = z + e z In a practical case one of course does not know e and e explicitly but knows x y only certain statistical information about these errors. Many times the statistical information is scanty and it is common to assume that the errors are normally distributed, or uniformly distributed. The latter assumption is somewhat simpler to deal with and generally a reasonable one when information concerning the errors is minimal. In order to get rough estimates on the magnitude of the error one frequently only considers the bounds of the error. In the above case we obviously have I e I < Max I e I + Max lei. I Z I _ I X I I y 1 If it is assumed that € and e are independent and satisfy a normal distribution x y law; 200 2 we have e x P(e x ) = ' ' e 2 e y 2 i 2 - §^— r e * • . * ^ x°^y / J ' - CO which, after performing the integration, becomes 2 e z HO =— = e 4 2itor z 2 where 2 2 2 is O-z The standard deviation of the sum thus increases in proportion to the square root of the number of terms in the sum. If N is sufficiently large one can apply the Central Limit Theorem* to obtain a similar result under much more general conditions. This theorem may be stated as follows: given a set \e j of N mutually independent statistical variables with mean values (i. ) and standard deviations \G~- } > then E„= € 1+ e 2 + ... + ^ approaches a normal distribution as N tends to infinity with standard deviation, Z„, satisfying the equation 3 2 2 2 = cr-j_ + a~2 + • • • + o~ N and mean given by V =i i + i 2 + ~- + h • It is to be noticed that the distribution of the e.'s does not need to be l normal for this result to apply. In fact the only restriction placed on the distribution of the e.'s is that the means 1 i, i and standard deviations \ 2 ♦ ( 2 -^) 2 1 2 With division, as has been cited earlier, round-off in the ILLIAC is automatic and is achieved by "stuffing" a 1 into the least significant digit of the quotient. Let us now consider the error produced by this mode of rounding 20U and verify that it indeed is unbiased as it has been previously asserted. To do this let us again fix our attention on a small subinterval of the x-axis where the numbers representable by the ILLIAC (in kO bits) are indicated by short vertical marks; a picture of this subinterval appears below in Figure 26-1. We assume in this figure that n is an even number. Since every rounded quotient in the ILLIAC must have its least significant digit equal to 1 it follows that the possible quotients are restricted to those numbers indicated by the heavy vertical marks in Figure 26-1. z w {— . C- -l+n-2" 59 -l+(n+l)°2~ 59 -l+(n+2) -2~ 59 -l+(n+3) -2~ 59 Figure 26-1 A small subinterval of the interval ( -1, l). Possible quotients are indicated by the heavy vertical marks. Let us now consider an exact division z = — and let the number z be represented by « in Figure 26-1. The rounded ILLIAC quotient will be z" 7 " = -1 + (n+l)-2~ 59 . In fact it is easy to see that any exact quotient in the interval (-1 + n-2 ' , -1 + (n+l)°2 ) will be represented by the rounded ILLIAC quotient z = -1 + (n+l)-2~ * The error for the quotient in this interval, Ax = 2 , is negative. Consider now another exact division yielding the quotient w = — and let the number w be represented by A in Figure 26-1. The rounded ILLIAC quotient will + —'59 again be w = -1 + (n+l)-2 . Noticing the fact that all exact quotients in the interval (-1 + (n+l)-2~ :)9 , -1 + (n+2) °2~ : ' 9 ) have their 2~ : ' th digit equal to 1 it follows again that these will be represented by the rounded ILLIAC quotient 205 + -39 -39 w = -1 + (n+l)-2 . The error for quotients in this interval, Ax = 2 , is positive. It follows from these considerations that the error resulting from the division round-off is unbiased; furthermore we see that the range of the error is -2~ 59 < e < 2~ 59 . which is just twice the error range resulting from the multiplication roundoff. Assuming a uniform distribution of errors e we compute the root-mean-square error: JZ - if =/ 2 - 2 £ - e ■39 ^ ' £-» e 2 de 1 2 1 is •39 <4> ■39 ,-39 1 2 ■/? + + Let us now consider two TT.T.TAf! numbers x and y with errors 6 and e and find + x+ x y the error in the ho bit rounded quotient z = — — y x y + x + e + y + e Assuming e and e small in comparison with x and y this can be written x y x y + X + 6 y y 206 and neglecting second order terms (all terms involving the square of the error or higher powers) we have approximately xx ( 1 + _x__v. } y + + + The error term represented by ^- ( -7- %■ ) is the propagated error, resulting + + + y x y from the initial errors in x and y. The total error in the quotient is obtained by adding the division roundoff error, i.e. the generated error e to obtain finally + e e + x_ ( _x __v. } . y x y Following arguments similar to those used in discussing the multiplication error, one finds for the bounds on 6 2 -39 + x y J I x y ) + where we have used the fact that | — | < 1 for ILLIAC division. Here it is seen y that the error e depends rather critically on the magnitudes of x and y. A root-mean-square error calculation in this case requires special assumptions about the distribution of x and y to be meaningful and is therefore omitted here. 207 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 27 ERRORS IN NUMERICAL COMPUTATIONS - PART 3 In this chapter we turn attention to the problem of estimating the error in a specific example, namely the computation of e (-1 < x < 0). It is only fair to point out in the beginning that the example here discussed is a particularly simple one and in general the programmer will not be blessed with such an easy situation: however, it is hoped that this discussion will serve as a guide to the treatment of more difficult problems. The subroutine which we will consider for the computation of e is designed to compute e directly from the series expression*: 2 3^ X i , X , X , X , e =1+ 2T + 3r + Fr The series is truncated at the 15th term to obtain the approximate expression e X = I £ J (27-1) i=o i - it is just this sum which the subroutine must evaluate. The effect of thus truncating the series is easy to estimate. Recognizing that the terms in the series alternate in sign as a consequence of x being negative, it follows that the sum of the neglected terms is less (in magnitude) than the first term neglected i.e. 16 truncation error < rrrr This degree of precision is quite adequate for a single precision computation since l6t = 2.1 x 10 15 and |x | < 1 it follows that * This is not the best scheme for computation of e from the standpoint of computing time. 208 truncation error < 2.1 10 ■13 which is smaller than the smallest number that can he held in an ILLIAC register; recall that 1 x 2~ 39 S? 1.8 x 10" 12 Thus, by taking the number of terms indicated in eq. (27-1 ) it has been guaranteed that the truncation error is negligible. The error in e , then, will not come from this source but rather it will come from the roundoff errors generated in the course of the computation. To estimate this error let us now consider in detail the subroutine itself. The series is evaluated using the standard procedure for the evaluation of a polynomial (see page 69) and the coefficients -77- are stored in a table of constants . A slight trick has been employed in order to accurately handle the coefficient yj- ) which consists of storing all coefficients 77 for i odd as negative numbers (thus we can write exactly -l) and then using negative multiplications by x. It will also be recognized that the first term in the series,!, is also treated exactly. The code follows. LOCATION ORDER PAIR COMMENTS (EXP) ^0 F K5 111 Store x at 1 k2 8L L5 10L Set link 2 kO IF L5 (EXP) Set sum box = - -rrrr 151 Set initial address 3 k2 hu 50 IP of factorials From 7L k 79 F L> [0]F I6-1 , ,1 by 3L,6L; (-x) S l6 _. + ±jf- (Continued on page 209) 209 LOCATION ORDER PAIR COMMENTS 5 kO IF F5 ^L Store S.,r • -, 16-i -1 Advance end counter 6 k2 kL LO 9L End test 7 32 3L 50 F Jump if not end Waste 8 F5 IF 22 [0]F Exit 9 L9 F iA 26L End constant 10 80 F oo 999 999 999 999J 1 15'. 11 00 F 00 000 000 000 012J 1 12 80 F 00 999 999 999 839J i " 13'- 13 00 F 00 000 000 002 087J i 12'. Ik 80 F 00 999 999 97^ 9^7J i " in 15 00 F 00 000 ooo 275 573J l 101 16 80 F 00 999 997 2kk 268j l " 91 17 00 F 00 000 024 801 588J l BT (Continued on page 210) 210 LOCATION ORDER PAIR COMMENTS 18 80 F 00 999 801 587 30LJ 1 " 7'- 19 00 F 00 001 388 888 889J l ST 20 80 F 00 991 666 666 6663 1 ' 5'- 21 00 F 00 o^i 666 666 666s l 5T 22 80 F 00 833 333 333 333J 1 " 31 23 1*0 F 00 F 1 2 2k 80 F 00 F -1 25 7L ^095F LL U095F 1 - 2-59 It is seen from this program that the computation proceeds as indicated by the equation below. x e = f V < " W > • M * TJT ) C-) " I3T ) ' C-s) (-x)+: (-D 1 The constants — p— are each going to be in error by an amount e. (assuming proper 1 1 -4o x rounding | e i | < 2 ). Furthermore, each multiplication will cause a roundoff error, \ a consequently the number actually computed is (e X ) + = f . ( ( " 15T ' G i 5 M- x ) + \ + Wi ~ hkj '(- x) •• + 1 211 which can be written / x,+ x 15 Ik (e ) = e + x e 15 - x e ll+ + o . + xe 1 - e Q + x lk \ ~ x 13 ^ + . ..-xX^ + ^ (27-2) where the first term on the right, written e , is just the truncated series of eq. (27-l). The sum of the remaining terms on the right of eq. (27-2), each of which contains e. or X. as a factor, is the negative of the error, -E (i.e. e = (e ) + E. It is to be noted that the errors contributed by the terms involving e. may be partially fixed by the programmer according to his specific 1 (-1) 1 choice of the constants \ , . The program has been so written to have e^ = e, = e_ = 0. The error contribution from the terms in e may be further 210 (-1) 1 reduced by making slight adjustments in the constants \ / such that when x is close to (-l) there is a tendency for cancellation of these errors. An upper bound on |e| is obtained by substituting into the expression for E the maximum values of the magnitudes of the various quantities : |x | = 1, |\| = 2 , and |€. | = 2 (i / 0, 1, 2). Carrying out this substitution we obtain |E| < 28.2" 4 ° It is to be noted that if x is restricted to the range (-1/2, 0) the bound on the error is reduced. In this case an upper bound on the error HI < I • 2" W . Consequently the user of this subroutine could achieve considerably greater accuracy in the computation of e x if for values of x in the range -1« x<--| he entered the subroutine with x + £ in the accumulator, rather than x. Upon exit from the subroutine the number e x 2 would reside in the accumulator; if this is then multiplied by e" ;> (stored as a constant) the desired result is achieved. Alternatively this feature could have been incorporated in the subroutine itself. 212 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 28 THE RUNGE-KUTTA SUBROUTINE FOR THE SOLUTION OF DIFFERENTIAL EQUATIONS In this chapter we shall be concerned with the use of library subroutine Fl which is a routine for numerical solution of a set of simultaneous first- order differential equations using the Runge-Kutta method. The write-up for this subroutine is in Appendix 21, pp. 39^-40^4-. The use of the subroutine will be illustrated here in its application to the solution of Weber's equation: 2 2 " v " ' 2 l -Z + (n + i - £ x 2 ) y = (28-1) dx Before proceeding to this example it will perhaps be worthwhile to briefly review some of the Ideas connected with the numerical solution of differential equations . The n -order differential equation describes a relation between dy d y d y th y, -j— > — o » •"■» — an( ^ x ? thus the general n -order linear differential dx dx equation has the form d n v d n_1 7n" + a n-l (x) 7T^ + '•• + a l< x) df +a (x) y = S (x) • dx dx Ideally one desires to find a function of x y = y (x) which when substituted into the differential equation will yield an equation in x which is satisfied identically. When one cannot find this solution by 213 analytic means it becomes necessary to use approximate methods, for example numerical integration. A solution by numerical integration implies that dy ^ dy d y numerical values for y, -?*- , — s- , . - "" dx J , 2 ' dx dx are found at discrete values of x which when substituted into the differential equation cause it to be satisfied within the precision of the numerical method o Let us consider the differential equation g = f (x) , (28-2) and suppose that the solution y = y(x) is as shown by the curve in Figure 28-1. y = y(x) Figure 28-1 dy Curve showing the solution to ^ = f (x). 21k It follows from the differential equation, eq. (28-2), that the slope of the line drawn tangent to the curve at y Q = yCO is f(x ). For a small increment in x, say Ax, the corresponding increment in y, Ay, is given by the approximate expression Ay = f (x) A x. Thus, if one knows the solution y at x = x_, an estimate of the solution at x = x, = x + A x can be obtained; y x = y Q + A y = y Q + f (x Q )(x 1 - x Q ) . (28-3) The estimate of the solution y at x = x.. obtained from this equation is illustrated graphically in Figure 28-1. The error in this estimate is clearly given by the distance between the straight line and the curve y = y(x) at x = x . Clearly the error will become smaller as A x becomes smaller and y = y(x) more closely is approximated by a straight line over the interval of interest, Ax. A numerical solution at points x , x, , x p , ..., x can then be obtained by taking steps along the x axis to generate y , y , y , ..., y according to the generalization of eq. (28-3)2 y. = y. ., + f (x„ , )(x. - x. , ) . J ± ''l-l v i-l /v 1 i-l' To begin this iterative process one must know the value of y for some x say x • this is the boundary condition for the process . In general if one knows the value of a function y for some value of x one can find the value of the function at x -:- A x from the Taylor expansion of the function; y(xfAx) = y(x) ^Ax^ ^ (i x) dx 21 , 2 dx 3 n 2 + ,1 d y , N n nl , n dx 215 The approximation method just described corresponds to truncating the Taylor series at terms involving the first derivative of y. The approximation method is called a first- order method since it agrees with the Taylor expansion to terms of first order in the derivative cf the function. Other, more accurate, integration schemes take into account the curvature cf y(x) by approximation of the curve over a short interval A x by a quadratic in A x rather than a straight line as above „ Such a scheme can agree with the Taylor expansion to terms of second order in the derivative of y(x)| when this agreement obtains it is called a second- order method,, This can be extended still further and there are methods which agree with the Taylor expansion to terms of still higher order. In the Runge-Kutta method;, employed by Fl, the estimate cf y(x ••:• Ax) agrees with the Taylor expansion to terms cf fourth order. The above remarks apply if the differential equation, eq. (28-2), assumes the nrre general form dx =*- - f 'x v) where now the slope is a function of the dependent variable, y, as well as the independent variable, x. We have discussed only first-order differential equations, let us now turn attention to the problem of solving a differential equation of higher order. It can be shown that the problem of solving a single differential equation cf a order is equivalent to the problem of solving n simultaneous first-order equations. For example consider the third-order differential equation; ISL , a( x) ^ b(x) g •■ c(x) y = g(x) , (28-U) dx dx^ and define g - « > (28-4.1) du dx = v (28-^.2) The Runge-Kutta method involves terms of higher order in ax but they do not agree with the Taylor series terms. 2l6 Substitution into eq. (28-4) yields g = -a(x) v - b(x) u - c(x) y + g(x) . (28-4.3) Solution of the three simultaneous first-order equations (28-4.1), (28-4.2) and (28-4.3) is equivalent to the solution of the single equation (28-4)j this should be self-evident since the three functions obtained as solutions to (4.1), (4.2) d d 2 and (4.3) are y 3 -7=- and — ^ of eq. (4). In this way any numerical scheme which dx can solve a set of n simultaneous first- order differential equations can be used to solve a single differential equation of n order . It can easily be seen that the simple first-order numerical scheme already described can be extended to the treatment of simultaneous first- order differential equations; consider it now in its application to the three equations above. As boundary conditions to the problem suppose that u = u Q , v = v Q , y = y Q at x = x Q , then u(x Q +Ax) = u Q + v Q A x , v(x Q +Ax) = v Q + ^-a(x Q ) v Q - b(x Q ) u Q - c(x Q ) y Q + g(x Q )J A x , y(x Q +Ax) = y Q + u Q A x . The process can be repeated to obtain u(x + 2Ax), v(x + 2Ax), y(x Q + 2Ax) by simply replacing u~, v , y in the above equations by u(x +Ax), v ( x + Ax), y( x +Ax), respectively. The solution to the third- order differential equation at Xq, Xq + A x, x + 2 A x etc. is thus generated by this simple iterative process . Let us now turn attention to the Runge-Kutta method itself. A characteristic feature of this method is that four estimates A,y, Apy, Ay, and A^y of the increment Ay of the dependent variable are made, corresponding to an increment A x of the independent variable. The four estimates of A y are obtained using the slope ^ evaluated at different points within the interval A x. The four estimates A^y, A^, A_^r, A, y are combined linearly to obtain the desired A ys 217 A y = a Ajy + b Z^y + c A,y + d A^y The numbers a, b, c and d may be regarded as weighting factors and must satisfy the normalization condition a + b + c + d = l The approximation thus obtained for A y agrees with that obtained from a Taylor expansion up to (and including) fourth-order terms. In the library subroutine Fl the four estimates of A y are obtained from four estimates of the slope -r*- = f (x,y) in the interval A xg specifically these estimates are taken at the left end-point of the interval, twice at the center of the interval and at the right end-point of the interval. The specific form in which the Runge-Kutta method is used by the subroutine is due to S. Gill and for this reason it is sometimes referred to as the Gill-Kutta method. The Subroutine is designed to solve n simultaneous first-order differential equations; y 6 =f (y 0' y l' y 2 ••■ y n-l ] y i = ^(yq, y v y 2 ... 7 n _ x ) y n-l = f n-l (y O> y l> y 2 •*• y n-l } ' (y* denotes first derivative of y), where for uniformity of notation the independent variable is identified as one of the y's, say y . The values of f_, f ... f must be supplied to the Runge-Kutta subroutine. The user of the subroutine must write a program which computes the derivatives for given y n , y . o. y | this program is known as the Auxiliary and it must be written in standard closed subroutine form. The Runge-Kutta subroutine jumps to the Auxiliary each time it needs a new estimate for the derivative and the Auxiliary computes the derivatives multiplied by a scale factor,, 2 n$ the scaled derivative is designated by k, thus the numbers computed by the Auxiliary are 218 Vr Af n-l (y O' y l' y 2 °°' y n-i ; Since four estimates of the derivative are needed at aach Runge-Kutta step, the Runge-Kutta subroutine will make four entries to the Auxiliary t© obtain the k. ' s at each step „ The scale factor is composed of two parts i h s which is the Ruage- Kutta step size (i.e. the increment in the independent variable) for the increments A y n >, Ay, . . . A y - computed by the Runge-Kutta subroutine! and 2 m where m is chosen to make 2^% f . within machine range but large enough to retain a reasonable amount of accuracy. The need for the factor 2 to retain accuracy in the computation should be fairly evident » In the first place the derivative itself may become very small and in the computer the effect will be to lose significant digits j loss of accuracy in this instance may be reduced by scaling the derivative up, taking care of c»urse to insure that the numbers stay within machine range = Secondly, the numbers hf., which represent the estimates A y,/will in general be small since the smaller the value one picks for h the smaller will be the truncation error (resulting from the fact that A y computed from this process deviates from the Taylor expansion in the terms jj- y K ' h for i > 5). Consequently, to retain significant digits in hf it is scaled by 2 m . It is obvious that at the stage in the computation when A y. is to be added to y. to form tie new value of y. both numbers must be in the same scale. It is quite likely that the increment will be considerably smaller than the function itself, consequently much of the significance in A y. can be lost at this point unless special provisions are aiadej the Runge-Kutta subroutine does make such a provision. Let - q. represent the roundoff error in y. (in effect this is the least significant part of y. — the part which would be beyond the * Not precisely the same Ay's as on. page 2.YJ , 219 right end of a ^0 bit register) then the number 2q. is preserved by the routine o As roundoff error accumulates to make a net contribution to the "40-bit-representation" of y. the contribution is appropriately added to y i- The user of the Runge-Kutta subroutine must provide three blocks of storage, each of length n, where n is the number of equations being solved. The first block of storage, the "y-bank", i s used to hold the n variables y , y, , . . . y > This bank thus holds the solution to the set of equations being solved. At the very start of the integration process, before the first entry to the Runge-Kutta subroutine is made, the initial values of the variables y n , y . .. y , must be loaded into this bank. The second block of storage, the "k-bank", is used to hold the scaled derivatives k n , le ... k . It is the responsibility of the Auxiliary to load this bank with the scaled derivatives which it computes. The third block of storage, the "q-bank", is used to hold the numbers 2 q., just described. This bank should be cleared to zero at the very start of the integration process, before the first entry to the Runge-Kutta subroutine is made. If this is not done then the numbers held in this bank will be treated as roundoff errors to the functions y. and consequently will contribute an initial error to the solutions. Let us now turn attention to the use of the subroutine Fl in its application to solving eq. (28-l). Let us suppose that in this equation n = "j/k-, the equation becomes iz + (9_l x 2 )y = m (28 _ 5) dx This equation can be written as the following pair of first- order differential equations; P- = z (28-6) dx dz dx ( - | + £ x 2 ) y . (28-7) 220 Since the independent variable x appears explicitly in the eq. (28-7) it is necessary tc add a third equation to this list, namely |£ = 1 . (28-8) dx 'This equation must he aided to the list when using Fl to solve equations wherein the independent variable occurs explicitly, because in this instance the value of x at the various points within the interval h = A x must be available for computation of the k ! s by the Auxiliary. If eq. (28-8) is added to the list, then Fl. will automatically provide the appropriate value of x in the y-bank. Let us suppose now that we wish to find the solution in the interval < x < 2, and that the "boundary conditions are y(0) = , z(0) = 2 . The variables x, y and z must be scaled so that the scaled values will remain within machine range j the scaled variables will be denoted x*, y* and z*. An appropriate scale factor for x is r , i.e. x x * = If s then < x* < — . Notice that a scale factor of p would not be sufficient for then at the right end -point of the interval where x = 2 the scaled variable would be x* = L which is outside machine range. Scale factors for y and z can be obtained from some simple considerations of the differential equation. 9 12 Hotiee that the factor 4- - ^ x is everywhere positive in the interval of integration, decreasing monotonically as x ranges from to 2 . As a consequence -f this £l f 9 1 2 s 2 ~ " '- it * s x ' y IX has the sign of =y on the interval and is thus always concave toward the x axis. It follows that the straight line y ' = 2x 221 which is tangent to y = y(x) at x = satisfies |y(x)| **/* (28-13) 223 As mentioned earlier the choice of the factor 2 n is governed by the need to keep the scaled derivatives within machine range and at the same time retain as many significant digits in the scaled derivatives as possible. The choice made here is not necessarily the optimum choice though it is probably close. With a more accurate determination of the bounds of the variables we might have been able to make a somewhat better choice of scale factors (better in the sense that we might not have had to scale down as much, thus preserving more accuracy) however as a practical matter one must decide just how much time and effort it is worthwhile to invest on the determination of a "best" set of scaling parameters. Just as in trying to optimize the number of words in a code one must break off at some point in order to get the code running in a reasonable time, being satisfied that any additional time spent in trying to optimize the code would probably not be worth the effort. It will be noticed that we have everywhere chosen scaling factors which are powers of two. Although it is not necessary to put the scale factors in this form it is usually convenient to do so simply because numbers can be multiplied by powers of two by shifting. The above discussion completes our consideration of the scaling problem. The question of the choice of the integration step size is not an easily answered one, and a careful discussion of the subject would require an amount of analysis outside of the intended scope of these notes. Consequently we will dispose of this topic by making some qualitative remarks on the type of thinking that must be applied to this problem. It should be fairly apparent that the interval size must be picked in such a way that the solution "does not change much" in the interval. Put in a little more precise way, h must be sufficiently small that the solution y(x) may be satisfactorily represented by just terms up to and including fourth-order terms in the Taylor expansion since the integration scheme takes accurate account of only these terms. In principle an estimate of the truncation error can be obtained by letting this error be represented by just the difference between the fifth-order Taylor 5 expansion term and the term in h of the Runge-Kutta scheme. However, as a practical matter this number is difficult to actually compute. Library routine F 6, which has recently been written, automatically selects the interval size to be as large as possible while maintaining a specified error bound in the solution. 224 Usually one's judgement on Interval size is based heavily on experience. The rough form of the solution is usually known in advance and consideration of the interval size that would be needed on a simple function of roughly the same character usually will lead to an intelligent choice for h. If the programmer has doubts about the proper choice of interval size he should write the code in such a way that the interval size is easy to change and then experiment with different interval sizes to see how much effect is produced on the solution when the interval size is reduced. It is obvious that the computing time required for finding the solution to some differential equation on a fixed interval a < x < b is proportional to the number of integration steps and consequently inversely proportional to h. Consequently the desire for accuracy through reduction of the interval size must be tempered somewhat by consideration of the computing time. Although it might first appear that the accuracy of the solution can be improved indefinitely by making h arbitrarily small this is not at all true. The reason is that as the number of integration steps increases the number of arithmetic operations increases proportionately consequently increasing the roundoff error. As h is reduced, then, a point will eventually be reached where the reduced truncation error achieved by the smaller h is counterbalanced by the increased roundoff errors for still smaller values of h the roundoff error dominates and causes the total error to increase. For optimum accuracy, neglecting computing time considerations, the best choice of h is that value for which the truncation error and roundoff error combine to give a minimum total error. In the current example we will take h = 2~ . The interval of 1 A x* 7 integration A x* = p to be divided into ■— — ■ = 2 steps. Since we have taken 2 m h = 2" it follows that m will be equal to k. Let us next assign the S parameters for Fl. We will assume that the function bank, or y bank,, begins at location ^00, the k bank begins at location k03, the q bank begins at location ko6 and the Auxiliary begins at location 500. The S parameters then are S3 = 400 x 2~ , Sk = 403 x 2~ 59 , S5 = ko6 x 2~^ , S6 = 3 x 2 (three equations are to be solved), S7 = 500 x 2~ ; the parameters must be loaded into locations 3 S '^, ... 7 by SAD0I before SAD0I reads an order from the program tape which makes reference to any one of these parameters. 225 Though our previous considerations were directed at a specific set of boundary conditions it will be instructive to write the code in such a way that the boundary conditions are parameters of the problem which may be varied. (This variation is presumed small, so that the problem does not need to be scaled again.) Consequently, the program is designed to read a parameter tape, using library routine N12 (INFRAPUT)* on which the boundary conditions are specified. In particular the form of the data on the tape is as follows: y n /10 (decimal fraction) z /lO (decimal fraction) N (end signal for N12) The solution is to be printed as a table; at each Runge-Kutta step the value of x and y is to be printed. The code follows. LOCATION ORDER PAIR COMMENTS 00 3K Preset parameters 00 F S3? y bank 00 400F 00 F S^s k bank 00 ^03F 00 F S5s q bank oo ko6F 00 F S6% number of equations 00 3F 00 F S7: location of Auxiliary 00 500F (Fl) 00 K Runge-Kutta Subroutine (Pl6) 00 K INFRAPRINT (N12) 00K INFRAPUT (Continued on page 226 ) * See APPENDIX 15' 226 LOCATION ORDER PAIR COMMENTS 00 K Constants (2) 00 F oo 625 000 000 000 J 10/l6 1 00 P 00 J+oo 000 000 OOOJ VlO 2 80 F 00 128F -1 + 2^ ' 2~ 39 3 00 F 00 562 500 000 OOOJ 9/16 Temporary Storage (3) 00 F 00 2 v '3) 02 K Master (1) 50 S3 50 (1) Enter N12 to read y Q /lO, z /!0 1 26 (W12) 19 2F 2 50 33 7^ (2) (10/16) (y Q /lO) + 2~ k2 3 00 2F i'-0 S3 Yt = y Q A rounded k 50 IS3 7J (2) (zq/IA) (10/16) (Continued on page 227 ) 227 LOCATION ORDER PAIR COMMENTS 5 40 1S3 z = Z c/ 1 ^ rounded 4l 2S3 x* = 6 19 3F 40 2S4 set *2 = IF 7 lH S5 clear cu 4l 1S5 *L 8 4l 2S5 Fl 2(2) set integration counter =1-129*2 -39 9 40 (3) 22 (1.2) jump for initial print 10 (1.1) 00 kF w 50 (l.i; 11 (1.2) 26 (Fl) 92 131F enter Runge-Kutta subroutine prepare to print x 12 92 515F 50 2S3 13 7J 1(2) 50 F x* • Vl° = x/10 waste Ik (1.5) 54 HOF 50 (1.3) print x 15 26 (Pl6) 92 963F space 16 50 S3 U 1(2) y* ■ 4/10 = y/10 17 (1.4) 54 llOF 50 (1.4) 18 26 (P16) F5 (3) print y advance integration counter 19 40 (3) jump if not end Od. \±°±J (Continued on page 228) 228 LOCATION ORDER PAIR COMMENTS 20 2k (1) 50 F 00 500K 00 K5 F k2 (l*.l) L5 1S3 40 Sk 50 2S5 7J 2S5 LO 3(2) to 1(3) lj-1 F 50 1(3) 75 S3 Yk F FJ+ F 10 2F (k.l) to lSlt- 22 [ ]F 26(1) 24lN BS stop if end waste AUXILIARY k o = z * (x*)< -9/l6 + x* c ( - YG+ x* 2 ).y* t-*i exit 229 UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 29 THE CATHODE RAY TUBE DISPLAY It is sometimes desirable to plot the results of a computation and for this purpose a cathode ray tube (CRT) display unit is available „ An output command may be given which will cause a spot, coordinates (x,y), on the face of the tube to be brightened. The coordinates of the spot to be brightened are specified by the bit configuration in the accumulator at the time the output command is given. There are actually three tubes on which the results are plotted in parallel. Two of these tubes have cameras attached over their faces, making it possible to take a picture of the set of points brightened — the sequence of points usually appearing as a curve in the picture. One of the cameras holds 35 ™n film and special ILLIAC orders may be given to advance the filmj thus it is possible to take a series of 35 nnn pictures of the sequence of points plotted completely automatically; the other camera is a Polaroid Land camera and is operated manually. The third tube, operating in parallel with the other two, is for direct visual observation. This tube is of a special type, called a Memotron, which has the property that a spot on the tube face once brightened will remain brightened until the computer operator erases it manually by throwing a switch on the control panel; thus, with this tube one sees immediately the picture that is being simultaneously recorded on film since the tube "permanently" records all brightened spots just as the film does. To describe the coordinate scheme used with the CRT display consider Figure 29-1. The origin of the coordinate system is located at the lower left-hand corner of the tube face. The x and y axes are divided into 256 discrete points numbered 0, 1, 2 ... 255° A spot on the tube face is specified by the number pair (x,y) where x and y are allowed just the values given above. The locations of three points are illustrated in the figure; the point x = 255> y = 255 is located in the upper right-hand corner; the point x = 128, y = 128 is located at the center; the point x = 128, y = 6k is located below the center, one-half the distance from the center of the tube to the x-axis. 230 Figure 29-1 Coordinate system for the CRT display unit. To display a point with coordinates (x,y) the values of x and y are placed in the accumulator according to the following rules: A. (l) y is placed in digital positions A A, 7 ' (2) x is placed in digital positions JL A. ... A_. j (3) digits in the remainder of A have no effect. Thus, y and x are located in the accumulator as shown helow in Figure 29-2. °. 1 . 2 . V **. *?. 6 . 7 . 8 . Q.in.n . 1? .^.^^ y y A ^ " A 39 arbitrary Figure 29-2 Location of digits of x and y in the accumulator to display point (x, y), 231 Having arranged the digits of x and y in A as shown in Figure 29-2, the execution of the output order 82 16 will cause the point with coordinates x = ag • 2 7 + a 9 • 2° + a 1Q • 2 5 + a^ • 2 + a^ ■ 2 3 + a^ • 2 2 + a^ • 2 + a^ 7 6 5^^2 y = a • 2 ' + a 1 • 2 + a 2 • 2^ + a • 2 + a^ • 2 J + a • 2 + a^ • 2 + a to be displayed. The execution of the output order will cause 16 left shifts of the AQ register. The execution time for this output order is about 800 |is. When making a recording of the points displayed with the 35 mm camera, the following things should be kept in mind. The roll of film in the camera may hold pictures taken by other users; therefore in order to distinguish pictures belonging to a particular user they should be maked in a characteristic way. The film can conveniently be marked with the CRT lettering routine stored on the drum. To use this simply punch the characters to be displayed on a tape, preceding the sequence of characters with the number 9 and terminating the sequence with a one-hole delay. This tape should be read into ILLIAC before the program tape is read. Lettering on the scope will begin in the upper left corner of the scope face and proceed from left to right. A maximum of 18 characters may be placed on one line. A line feed and carriage return character will cause a new line of characters to begin. A maximum of Ik lines may be displayed. If one tries to display more than 18 characters on a line, then a "line feed and carriage return" will automatically be executed. Also, if one attempts to print more than 1^ lines, then a film advance will automatically be executed. If several frames of pictures are taken, it is usually found convenient to mark each frame with some kind, of identification symbol. Library subroutine 05 may be used for this purpose. If each frame is not marked, the user should put a mark of some kind after the last picture taken. It is also generally good practice to advance the film one or two frames before the display of points begins; the command 92 1^9-rx will advance the film one frame. Also it is a good idea to advance the film a frame or two after the last picture taken in order to be sure that the next user does not draw a curve on top of the results just obtained by the last user. It is also wise to advance the film to prevent fogging of the 232 picture. The camera has no shutter and as a consequence just the filament light from the CRT will fog the film if the film remains exposed for a long period of time (order of 15 minutes). The use of the CRT display unit for displaying a curve will now be illustrated in a simple example. Let us suppose that a variable Y which is being computed (for example suppose Y to be the solution to a differential equation) is to be plotted as a function of time, T. The plot is to consist of Y on the vertical axis (ordinate) and T on the horizontal axis (abscissa). We will suppose that bounds on Y have been determined: - — < Y < -r « The variable T is held as an -39 / integer, i.e. is stored as T°2 (the units of T might be those of the integration interval, h, thus T would just be the number of integration steps). Bound on T are such that 0< T < 2^6. Since the variable Y assumes negative as well as positive values with upper and lower bounds symmetrically disposed about zero, we will take the mid- point of the vertical axis to correspond to Y = 0. The proper value of Y for plotting is obtained if we just extract the first 8 bits of Y and add a 1 to the sign digit to shift the origin for the y axis to the center of the tube face. The correct value of T for plotting is obtained if we simply shift this number into digit positions An - A (least significant digit of integer T in A ) . The code which follows is to be considered as a closed subroutine of a larger program. The purpose of this subroutine is to plot the point (T,Y) on the CRT display unit according to the scheme described above. The subroutine begins at symbolic address (l); on entry to the subroutine it is assumed that Y is in symbolic address (2) and T is in symbolic address 1(2). 233 LOCATION ORDER PAIR COMMENTS (1) K5 F k2 (1.1) Set link 1 09 IF Lk (2) Shift Y origin 2 40 F L5 1(2) Temporarily store Y 3 00 2^F 50 F Put T into position Put Y in Q h JO (1.2) S4 F Extract Q - Cu Put Y in A ... A 5 (1:1) 82 i6f 22 F Plot Y,T Exit 6 (1.2) LL F 00 F Y extractor 7 (2) Y 8 m ,ip~ ~>y Sometimes it is desired to plot more than one point at a given value of x; in the preceding example one might desire to plot Y vs. T and -—vs. T simultaneously. After plotting the point T,Y as just described, then the point T, — - may he plotted hy simply placing — in the digits of A, A A, ... A , and executing the order 82 8. This point will then he plotted with ordinate given hy digits in A A, A,^ and the ahscissa of the preceding point. 23^ UNIVERSITY OF ILLINOIS DIGITAL COMPUTER CHAPTER 30 B-LINES AND FLOATING POINT ARITHMETIC Almost any routine of practical importance contains a number of loops. A counter is generally associated with each loop which keeps track of the number of passes through the loop. Usually within each loop the address of one or more instructions is modified in a regular fashionj quite commonly, as has been seen in the preceeding chapters, the addresses are changed by one on each pass. Because these features are so common in programs a number of computing machines have built into them special devices called B-lines or index registers which permit counting and address modification to be performed with considerable efficiency. The detailed characteristics of the B-lines vary somewhat for different computing machines but in general they possess the following common features. Each B-line is a register in the machine comprising n bits, where n is usually equal to the number of bits in the address portion of an instruction. The B-line is used to modify the address digits of an instruction^ the B-line which is to do the modification is specified by a set of bits within the instruction. When the instruction is executed its address is taken to be the number in the address portion of the instruction modified by the number in the specified B-line. It is common to perform the modification by adding the contents of the B-line to the number in the address digits of the instruction. This modification of the address is not permanent, for the instruction as it appears in the memory of the computer is not altered, it is only the inter- pretation of the address by the control unit of the computer at the time the instruction is to be executed which is modified. To illustrate the preceding remarks we now consider a computing machine with B-lines.* The form of an This computer is not necessarily identical to a real computer but its properties are similar to those of a real computer with B-lines. 235 instruction is as shovn in Figure 1 below. The instruction is thus composed FUNCTION ADDRESS B-LINE (f Bits) (a Bits) (b Bits) Figure 30-1 Typical form of an instruction in a computing machine with B-lines. of three parts, a block of function digits and a block of address digits, as in an ILLIAC instruction, plus a block of B-line digits. Let us consider a specific instruction and its interpretation by the control. We will assume that (a) the function digits specify a clear add instruction (i.e. L5 in ILLIAC language )| (b) the number in the address digits is 165-pJ (c) the number in the B-line digits is J> } (d) the number in B-line 3 is ^0 ; (e) the number in memory location 205^ is x; when this instruction is executed the effective address is 205 D = i65 D + to t specified N contents of by address B-line 5« of instruction hence the number from memory location 205, namely x, is brought into the accumulator by this instruction. Our computer will have certain instructions unlike any on the ILLIAC which refer to certain operations on the B-lines. 236 One instruction we will call "load. B-line". This instruction will cause the number in the address digits of the instruction to he placed in the B-line specified by the B-line bits of the instruction! thus, the instruction Load B-line 1,000 would cause the number 1,000 to be loaded into B-line 3« Another instruction will be called "advance B-line" . This instruction will cause the contents of the specified B-line to be incremented by one and then compared with the number in the address portion of the instruction! if the two numbers are equal the control skips the instruction immediately following the "advance B-line" instruction, otherwise the execution of instructions proceeds in the normal fashion . Any instruction having all B-line digits equal to zero is not to have its address modified. Let us now write the orders necessary for the evaluation of the polynomial 20 P on( x ) 3 oa x + a l9 x 19 ■20 20 + . . . + a x + a It is assumed that the polynomial coefficients a , . . a are located in 20' "19 a block of words in the memory beginning at location 500 and x is in location 600. The code begins at location 100. In this illustration ILLIAC function digits are used whenever the instruction is a possible ILLIAC instruction. Instruction Function Address B-Line Location 100 in Load B-line 1 101 50 600 7J 102 Lk 500 1 kO 103 Advance B-line 21 1 26 101 ixA OF 237 The hold-add instruction at the left-hand side of 102 is B-line modified^ the effective address of this order on successive passes through the loop is 500, 501 3 502 ... 520, thus calling out the coefficients a , a , a q, . .. a . As long as the contents of B-line 1 are less than 21 the 26 order at RH of location 103 is obeyed « When the contents of B-line 1 are equal to 21 then the 26 order is skipped and the computer will stop on the OF order at 10^. One can see from this simple example that the number of orders necessary for 'book- keeping" in the loop has been reduced from that necessary in a similar program in the ILLIAC and in addition the bookkeeping is very simply specified notice that the address in the hold-add instruction at 102 is just the base address of the list of polynomial coefficients and the address of the advance B-line instruction at 103 is just equal to the number of passes through the loop. A quite different feature also included in many of the present high- speed computing machines is a provision for doing "floating point" arithmetic. The operands in "floating point" arithmetic are called "floating point" numbers which have the form x = a »b The number b is a constant for the machine and is usually either 2 or 10 . Let us consider a representation in which b = 2, then the floating point number has the form x = a»2 C . Each number x in the machine is held in the memory as a number pair (a,c) $ b need not be specified since it is the same for all numbers in the machine. With- in a word one group of bits is used to hold a, called the fractional part of the floating point number (it is a number in the interval (-1, +l), and another group of bits is used to specify c, called the exponent or characteristic of the floating point number » The aim of the floating point scheme is to increase the range of the numbers which the machine can represent and thereby reduce the scaling problem. Consider a floating point computer with kO bit words, having bits w , w . . „ w 238 assigned for holding the fractional part of the floating point number and hits w -, ... w^ assigned for holding the exponent part of the floating point number. 33 39 The number range for this representation is then -1.2 65 where p a' = a • 2 X X X - C y j C = C x y c -c The fractional part a is thus reduced by the factor 2 y (C -C < 0), this x x y operation being executed in the computer as a right shift of C -C places. After the two numbers have thus been put into the same scale the fractional parts are added, a" + a . and the exponent associated with the result is just C . x y' y The alternative procedure of picking the number with the larger exponent and shifting its fractional part left to bring x and y into the same scale is excluded because the most significant digits of the number with the larger exponent would then be "lost" by spilling out of the left end of the shifting register. When the number with the smaller exponent is shifted to the right to bring x and y into the same scale digits also spill out of the shifting register, but these are the least significant digits. There is the possibility that overflow may occur for it is entirely conceivable that la' + a I > 1 1 x y 1 240 and it is therefore necessary for the floating-point addition operation to properly detect and treat this situation when it does arise. The scheme is to have a means for detecting and preserving the overflow hit (under any circumstances we must have |a' + a | < 2) and whenever the overflow situation is detected the sum a' + a , including the overflow bit, is shifted to the right once, i.e. it is reduced by r , and the exponent is increased by 1. The result of an addition may not be in normalized form. In some floating point schemes normalization of the sum is executed automatically, in other schemes the programmer is provided with two types of floating add instructions, one providing for automatic normalization of the sum and the other leaving the sum unnormalized . Multiplication is not quite so involved. The procedure for multipli- cation is simply to multiply the fractional parts of the two numbers and sum their exponents C +C C x»y = a -a -2 X y = a -2 z x y z This may or may not be followed by automatic normalization of the product depending on the scheme used. In this situation overflow of the fractional part is not possible. Division is slightly more involved than multiplication. Essentially the procedure is to divide the fractional parts and subtract exponents, thus a C -C _y * _ JL . 2 x y y However, since the division of the fractional parts proceeds as in ordinary fixed point division it is necessary to pre-scale the floating point numbers to insure that the quotient of the fractional parts is itself a fraction. A procedure for handling this is to always first shift the fractional part of the numerator one place to the right, putting x into the form a C +1 x = ( -i ) , 2 x 2lkL before executing the division cf the fractional parts| it is assumed in this that "both x and y are initially in normal form. This prescaling of x takes place automatically as an initial step of the floating point division operation. Normalization after division may be automatic. While the increased number range permitted by the use of floating point arithmetic ma'&es it very attractive there are certain problems attending the use of this scheme of arithmetic vhich are all too often not fully appreciated,, The primary problem concerns error analysis , It has already been made apparent that error analysis in fixed point arithmetic is a very difficult task. In floating point arithmetic these difficulties are greatly exaggerated. The source cf the increased difficulty is that the magnitude of the error is not absolute as it is in fixed point but relative to the size of the number with which it is associated, Returning to the floating point scheme described on page 2^0 where 33 bits were assigned to the fractional part of the number , a number x put into this form and properly rounded will have an error C' ,% -2~ 55 -2 X < e < 2" 55 »2 X . Thus the bounds on the error of any number are vitally related to the scale factor of the number itself. In a fixed point calculation a number x ! put into a 33 bit register, ana properly r:uaded will have its error bounded as follows -2~ 35 < e < 2" 55 . Of course it is true that x- may have tc be scaled by a factor s to bring it into fixed point range so that the number actually treated in the machine is (x 1 )* = x 1 -^ s The error in x 1 is then -2~ 55 -s < e < 2 " 55 »s . 2^2 This looks very much like the above expression for the error in a floating point computation, but there is one vital difference. In the fixed point computation the scale factor is fixed by the programmer and therefore known to him at all times . In the floating point computation the scale factor is generally assigned automatically when the number is normalized consequently the scaling is taken out of the hands of the programmer and essentially hidden from him and since the bounds on the errors are proportional to the scale factor it follows that the bounds of the errors also become hidden. It is for this reason that the notion that one can bypass the analysis of a problem to determine the sizes of numbers which arise at various stages of a computation by doing everything in floating point is a dangerous one to assume, for it implies that there is very little knowledge of the accuracy of the result and the result is therefore of very little value. To further demonstrate the difficulties one can get into in a floating point calculation by neglecting careful consideration of the numbers being dealt with and the errors which are generated, two extreme examples of typical difficulties are now cited. If two numbers of opposite sign and nearly equal magnitude are added to each other there will be strong cancellation in the fractional parts. Let us suppose in fact that the two numbers have the same exponent and that their fractional parts differ (in magnitude) only in the last two bit positions of their fractional part. The resultant sum then has at most two significant digits but after normalization of the sum there is nothing to indicate that only the first two bits of the fractional part of the sum are significant. In the corresponding situation in fixed point arithmetic the non-significant digits are clearly apparent because of the leading zeros which would result. Another difficulty arises in a computation of the following type. Suppose we have a computation to perform which involves the iterative procedure z. = z. _ + x. , i = 0, 1, ... N l i-1 l * ' ' z Q = P . 243 Further let us suppose that the character of the numbers is such that P > > x. for all i, although N Z x. > P . i=l X If one prepares the floating point program for this computation with no regard to the sizes of the numbers involved, then the sequencing of the sums would probably occur as follows: z = P + x Z 2 = Z l + X 2 = ( p + x x ) + x 2 Z 3 = Z 2 + X 3 = (P + x x + x 2 ) + x^ etc . Consider the first sum. Since x < < P the fractional part of x will be shifted far to the right to get it into the same scale as P for the addition; the result is that only a very few significant digits of x are actually used to form the fractional part of P + x . In an extreme situation the fractional part of x may even be completely lost in the attempt to put the two numbers in the same scale. The same difficulty arises at each successive addition of a new x. with the 1 consequence that the part of the sum contributed by x + x p + . . . + x will be greatly in error; and again in an extreme situation it might even be zero. This difficulty could of course be eliminated easily by simply forming x + x + . . „ + x first and then adding P. The point is that to know that this must be done implies that some consideration be given to the sizes of numbers . The above remarks should make it fairly evident that a careful floating point calculation demands a consideration of the magnitudes of the numbers just as a fixed point calculation does . The question arises as to why floating point should then be used at all, for if one knows enough about the magnitudes of the numbers to properly do a calculation in floating point, then one might just as well write the program in fixed point arithmetic in the first place. This is a contro- versial point but many hold that floating point arithmetic is a quite useful and practical scheme for a large number of problems <> 2kk The ILLIAC does not have the facility for doing floating point arithmetic "wired in". However, it is possible to write a program to make the ILLIAC act as if floating point arithmetic was wired in, just as it is possible by means of a closed subroutine for the computation of -\j x to make it appear as if there was a single ILLIAC order to execute a[ x. Floating point arithmetic is achieved on the ILLIAC by means of an interpretive subroutine. This interpretive subroutine differs from the subroutines thus far considered in that the program parameters follow the jump order to the subroutine and the "parameters" are actually instructions to execute various floating point arithmetic operations written in a form similar to conventional ILLIAC orders . When the jump to the subroutine is executed the subroutine examines the floating point orders one by one and executes a series of ILLIAC orders designed to produce the desired floating point operation; thus, within the interpretive floating point subroutine there are blocks of orders (regular ILLIAC orders of course) which will operate on the two number pairs C (a , C ) representing x = a 10 x and C (a , C ) representing y = a 10 y y y to form the normalized result C (a o C ) representing z = a 10 =x + y: x z z z ' other blocks of orders within the subroutine effect floating point multiplication and so forth. In addition, the floating point interpretive routine permits one to write the floating point instruction as if B-lines were available on the ILLIAC. The standard library subroutine for executing floating point arithmetic is labeled Al- There are also routines in the library for computation of the frequently used functions in floating point form; routines included in this list are square root (RAl), sine (TAl) exponential (SA2) natural logarithm (SA3), arc 2U5 tangent (TA2). These routines for computing special functions are always used in connection with Al. There is also in the library a "package" of floating point routines which includes Al and the above auxiliaries for computing special functions; the "package" is labeled A6. A library write-up of Al, with the code omitted, is given in Appendix 23, pp. 409-^15. A library write-up of A6, with the code omitted, is given in Appendix 2k, pp. i4-l6-i4-19. 2k APPENDIX 1 ADDITIONAL LITERATURE REFERENCES Logical design and circuitry of computers: (lA) "Logical Design of Digital Computers", M. Phi ster, Jr., John Wiley and Sons, Inc., New York, 1958. Programming: These reports by Goldstine and von Neumann are of historical interest. (2A) "Planning and Coding of Problems for an Electronic Computing Instrument", Herman H. Goldstine and John von Neumann. Re- port on the Mathematical and Logical Aspects of an Electronic Computing Instrument, Part II, Volume I (19^-7) and Volume II (19^8). Institute for Advanced Study, Princeton, New Jersey. (3A) "High Speed Data Processing", C. C. Gotlieb and J. N. P. Hume, McGraw-Hill, New York, 1958. (UA) "Programming the IBM 650 Electronic Data Processing Machine", J. V. Andree, Holt, Rinehart and Winston, Inc., New York, 1958. (5A) "Electronic Digital Computers", F. Alt, Academic Press, New York, 1958. (6A) "A Primer of Primer of Programming for Digital Computers", M. H. Wrubel, McGraw-Hill, New York, 1959- (7A) "Programming for Digital Computers", J. Jeenel, McGraw-Hill, New York, 1959- (8A) "Mathematical Methods for Digital Computers", A. Ralston and H. Wilf, John Wiley and Son-,, Inc., New York, i960. Periodicals : (9A) Communications of the Association for Computing Machinery 2U8 (lOA) Computing Reviews (llA) Proceedings of the IRE Professional Group on Electronic Computers (12A) Computer Journal (This is a publication of the British Computer Society) (13A) "Advances in Computers", Volume 1 (i960), edited by F. L. Alt, Academic Press, New York. 249 APPENDIX 2 TABLE OF POWERS OF 2 2 n n 2" n 1 1.0 2 l 0.5 4 2 0.25 8 5 0.125 16 4 0.062 5 52 5 0.031 25 64 6 0.015 625 128 7 0.007 812 5 256 8 0.005 906 25 512 9 0.001 953 125 1 024 10 0.000 976 562 5 2 048 11 0.000 488 281 25 4 096 12 0.000 244 140 625 8 192 13 0.000 122 070 312 5 16 384 14 0.000 061 035 156 25 32 768 15 0.000 030 517 578 125 65 536 16 0.000 015 258 789 062 5 131 072 17 0.000 007 629 394 531 25 262 144 18 0.000 003 8l4 697 265 625 524 288 19 0.000 001 907 348 632 812 5 1 048 576 20 0.000 000 953 674 316 4o6 25 2 097 152 21 0.000 000 476 837 158 203 125 4 194 304 22 0.000 000 238 4i8 579 101 562 5 8 388 608 23 0.000 000 119 209 289 550 781 25 16 777 216 24 0.000 000 059 604 644 775 390 625 33 554 432 25 0.000 000 029 802 322 387 695 312 5 67 108 864 26 0.000 000 014 901 161 193 847 656 25 134 217 728 27 0.000 000 007 450 580 596 923 828 125 268 435 456 28 0.000 000 003 725 290 298 46i 914 062 5 536 870 912 29 0.000 000 001 862 645 149 230 957 031 25 1 073 74i 824 30 0.000 000 000 931 322 574 615 478 515 625 2 147 483 648 31 0.000 000 000 465 661 287 307 739 257 812 5 4 294 967 296 32 0.000 000 000 232 830 643 653 869 628 906 25 8 589 934 592 33 0„000 000 000 116 415 321 826 934 8l4 453 125 17 179 869 i84 34 0.000 000 000 058 207 660 913 467 407 226 562 5 34 359 738 368 35 0.000 000 000 029 103 830 456 733 703 613 28l 25 68 719 476 736 36 0.000 000 000 oi4 551 915 228 366 851 806 64o 625 137 438 953 472 37 0.000 000 000 007 275 957 6l4 183 425 903 320 312 5 274 877 906 944 38 0.000 000 000 003 637 978 807 091 712 951 660 156 25 549 755 813 888 39 0.000 000 000 001 818 989 403 545 856 475 830 078 125 250 APPENDIX 3 ADDRESS CONVERSION TABLE O en O O o o o — ) o _ fO 1T> N en •-> _i CU CU eu CU cu »-l c2 uj a 03 ft b Z O us CsJ CM co g i 1 00 o CO j§ o 3 8 \0 4^ cu N ^r O fc en 3 8 a V in r-n § w> ^ O s CO o re 0i £ a s a o § lO < § 3 a 39» ^i* ^2' ' • • ' <±yi> ^jQ* leaving q unchanged. The number n will be interpreted modulo 6U. Variants 0, 2, k, 6 Order as described above. 1j 3 , 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 25^ 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 beforehand or not, depending upon V. Variants Stop. The first order after starting with the START 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. 1j 3 j 5 ) 7 Same as 0, 2, k } 6 except clear A first. 8, K, N, F Illiac will hang up. Avoid these. 9, S, J, L Same as 1, 3* 5 , 7 except also make A = l/2 after clearing. Use 20, 21, 22, 23, 2k, 25 , 26, 2J, 29, 2S, 2J 5 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 done, the control transfer order which stopped the Illiac will be ignored. The normal sequencing 255 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 he 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 40 IF 24 p p+2 7J 2F L4 3F If we stop with the 20 order, the black switch will start with L4 5F and the white switch with 24 p. If we stop with the 24 order, the black switch will start with L5 F and the white switch with J J 2F. 256 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 beforehand or not, depending upon V. If A < 0, go on to the next order. Variants 0, 2, k, 6 If A > 0, do the same operation as for the corresponding 2V order. If A < 0, go on to the next order . I* 3j 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 . 257 kV 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, k Replace N(n) by A. 1, 5 Replace N(n) and 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. 7 Same as 6 except clear A first. 8, K, N, F Illiac will hang up. Avoid these. 9, J Replace N(n) and A by l/2 . S Replace A by l/2 and address digits of right-hand order at memory location n by . L Same as S except take left-hand order. Use only ho, kl, k2, kj, h6, kf s K9 , ks, Kl. 258 5V n Memory to Q 3 Orders Transfer N(n) to Q Variants 0, 2, k, 6, Transfer N(n) to Q 1, 3, 5, 7 Clear A and transfer N(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. 259 6v n Divide 3 Orders Divide AQ by N(n), placing the rounded quotient in Q (the least significant digit being 1 for the roundoff) and leaving a residue in A. If |A| > |N(n)| the Illiac will stop after dividing. If |a| = |N(n) | and if A > 0, the Illiac will stop after dividing; if |a| = |N(n) | and if A < 0, the Illiac will not stop after dividing. Variants 6 As described above. 7 Make A = 0, then proceed as above. L, S Make A = l/2, then proceed as above. 8, K, N, F Illiac will hang up. Avoid these. 0, 1, 2, 3 These give incorrect results or results ^> 5> 9> J which are correct only under certain conditions. Avoid them. Use only 66, 67, 6l. 260 7V n Multiply 12 Orders -39 Put QxP(n)+2 A into AQ, the least significant 39 digits being in Q with q_ = 0. Variants P(n) = - N(n) 1 P(n) = - N(n); A = "Unrounded Negative Multiply" 2 P(n) = - |N(n)| 3 P(n) = - |N(n)| j A = k P(n) = N(n) "Hold Multiply" 5 P(n)=N(n)jA=0 "Unrounded Multiply" 6 P(n) = |N(n)| 7 P(n) = |N(n) | j A = 8, K, N, F Illiac will hang up. Avoid these. 9 P(n) = -N(n) ; A = l/2 "Rounded Negative Multiply" S P(n) = - |N(n)| J A = 1/2 J P(n) = N(n) j A = 1/2 "Rounded Multiply" L P(n) = |N(n)| ; A = l/2 Use only JO, U, 72, 73, 1±, 75, r 6, 77, 79, 7S, 7J, 7L 26l 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 h 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 ^j> a ^,P > > a ^q ^y "^e lo ^ n£iT y digits corresponding to the sexadecimal character being read. This is done n/k times. 1, 9 Clear A and then do as in 80 order. 2 Punch 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 *K)-digit order of the form 85 11 TV p. We distinguish two cases, (l) 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. 262 (2) T is 0, 1, 8, 9o 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 40-digit order of the form 86 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 available in drum addresses he- 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 l/2 in A and do as in 82 order. L Put l/2 in A and do as in 86 order. 8, K, N, F Illiac will hang up. Avoid these. ^■j J These are not useful. Avoid them. Use 80, 81, 82, 83, 85, 86, 87, 8S, 8L. 263 When the input order 80 n with n < k is executed, it acts like a left shift order, except that digits from Q do not go into A; zeroes go into the low order end of A instead. No tape character is read in this case. The following example illustrates the effect of this order when n = 3: Initial state of A Q A a o a l a 2 a 3 a k a 36 a 37 a 38 a 39 Q q Q q x qg q 3 q^ ^ 6 ^ ^q ^ State of A Q after obeying 80 3 A a 3 % a 5 a 6 a 7 a 39 ° Q ^o \ q 5 q 6 q 7 q 39 ° ° ° 26^ 9V n Special Input-Output 2 Orders Variants 1 Five hole input. Clear A, shift AQ four places right and replace a r, a,„, a *o.> a ^q °y "the binary digits corresponding to the four least significant holes on the tape. Place the contents of the fifth hole in position a • The address part of this order must be k. 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 k digits define the usual k 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 = 6ka + 4b + c - 2 where a is the character punched, a = 0, 1, 2, . . . , J, F, L b is the number of characters punched, 1 < b < 16 c determines the fifth hole, c =0, 1. 265 The number of right shifts executed is Vb + c - 2 . Example . Punch the character 7 thirteen times. n = 61+x7+l4-xl3 + 0-2=U98 It will be found that the last 6 digits contain the number 50 which when divided by 4 and rounded up gives 13- There will be 50 right shifts. Figure 1 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 1 Address Digits of 92 Order 266 KV n 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~ 59 in A. 2 Same as if Q > 0; same as k if Q < 0. 3 Same as 1 if Q > 0; same as 5 if Q < 0. h Add Q + 2~ 59 to A. 5 Put Q + 2~ 59 in A. 6 Same as k if Q > 0; same as if Q < . 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 -59 + 1/2 in A. S Same as 9 if Q > 0; same as J if Q < 0. J Put Q + 2~ 59 + 1/2 in A. L Same as J if Q > 0; same as 9 if Q < 0. Use KG, KL, K2, K3, Kfc, K5, K6, KJ, K9, KS, KJ, KL -59 NOTE: -Q - 2 Jy is the digitwise complement of Q. 267 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 |q| from A 3 Put - |Q | in A. h Add Q to A. 5 Put Q in A. 6 Add |Q| to A. 7 Put |Q| in A. 8, K, N, F Illiac will hang up. Avoid these. 9 Put 1/2 - Q in A. S Put 1/2 - |Q| in A. J Put 1/2 + Q in A. L Put 1/2 + |Q| in A. Use SO, SI, S2, S3, S4, S5, S6, S7, S9, SS, SJ, SL 268 JV n Extract 3 Orders If two corresponding digits of N(n) and Q are both l'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. 1j 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 269 FV n Increment Add 12 Orders Programmed Stop 1 Order Variants Add -N(n) - 2 Jy to A. (See note) 1 Put -N(n) - 2 Jy in A. 2 Same as if N(n) > 0; same as k- if N(n) < 0. 3 Same as 1 if N(n) > Oj same as 5 if N(n) < 0. h Add N(n) + 2~ 59 to A. 5 Put N(n) + 2~ 59 in A. 6 Same as 4 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 Illiac will hang up. Avoid these. 9 Put -N(n) - 2~ 59 + 1/2 in A. S Same as 9 if N(n) > 0; same as J if N(n) < 0. J Put N(n) + 2 -59 + 1/2 in A. L Same as J if N(n) > 0; same as 9 if N(n) < 0. F Stop. This stop is used to indicate failure of a programmed check. Use F0, Fl, F2, F3, Fk, F5, F6, F7, F9, FS, FJ, FF, FL. NOTE: -N(n) - 2~ is the digitwise complement of N(n). 270 LV n Add 12 Orders N(n) is added, subtracted, etc., to A. Variants Subtract N(n) from A. 1 Put -N(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 |N(n) | in A. 8, K, N, F Illiac will hang up. Avoid these. 9 Put 1/2 - N(n) in A. S Put 1/2 - |N(n)| in A. J Put 1/2 + N(n) in A. L Put 1/2 + |N(n)| in A. Use LO, LI, L2, L3, iA, L5, L6, L7, L9, LS, LJ, LL. 271 APPENDIX 5 TIME FOR ORDER EXECUTION The list below gives approximate execution times for ILLIAC orders which are suitable for estimating the running time of programs. Special timing considerations are necessary for estimating the time for the transfer of information between the drum and the WM (see Chapter 21 ). ORDER TYPE n, 1 n 2, 3, k, 5, J 3 not executed 6 7 80, 81 82, 92 K, S, F, L TIME l6n usee 55 usee 18 usee 800 usee 700 usee k millisec/char. 17 millisec/char. (punch) 1 millisec/char. (CRT) 90 usee 272 APPENDIX 6 THE COMPLETE TAPE CODE (^ w w o fc w • • • •• • • pq ON CO m ■a -W- -P o S? rH p H 0) P to — U CD 43 -P tp P -H M CO tg ><: to « p

a> ai « Uh o) 0) W) c 3 •H •H i-l ^ in ■rt cd a o a w CO CO K H « Ph CO K W CO CO PS w 9 H 273 APPENDIX 7 92 ORDERS FOR PRINT BIG TELETYPE CHARACTERS AND ADVANCING CAMERA FILM PRINTED CHARACTERS MACHINE ORDER (DECIMAL ADDRESS) Space 92 965F Carriage Return and Line Feed 92 131F Delay 92 515F Letters Shift 92 259F Numbers Shift 92 707F Film Advance 92 769F AFTER AFTER LETTERS SHIFT NUMBERS SHIFT A ) 92 387F B ( 92 195F C t 92 835F D $ or tab* 92 67F E 3 92 19^F F F 92 898F G = 92 579F H apostrophe 92 771F I 8 92 51^F J J 92 83^f K + 92 6U2F L L 92 962F M • 92 6I+3F N N 92 770F 9 92 578F P 92 2F Q 1 92 66f R 1+ 92 258F S - 92 706F T 5 92 322F U 7 92 1+50F V > 92 32 3F W 2 92 130F X / 92 1J-51F Y 6 92 386F Z X 92 89 9F Note These orders change the state of A and Q, see page 26U, *Only one printer has a tabulation mechanism. 27^ APPENDLX 8 96 ORDERS TO SPECIFY OUTPUT MODE The following 96 orders cause ILLIAC output to be transmitted to the output unit selected. ORDER OUTPUT UNIT SELECTED 96 IF Punch 96 65F Scope 96 129F Printer Once an output unit has been selected, all subsequent output will be trans- mitted to it until another unit is selected by execution of another 96 order. None of these orders changes the state of A or Q. SADOI always selects the punch, therefore, unless the programmer gives a 96 order to select another output unit, his output will be on the punch. 275 APPENDIX 9 ILLIAC LIBRARY DESCRIPTION OF SADOI LIBRARY ROUTINE X 12 - 235 By Roger H. Farrell (Preliminary work also done by Lily H. Seshu Raymond P. Polivka, Gene H. Golub.) TITLE TYPE NIMBER OF WORDS WORDS USED TEMPORARY STORAGE DESCRIPTION Symbolic Address Decimal Order Input (SADOI) Input Assembly Program 615 Words in the locked out section of the drum 999-1023 in the high speed memory 11,058-12,799 on drum 0, 1 This routine is stored on the drum- It is automatically brought Into the Williams memory and is not included on the program tape. It is an input routine designed to read instructions with addresses in decimal or symbolic form. It is compatible with the D.O.I. Any program written for the D.O.I, (library routine X l) and which refers to the D.O.I, only in standard fashion may be used with SADOI. It ■ay be necessary to recompute sum checks for programs to be input by SADOI. During input the entire Williams memory is used by SADOI < The instructions in SADOI occupy locations 32-562, 999-1023- The remainder of the Williams memory is used for temporary storage. Instruction pairs of the program being read are initially stored on the drum. The correspondence used is drum address 11756+X *—> Williams memory address X. When SADOI is instructed to jump to the program which has been read, words of the program are transferred from the drum to the Williams memory and the jump is executed. A more detailed description is given under interludes . Initially the reading of a program tape must be started by a hold start or a clear start . In either case Williams memory 2-998 is transferred to drua locations 1 1,758- 12, 75^. SADOI is then placed in the Williams memory. Input then begins . 276 Each instruction consists of a pair of function digits and an address . Addresses are written in numerical or symbolic form. Numerical addresses are written and punched in decimal form with non-significant zeros omitted. Thus we write 1023, 35, 7. Each numerical address is followed by a terminating symbol K, S, N, J, F, or L. This symbol indicates a method of treating the numerical address and the instruction. For example, L5 29F and 40 71. A zero address is indicated by writing a terminating symbol immediately following the function digits. For example, 00K and 26F. Symbolic addresses are written and punched as a pair of parentheses; any combination of symbols or characters may be placed between the parentheses. Examples of distinct symbolic addresses are ( ), (0), (l), (51372), (WQXR). Generally speaking, any two combinations of teletype characters which produce the same sequence of printed characters will represent the same symbolic address. Numerical and symbolic addresses are most frequently written to refer to memory locations. When symbolic addresses are used this reference is made by using the same symbolic address twice. One use is as the address of an instruction. The other use is as a marker showing which instruction is being referred to. The instruction 40 (A) says store the contents of the accumulator at (A), using "(A)" as an address of the instruction. We call this an Inside symbolic address or inside address. Some other instruction pair will use "(A)" as an outside symbolic address or outside address. This instruction pair might be (A) OOF OOF. When this instruction pair is read by SADOI during input the location at which it is to be stored is remembered by SADOI as the real address corresponding to "(A)". This real address is substituted whenever instructions are written with the inside symbolic address (A). There is no limit to the number of references that may be made to a particular memory location using symbolic addresses. Further, the word being referred to may appear anywhere on the program tape. When symbolic addresses are used SADOI determines the real addresses completely in terms of the relative posi- tions of instructions on the input tape. The programmer will find that he normally thinks in terms of symbolic addresses while writing a program. Numerical addresses can be written only after bookkeeping that is made unnecessary by writing symbolic addresses. Further, the programmer will find that use of symbolic addresses greatly facilitates making corrections in program tapes. For, instructions often may be added or deleted without having to change addresses. 277 TERMINATING SYMBOLS K is a directive symbol. A directive is an instruction written with a pair of sexadecimal characters, a numerical address and terminated by K. It tells SADOI where to store word3 of program. In addition it provides an address which is called the relativizer. This address is the origin against which relative addresses are measured (see discussion of L, below). The first instruction on a tape must be a directive. The instruction following a directive will always be a left hand instruction. The directive is never stored as part of the program being read. There are four types of directives which are written as follows: 00 n K with n a nor.-ze:o numerical address. The following instruction pairs on the tape will go into locations n,n+l,n+2, .... The relativizer is given the value n. 00 K If m is the location of the last instruction pair, then set the relativizer to is ♦ 1. The instruction pairs following will go into locations m + 1, m + 2, .... 01 nK If m is the value of the relativizer then the instruction pairs following will go into m ♦ n, a + n + 1, .... The relativizer is not changed. 02 nK Set the relativizer to the address m of the preceding instruction. The following instruction pairs will go into m ♦ n, m + n « 1, .... When using this type of directive the preceding instruction will most often be a dummy instruction written solely to provide a value for the 02 K directive. For example, 00 (A) 02 K will result in the real address corresponding to (A) being used as the relativizer. When the preceding instruction (00 (A)) appears on the tape as a left hand instruction , it will not be stored as part of the program being read. The programmer should be careful to use symbolic addresses with the 02 K directive only in cases where the symbolic address is previously used as an outside address. F means fixed address. Thus L5 29F 40F when executed instructs ILLIAC to put the number at location 29 into A then, store this number at location 0. The pairs of Instructions OOF OOF, 80F OOF, and LL 4095F LL A095F are particularly useful -39 is they set a memory location to 0, -1, -2 respectively. X 278 L means relative address. If n is the value of the relativizer, the instruction 50 3L will have address n + 3. N is used with a jump instruction to cause SADOI to jump to a specified location. Let n be the address of the jump instruction. If n < 998 then the words of program are read back from the drum and put into the Williams memory. Control then transfers to the word at location n. The jump instruction is stored at location 1. It is not otherwise stored as part of the program being read. If the address n ^ 999 then a new address m is computed and substituted into the jump instruction, m = 93 + (n - 999). The jump (stored at location l) is then executed. By this means control may be transferred to any part of the Williams memory during input. The following jump instructions are useful: 24 999N: Stop input. This instruction has no other effect. 26 999N: Use to mark an address (see example 4) 26 1000N: Special interlude marker (see interludes, below) 22 1000N: Special drum storage order (see same, below) 26 1469N: Jump to the first word of temporary storage. Example 1 00 100 K L5 L 82 40 F OF F 00 F 26 100 N. In this example instructions are stored at locations 100, 101. Control transfers to location 100. The first pair of instructions prints itself in sexadecimal. J terminations used after right-hand instructions tell SADOI to convert the pair of instructions into a fraction. It is thus a way of reading a few decimal fractions alonj with the instructions of a program. For this purpose instructions are written in a special form. For example, the fraction .3333 3333 3333 should be written as 00 F 00 3333 3333 3333J and the fraction .1 should be written as 00 F 00 1000 0000 00O0J, The function digits of both instructions are zero and the decimal digits of the fractior are written as the address of the right instruction. Twelve decimal digits must always follow the second pair of zeros except that zeros immediately following the decimal poii may be omitted. For example, write .001 as 00 F 00 10 0000 0O00J. Any fraction in the range to .9999 9999 9999 may be written in this way. 279 We can extend the range by using the function digits of the left instruction. By writing 80 for the function digits we can subtract 1 from the fraction. For example, the number. 8888 8888 8889 would be written as OOF 00 8888 8888 8889J while _0.8888 8888 8889 = -1 +.1111 1111 1111 would be written as 80F 00 1111 1111 1111J. 3 This termination is used to refer to S-parameters. Discussion of S-parameters is deferred until later. USE OF SYMBOLIC ADDRESSES The use of symbolic addresses can be illustrated by the following example. In this example library subroutine P 10 has been rewritten using symbolic addresses. This routine is used to print headings. Example 2 (1) 04F L5 F 32 (2) 50 (3) (2) 26 U) 50 (1) U) 00 6F 42 (3) (3) 02 IF 92 F (5) 91 UF 40 F L7 F 32 (1) 92 707F 26 999F 26 (5) 26 IN 5th hole character non 5th hole character Substitute proper address in the 92 instruction Enter loop 5-hold delay? If not, repeat. Exit from loop. See discussion of interludes. For this example to be complete it should be preceded by a irective. Each pair of instructions referred to in the program is marked by an outside ddress. Thus, in the first instruction pair (l) 04F L5F, (l) is used as an outside idress. Similarly (2), ... , (5) are used as outside addresses. Certain of the istructions use these symbolic addresses as addresses. For example, 32 (2) 50 (3) lich instructs ILLIAC to jump to the right side of (2) if the accumulator is positive, .herwise, put the contents of (3) into Q register. It should be noted that forward and backward references can be ide. The third word contains the instruction 50 (l). This refers back to an instruc- •on pair already read by SAD0I . The reference is called a backward reference . In the •me word, the instruction 26 (4) makes a forward reference to an instruction pair not Jit read by SAD0I . 280 In example 2, location is used for temporary storage. This means that no matter where the block of instructions is located in the Williams memory, location will be used for storing results temporarily during the computation. Thus, fixed addresses are used. In the first word, for example, the instruction L5F refers to this temporary storage location. Last, addresses of certain instructions do not refer to memory locations. In shift instructions, for example, the adiress further supplements the function digits by telling how far to shift. In such cases fixed addresses are almost always written. WRITING SYMBOLIC ADDRESSES An outside symbolic address is written before the function digit: of either instruction of a pair. In example 2, the first instruction pair could also have been punched as 04 F (1) L5 F or as (1) 0/, F (1) L5 F Further, an instruction pair may have several outside addresses. For example, (1) (2) (3) (4) 40 F (5J 81 4 F. An inside symbolic address is written immediately following the function digits. Only one inside address may be used in an instruction. It must not be followed by a termination K, S, N, J, F, !. «, Constants may be added to inside addresses. Thus, the instruc- tion L5 21 (N12) will refer to the 21st word past the word marked by (N12) as an outside address. Generally the form "n ( )" will be used to add n to the real address corre- sponding to ( ) „ The full range of available teletype signs may be used in writing symbolic addresses: numbers, letters, punctuation marks, etc. During input the characters placed between parentheses are read and converted to numerical equivalents. From these numerical equivalents a symbolic address word is formed. As stated earlier, two combinations of teletype characters which produce the same sequence of printed characters will represent the same symbolic address. Delays, spaces, and LF-CR characters do not affect the symbolic address. Figures-shift and letters-shift characters, on the other hand, may affect the symbolic 281 address. After reading the beginning parenthesis of a symbolic address, SADOI assume; each character following is in figures-shift until a letters-shift character is read. Thus, input of a symbolic address is not terminated by "A". The symbolic address (1A would be punched using the following six characters: "(", "1", "LTR-3H" , "A", "FIC-SH 1 ")". The symbolic address (12) would be punched using four characters. Thus + and K, - and S are different. Similarly the letter "X 1 and times "x" are different. The number "0" and letter "0", because they look the same when printed, are given the same numerical equivalent when read, N, J, F, L print the same regardless of the print shift. Each is given the same numerical equivalent in both print shifts when read. The letter "0" or number "0" is different from the absence of a character. Thus, ( ), (0), and (1), (01) are four distinct symbolic addresses. The symbolic address recognized by SADOI consists of the last five printed characters. Thus, "(1A2B3C)" is the same as "(A2B3CJ" but different from "(2B3C)". USE OF TEMPORARY STORAGE LOCATIONS 0, 1 BY SADOI Location is used by SAD01 to compute and .store numerical addresses during the input of instructions . At the beginning of interludes it is usee to compute a sum check. Location 1 is used by SADul to form instruction pairs. Once a pair of instructions has formed a word at location 1, the contents of location 1 an stored as part of the program being input. The only cases in which the contents of location 1 are not stored as part of the program being read is when K or N terminated instructions are read. The right side of location 1 always contains the most recent instruction read. The left side of location 1 always contains the immediately pre- ceding instruction. Consider the following examples: Example 3 (a) (b) 00 F 26 100 F 26 100 F 26 IN 26 LN L5 F U0 F L5 F U0 F 282 In example 3a, the instruction 26 100F appears as a right-hand instruction . The word formed from oOF 26 100F is stored as part of the program being read. When the jump 26 ID is executed, the contents of location 1 is 26064 26001 (sexadecimal). When input resumes, both instructions L5F and 40F must be read before the contents of loca- tion 1 are again stored as part of the program. In example 3t>, the instruction 26 100F appears as a left-hand instruction. After the right hand instruction 26 IN is read the contents of location 1 appear as before: 26064 26001. This word is not stored as part of the program because of the N termination. As before, the next pair of instructions, L5F and 40F, are read before the contents of location 1 are stored as part of the pro- gram being read. During input when an inside symbolic address is used and a backward reference is made, the real address is substituted immediately into location 1 If an instruction like L5 21 (N12; is written, the numerical part, 21, has been com- puted and is stored at location 0. When (N12) makes a backward reference, the real address is substituted. Then, N(0) + N(l) is computed and stored at location 1. When forward references are made during input, sufficient infor mation is retained to allow 5AD0I to form the correct addresses later. A pseudo addres is temporarily substituted into the word at location 1. S PARAMETERS Words stored in locations 2-15 of the Williams memory are called S parameters. These numbers give a way of modifying instructions during input. Following the 3 termination must be a d = 2, 3, 4, 5, 6, 7, 8, 9, K, S, N, J, F, L. This gives the address (in sexadecimal) of a location which is added to the S-termi- nated instruction before it is stored in the memory. The right-hand instruction of an instruction pair stored in locations 2-15 may have an inside symbolic address and still be used as an S parameter. The left hand instruction must not have an inside address if it is to be used as an S parameter. The iirectives 00K , 01K and 02K enable the programmer to minimize the number of memory locations needed to store his program. Use of the 02K directive for this purpose is illustrated in example 4. An S parameter is stored at location 5. After the interrupting instructions are read SADOI is set so that the following instructions will be stored immediately after the earlier instructions. 283 Example Z» L5 F 40 IF (A) 26 999N Introduce address (A) 00 5K Store S parameter at 5 OOF 00 12F 00 (A) 02K Reset 3AD0I to begin storing at (A) L5 IF 82 35 Instruction using 3 parameter The instruction (A) 2fa 999N has no effect other than to introduce the symbolic address (A). INTERLUDES .ihenever SADOI is told to jump to instructions which have been read, an interlude begins. This is done by writing an N-terminated jump instruction with address less than 999. The jump instruction may appear on tape as if it were a left-hand or a right-hand instruction. Pairs of instructions may be written. For example, the instructions 26 L 2o LN or 26 (A) 26 IN may be used to start interludes. In these cases, the instruction pair is stored at location 1 only. The system used with the Decimal Order Input (D.O.I.) in which OOF 26L 26 IN is written to begin an interlude may also be used. During input the last two instruc- tions read are stored at location 1. The next to last instruction is always the left- land instruction of the pair stored at location 1. There are three types of interludes possible with SADOI. REGULAR INTERLUDES Regular interludes happen when 3ADCI is not explicitly told lifferently (see below),, To get ready for the interlude real addresses are substituted nto instructions wherever necessary. After the substitutions are completed drum loca- ions 11,758 to 12,754 inclusive are transferred to Williams memory locations 2-998 nclusive. Control then transfers to the right side of location 1. The interlude ;egins. Since at the beginning of a regular interlude substitutions of : eal addresses are made, the programmer should be careful about putting on tape library outines having interludes . The programmer should put such routines at the beginning |f his tape before inside aidresses are first used or else convert the interlude to he soecial interlude discussed below* 284 Use of a symbolic address as an inside address but not as an outside address is a programming error. SADOI detects all errors of this type before stopping. Information is punched about each error (see below). After all possible substitutions are made and errors indicated, the instructions on the drum are trans- ferred to the 'William's memory. An FF031 stop then occurs. The symbolic addresses used prior to an interlude are rememberec This information is stored on the drum during the interlude at addresses higher than 11,000. A small part of the instructions in SADOI are stored at 999-102; These instructions enable the programmer to jump to SADOI after an interlude for more input. Two types of jumps may be used. When a jump to the left side of l ocation 999 is made the right hand address of the number in Q is usea as a new relativizer, If this address has value m then the following instruction pairs will g,j into a, n» + .1, m + 2, ., until a directive is received. When a jump to the right side of location 1014 is made the old relativizer is retained . The right-hand address of A determines where the following instructions will go. If this address has value m the following instruction pairs will go into m, m + 1, m ♦ 2, ... l/hen a regular interlude is ended by one of these jumps the contents of the Williams memory are put back on the drum. Locations 2-998 are moved to 11,758 - 12,754 respectively. SADOI is then put into the 'Williams memory, infor- mation about the previously used symbolic addresses is restored, and input begins. SPECIAL INTERLUDES Special interludes are provided so that a small amount of calculation may be accomplished without requiring substitution of real addresses for symbolic addresses and without transferring all of 1000 words from one memory to another. To write a special interlude precede the first instruction pair to be used by the instruction 26 1000N. The first instruction following an N. termination will always be a left-hand instruction. Follow the last instruction pair by a normal jump instruction terminated by N. only the instructions lying between the two jump instruc- tions will be brought from the drum for use in the interlude. 285 Example 5 Input one sexadecimal number 00K 26 1000N 80 AOF 40L 22 1L L5 1L 22 1014F 26L 26 IN 0000000000 The instruction 26 1000N marks the first word to be used in the special interlude. Let the Williams memory location for this word be n. When 26 1000N is read n is substituted into the right-hand address of the word in 1022. This address will have been set to zero previously, and by testing to see whether or not this address is zero SADOI determines whether a regular or a special interlude is to occur. Let n„ be the Williams memory location for the last word of the interlude which is read from the tape. Then the words brought from the drum will be placed in locations n, , n +1, . . . , n„ in the Williams memory. The programmer should be careful not to store instructions to be used outside this range. This may happen if directives are used between the 26 1000N instruction and the normal jump instruction. Before a special interlude begins, information about symbolic addresses previously used is stored on the drum. After the interlude this information is brought back to the Williams memory again. Special interludes, like regular interludes, are ended by jumps to 999 or 101i». The meanings of these jumps are the same as for regular interludes. After the end of the special interlude the o parameters 2-15 are copied onto the corres- ponding drum locations 11,758 - 11,771. Aside from the S parameters only the words in locations used for the special interlude are copied onto the correspon iing drum locati ns, FA.5T INTERLUDES Fast interludes may be written when l+L instruction pairs or 1-ss ire needed. During input, blocks of instruction pairs are accumulated in the Williams memory before being transferred to the drum. These transfers t the lrum take place ifter 286 (1) 45 instruction pairs are accumulated (2) a directive is read (3) an N terminated instruction with address less than 999 is read (4) an S termination is used and the S parameter has a right inside address for which a real address must be substituted. The addresses used for the temporary storage are 563 - 607. If the jump 26 1469 ♦ k F is written then according to the rule cited earlier the fixed address 1469 + k is changed to (1469 + k - 999) * 93 = 563 ♦ k. Consequently the instruction 26 1469N will cause SADUI to jump to the left side of location 563. Fast interludes must be ended by a jump to the left side of 93 - Input resumes immediately. If the instructions used in the interlude go to addresses m, m+1, ...,m+k then the instructions following will go into m + k + l,m*k + 2,.. until a directive is read. Example 5 is rewritten for a fast interlude and presented in Example 6 Input om» sexadecimal number 00 K 80 40F 40 563F 26 93 F 00 F 26 1469N 01 IK In this example fixed adiresses are used throughout. In general the instructions will not go to the same place as that occupied by them when the inter- lude is execu-ed. LIBRARY ROUTlilEo JTuRED uN DRUM Certain of the more commonly used ILLIAC library routines have been stored in the locked out section of the drum memory. These routines are, at presen, P16, Yl, IJ12, Rl, S4, 35, T4, T5, FI, Al. By use of a modified directive , SADUI is instructed to take a specified routine from the drum and insert it in the program being read. 287 A modified directive like (P12) 00 100K consists of two parts: (1) An outside address which specifies the library routine. (2) A directive which specifies the relativizer and first memory Location for the program. Any of the other types of directive may be used. For example, (N12) 00K will cause N12 to be placed following the last instruction read. Similarly, the OIK and 02K type of directives will affect the relativizer and store addresses as described earlier. When a library routine is obtained using a modified directive, the outside address is inserted into the list of symbolic addresses. The real address which corresponds is the location of the first word of the library routine. Thus, for example, when (N12) 00K is written to obtain N12, the entries to N12 may be written: 50 n 50 q • • • 26 (N12). The programmer may use instructions like L5 2l(N12) to refer to words interior to a library routine. When punching teletype tapes the programmer should be careful how he punches P16, Yl, etc. The letters must appear in letters shift . For example, (,P16) is punched as M ( n , "LTR-SH" , "P", "FIG-SH" , "1", "6", ■)" using seven teletype characters. Note, also that the use of a hyphen in writing P-16 j incorrect. Miswriting the designating outside address, or asking for a library routine not stored on the drum will result in an immediate FF 030 stop. Library routines, stored on the drum, which use interludes (Fl for example) execute their interludes without affecting in any way the symbolic addresses used by the programmer. SELF CHECKING FEATURES FF 824 This stop occurs because of a sum check failure in transfers of routines from i the locked out section of the drum. Depending on the characters of the input tape last read before the stop, the routine may be (1) Part of SAD0I which was incorrectly placed in the Williams memory (2) A library routine called for by the input tape which was incorrectly read back from the drum. 288 FF 030 This stop occurs when the programmer asks for a library routine not stored jn the drum. Input stops immediately. FF 031 This stop indicates that the programmer has misused his symbolic addresses. The nature of these errors is always indicated by output on the punch. The FF stop occurs at the beginning of the 1st regular interlude following an error. At this time all instructions read by SADOI are in the Williams memory . Three types of coding error are covered by this stop. S parameters ; A word having an inside address is used as an S parameter and the real address corresponding to the inside address has not yet been given to SADOI (by use of an outside address). The punched output appears as S 004 355 H, consisting of ■S" which identifies the type of error, two decimal addresses, and the symbolic address involved. The first decimal address specifies the location of the S parameter. The second decimal address specifies the location of the instruction using the S parameter. If the order was, for example, L5 nS4, then this instruction appear in the Williams memory as L5 nF when the stop occurs. Outside type error : The same symbolic address is used as an outside address for two instructions having different locations. In this case the punched output appears as 367 528 Q. • "0" signifies "outside". The first decimal address is the location of the first instruc tion, the second decimal address is the location of the second instruction. The symboli address involved is printed last. During input, when the real address corresponding to a symbol!' address is Known, the real address is substituted into instructions immediately. In case of duplicate outside addresses, the most recent real address value is the one sav**d and used during subsequent input. Inside type error ; When a regular interlude is to begin, real addresses are sub- stituted into instructions. When a zero real address or no real address is available, this -.rpe of error is indicated. The punched output appears as: 473 K3. This first thing punched is the location of the instruction using the inside address. The symbolic address involved is punched second. 289 FF 032 This stop may occur when a directive appears as a right-hand instruction. The stop indicates that the left-hand instruction which preceded used an inside address i-'iich mad* a forward reference. This may mean that input is out of phase one-half word or that an 02K directive cannot be executed. Input stops immediately. FF 033 This stop occurs when an N terminated order is read and (1) it appears as the right-hand order of an order pair, and (2) the left-hand order of the order pair has an inside address for which the corresponding real address is not known, and (3) the address of the right hand order is < 998. This error stop may occur at the start of special or regular interludes. The stop is made after the appropriate instructions have been transferred to the Williams memory. There may also be output on the tape punch . FF 034 This stop occurs when too many instructions of the type AB n (C) are written with n f 0. Each time such an instruction is read and the real address corresponding to n (C)" is not known (forward reference), a word is added to the additions list. If the real address is known, the additions list is not increased. This list is limited to 314 entries. FF 035 This stop occurs when too many distinct symbolic addresses are used. The number of symbolic addresses is limited to 324. SUi; CHECKS Library routine X-7, used for sum checks, is not well suited for use with SADOI. It is written as an interlude ending with a 36 999F jump. Ending an interlude causes SADCI to reload itself into the Williams memory, thus causing addi- tional drum transfers which may be omitted by using a more efficient sum check. At the beginning of interludes SADOI automatically computes a sum of the words (order pairs or numbers) transferred from the drum memory to the Williams memory. At the end of the transfer this sum is in location zero and may be used by trie programmer for checking. If the words transferred are x, , ,. ., x , the sum computed is defined by the relations s = Vi vi + 1 4 i+1 = L » 2 > 290 A sun. check routine suitable for SADOI may be written as follows and placed at the end of $. tape. 00996K L3F 36 (A) Let (A) represent the FF F 26 (AJ location of the first OOOOowFOOOOOOF instruction to be obeyed 26L 26 IN in the program The last word in this routine is the sua check and should be punched by hand in the form of an instruction after the program is tried the first time. This word is obtained then by reading the contents of the accumulator when the FF stoc iir-t occurs. SPECIAL DRUh LOADING rjSCiit.l'JUE a special instruction has been provided which will allow the pro- grammer to load blocks of instructions directly into any desired drum locations. Instruc tions to be loaded this way must be written without symbolic addresses. A sum check is not computed . The following sequence must be followed: (1) A directive, which sets the relativizer. (2) Follow the directive by OC nF 22 1000N . The order pairs following on the tape are stored on the drum at n, n + 1, n ♦ 2, .... (3) To stop the direct loading, write a directive or begin an interlude (regular or special). Library routines stored on the drum and containing less than 45 words may be transferred by this technique. For example, (Rl) 00 100K 00 3000F 22 1000N will put Rl on the drum starting at 3000. The relativizer used is 100. Special care must be taken when this technique is used. All bookkeeping work of SADOI proceeds as if the instructions being read were being normally stored. Consequently, if instructions previously read used inside addresses and if thes< instructions would be overwritten were the new instructions still normally stored, then the bookkeeping will be incorrect. 291 DETAILS OF THE FORMATION OF INSTRUCTIONS DURING INPUT During input, decimal addresses are computed and stored at location 0. The pair of instructions being formed is always stored at location 1. The following sequence is followed: (i) Instruction type AB n (c) 1. Put N(l) in A. 2. Read two function digits "A" and "B" shifting A left eight places „ 3. Shift A left 12 places and store at 1. k. Read the address n and store at 0. 5. Read the symbolic address (c). a. Forward reference (real address not known). (1) Substitute a false address into the right-hand instruction at location 1. (2) Test for n = 0. If zero, begin reading the next instruction. (3) If n / put a new word into the additions list. Left most 30 bits are used for the number n. Right most 10 bits determine the symbolic address (c) used. Begin reading the next instruction, b. Backward reference (real address known) - (1) Substitute real address into right-hand instruction at 1. (2) Form N(0) + N(l) and store at 1. (3) Begin reading the next instruction. (II) Instruction type AB n D D a K, S, N, S, F, L termination. 1. Repeat steps 1-k of I above 2. K, N, F; form N(0) + N(l) and store at 1. In case of F, begin reading the next instruction. In case of K, N, finish execution of the termination. 3« L; form N(0) + N(l) + relativizer and store at 1. Begin reading the next instruction. k. Skj form N(0) + N(l) + N(k) and store at 1. Begin reading the nr;xt instruction. J; form N(l) * I N N(0) l 1 -*>9 11 5 x 10 x 2 ' + 5 x x 2 -79 5 x 10 11 x 2" 59 1 + 2 ind store at 1. Begin reading the next instruction. lgr DATE 7/11/57 RT: 3/5/58; 12/3/5* PROGRAMMED BY APPROVED BY R. H. Farrell D. E. Muller 292 PROGRAM NOTES INTRODUCTION The following is by no means a complete analysis of SADOI. Some parts of the program are only named while others are analyzed in detail. The following tries to present the ideas which have made SADOI a usuable input routine. Input is something that happens in time. When one understands the general sequence of steps and i few of the minute details one should then be equipped to understand what actually Lakes place in ILLIAC. LNPUT STARTS When instructions being read by SADOI are on tape the input taking Dlace is called tape input . When the instructions are on the drum (reading a library routine) the input taking place is called drum input . The main part of SADOI fills Williams memory locations 30-604. \n input start occurs at any point that the main part of SADOI is written into the Williams memory. Immediately after each input start tape or drum input begins. Interludes are classed as tape controlled or drum controlled i-. wording to the type of input at the start of the interlude. Fast interludes are not [■oil wed bj input starts (and hence may be used to modify SADOI), while regular and special . nterludes are. SADOI distinguishes four classes of input start: (1) i hold or clear start (2,> tape controlled regular interludes (3 ; - v e controlled special interludes {Uj drum controlled regular or special interludes. During each input start approximately 200 instructions are used ic set up SADOI to begin input. The overall sequence followed during input starts is shown in diagram 1. :APE INPUT SEQUENCE To initiate a clear or hold start one character is read by ILLIAC. >AD0I assumes this was the first of a pair of function digits and fakes in a zero for ihis digit. In this case input starts by reading the second function digit. Consequently, i tape may not be started by a symbolic address. 293 o o o c— — 1 o 3 rH II II l~ II H p • CO X) f<" -P o hO , — v co »_3- , — .. P C\ J- — CO -P C\J 1 -p CU U r-i t~~ OJ Ph CO 1 O OJ p O H p o cj aj ct o O K~ CO LfS o •H H~\ O t- CQ CO o -P O 1 o O co O 1 o ON -p iH r<^ k P -P CO co rH CO rH O th c- ^-i rH -P C\ p .S84 c^ TD OJ 3 OJ o P. P CO CU -P K -H p £) -P •H > O O P bo '-^ o OJ CU II CvJ CQ P CU +J -p •H -H ■P •p 3 • P i i O P OJ CU CO cc CU E T) O P -H O CO -P • OJ ■P r- CO " CO U cu o bO rH CU — - H OJ O O CO II —1 O (L « -P u cu U 0) o X -H CU W -P rQ K TJ K CO II EH f-™ ^^ 4 H rH T CO rH cu fe O 1 CO CO p d) p p O o Tj If cu a T3 10 ii CO -P T3 CO •H o r- •H -p -P IT rH rH • ro 3 p cu CO VC -hi. o *» — * o >, ON Pj P CO T3 O LT S w £ r. a 0) p O I ii ^ O -H CU CU rH rH rO OJ P 1 > T3 P NO o CO CD CO a -P P OJ p it o o- X ITN P* 'H CU rH -p 0) rH H Ch i § bD ^3 P P > — *• o co ir\ 3 co r am co CO CO P -X} •H -H 0) ■P O •H tH * P rH 0) r~i ^ O ting cial trol -596 CO II rH O bo -H vo i i. •H CO CO CU P LTN ^ OON •h a, o o\ ' PQ -P LfA O CO O LTN 1 4 k c ° o t- ro B LT\ I 0- 3 rH t- t- p l NO LTN Q CM *- 1 ITS cu • 4 L 001) ai ivizer stant Ph -Plf CO P -P -hcx CO • Lf ■ -HC : t- ■ _rH CO o p> B co U rH 3 P( p •rH a bo rH T3 o t H -P P ^ CO cu 25 1 h CO ,C P -p o *—' CO o w CU p 1 » a l* 1 rH B rH O cu a T3 cu CO O •H -H -J- NO A* H-> P CO O CU •p rH +J OJ O o P r-\ p X) -H CU (3 0) O 11 rH -P o CO T3 -4- o .C a, p -h o •H CO -p C_> ecom estc ddit •^ P t- -p rH P — - o ubst 79-5 e-es or a 81-5 1 CO a p co 55 o CO lT* « ~3 *P CO -H •> > W CO O P Cw H P to •H In o I o o o o pq -& CM I O CM oj p O > OJ OJ > •H P O OJ •H T3 OJ 13 o "<-i OJ u -a P. <° I- 1 3 2 a «8- jj_ 8 -q en c 5 c c q a c o e a CVJ S s bO CO p i-i In P '. f-. t P Ch o p '. . 296 If during drum input an interlude is initiated, certain infor- mation must be retained in order to restart the drum input after the interlude. Conse- quently, locations 1019-1021, 1023 are used for temporary storage by the drum input section. They are set equal zero at all times except during drum input. Their use is 1019: A counter for which of the 5 blocks of 8 bits was last taken. 1020: Word currently being decoded. 1021: Drum order set to bring next word from drum. 1023: bum check on library routines. In addition 1022 is used when a library routine calls for a special interlude. Where possible the drum input section was interwoven with other parts of SADol . This was done to shorten the program but also to keep the drum input compatible with tape input. Thus the K, 3, and N termination sections of SAD0I are used during both types of input. The bookkeeping section (69-92) is also used during drum input after each instruction pair of a routine is formed. Because of this sharing (1) S parameters may be automatically preset during drum input (2) The special transfers (N terminated jumps with address > 999) may be used during drum input (3) The various types of directives may be used during drum input (4) S parameters having symbolic addresses will be properly handled. The following diagram shows the drum input sequence. READING oYMBOLIC ADDRESSES The parentheses "(." and ")" have no effect other than to initiate and terminate reading a symbolic address. Each character on the tape following "(" is examined by means of a 32 position switch (132-147) and has one of the following effects: (1) None. Spaces, ielays and LF-CR characters are skipped. (2) Change from letters to figures shift or from figures to letters shift. Letters and figures shift characters. (3) Terminate reading of the symbolic address. Closing ")". (/+) Add six bits to the symbolic address word being formed in ILLIAC 297 O ft O •P CO CI •H -P O hI o CU o T3 OJ -o d < w — T o -65- o CO CD s- c CD o -P -H O Ch -p t— cd o cvj pi i >> u a\ h P> VC a o CO f^- H On -P -P C\J cfl i ft a CO B -H OJ -o 5 CD Ui d CO * w -p •H 00 Ch lf\ Ch CO O OJ I -P -=f •H CO ■H OJ ft CO bO •H d Cm K OJ ■P •H LP\ bOCO CM Ch t3 - S ) d aj o m H O ,0 o o o -p en -p ■P CO o\ •H CO ,Q CO OJ to 1 vn CD CO M CO ti X3 OJ Ti T3 < CO a o ►H -H - -p LMti M O o o Ch KA •H W T3 P • CO vo ft o 5 -p d Ph ■H g bO 3 a; ^ ^3 § d° 512). 2. N(0) f 0. Form a new word composed as follows: The left 30 bits equal the right 3^ bits of N(0); the right address is the location of the symbolic address word. Store this word on the drum in the additions list until needed. Substitute into N(1J the location the additions word will have in the Williams memory when it is used (a numbers 512). BACK SUBSTITUTION PROCESS (479-562) 52 words called 2 bit registers are used by 3AD0I to keep a record of where real addresses must be substituted later. A digit 1 means a substitution must be made while a digit means no substitution is required. One register thus serves 40 instructions or 20 instruction pairs that have been read. Let an instruction pair have location n (the address it will ultimately have in the Williams memory) and let n = 20q + r with 0< r< 20. Then 9^7 + q is the location of the 2 bit register. After each directive this constant is computed by the K-terndnation section (see 217-226) and stored at 26. If a n a,...a is the 2 bit register then a n is the di^it position for left instructions, a„ , 2r 2r + 1 for right instructions,, Throughout input a counter word is stored at location 25. This word has one non zero digit a. where i = 2r or 2r + 1 according as the instruction being read is a left or right instruction. The counter word is used to add or delete non zero digits from the 2 bit registers as ea^h new instruction is read. During the Dack suDstitution for real addresses the 2 bit register: are successively tested to detenrdne whether they are equal zero. When a non- zero 2 bit register is found the corresponding 20 words are brought from the drum. The required substitutions are made and the 20 words reolaced on the drum. 301 The parts of SADOI required during the back substitution are the temporary storage locations 16-29, the numerical constants 30-42, and instructions 357-562. The list of additions words stored on the drum are transferred to the Williams memory overwriting locations 43-356 (the upper limit is variable). The list of symbolic addresses is then transferred to the drum overwriting the additions list (which is not to be saved). The back substitution then begins. When a substitution is required the address n of the instruction involved is examined: (1) n< 512 means an addition is required. (2) n > 512 means no addition is required. The following diagram shows in detail the operation of instructions 479-562. USE OF THE WILLIAMS AND DRUM MEMORIES AND SUM CHECKS SADOI is permanently stored at locations 1027-1641 on the drum. I It is set so that the first word of the reference list is stored at 1850. To change this address it is necessary to change the drum instruction at 1252 and adjust the sum check at 1612. When a clear or hold start is used the drum bootstraps load locations 1614-1640 into the Williams memory locations 999-1025. Control transfers to 1020 of the Williams memory. The words at 1019-1025 are used during hold or clear starts to restore Williams memory locations 2-32 after the drum bootstraps have finished their work. They are not reloaded into the Williams memory during other input starts. The sum check at 1641 is used by the drum bootstrap routines but not otherwise. The sura check at 1612 is used each time the main part of SADOI is put into the Williams memory. Let N(n) = X be the number stored at location n while the j n main part of SADOI is being brought to the William 1 s memory. The drum loop computes the following sum Y 31 = *31 I , ■ X . ♦ ll I n+1 n+1 ' nl The values Y are stored at 31. Let X^ = - j Y^ Q2 | + X 6 . X^ Q . is the sum check constant stored on the drum at 1612. X, Q is the last word brought from the drum. Therefore Y^ - X^ ♦ | Y^j = X^ *| X^ * | Y^ 1 1 - X^ ♦ | X^. Since X^ is a negative number, Y,„, - 0. 302 CO cr Cm CO O -H H fn H (1) -H CO c c > — 1 cv c c H Cm O CO O •H CO +J CO . CQ to 3 g o CU , CO 13 LT\ +J a a ifN CO M -P 13 3 • -— • cO ^ CO M O -H 1 CD a o •H 1 -P t~- O LP> cu M

3 LT co cr 1 CD CD co a in ■p OtA OCh ^3 n O CO •H ^H ■p to O rQ -P 3 a CO -H 13 13 13 G < CO M O C EH CU " M ; 1 > > co a O O + i i K M CU cd t. O h CO -4 o x c i CO cu >H ■H -p -p "3 to a 3 oj Ph 1-3 CTN *r i U i m J a) 4-i O iT O 1 C • i-i cc CU o O r<^ P> LP M ope -4 ■y ■H -p bO -H Is constant added? ^29- 13 LP, 13 • CO +> O 13 CJ 13 3 H OO G OJ CO st di r 1 dig CO h P iH tt ! .M G V> CO -P 'S -P CO (1) H 0) a -p p P 13 CO LfN 13 a cu ^3 i a "Hm -1 o oi O 13 P( < -P U cn -H Cm j O co OJ O J* -p IP .-I • 9 c CO i- o O o » c M ' rL- to ,o O co -4- 1 o CO 3 M CU • m O OJ 13 - CU N"A M VO c o a lca O 1 « •P c a -4- s O 5 O -t - 13 P ■p K> 3 lf\ P 1 + a ca ■H CU CO u -P 13 h G -P o 2 CO CU ^3 fO CO * CU G ch u cu en CD CQ O - J •P OJ •H C- >H O x •H 03 CJ CO CO V, • C h CD ■( ,G O LP CO -p +J -P co ^J o a ^3 13 O cO M i—l CD bO P 1 I c CO 13 13 co ,1 •H ,-1 U "^OJ ^3 • ^i 13 IS a 13 O C •H OJ bo m M ^H P CO to CU CO II bu •H 13 H CO -H O m u > i N^ 13 CU vo d m CU LP P 1 Cm CO to CO 13 Q M 13 2 CO > O LP > 1 O LP OJ LP Ih 4> § U P CD CO ^ > CJ M ' co cO CU a O r-i H co E-i lf\ CO o co O r -1 o cu ■p CO H •H H CO +j P> -H H OI cu o M W iH CM bO Cm -P CO CO e -p CO M E S5 a s o- CD • O Hh OJ CU 3 h 3 P> M 13 G b O -4 U CO c ) to M CU 13 CO R -P r M O iH O 1 i-l r- ^ 13 N" IhH Cl 1 •P -H H 1 13 CU OJ M P> CO LO 3 co P O 71 CU i-i 3 u CO & bD k aao OJ -P If •H g ■M % CO M > O O i- > -P co •H CO • bO -P CU rH a co h r<^ ■H^'O < co E ~si ^ OJ Lf " t ■H O \/ V »H fn 999 get special treatment. It was decided that before executing a special jump SADOI should be reset so that one next instruction would be a left instruction and in general that the N terminated instruction was not read. Words U39-UUU therefore (1) back up the counter word to its previous position, (2) destroy information about inside and outside addresses having been used: N(20) = N(22) = N(23) = 0, (3) set for left-hand instruction: N(3l) = 1/2. The 2 bit register held at 2/+ is replaced 5n the list wh»n K, S, N terminations are read or when N(2$) = 0. S TSKKIIIATIUNS Use of S parameters is made almost unnecessary by the details of SADGI. They were included, however, to make SADOI compatible with the D.O.I. In certain cases it is convenient not only to use S parameters but to have a facility allowing use of inside addresses. Some provision is made for this in SADOI. First, any number which may be used as an S parameter is stored simultaneously in the Williams memory and on the drum. These are the words having locations 2, 3, . .., L c If the number is not used as an b parameter then it may have inside audresses on botn sides whicn make forward references. Backward references never cause difficulty because the real address is substituted immediately. If it is used as a S oarameter only the right instruction may use an inside address making a forward reference . 307 When an S termination is written SADOI checks the 2 bit register at 947 to determine whether a substitution is needed. The current 2 bit register at 25 is replaced in the list just to make sure the register at 947 is actually there. In case a substitution is needed, then trie 2 copies of the 3 parameter must be changed. The instruction pairs (,563-007) being held temporarily in the Williams memory are put on the drum to make sure the second copy of the S parameter is actually on the drum. SADOI then deten.j.nes whether the required real address has been received. If so corrections are made. Otherwise, an error is indicated by the tape punch. After special interludes which end with 999 or 1014 jumps to SADOI locat _ons 2-15 are transferred to the corresponding drum locations regardless of the locations ;oecified for the soecial interlude. O.RDER 4u 1012 26 1012 F5 60? 40 1015 40 1016 26 1012 40 604 26 60? 00 F5 607 40 605 26 607 40 607 L5 608 40 606 26 607 L4 604 46 603 40 609 26 607 40 31 22 604 40 608 26 607 40 31 L6 31 00 00 00 00 2 NOTES Words of bootstrap stored on drum at 1027-1039. These set up a loop at Williams memory locations 604-609 to read main body of SAD0I into the Williams memory. Remainder of boot- strap is in Williams memory 1013- 1016. Start at 1013. X 12 First words of main part of SAD0I. Stored at 31, 32. 309 WILLIAMS MEMORY LOCATIONS ONLY ARE INDICATED. DRUM LOCATIONS ARE 1009 GREATER THAN WILLIAMS MEMORY LOCATIONS LOCATION ORDER 30 00 00 1 00 00 2 00 00 2 3 00 00 10 4 80 00 16 5 00 00 20 6 00 00 32 7 00 00 40 8 00 00 999 9 741701 282048 40 7L4095 LL3072 1 7L4095 LL2048 2 00 00 132 3 40 16 41 4 49 21 L5 16 5 LO 33 36 56 6 L4 33 40 7 91 4 32 48 8 26 53 LO 33 9 36 56 10 3 50 F4 00 2 1 F4 00 1 2 40 26 47 3 FO 32 40 16 4 L7 16 36 47 5 22 115 FF 53 6 F4 56 42 57 7 L5 26 8 L5 70 22 74 9 L5 251 22 74 NOTES Numerical Constants X 12 R«ad in Decimal Address Set up Read Loop Check 5-hole characters for start of inside address Set switch K S 310 LOCATION OR DER 60 L5 158 22 74 1 50 39 22 97 2 L4 1 26 64 3 L41001 L4 1 4 40 1 LI 31 5 40 31 32 69 6 91 4 36 104 7 FO 32 40 16 8 L7 16 36 66 9 26 116 50 24 70 JO 22 -1 203 1 L4 24 L4 23 2 40 24 L3 25 3 36 74 22 81 4 F5 74 42 77 5 L5 26 42 76 / L5 24 40 7 50 30 26 8 89 1 40 25 9 F5 26 42 80 80 42 26 L5 1 40 24 41 22 2 41 23 L5 84 3 LO 91 36 85 4 L5 1 40 5 F5 84 40 84 6 L5 1 40 563 7 41 20 F5 86 8 40 86 LO 92 9 32 90 50 89 NOTES X 12 N J F L and final operations of J and S. Left-right switch. Jump after right inst. Search for (of outside address. Bookkeeping Modify current 2-bit reg. after inst. pair Test counter word for zero Replace 2-bit register in list when counter = or for K, S, N When counter word = 0, get next 2-bit register and reset counter word, Store S parameters in Williams Memory. Store inst. pair temporarily at 563 - 607 311 CAIIUN ORDER 90 26 357 26 66 1 L5 1 40 16 2 75 1 40 608 3 26 66 22 63 4 22 101 26 95 5 L5 1 10 20 6 U 103 40 362 n i 26 93 LO 39 .Q 66 39 10 1 / -J 22 63 100 L3 31 32 361 1 FF2084 L5 84 2 421022 26 93 3 86 11 4 10 4 L5 25 5 40 29 L4 22 6 40 22 L5 1 00 4 80 4 8 50 30 00 12 9 40 1 L5 25 ilO 10 1 32 111 1 L4 25 40 25 2 91 4 36 43 3 FO 32 40 16 4 L7 16 36 112 5 41 41 21 6 LI 42 40 18 7 41 17 51 17 8 10 2 90 4 ^ U 42 42 120 NOTES X 12 26 999IJ 26 1000N Set drum input J termination Sum check test Set special interlude address Read second function digit; Save old counter word and advance counter word one shift. Search for (of inside address. Input Symbolic Address- Set for fig. shift Core of input loop )CATION Oil DER 120 L4 18 26 1 L0 17 26 118 2 L4 34 26 118 3 L5 36 40 17 4 LO 42 UO 18 5 01 4 22 118 6 40 16 L3 17 7 36 143 L5 16 8 26 122 40 16 9 L3 17 36 131 130 L5 16 2o 118 l F5 37 26 118 2 32 128 26 125 3 36 118 26 122 4 36 118 26 125 5 36 118 26 122 6 36 118 26 123 7 36 118 26 122 8 36 118 26 126 9 36 118 26 122 140 36 118 26 125 1 36 118 26 122 2 36 118 26 122 3 36 118 23 123 4 36 121 26 122 5 36 121 26 122 6 36 121 26 122 7 36 121 26 125 8 -J 30 1 9 40 946 43 946 NOTES Jump to switch Entry for N, J, F, L Entry for "normal" 5-hole char- Change of letters-figures shift; entry when character is skipped. ) or A zero or P X 12 delay P delay 1 S w D 2 CR-LF W CR-LF 3 ( E B 4 Ltr.Sh. R Ltr.Sh. 5 > T V 6 ) Y A 7 / U X 8 delay I delay 9 = G + • K M - Nr.sh. S Nr.Sh. N i N H J : J C F X F Z L space L space LOCAf.l ,N Oit JER 150 89 1 36 151 1 L4 946 40 945 2 L5 999 22 153 3 F5 160 42 154 4 LI 946 L4 5 36 159 L4 40 6 36 159 42 17 7 L5 154 42 160 8 26 163 00 435 9 F5 154 42 160 160 LI 946 L4 1 36 153 L4 40 2 36 153 42 17 3 L3 17 36 167 J* L3 21 32 172 5 L5 160 42 20 6 42 171 26 328 7 L5 160 LO 1?8 8 3o 192 L3 21 9 36 175 L5 160 170 42 171 42 20 1 L5 84 42 2 26 66 L5 17 3 L4 L4 1 <+ 40 1 26 138 5 L3 )> 185 6 F5 180 42 180 7 50 30 L5 160 8 42 17 L5 9 00 10 L4 17 note:; 313 X 12 Search list of symbolic addresses. Note double loop because of high read around ratio. Test real add. = Test inside-outside Outside. Word in list has non-zero address. Test for new syra. Add. Test inside-outside. 1st time outside. Substitute real address. Inside when real address is known. Inside when real address is not known. Jump to 185 when no constant to be added. Otherwise add new word to additions list. OL'ATION RDER 180 50 30 40 607 1 L5 180 LO 199 2 32 447 26 184 3 L5 261 42 180 k F5 190 42 190 5 26 186 L5 160 6 42 1 L5 *29 7 L4 23 40 23 8 49 21 LI 31 9 40 31 32 69 190 26 66 00 42 1 +6 66 00 357 2 L5 999 FO 30 3 42 999 42 160 4 42 195 89 1 5 L4 946 40 6 LI 999 L4 200 7 32 204 22 168 8 LI 946 L4 945 9 50 30 40 620 200 491002 -5 620 1 L5 151 42 999 2 26 66 00 93 3 L3 23 32 204 k 26 480 L5 1 5 10 16 40 1 6 01 4 L4 221 7 42 208 50 207 £ 26 357 26 * L5 3 22 214 NOTES X 12 For inside, subst. list address and add bit to those to be added to 2 bit register. Bookkeeping after inside add. New symbolic address. Decrease list address by one and add new word to the list. Test if list capacity is exceeded. K Termination Test for error Determine function digit and set switch 00 K 315 XftTTO* f ORDER 210 L51001 22 212 1 L5 1 10 4 2 421001 L4 3 42 84 42 4 22 217 401001 5 L3 32 216 6 23 212 L5 84 7 26 212 50 6 09 1 4o 25 9 67 35 4o 18 220 FO 30 42 224 1 11 1 -5 209 2 L4 254 42 26 3 42 225 L3 18 4 32 225 19 5 40 25 L5 6 40 24 L5 367 7 L4 40 362 8 49 31 49 21 9 41 22 4l 23 230 L3 20 36 93 1 L5 20 42 232 2 L51001 42 3 L5 242 40 235 1* 411023 41 20 5 85 11 6 36 238 LO 32 7 36 479 L4 52 8 LO 945 32 239 ■ =21 240 Ik 4i NOTES X 12 01 K 02 K Compute address and position of bit in counter word. Set drum order Test whether outside address calling for library routine. Set correct real address . Search reference vord list on drum. End search on -1. 316 LOCATION 240 36 262 1 40 235 2 85 11 3 81 5 -r 10 1 5 42 260 6 40 259 7 50 16 8 JO 9k7 9 42 251 250 22 250 1 36 260 2 42 17 3 L3 17 4 L5 9^7 5 4o 947 6 42 257 - 26 357 8 40 24 9 86 11 ?6o L5 16 l L4 2 LO 41 3 401021 4 L51022 5 411022 6 42 90 7 40 93 8 42 379 9 4l ORDER NOTES X 12 F5 235 26 235 001850 42 247 42 248 L4 567 49 16 11 L5 40 16 -3 245 L5 42 16 36 341 -0 947 L5 26 50 256 L5 L5 16 40 22 93 L4 242 491019 40 19 L5 296 L5 325 ^5 92 26 269 50 -- — — S Termination — Read extra character and set addresses . Determine is inside address used. Is correction to be made? Can correction be mad- ? Change 2 bit register Record words on drum. Replace 2 bit register and correct copies of S parameter. -Modified re- Store drum order and modify counter Save info, on spec, interludes and errors. Modify important Jump addresses. Set end constant. ORDER 270 F5 270 42 285 1 L51019 00 1 2 401019 32 283 1 J F5 279 40 279 + LO 327 32 279 3 L5 294 42 279 6 42 375 50 276 ? 26 357 L51021 8 40 374 50 278 9 26 373 L5 608 280 401020 L61023 1 401023 F51021 2 401021 19 4 T > 401019 L51020 4 50 32 10 8 5 401020 22 6 LN 01 2 7 F4 237 42 289 8 L5 00 6 9 40 26 290 26 271 oo 607 1 L41001 40 2 40 16 22 300 3 L5 10 6 4 40 -3 572 5 32 309 U 286 6 32 312 -5 269 7 L4 286 32 299 15 16 40 26 58 01 7 NOTES Sat add.-fn. dig. switch. Advance count. End of 5 blocks? End of 36 words from drum? Record words on drum. Bring next group of 3- words from the drum. Pick off one word. Adjust sum check, drum order, counter. 317 I 12 Split off 8 bits. Add.-fn. dig. swi + cfi. Set termination s^itoh. Add 6 bits to adr'ress al 0. > 64 L F K, S, N. Test for interlude Test for termination of d^xia i^Dut, Test for K, S. K termination. S termination. LOCATION OR DER 300 22 244 F5 300 .. 22 270 L5 1 2 00 20 L4 3 40 1 L5 25 4 L4 22 40 22 r ,; 25 10 1 6 36 307 L4 25 , 40 2$ LI 31 8 40 31 32 69 9 26 269 L5 1 310 LO 16 40 1 I L5 16 40 2 26 60 49 21 3 L5 327 42 279 4 L5 19 401022 5 L51021 40 317 6 F5 317 401021 7 8} 11 3 F41023 401023 c < L?:.023 32 320 320 26 101 L5 32Z, 1 42 90 L5 326 2 40 93 411019 411020 411021 4 49 31 26 66 5 26 269 22 291 6 26 66 22 63 7 +6 373 L5 608 41 27 L5 84 LO 17 42 27 NOTES Set switch for fn. digits. Read fn. digit block. Add to word and bookkeeping. X 12 N termination. Test sumcheck. Reset constants, addresses c Terminate drum input, Constants —Print Outside Type Error- 319 LOCATION ORDER 330 L3 27 36 66 1 92 131 92 2 2 92 963 L5 20 3 42 382 L5 17 4 42 27 50 334 5 26 407 L5 84 6 42 27 50 336 7 26 407 F5 337 8 26 382 89 1 9 U1022 36 171 340 401022 26 171 1 92 131 92 259 2 92 706 92 707 3 92 963 41 27 4 L5 253 42 382 5 50 32 L5 248 6 42 27 50 346 7 26 407 L5 84 8 42 27 50 348 9 26 407 F5 349 350 26 382 L31019 1 36 354 89 1 2 L4 19 56 356 3 40 19 26 356 4 89 1 L41022 5 56 356 401022 6 L5 22 93 7 +5 42 366 8 L5 368 42 361 9 L5 86 42 369 NOTES X 12 -Print S type error- Store words on the drum. Closed subroutine. Set 320 LOCATION ORDER 360 L5 361 LO 369 1 32 365 L5 2 2 86 11 023566 3 F5 362 40 362 <4 p 5 36" 40 36.1 C 22 360 L5 36^ 6 42 56 22 563 '7 86 11 023564 3 00 00 563 9 32 365 L5 16 370 86 11 023563 1 3o 374 22 2 00 42 375 3 + 5 507 42 371 4 85 11 001617 5 32 375 401002 6 F5 374 40 374 7 r 5 375 40 375 8 LO 379 26 371 9 -2 375 401019 380 85 11 023564 1 85 11 023563 2 42 388 L5 3 10 10 40 27 4 41 28 19 3 5 40 21 26 390 6 L5 21 36 389 7 L5 28 32 388 8 92 707 22 9 04 1 40 21 NOTES initially to store 2-15 on the drnm. X 12 .jinK. Link. Bring words fror; the drum. Closed subroutine. Set initially to rewrite 1002 - 10:8. Entry. Print symbolic address. Closed subroutine. Address of word to be printed is substituted in 382. uin!: . 321 LOCATION ORDER 390 50 28 L5 27 1 10 6 40 27 2 -5 00 2 3 40 946 10 2 4 43 946 -3 5 36 386 -J 6 36 400 89 1 7 L4 28 40 28 8 32 399 92 259 9 26 400 92 707 400 51 946 01 4 1 -4 36 403 2 50 405 22 403 3 50 389 00 3 4 00 3 42 405 5 02 1 92 6 26 386 00 549 7 +5 42 416 8 50 32 L5 27 9 00 20 50 417 410 -0 36 410 1 -4 50 418 2 -0 36 412 3 -4 46 27 4 00 12 L4 27 5 00 8 82 12 6 92 963 22 7 00 99 LO 8 00 9 LL 9 a 27 L5 532 NOTES X 12 Entry. Convert binary address to decimal and print. Closed subroutine. Address to be printed is stored at 27. Link. Print inside type error. 322 LOCATION OR DER 420 42 434 L5 531 1 LO 551 36 423 2 L5 533 2o 424 3 L5 535 10 20 4 42 382 22 427 5 41 27 L5 406 6 42 434 L5 544 7 42 382 92 131 8 L5 381 LO 367 9 LO 368 L4 16 430 42 27 50 430 1 26 407 F5 431 2 26 382 89 1 3 L41022 32 434 4 401022 26 5 L5 1 L4 6 40 1 L5 7 LO 38 32 438 8 26 445 L4 202 9 42 1 41 22 440 41 23 LI 31 1 3o 442 23 442 2 L5 29 L4 29 3 40 25 49 31 4 41 20 22 1 5 41 50 445 6 26 357 F5 456 7 42 457 L5 180 8 42 452 L5 370 9 LU 458 FO 452 NOTES X 12 -N Termination- Construct jump instruction, Jumps with address > 999. Record words on drum. Set link and record remainder of additions list on dram. 323 LOCATION ORDER 450 40 453 40 370 1 L5 452 50 30 2 22 456 L5 3 86 11 4 F5 453 40 453 5 u5 452 FU 30 6 42 452 LO 458 7 32 452 26 183 8 22 456 L5 603 9 L51022 42 17 460 L3 17 32 476 1 L5 17 421008 2 421003 L4 367 3 401009 LO 478 .' 401002 L5 84 5 421017 421018 6 L31019 36 468 7 15 19 401022 C L3 23 36 470 JaJ 480 40 1 *70 L5 190 50 32 1 10 10 -5 2 L41001 401001 3 L5 523 42 452 4 L5 999 42 458 5 L51005 42 457 6 22 448 L31019 7 36 481 26 467 8 01 9 FF 48 FF 49 NOTES Note that the order is reversed during the transfer. X 12 Test for special interlude. Set addresses in control block (999 - 1018) for special interlude. Test for tape-drum input. Test for error in jump at location 1. Compact address at 190 with relativizer and store at 1001. Store 2 bit registers and symbolic address list on drum. Test for drum or regular interlude. Back Substitution and Regular interludes for tape input 324 LOCATION ORDER 480 FF 50 FF 51 1 L5 190 42 488 2 LO 191 32 483 3 FF 52 L5 381 4 FO 488 L4 497 5 40 487 L5 488 6 50 30 22 491 7 85 11 023563 8 32 488 40 9 F5 487 40 487 490 L5 488 FO 30 1 42 488 L0 497 2 36 487 26 588 3 42 458 L5 513 4 42 452 F5 491 5 42 457 L5 478 6 L4 381 26 449 7 32 488 40 43 8 L5 367 40 381 9 L5 380 40 374 500 L5 368 L4 35 1 42 369 42 379 2 L5 373 46 361 3 46 369 L5 556 4 42 371 22 509 5 L5 381 U 35 6 40 381 LO 478 7 40 374 F5 509 8 40 509 LO 557 9 36 558 Fl 947 NOTES Transfer additions list from drum to Williams memory. This loop is set initially to bring symbolic address list, etc., from the drum during input starts. X 12 See word 593. Changed during input starts. Store list of symbolic addresses on drum. Set links, etc., for transferring blocks of 20 words to and from the drum. Advance addresses. Entry after transfer to drum. Test 2 bit register for 0. 325 CATION ORDER 510 40 18 ?3 18 1 36 505 L5 368 2 42 361 42 375 3 26 374 00 944 4 40 16 L5 18 5 80 2 F4 32 6 40 18 F3 18 7 36 553 L5 18 8 36 524 80 l 9 36 524 8o l NOTES X 12 In case 2 bit reg. / 0, bring 20 words from the drum. Adjustment after subst. real addresses. Test for completion of subst. Test for inside addresses requiring substitution of real addresses. Both instructions of a pair tested each time through loop. 520 F4 32 40 18 1 F5 16 40 16 2 22 517 L5 368 3 22 521 00 998 4 L5 16 42 525 5 42 549 L5 6 46 531 42 542 7 46 535 42 544 8 40 31 Fl 18 '- 36 539 L5 531 po L0 551 32 534 A L5 42 533 2 40 50 539 3 43 L5 4 22 535 41 5 L5 42 17 ^ 00 10 L4 7 00 10 46 31 p L3 17 36 419 9 Fl 18 80 I Entry after bringing 20 words. Set up for address substitution. Substitution for left instruction. Test is constant to be added? Set up if constant to be added. Substitution of address in left instruction. Test for error. Substitution for right instruction 326 LOCATION OR DER 540 36 549 u o 1 L5 542 LO 552 2 32 544 L5 3 42 544 10 10 4 40 L5 5 42 17 43 31 6 L5 17 L4 31 7 L4 40 31 8 L3 17 36 425 9 L5 31 40 550 F5 16 26 514 1 L5 512 42 533 2 32 544 L5 512 3 L5 381 40 362 4 L4 35 40 381 5 L5 16 42 369 22 361 00 522 7 36 558 Fl 999 8 L51022 36 560 9 L5 479 40 1 560 L3 23 361002 1 L5 480 40 1 2 261002 ■a 23 107 41 u 41 30 41 17 5 41 20 41 1 6 L51002 42 7 40 16 50 567 8 26 373 L3 16 9 32 570 26 575 NOTES Test is constant to be added to right instruction? Set up if constant is to be added. Substitute address. X 12 Test for error. Constants Record modified words on drum. Test for error in jump instruction at location 1. Begin interlude. — Input Starts Entry at right of 563 from 366. Save information on type of start, Rewrite 1002 - 1018. Hold or clear start i*hen N(l6)-0 327 LOCATION ORDER 570 42 574 41 947 1 F5 570 40 570 2 LO 601 32 570 3 411019 411021 4 411022 22 588 5 501001 01 10 6 40 17 11 10 7 -5 401001 8 L3 17 32 597 9 F5 579 42 594 580 L5 17 42 190 1 42 488 L5 487 2 L4 497 FO 488 3 40 487 L4 478 4 40 370 L5 523 5 42 488 L5 999 6 42 497 L5 487 7 26 484 8 41 1 L5 600 9 42 231 L5 16 590 36 210 26 214 1 L5 202 42 231 2 L5 112 42 497 3 L5 602 40 492 4 50 30 26 563 5 L51021 32 596 6 26 264 431022 i i 26 93 F5 597 j 26 570 L5 202 9 42 594 L5 513 NOrES X 12 Set 2 bit registers ■ Set locations for special interludes, errors and drum input. In case of interludes decompact 1001. Re-establish relativizer. N(17)= means regular interlude. For special and drum input interludes replace constant at 190. Re-establish drum orders for additions list and bring back symbolic address list and 2 bit registers. Transfer lists to Williams memory. Enter K termination loop to set up constants for SAD0I Reset some orders and start input. Distinguish between special and drum input interludes. Regular interludes LOCATION ORI )£K 600 26 585 00 591 1 N2 574 41 999 2 36 487 L5 999 3 00 00 4 30 26 100 1614 49 1002 999 S5 945 1615 42 1002 1000 22 1008 1616 00 1001 00 1617 85 11 1002 02 3566 1610 32 1003 1003 40 2 1619 L6 1004 40 1620 F5 1002 1005 40 1002 1621 F5 1003 1006 40 1003 1622 LO 1018 1007 36 1002 1623 22 1 1008 L5 16 1624 86 11 1009 02 3580 1625 F5 1009 1010 40 1009 1626 F5 1008 1011 40 1008 NOTES Constants sum check constant. Overwrite bootstrap to start SADOI 999 type interludes I 12 Relativizer Bring assembled program to Williams memory. Put contents of Williams memory on drum. ORDER LO 1017 32 1008 F5 1015 40 607 26 1015 26 1000 85 11 00 1027 40 608 26 607 K2 1 L5 999 S2 1003 40 999 05 03 85 03 11 512 11 482 32 1021 40 2 F5 1021 40 1021 F5 1020 40 1020 LO 1019 36 1Q20 41 1002 22 1008 8S 1759 13 2340 NOTES Bootstrap start Waste 1014 interludes for main part of SADOI constants. 2-31 Restore after SADOI is first called for. Used as storage locations by SADOI. Sum check 329 X 12 330 APPENDIX 10 A DESCRIPTION OF ROUTINES EXECUTED SUBSEQUENT TO THE CLEAR START AND PRELIMINARY TO THE ROUTINE SELECTED BY THE KEY CHARACTER In this appendix the details of the logical operations subsequent to the "clear start are presented. These include the operation of the drum bootstrap and four routines identified as routines 1, 2, 3, and k. This appendix is essentially a copy of File No. 228 of the DCL except for certain minor changes which have been made to bring it up to date. A schematic diagram of the sequence of logical operations subsequent to the hold start is presented in Figure 1**. The material in this appendix covers the operations from the clear stsrt up to the sixteen position switch, with Just a partial description of the operations executed by routine k. In broad outline the function of these routines is to bring a routine from the drum, preserving as much as is possible of the Williams Memory (WM) on the drum, which will read a single character from the tape, known as the key character, interpret the key character and execute certain operations corre- sponding to the one of sixteen possible logical paths it specifies. The bulk of the operations are devoted to the preservation on the drum of that portion of the WM which must be used to hold the routine which will do the reading and interpretation of the key character. Pages 332,333 contain a complete list of the instructions in the drum bootstrap, and routines 1, 2, 3, and k. The drum location of each instruction pair is indicated in the first column. The WM location of the instruction pair at the time of its execution is indicated in the second column. All of the characters are sexadecimal including the numbers appearing in the "remarks" column. The operations of routines 1, 2, 3> and k are reasonably straight- forward and may be relatively easily followed from the instruction list alone. The operation of the drum bootstrap, however, is too complex to be followed easily from the instruction list. Its operation is hopefully clarified by Figure 2 wherein the successive states of all registers and WM locations significantly involved in the operation of the drum bootstrap are recorded. Time is regarded as increasing from the top of the figure to the bottom. Each register and WM location is to be considered as holding the entry last recorded * The discussion also applies to a "hold start". ** Figures and Tables are at the end of this appendix, 331 in the column corresponding to it; its state changing only when a new entry is made in the corresponding column. The first entry into the control counter and order register is made by the hold start. No drum location is altered by the drum bootstrap, snd it of course is assumed that the state of the drum memory is as indicated in the instruction list. Exit is made from the drum bootstrap into routine 1 via the order 26 3L8. Since it is sometimes helpful to have a convenient reference to the transfer of information from the WM to the drum and vicp versa, Table 1 has been constructed Table 1 indicates the transfer of information between the w'M and the drum during each routine. Except for the information transfer ^enoted by * fur the irum booLstrap the transfer is always one-to-one; thus, in routine 2 the contents of WM location 2 are placed in drum location 31F2, the contents of WM location 3 are placed in drum location 31F3 etc., and finally the contents of WM location 1L are placed in location 31LL of the drum. In routine 3 the key character, k, is read from the tape. This key character corresponds to a key word held in location ih+k on the drum. The key word contains all the necessary information for the setting of addresses in routine U. The detailed structure of the key word illustrating the significance of the various bit positions is shown in Figure 3« In Table 2 the sixteen key words, corresponding to the sixteen key characters are listed. The name of the program which the key character eventually calls into operation is also listed. The routine which is called from the drum into the WM, and subsequently executed, is called routine 5- The routines described in this appendix evolved from the work of many people, particularly J. Fishel, D. Gillies, D. Muller, and J. Robertson. The present form of these routines was prepared by D. Gillies. 332 Drum Address Williams Mei Address iT| Order Pair Remarks 3L6 3L6 F5 3L7 k2 3L7 Routine 1; Reads in recording routine which records WM (2) -» (1L ) on the drum; also loads WM 3L7 3L7 85 OOS ^0 (3L9) (1) -» (13) from drum (l) -» (13). 3L8 3L8 00 008 st Negative 1 time when drum location zero 36 3L6 00 001 3L9 3L9 is read. On second pass negative when drum location one is read. Negative on 1 pass, positive on second pas Transfer to loc . 1 when recording completed. Routine 2% Record W.M. (2) -» (lL) 3LK 3LK 32 001 K6 3L6 *• L5 (002) on drum (31F2) -> (31LL) 3LS 3LS 86 oos 03 1F2 3LN 3LW F5 3LS 1+0 3LS Advance recording address 3LJ 3LJ F5 3LK 1+2 3LK Advance call address 3LF 3LF LO 3LL 32 3LK end- test end transfer 3LL 3LL 26 3L6 L5 020 here when recording of W.M. (2) -> (lL) completed. 1+00 85 oos ho 3L8 Uoi 1 1+2 000 26 000 Drum Bootstrap 85 NOS 1+0 1+01 r \+» 1 1 26 3L8 8l 00l+ Routine 3s Prepare switches in Routine k Read key character from tape 2 2 L.1+ ook 1+2 003 Form key character + Oik and plant call address for key word 3 3 85 OOS Read key word from the drum 00 (0110 333 Drum Address Williams Mem Address 3 Order Pair Remarks 4 5 6 7 8 9 K J •10 11 12 13 5 6 -^ K N 10 11 12 13 42 009 10 01S l4 003 40 OOF oi 007 L4 009 42 012 01 00K L.4 OOF 40 010 23 OOK 40 (000) L.6 014 40 014 F5 009 42 009 F5 OOF 40 OOF LO 010 36 010 00 000 00 000 22 009 00 022 00 000 00 000 L4 014 40 014 F3 014 36 (000) FF 824 23 012 Plant initial Illiac store address minus 1 of Routine 5. Form and plant drum read instruction with read address equal to drum location minus 1 of Routine 5- Form and plant address for transfer into Routine 5 • Form and plant end constant for drum read loop.. Constant also serves as read instruction for fiducial check sum. Enter drum read loop . Routine 4s Read block from Drum ±nto W. M* as specified by key character. Store drum word in W.M. Mod by 4, S Accumulate drum sum check at 014 „ Advance W.M. storage address Advance Drum read address Test for end of drum read loop Transfer if end of drum read loop . Read word from drum. Word plant by 5 • Mod . by N end constant for reading program from drum and drum read to obtain fiducial sum check number. Set by 8. Form drum sum check test number address set by 7 transfer to program selected by key character here if drum sum check fails 33^ H ax p o CO U .G a CD M o CO C3 O K Si o 0.1 co a, o Eh CO Q B En O E3 OJ Eh O P-i Eh CO W Eh Ph Q CO W K> -3" , „ ^d ^ rid iH -K^d ' °° 1 — - CO ' c\j •— i -h -7T oj .—. -p aj CD v — OJ v* — ' g fed. •H • H M 'P P S N"N o p . ' en K g, ro if fl 3 CD fl fn ^ >^^- - !h J hH id W v -'>-<-P 1 1 P p '-v-v o w W W K H hJ J KMA C H d E "O 3 s co cu U * CD G Q > K •H p 13 O • P CO P 5 P H co rO P PQ > Ph p J-H CD > X CO U G P --N— v . H p« rc\ ro -p pq H H P • • i K G H H G CM — '' — ' -H H P S CO • H • CD -H- 0) Q 13 K G id •H t3 o • G p CO P CD co P NOS 40 400 i 85 NOS 40 400 85 OOS 40 3L8 85 OOS 40 3L8 2 42 000 26 000 85 OOS 40 31.8 I 35 OOS 40 3L8 00 008 36 3L6 00 008 36 3L6 2 42 000 26 000 85 OOS 40 3L6 1 65 OOS 40 3L6 F5 3L7 42 3L7 F5 3L7 42 3L7 2 42 000 26 000 85 OOS 40 3L7 85 OOS 40 3L7 85 OOS 40 3L9 85 OOS 40 3L9 2 42 000 26 000 85 OOS *0 3L9 i 85 OOS 40 3L9 00 00! 32 001 00 001 32 001 2 42 COO 26 000 85 OOS 40 001 1 85 OOS 40 001 26 3L8 81 004 26 3L8 81 004 . 2 26 3L8 81 004 DETAILED SEQUENCE OF THE OPEF FIGURE 2 JATIONS INVOLVED IN THE DRUM BOOTSTRAP 336 \ 2 3 4 5 lo 7 a 9 io U 12 ft 14 I3M7 16 |j 20 2\ 22 23 24 2> 24 27 26 29 30 3t 32 S3 34- 3^ 3^ 37 36 3^ b c wh = rt a + k + 15 c k d + 1 d + b c - 1 drum location of Routine 5 key character Williams Memory location of Routine 5 entry address of Routine 5 number of words in Routine 5 Figure 3 Structure of Key Word 337 Routine Drum Bootstrap Routine 1: 1 entry- Routine 2 Routine 1: 2 entry Routine 3 Routine k: k = k = 1 k = 2 k = *, k - k k = 5 k = 6 k = 7 k = 8 1 k = 9 k = K k = S k = N k = J k = F k = L Table 1 Transfer oV Wot . Between Williams Memory and Drum Mfemui-y J uo sequent lo u Hold Start Transfer not one-to-one 338 KEY CHARACTER KEY WORD PROGRAM NAME 31N96073F6 SADOI 1 050820JSNK Leapfrog 2 LJ98100800 Not used and causes stop FF 82 h 3 04L810JSNK Flying leapfrog k 08J011i+7KF Punch input test 5 0N2011JULL Read-around test 6 111303K8KO Drum test 7 OLS840K900 Adder test 8 1F802027L9 Simulated tape bootstrap 9 1S1561601L CRT label K 31796073F6 SADOI S 1KJ010181K Comparison Post- Mo rt em N OS19004LL5 Drum clear J 1JS07023L9 Reperforate F 326012FU1F Drum Post-Mortem L 38203017L5 WM Post-Mortem Table 2 Index to key words 339 APPENDIX 11 ILLIAC LIBRARY DESCRIPTION OF Dl: THE CHECK POINT CODE LIBRARY ROUTINE D 1 - 95 TITLE Check Point Code II TYPE Special NUMBER OF WORDS 57 + iJL + B + J ( see text ) DESCRIPTION: This code is designed to print out intermediate information about the operation of some other code. Its purpose is to help the pro- grammer locate mistake in a code which is not working properly, or else to verify that a code suspected of working properly is actually doing so. The principle of operation of the check point code is to place "blocking orders" at particular points of your program (these points to be specified by you on a specification tape to be discussed later). Each blocking order results in a transfer of control to Code 95* When control is transferred, Code 95 prints out the location (fixed) of the order at which the block has been placed, and then prints out other information which you think will help you in locating the mistake in your program. The nature of the other information to be printed out at the checkpoint is also specified on the specification tape. This other information is printed out before the blocked order is finally obeyed. The blocking order it6elf is placed in the left hand side of the blocked placed in the memory. For each checkpoint, the programmer can specify how many times no printing is to occur (e.g., do not print the first lk times) and how often to print thereafter (e.g., print 18 times and then print no more). In this particular case, the following things would happen: When Code 95 is read in, it places a blocking order at the checkpoint. The first lk times the blocking order is reached, control is transferred to Code 95 • Code 95 prints nothings, executes the blocked order, and transfers control back to your program. The 15th time the blocking order is reached, control is transferred to Code 95- Code 95 prints two line feed characters, the location of the blocking order, and prints such other information as you have asked it to print (on the specification tape). It then executes the blocked order, and transfers control back to your program. The l6th time the blocking order is reached, printing occurs, and so on. The 32nd time (32 = lk + 18) the blocking 3^0 order is encountered, printing occurs, the blocked order is obeyed, and the blocked order is restored to its rightful place in the memory the 33rd time. The 3 1 +th time the previously blocked order is encountered, it is simply obeyed Just as if it had never been blocked, and the same occurs forever thereafter, until your program terminates with an OFF order, or fails someplace else. Certain precautions must be obeyed in deciding on the location of blocking orders: (1) The blocked order must not be overwritten by your program during the time' It is blocked (however, it may be overwritten after code 95 has relinquished control). (2) The blocked order must not be used as a number by your program during the time it is blocked (however, it may be used as a number after Code 95 has relinquished control). (3) It is not necessary to avoid locating your checkpoint at a place which contains a control transfer order. The printing occurs before any transfer of control (to another part of your program) is obeyed. (k ) It is not necessary to make special provision for ident- ifying each checkpoint (assuming that you have decided to insert several blocking orders), since Code 95 always prints the location of the checkpoint before any other information. (5) Blocking orders can be overwritten by Code 95* i.e., it is possible to print information at some particular checkpoint the l+7th time it is reached, the 58th time it is reached, but at no other times. The specification tape necessary for this will be discussec 1 later. NATURE OF INFORMATION WHICH CAN BE PRINTED AT EACH CHECKPOINT At each checkpoint, we may take a number from any place in the memory, or from R , or from R , and print it in a number of ways: (1 (2 (5 (»» (5 (6 (7 As an order pair As a right hand address As a left hand address As a ten character sexadecimal word As a signed integer As a signed 12 figure decimal fraction, not rounded As a signed 5 figure fraction, not rounded 341 The number of items to be printed at each checkpoint is a Ltrary and so is the number of different checkpoints. Both are Ills'? ted nlj by the memory space available for the operation of Coae 95- Code 35 will print two line feed and carriage return characters before each checkpoint print, but it will not print such characters during each checkpoint print unless the programmer so specifies. If the amount of printing you want to do at a given checkpoint exceeds the capacity of a line on the teletype machines (about 60 characters), you can and should specify additional carriage returns and line feeds by means of the specification tape . If the number to be printed consists of a sign digit only (i.e., the sexadecimal word is 8000000000 ) the following things will be printed: Order pair: 80 00 R. H. address: L. H. address: Sexadecimal! 3000000000 Signed integer: -0 Signed 12 figure fraction: = -000000000000 Signed 5 figure fraction: = -00000 Zero is always preced by a + sign. Two spaces are left between any two printed items. Non-significant zeros are omitted in the printing of integers -39 or addresses. Zero is printed as a single zero. The integer 1235 x 2 ' is printed as + 1235, not as +OOO00O001235- THE SPECI FICATION TAPE For each checkpoint, we must specify the location of the check- point, the natu-e of the information to be printed at the checkpoint, how often the printing is to be suppressed at first, and how often printing should occur thereafter until the order is unblocked. This is done as follows: (1) Let "c" be the location of the checkpoint. Put cL on the specification tape. (2) Let "f" be the number of times printing is to be suppressed (f ■= lU in the example on page 1 of this write-up). Put fF on the specifi- cation tape, f must lie between and 511- If f = 0, i.e., if you wish to print the very first time your program reaches the blocking order at c, you do not need to specify f at all. 3^-2 (3) Let "k" be the number of times printing is to occur before the order is unblocked (k = 18 in the example on page 1 of this write-up). Put kK on the specification tape. If k = 1 (i.e., if you wish to print once and once only at this check point), you need not specify k at all. (h) Let a, b, c,..., be the addresses of words you wish to have printed at this checkpoint. Let "G" be any one of the following seven sexa- decimal characters: G = 0, 2, 5, 6, S, N, F. The character G specifies the way in which the number is to be printed: (i) As an order pair: G = (ii) As a right hand address: G = 2 (iii) As a left hand address: G = 6 (iv) As a ten-character sexadecimal word: G = S (v) As a signed integer: G = N (vi) As a signed twelve figure fraction: G = F (vii) As a signed five figure decimal fraction: G = 5 Put on the specification tape: aSG , bSG,, ..., where G specifies the way N(a) is to be printed, G. specifies how N(b) is to be printed, and so on. If you wish to print the number in P... , specify the location of word of Code 95, (this is 900 if you use the ILLIAC copy). If you wish to print the number in R^, specify the location of word 1 of Code 95, (this is 901 if you use the ILLIAC copy). If you wish to print a line feed and carriage return character, specify the symbol "J" on the specification tape. (5) After all the checkpoints and the printing at each check- point have been specified, we conclude the specification tape with nNB where "n" is the location of the first order in your program which you wish to have obeyed, and "B" is a sexadecimal character which specifies the nature of the control transfer (in practice, B will be one of 0, 2, k, 6, in most cases). The control transfer is accomplished by means of a 2Bn order. (6) If we wish to print, say, the order pair at location 12 during the 10th and 20th times control passes the check point at c, this may be done by having 2 check points at the same address: e.g. cL 19F 12S0 cL 9F 12S0 3^3 MEMORY SPACE NEEDED FOR CODE 95 Code 95 itself occupies 57 memory positions. However, more memory positions must be allowed after the last word of Code 95 to contain the blocked orders, locations of numbers to be printed, and so on. Let "j£," be the number of check-points ( = the number of L's on your specification tape) Allow 5 J?, memory positions. Furthermore, allow one memory position for each piece of information (word) you wish to have printed out, and one memory position for each line feed character ( each J on the specification tape) over and above the automatic line feeds. Thus the total number of memory positions needed is Memory positions necessary = 57 + 3X+ s + J where "J^ " is the number of L's on the specification tape, "s" is the number of S's (not counting the second S in SS, however), and "J" is the number of J*s. READING IN OF CODE 95 Code 95 is in two parts, both on the same tape. Read in the program to be checked. Then read in Part I. When Part I is in, the ILLIAC stops and the Specification Tape is read in. The ILLIAC stops again and Part II is read in. The program then starts. ILLIAC COPY OF CODE 95 The operator's copy uses a bootstrap input which places the code at positions beginning with 900 and overwrites the Decimal Order Input. If you have no program beyond 899 > then you can use this and will have 67 locations for the list. RT: 9/22/55, DATE November 50, 1953 WRITTEN BY D.J. Wheeler APPROVED BY typtUaL DJW:mge Sept. 22, 1955 APPENDIX 12 THE COMBINED POST-MORTEM Both the key characters F and L call into operation a single large program known as the Combined Post-Mortera routine which is placed in the WM after either of these key characters is encountered. The Combined Post-Mortem reads data, via the tape reader, which specifies the exact type of post-mortem that is desired and a memory address indicating the location of a block of ten words in the memory to which the post-mortem is to be applied, or, in the case of an address search, the address on which the search is to be applied. The specific types of post-mortem which may be requested are: (1) Order Pairs (2) Decimal Integers (3) Decimal Fractions (U) Floating Point. Numbers (5) Sexadecimal Numbers (6) Address Search (WM only). Memory Locations Available for Post-Mortem .* It should be obvious that certain information in the memory will necessarily be lost whenever the Combined Post-Mortem is called into operation. It is important that the user be aware of the memory locations which can be post-mortemed and those which cannot. Since the post-mortem always begins from a HOLD START, the contents of certain locations in the memory are destroyed initially by the drum bootstrap and routines 1, 2., 3 and k. The words in the memory which get overwritten are indicated in Table 1 of Appendix 10 "A Description of Routines Executed Subsequent to the Clear Start and Preliminary to the Routine Selected by the Key Character". The WM post-mortem and the drum post-mortem treat the preservation of the memory differently. If a WM post-mortem is requested, then a routine is called into operation which preserves the WM, locations 20 through 3L5, in drum locations 2F0N through 31F1. The contents of the drum locations 2F0N-31F1 are not preserved . Following this preservation All references to locations in the WM or drum are sexadecimal unless specified otherwise. Subscripts S and D are used to identify 6exadeci«al and decimal numbers respectively, whenever the base of any number is not obvious from the context. 3^5 of the WM a transfer back to routine k is made with a simulated key character k = F and routine k will be executed as if a drum post-mortem had been requested*. On the other hand, if a drum post-mortem is requested, the the Combined Post- Mortem is immediately read into the WM locations 20 through j6 from the drum locations 670 through 726. The contents of the WM locations 20 - j6 are not preserved . Thus, in a WM post-mortem the maximum amount of information in the WM is preserved while in the drum post-mortem the maximum amount of information on the drum is preserved . The Combined Post-Mortem routine permits the user to run the post- mortems in any desired order. However, it is clear from the above discussion that the order of running the post-mortems will affect the memory locations available for post-mortem. In Table 1** the memory locations available for post-mortem are indicated for the two situations: the WM post-mortem is run first and then drum and WM post-mortem follow in any order; the drum post- mortem is run first and the drum and WM post-mortems follow in any order. The locations indicated in Table 1 are available for post-mortem on any post-mortem in the sequence of post-mortems which may follow the first. Format for the data tape . In this discussion we will assume that the characters on the data tape are indicated by c^, c , c ? , ... . Following the key character F or L, three sexadecimal characters must appear on the tape (c, c p c,). If the third character, c,, is even (least significant binary digit equals zero), then an address search is specified and three more sexa- decimal characters will be read from the tape (c, c_ Cg) which specify the search address. No other data is necessary for the address search post-mortem. Returning to the three sexadecimal characters following the key character, if c_ is odd, then c c c form the address of a transfer order entering a subroutine to give one of post-mortems (l)-(5)- 1° Table 2 the three characters, for each type of post-mortem are listed. * The routine "remembers" that a WM post-mortem was requested by the sign of a certain word in the memory. ** Figures and Tables appear at the end of this appendix. 3^6 If the post-mortem desired is one of (l)-(5) then beginning with the character c. the tape is copied identically, with a line-feed and carriage return preceding the copy, until a one-hole delay character, say c., is read. The purpose of this operation is of course to print an appropriate heading. At the completion of the copy tape operation a black switch (BS) STOP is encountered (21 02S). Following this stop the address of the block of storage on which the post-mortem is to be applied is read from the tape. There are two modes for the read-in of this data depending on whether a drum post-mortem or a WM post-mortem is desired. If a drum post-mortem is desired the address of the block on the drum is read in two stages . In the first stage the thousands portion of the address is specified and in the second stage the hundreds portion of the address is specified. Specifically, this read-in proceeds as follows: (1) Read digits from tape as an integer until a space character is encountered. Thus, the sequence of digits 2, 0, 0, followed by a space would be read in as the integer two hundred. (2) When the space character is encountered a BS STOP (3k 02S) is obeyed . (3) Resume read-in by putting the black switch to START. In this second stage the digits read in are converted as an integer and read-in continues until a character with the 5th hole punched, but not a space character, is encountered. Thus the sequence 3, 5, line feed, would be read in as the integer thirty-five . (k) When the character with the 5th hole punched is encountered in step (3) the integer formed in step (3) is added to the Integer in step (l). The result (which in the example cited above would be two hundred and thirty-five) is interpreted as the address of the block to be post-mortemed, divided by 10 (thus in the current example the address of the desired block is two thousand three hundred and fifty) . No stop is executed and the post-mortem proceeds immediately. 3^7 If a WM post-mortem is desired the read-in of the address proceeds in one stage starting at step (?) above and the register that would hold the integer from step (l) above is initially set to zero. It should be noted that it is the character terminating a sequence of digits read in which determines whether these digits form the most significant part (MSP) of the address (i.e. the thousands part) and that reading must continue tc get the least significant part or whether these digits form the least significant part of the address (i.e. the hundreds part) and that they must be added to the MSP which has already been read. The block to be post-mortemed is always assumed to contain just ten words, the address of the first word being read from the tape in the manner described above. After the ten words have been post-mortemed a BS STOP (30 029) is encountered. If the black switch is then set to START a new block address is read from the tape. The reading of this address proceeds in one or two stages depending on whether the digits are terminated by a space character or some other character with a 5th hole punch. The library post-mortem tape contains the key character, transfer address, and heading for post-mortems (l)-(5). The tail of the tape contains all necessary block addresses. The block addresses are properly ordered so that consecutive blocks of ten words in storage will be processed without a STOP when the black switch is in the IGNORE position. The data for the drum post-mortem and WM post-mortem are contained on two separate library tapes. For the address search post-mortem a special tape must be prepared. The leading character must be L (the key character designating a WM post-mortem). By convention the transfer address which must follow the L is 00K. Following the transfer address the search address is written as three tetrads. Thus, if the search address is 11 , it must be written on the tape as 00S . The search addresr. must follow immediately after the transfer address. Output Format . Certain features of the output format which are common to the post-mortem routines (l)-(5) are discussed in this section. 3^8 Each post-mortem has a heading copied identically from the data tape, as described earlier. Following this the address, divided by 10, of the block to be post-mortemed is printed on a separate line, at the left of the page. On the following lines the words printed from the memory as order pairs, or integers, etc. are each preceeded by the least significant digit of the address. The address digits are all printed as decimal numbers. Any word which is identically zero is ignored by the post-mortem and thus does not appear in the post-mortem output. Details of the output with examples follow. Order Pairs. Words from the memory are printed on successive lines as order pairs. The function digits are printed sexadecimally and addresses are printed as unsigned decimal integers with zero suppression on all but the least significant digit. Pl6 is used to print the address. If the right hand order is identically zero it is not printed. An example of an output from the order-pair post-mortem is shown in Figure 2. Figure 1 shows the relevant portion of the memory as sexadecimal numbers at the time the results in Figure 2 were obtained. Decimal Integers . Words from the memory are printed on successive lines as decimal integers with + suppressed if the number is positive and zero suppression. Pl6 is used for the printing. Using the data of Figure 1 the output from a decimal integer post-mortem is shown in Figure 5- Notice that the word 39 80 000 00 000 in location 313 is given the correct integer representation, -2 Decimal Fractions . Words from the memory are printed on successive lines as twelve-place decimal fractions with + suppressed if the fraction is positive. Pl6 is used for the printing. Using the data of Figure 1 the output from a decimal fraction post-mortem is shown in Figure k. Notice the appearance of the word in location 313 when printed as a fraction. If we regard K as the representation of 10 then we see that -1 is represented consistently. Floating Point Numbers . Words from the memory are printed on successive lines as floating point numbers. The floating point number is printed with the fractional part first followed by the exponent, base 10 . In the printing of the 3^9 fractional part, the entire word is treated as a fraction, thus the exponent acts like the least significant part of the fraction. The fraction is printed by Pl6 as a ten-place decimal fraction with + suppressed if the fraction is positive. The exponent is printed by Pl6 as a signed decimal integer with zero suppression on all but the least significant digit. Using the data of Figure 1 the output from a floating point post-mortem is shown in Figure 5. Notice the appearance of the word in location 313 when printed as a floating point number. The fractional part is the representation of minus one produced by Pl6 when a fraction print of less than 12 digits is requested. Sexadecimal Numbers . Words from the memory are printed on successive lines as sexadecimal numbers. Using the data of Figure 1 the output from a sexadecimal post-mortem is shown in Figure 6. Address Search . The general format of the address search post-mortem differs from that of the post-mortems discussed above. This post-mortem will not be headed by a title. The first line of output will contain the search address, printed as a sexadecimal number, followed by the sign =, followed by the search address, printed as a decimal integer. The address of every instruction in the WM memory, locations 2-3L5, is examined and if the address of either the left instruction or right Instruction or both of a word is equal to the search address, then the entire word is printed as an order pair on a distinct line. Just to the left of the order pair the memory location holding the order pair is printed as a decimal integer. Using the data of Figure 1 the output from an address search post-mortem with initial search address 00K and going back through search address 003 is shown in Figure J. Operating Procedure . The operation of the Combined Post-Mortem calls for a somewhat involved manipulation of the tapes and control switches. There are essentially five distinct situations which should be cited in the procedures for the operation of the post-mortem. These procedures have been listed below for each of the five situations. 350 A. WM post-mortem and this is the first post-mortem to be executed . (1) Place WM post-mortem library tape in reader in position to read data for the desired post-mortem. (if an address search is desired follow the procedure in (5) below.) These positions are marked on the tape with the name of the post-mortem. The black switch should be set to OBEY. (2) Execute a HOLD START. A heading will be printed and a BS STOP (21 02S) is reached. (5) Position the tape to read the address of the block on which the post-mortem is desired. The block addresses, divided by 10 n , are on the tail of the tape. (k) Begin the post-mortem with a BS START. If the black switch is in the OBEY position a BS STOP (}0 029) is reached after a blcok of ten words has been post-mortemed. As long as the black switch is in the IGNORE position consecutive blocks of ten words will be post-mortemed without a STOP. To skip to some other block in the memory return to step (3). (5) For an address search proceed as follows. Prepare a tape with the characters L K A, A A , where the A A_ A represents the three sexadecimal characters of the search address. Any fifth hole characters may precede the L. (6) Place the tape in the reader and execute a HOLD START. (7) If the black switch is in the OBEY position a BS STOP (2k 06n) is reached after a complete search of the memory. A subsequent BS START will result in a new search with the search address reduced by 1 . If the black switch is in the IGNORE position successive searches will be made with the search address decreased by 1 each tine and with no intermediate stop. 351 B. Drum post-mortem and this is the first post-mortem to be executed . (1) Place the drum post-mortem library tape in the reader in position to read data for the desired post-mortem. These positions are marked on the tape with the name of the post-mortem. The black switch should be set to OBEY. (2) Execute a HOLD START. A heading will be printed and a BS STOP (21 02S) is reached. (?) Position the tape to read the thousands part of the address of the block on which the post-mortem is desired. These numbers, divided by 10 , are located after the data for each post-mortem. (it is possible to ,r black switch through" these numbers until the desired one is reached.) (U) Execute a BS START. A BS STOP (3^ 02S) is encountered. (5) Position the tape to read the hundreds part of the address of the block on which the post-mortem is desired. These numbers, divided by 10 , are located on the tail of the tape. (6) Begin the post-mortem with a BS START. If the black switch is in the OBEY position a BS STOP (30 029) is reached after a block of ten words has been post-mortemed. As long as the black switch is in the IGNORE position consecutive blocks of ten words will be post-mortemed without a STOP. (7) If a skip to some other block in the memory is desired then return to step three if the address of the new block has a different thousands part, otherwise return to step (!?)• C . Drum post-mortem following any other post-mortem, WM or drum . (1) Place the drum post-mortem library tape in the reader in position to read data for the desired post-mortem. (2) If the previous post-mortem was not an address search, then execute a BS START, otherwise execute a SKIP START (white switch up and down) . A heading will be printed and a BS STOP (21 02S) is reached. Proceed to step (3) in B above. 352 D. WM post-mortem following any other post-mortem and a WM post-mortem has already been run . (1) Place the WM post-mortem library tape in the reader in position to read data for the desired post-mortem. (if an address search is desired follow the procedure in (3) below.) (2) If the previous post-mortem was not an address search, then execute a BS START, otherwise execute a SKIP START (white switch up and down). A heading will be printed and a BS STOP (21 02S) is reached. Proceed to step (3) in A above. (3) For an address search post-mortem proceed as follows. Prepare a tape as in step 5 of A. (h) Place the tape in the reader. If the previous post-mortem was not an address search, then execute a BS START, otherwise execute a SKIP START. Proceed to step (7) of A. E. WM post-mortem following a drum post-mortem and no WM post-mortem has yet been run . (l) Procedure is identical to A above. Restoration of the WM . At the completion of a post-mortem it is possible to restore locations 2-3L5 in the WM to their initial state, provided that they have been preserved with the WM post-mortem (Routine 5) as described earlier. This is accomplished as follows. When the post-mortem is complete insert a tape containing the following sequence of characters into the reader: L, 0, J, 1, 0, 1-hole delay, 0, line feeds. Begin restoration with a BS START. When restoration is complete a BS STOP (2k 3LL) is encountered. Following this STOP any of the three possible starts, BS START, SKIP START, HOLD START, have the sa»e effect as a HOLD START. The Combined Post-Mortem has evolved from the work of many people, especially J. Fishel, R. Farrell, D. Gillies, D. Muller and J. Robertson. The present form of the Combined Post-Mortem is due to D. Gillies. 353 WM Post -Mortem First Drum Post -Mortem First WM Drum WM Drum Sexadecimal 2-3L5 K00-2F0S J7-3L5 K00-31F1 Decimal 2-1,013 2,560-11,787 215-1,013 , 2,560-12,769 Table 1 Memory Locations Available for Post-Mortem as a Function of the Post-Mortem Run First. Post Mortem 3 Tetrads (Drum or WM) following key character Order Pairs 051 Decimal Integers OSJ Decimal Fractions 039 Floating Point Numbers oi+s Sexadecimal Numbers 059 Address Search (WM only) 00K* Table 2 Tetrads Following the Key Character Specifying Transfer to a Post-Mortem Subroutine. * These tetrads are arbitrary so long as the least significant digit is even by convention 00K is used . WM Address Order Pair 12N 00 000 00 OOK 12J L5 005 l»-0 06i+ 12F 50 000 22 135 12L LL T.T.T, LL T.T.T. 130 1+0 000 00 000 131 60 000 00 000 132 00 000 00 000 133 00 000 00 000 13k 70 000 00 006 135 26 008 uo 008 136 L5 007 66 003 137 71+ 000 kO 12J 138 36 12F 2U 12N 139 80 000 00 000 13K 00 000 00 000 Figure 1 (Continued on the next page.) 355 WM Address Ord< ;r Pair 13S 00 000 00 000 UN 00 000 00 000 13J 00 000 00 000 15F 00 000 00 000 13L 00 000 00 000 Figure 1 Contents of WM 12N-13L (30CL-319 D ) at the time of the post-mortems illustrated in Figs. 2-7- ORDER PAIRS 30 00 00 10 1 L5 5 Uo 100 2 50 22 309 3 LL4095 LIA095 k UO 5 60 8 70 00 6 9 26 8 ko 8 31 L5 7 66 3 1 7i+ o4o 301 2 36 302 2k 300 3 80 Figure 2 Output from fraction post-mortem on blocks 300 and 31CL of the WM. 356 INTEGERS 30 10 1 -U7239135152 2 3^3597523253 3 -1 1+ 27I+8779069J+U 5 1+12316860^16 8 1+81036337158 9 163217^08008 31 -i+ 72 368821+29 1 1+98216I+68781 2 23221+5051692 3 -5 1 +97558l3888 Figure 3 Output from integer post-mortem on blocks 300 and 310 of the WM. D D FRACTIONS 30 000000000018 1 -085927^86238 2 625000253882 3 -000000000002 1+ 500000000000 5 750000000000 8 875000000011 9 2968907356^1 31 -085923388595 1 9062 50U 77 385 2 l+22l+5128805l+ 3 -+00000000001 Figure 1+ Output from fraction post-mortem on blocks 300 and 310 of the WM. D D 357 FLOATING DECIMAL 30 oooooooooo -51+ 1 -085927I+862 +56 2 6250002539 -11 3 oooooooooo +63 1+ 5000000000 -61+ 5 7500000000 -6k 8 8750000000 -58 9 2968907356 -56 31 -0859233886 -61 1 ;o6250477U -19 2 1+22^512881 -20 3 -10000000000 -6k Figure 5 Output from floating point post-mortem on blocks 300 and 31CU of the WM. SEXADECIMAL 30 00000 0000+ 1 L5005 koo6k 2 50000 22135 3 LLLLL LLLLL k 1+0000 00000 5 60000 00000 8 70000 00006 9 26008 1+0008 31 L5007 66003 1 7I+OOO 1+012J 2 3612F 21+12N 3 80000 00000 Figure 6 Output from sexadecimal post-mortem on blocks 300 and 310^ of the WM. 358 00+ =10 300 00 00 10 009=9 oo8=8 309 26 8 ko 8 007=7 310 L5 7 66 3 006=6 308 70 00 6 005=5 301 L5 5 ^0 100 004 =h 003=3 310 L5 7 66 3 Figure 7 Output from address search post-mortem with initial search address 00K and final search address 003- 359 APPENDIX 13 THE COMPARISON POST-MORTEM This diagnostic program provides a very effective means for locating a common type of coding blunder, namely, the alteration of a word which is supposed to remain unaltered during the running of a program. Such alterations, of course, result from an incorrect address on a store instruction. The inexperienced programmer will frequently use the order pair post-mortem to locate such blunders, however a little practice in using the comparison post-mortem will make evident its superiority in this area. USAGE Let us assume that a program on the ILLIAC has stopped for some unknown reason, presumably a coding error, and follow the action of a comparison post-mortem. The block on the drum holding the words of the present program as assembled by SADOI, specifically drum locations 11,758 (2JFF) through 12,756 (3UM, i s examined. This block holds the words orginally assembled by SADOI into the Williams memory (WM) at locations 2 through 1000 (3F8)} provided of course this block on the drum was not overwritten by the program under diagnosis. Bach word read from the drum is first tested to determine whether it is identically zero. If it is zero the next word in sequence is examined. If it is not zero, then it is compared with the word in the corres- ponding location of the (WM); the word from drum location Y is compared against the word in the WM location Y - 11,756 . If the two words are different the word from the drum, the "BEFORE" word, and the word from the WM, the "AFTER" word, are printed. If they are identical no printing occurs and the program goes on to examine the next word on the drum. This process continues until all locations in the above indicated block have been examined. Thu» it is seen that the words of the original program, except those identically equal to zero, are compared against their state at the time of the program stop and any difference results in a print-out of the BEFORE word and AFTER word. The BEFORE and AFTER words are printed as order pairs: sexadecimal function digits, decimal address. The print-out includes the WM address of the altered word. At the completion of the comparison po6t-mortem, a symbolic address list is printed. This list contains all symbolic addresses and their WM decimal address assignments. 360 The short program below t designed to hang up on a zero left shift n 106 , will comparison post-mortem. at location 106 , will illustrate the type of output produced by the 00 100K (TEST) L5 4 (TEST) iA 4 (TEST) 4o 4 (TEST) L5 5 (TEST) L4 4 (TEST) 40 5 (TEST) 26 (FAIL) 00 F 04 IF 21 10F by 1 (TEST) 00 F 00 F by 2 (TEST) (FAIL) 00 F 00 F from 3 (TEST) Sample Program to Illustrate Comparison Post-Mortem Output* The output from the comparison post mortem after the hang-up at 106 is Bhown below. COMPARISON POST MORTEM BEFORE AFTER 104 04 001 21 010 08 002 42 020 106 FAIL 100 TEST 361 lotice that location 104 which was altered by the program has its BEFORE and AFTER words printed, but location 105 which was also altered is not similarly printed. The latter change is not printed because the BEFORE word is identically zero and hence ignored by the comparison post-mortem. The comparison post-mortem is commonly U3ed together with the address search post-mortem to locate coding blunders. O&ce the comparison post-mortem has shown that a word has been altered that should not have been altered, or has been altered improperly, then an address search on the address of the altered word will usually produce the culprit instruction. One can bypass the execution of the comparison post-aortem to obtain only the symbolic address list print. The details for doing this are given in the operators instructions at the end of this appendix. LDPTATIOBS ON U5AGB Since other post-mortem routines cause the BEFORE words on the drum to be overwritten by the AFTER words in the WM it is essential that the com- parison post mortem, if it is desired, be run before any other post-mortem. After completion of the comparison post-mortem any other post-mortem may be run. It is clear from the earlier discussion that any words on the drum in the block 11,758 - 12, 756-, which were altered by the program being diagnosed will yield a meaningless comparison with the AFTER words. The symbolic address list is stored on the drum in a block beginning at 11, 75^ and goes backwards, that is in the order of decreasing address (11, 75^} 11*755} 11*752 etc.). Consequently, if the program under diagnosis has altered any word in the symbolic address list there will be a corresponding error in the symbolic address list print. The end constant determining the number of words in the symbolic address list is never transferred to the drum by SADOI but remains in the right address of 999 n i* 1 the WM. When the symbolic address list is printed by the comparison post-mortem the number in the right address of 999ts is used to form the printing end constant. There is a check to prohibit an almost infinite 362 amount of printing, should 999 n have been overwritten, such that no more than 325 words in the list will ever be printed. It is of course possible that 999 was overwritten so as to make the symbolic address list appear shorter than it really is, in which case it is possible by appropriate switch operation (see operator's instructions, step 5) to cause the number of words in the list to be artificially set to 325- All of the symbolic addresses will then be printed at the start of the list and the remainder of the list will contain whatever gibberish was in the remainder of the 325 words. It is always assumed that there is at least one word in the list. This means that there will always be one word printed in the list whether or not the program actually contained a symbolic address. The address zero is printed as four spaces; the corresponding symbolic address is, of course, printed explicitly. The comparison post-mortem causes the contents of the WM at locations 100L (3F9) - l°23 n (3LL), 0, and 1 to be destroyed. Thus, if a restore WM is executed at the completion of a comparison post-mortem, only locations 2 to 1,000 will be correctly restored. Since SADOI only reads WM locations 2 - 998 on to the drum when it is called into operation it leaves the possibility that 999 and 1000 can cause a comparison post-mortem print-out if they are not initially cleared on the drum by some means . FINAL STATE OF MACHINE When the print of the symbolic address list is completed the contents of the WM block at 32 (020) - 1000 (3F8) is recorded on the drum block 11,788 (2F0N) - 12,756 (3U^). Then the combined post-mortem is read into the WM and the routine stops on 20 02N. At this point any of the combined post-mortem programs may be initiated with a BS START in the customary fashion. 363 COMPARISON POST-MORTEM OPERATOR'S INSTRUCTIONS 1. Put tape in reader (k : character J) and begin with °. HOLD START; ■c heading it? now punched on the tape. 2. Now a BS STOP (2^ 002) occurs. 3- a) If a COMPARISON POST-MORTEM is desired, execute a BS START. b) If the COMPARISON POST-MORTEM is to be suppressed and only a SYMBOLIC ADDRESS LIST print is desired, then execute a SKIP START. k. Now a BS STOP (2k 014) occurs. 5- a) If the user has not overwritten location 999 n (3F7)» then proceed with a BS START to print the SYMBOLIC ADDRESS LIST. b) If the user has overwritten location 999 n (3F7), then pro- ceed with a SKIP START to print the SYMBOLIC ADDRESS LIST. 6. When the SYMBOLIC ADDRESS LIST printing is completed, a BS STOP 20 02N is encountered. 7- Now any POST-MORTEM (key character F or L) can be initiated with a BS START. NOTES: 1. The COMPARISON POST-MORTEM must be run first before any other POST-MORTEM. 2. If step 5b is taken, then there will sometimes be gibberish printed at the end of the SYMBOLIC ADDRESS LIST. APPENDIX l4 ILLIAC ACTIVE PROGRAM LIBRARY INDEX-** August 8, i960 LABEL SERIAL DATE Al A3 A4 A5 A6 A7 o3 125 87 138 154 12/29/55 11/27/59 IO/28/58 6/10/55 9/24/59 244 3/18/59 Dl D4 95 70 V12/57 9/12/58 E2 E3 Ell E5 158 186 193 195 4/27/56 6/17/60 8/7/59 7/20/59 Fl ll4 3/19/59 F2 115 1/23/59 F3 129 6/27/55 F5 229 9/22/58 F6 - 3! ' 4/10/59 FAl 122 12/9/59 FA2 203 7/20/59 Gl G2 78 98 3/19/59 4/10/59 HI H2 H3 H4 H5 H6 71 72 80 84 65 86 1/23/59 1/23/59 12/16/58 3/3V59 3/5/59 7/22/59 11 07 5/20/59 J2 J3 209 289 7/20/59 2/15/60 TITLE Floating Decimal Arithmetic Routine (168) (DOI or SADOl) Convert a Number From Floating Decimal Representation to Normal Machine Form (27) (DOI or SADOl) 1.7 Precision Floating Decimal (279) (DOI or SADOl) Complex Number Arithmetic (248) (DOI or SADOl) Floating Decimal Routine and Auxiliaries (See Description) (Separate Versions for DOI or SADOl) 1.7 Precision Floating Binary Arithmetic and Double Precision Arithmetic With Floating Decimal Conversion (6l0) (DOI or SADOl) Check Point Routine ( 57+31+s+j(See Text)) (DOI or SADOl) Control Transfer Check (4l) (DOI or SADOl) Integration by Simpson's Rule (Tabulated Values )( 21) (DOI or SADOl) Integration by Simpson's Rule (Function Values )(j8)(D0I or SADOl) Numerical Differentiation with Interpolation (l03)(D0I or SADOl) Quadrature by Gauss' Method (l8 + 2n) (DOI or SADOl) Solution of a System of Ordinary Differential Equations (4l) ( SADOl Only) Solution of a System of Differential Equations by Milne's Method (80-46) ( SADOl Only) Integration of n Simultaneous 2nd Order Differential Equations with Initial Conditions Specif ied(Sub . 39-P arame "ter Storage 1=40) (DOI or SADOl) Integration of a System of Ordinary Differential Equations up to a Specified Value of One Variable (60) ( SADOl Only) Integration of a System of Ordinary Differential Equations with Automatic Control of Integration Interval (129) (SADOl Only) Second Order Linear Differential Equation with Two Point Boundary Condition (l0l)(D0I Only) Floating Decimal Solution of a System of Ordinary Differential Equations (See Description) (SADOl Only) LaPlace's Equation -Liebmann Method (5 thru 46) (DOI Only) Poisson's Equation -Liebmann -Frankel Method(6 thru 64)(DOI Only) Inverse Interpolation (33) (DOI or SADOl) A Search for the Real Roots of f(x) = (80) (DOI or SADOl) Minimization of a Function of Two Variables (46) (DOI or SADOl) Minimization of a Function of Four Variables(75) (DOI or SADOl) Minimization of a Function of n Variables (89) (DOI or SADOl) Minimization of a Function of n Variables Treating One Variable at a Time (4o) (DOI or SADOl) Interpolation (51) (DOI or SADOl) Roots of a Polynomial (Entire Program) (DOI Only) Roots of a Polynomial (85) (SADOl Only)* ****Number after title is number of words in Routine * New additions to our Library Those routines compatible with both DOI and SADOl should have SADCI directives omitted when used with DOI. August 8, I960 365 LABEL SERIAL DATE K3 137 1/27/60 K5 182 8/5/59 K6 185 7/22/59 K8 189 11/27/59 K9 K10 K1*J- K15 Kl6 L3 L6 L7 190 9/12/58 191 233 258 263 100 22U 9/13/58 7/1/60 3/6/59 1/13/60 5/20/59 5/20/59 230 3/25/59 ivk 136 10/13/55 Mil 160 3/5/59 M12 173 12/3/58 Ml 3 179 5/V55 Mll+ 180 12/3/58 Ml 5 183 5/19/60 M17 197 n/9/55 Ml 8 213 V3/57 M19 232 2/13/57 M20 23^ 1/23/59 M21 2^0 V17/58 M22 2kl 5/20/59 M23 2.K6 11/21/58 M2k 260 tyl/59 M25 262 U/27/59 M26 26^ 5/6/59 M27 267 5/26/59 M28 270 9/28/59 MAI 10k 6/U/58 ILLIAC ACTIVE PROGRAM LIBRARY INDEX* * TITLE Least Squares (Entire Program) (DOI or SADOl) Autocorrelations (Entire Program) (DOI Only) Chi -Squared (23) (DOI or SADOl) Product Moment Correlations, Variance -Covariances, Means and Standard Deviation for Use with Magnetic Drum( Complete Program) ( SADOl Only) Product Moment Correlation, Means, Standard Deviations, Variances in Logarithmic Scale (Entire Program) (DOI Only) Calculate Autocorrection of a Time Series (85) (DOI or SADOl) Multiple Regression Analysis with Transformations(Entire Program,) (DOI) Analysis of Variance by Method of Fitting Constants(DOI or SADOl) Modified Multiple Regression Analysis (DOI Only) (Complete) Complete Linear Equation Solver (Complete Program) (DOI or SADOl) Solution of a Set of n Simultaneous Linear Algebraic Equations Using Magnetic Drum Storage (162) (DOI or SADOl) Automatic Linear Equation Solver With Programmed Checks and Cal- culation of Residues (Entire Program) (DOI or SADOl) Closed Eigenvalues and Eigenvectors (163) (DOI or SADOl) Matrix Multiplication (Closed) (77) (DOI or SADOl) Triangularization of a Matrix and its Determinant (Complete Program) (DOI Only) Complete Linear Matrix Equation Solver and General Matrix Inversion (Complete Program) (DOI Only) Linear Matrix Equation Solver and General Matrix Inversion (115) (DOI or SADOl) Linear Programming (Complete Program) (DOI or SADOl) Post Multiplication of a Matrix of its Transpose by a Vector (*+5) (DOI or SADOl) One-Step Automatic Eigenvalue -Eigenvector Program( Entire Program) (DOI) Solution of the Matrix Equation Ax=\Bx where A+B are Symmetric and B is Positive Definite (Entire Program) (DOI or SADOl) Eigenvalues of a Symmetric Matrix by Given's Method (Entire Program) ( SADOl Only) Matrix Multiplication (198) (SADOl Only) Eigenvalues and Eigenvectors of a Symmetric Matrix Using the Methods of Givens and Wilkinson (105^+data storage) (SADOl Only) Closed Eigenvectors and/or Eigenvalues by Jacob! Method(l85) (DOI or SADOl) Complete Linear Matrix Equation Solver and General Matrix Inversion Routine Using Drum Storage (DOI Only) Eigenvalues and Eigenvectors of a Symmetric Matrix (SADOl Only) Eigenvalues and Eigenvectors of a Symmetric Matrix (SADOl Only) Linear Matrix Equation Solver and General Matrix Inversion Using Drum Storage (SADOl Only) Matrix Multiplication with or without rescaling(SADOl)* Matrix Multiplication with Floating Decimal Auxiliary(21 or 26-See Description) (DOI or SADOl) **-**Number after title is number of words in Routine * New Additions to our Library ** Those routines compatible with both DOI and SADOl should have SADOl directives omitted when used with DOI. 366 LABEL SERIAL DATE Nl N2 N8 N12 N13 6l 88 181 225 226 4/6/60 7/7/55 V6/55 10/29/58 3/5/59 Nl4 N15 Nl6 227 271 281 3/4/59 11/3/59 1/20/60 02 03 143 147 12/19/58 6/V58 04 05 06 161 162 1 7T 9/12/58 3/4/60 3/11M 07 245 11/18/58 P2 52 7/20/59 P3 53 4/10/59 P4 P5 P12 P13 P15 Pl6 P17 55 37 194 204 207 214 2I4-2 1/23/59 1/25/59 12/29/59 12/3/58 2/7/56 3/9/59 V22/58 P19 252 1/15/59 Rl R2 R3 RA1 116 105 106 92 7/20/59 7/21/59 9/28/59 9/15/58 S3 S4 S5 SA2 SA3 130 212 231 127 155 7/18/60 10/29/58 10/29/58 6/5/58 1/23/59 T4 T5 T7 TA1 TA2 l4o 157 293 126 156 3/24/58 4/5/60 3/30/60 o/5/58 6/5/58 VI V2 V4 V9 82 120 178 216 7/21/59 9/23/55 4/4/55 10/29/58 August 8, i960 ILLIAC ACITVE PROGRAM LIBRARY INDEX* * TITLE Input One Number from Tape, Integer or Fractlon(l9)(D0I or SADOl) Input a Sequence of Decimal Fractions (26)(D0I or SADOl ) Read One Number from Tape as Integer or Fraction(22)(D0I or SADOl) Infraput (39) (DOI or SADOl) Input a Sequence of Fractions, all having the Same Number of Decimal Digits (21) (DOI or SADOl) Input a Sequence of Integers (l8) (DOI or SADOl) Mixed Number Input (1)4)* Mixed Number Input (4l) (DOI or SADOl)* Routine to Plot Point and Axes (29) ( SADOl Only) Display Numbers and Letters on the Cathode Ray Tube(l3+(See Text)) (DOI or SADOl) Fast Fraction Display 4x6 Raster (68) (DOI or SADOl) Fast Character Display 4x6 Raster(50 words for 0. . ,9,+-)(SAD0l) Punch to Cathode Ray Tube Conversion Program(l75+(See Des.))(D0I or 3AD0I ) Linear Interpolation for the Cathode Ray Tube (43) (DOI or SADOl) Print (A) with or without Sign to n Places as Determined by a Program Parameter (l8) (DOI or SADOl) Print n Digits of an Integer with or without a Sign(20)(D0I or SADOl) Zero Suppression Integer Print (27) (DOI or SADOl) Print One Number in a Parameter Set Layout (24) (SADOl Only) Single Column Print (Revised) (13) (DOI or SADOl) Combined Integer Print (35) (DOI or SADOl) "Multiple Precision Integer Conversion (32) (DOI or SADOl) Infraprint (56) (DOI or SADOl) Maximum Speed Fraction Print to Twelve or Fewer Places( 59)(DOI or SADOl) Output for the Data Plotter (44) (DOI or SADOl) Square Root Routine (9) (DOI or SADOl) Integral Root aVp (24) (DOI or SADOl) Fractional Power Routine (l8) (DOI or SADOl) Floating Decimal Square Root Auxiliary (l6) (DOI or SADOl) Logarithm (l4) (DOI or SADOl) Exponential (2l) (DOI or SADOl) 1/32 Natural Logarithm (36) (DOI or SADOl) Exponential Auxiliary for Floating Decimal (26) (DOI or SADOl) Natural Logarithm (30) (DOI or SADOl) New Arc tan X Routine (25) (DOI or SADOl) Sine Cosine (2l) (DOI or SADOl) 1/2 Sin X/X (37) (SADOl Only)* Sine Auxiliary for Floating Decimal (26) (DOI or SADOl) Arctan Auxiliary to the Floating Point Routine(48)(DOI or SADOl) Legendre Polynomials (25) (DOI or SADOl) Tchebyscheff Polynomials (15) (DOI or SADOl) Fourier Analysis (52) (DOI or SADOl) Generate 40-bit Random Numbers (27) ( SADOl Only) 367 August 8, i960 ILLIAC ACTIVE PROGRAM LIBRARY INDEX** LABEL SERIAL DATE XI 218 3/17/59 X3 222 10/15/56 X12 235 12/3/58 Xl6 28*4- l/l2/60 XA1 Yl Y5 223 199 10/15/56 7/29/60 291 3/10/60 TITLE Decimal Order Input (DOl) (25) (DOI Itself) Constant-Listing Auxiliary (21 ) (DOI Only) Symbolic Address Decimal Order Input (SADOI ) (615 ) (SADOI Itself) "Current Floating Relativizer" SADOI Modification to be placed on Program Tape (Special)* Constant Listing Auxiliary for Floating Decimal (l8)(D0I Only) Transfer Blocks of Words from the Memory to the Drum or from the Drum to the Memory (ko) (DOI or SADOI ) Transfer Blocks of Words between the Drum and the Williams Memory (35)* 368 TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE ACCURACY SPEED USE APPENDIX 15 ILLIAC LIBRARY DESCRIPTION OF NI2 : INPUT DECIMAL INTEGERS AND FRACTIONS LIBRARY ROUTINE N 12 - 225 By Donald B. Gillies Infraput (D.O.I, or SADOI ) Closed with one program parameter. 39 0, 1, 2 Up to 12 digit integers or fractions. Integers are exact; fractions are correctly rounded (error up to + 2 ) . Input time (k ms per digit). This routine has an inner loop at "JOOJ/ sec. which makes it twice as fast, overall, as earlier input routines . To read a sequence of fractions into locations n, n+1, . . . enter with Q = 50 n 50 q To read a sequence of integers into locations, n, n+1, . . . enter with Q = 52 n 50 q Each number is punched with a sign (+ or 1 ^followed by up to 12 decimal digits. Zero may be punched as + alone. A sequence is terminated by one of N,J,F,L. When one of these characters is encountered, control is transferred to the right hand side of q+1, with A = 0, 2~ 59 , 2.2~ 59 , 3.2 according as the termination was N,J,F,L. The left hand address of 21L relative to the subroutine at this time is n+k if k words have been read in to locations n, n+1, . . n+k-1, RT: 10/8/59 DATE January 29, 1957 CODED BY D. B. Gillies APPROVED BY D. E. Muller nj :.- n location ORDER NOTES NX2 00 K(NXS K5 F 1+2 5L ; Plant link and n 1 46 21L 01 "JT Plant fraction/integer switch : 2 I> 18L -set 16 * as 17L if fractions (50 entry) 1+2 16L . 19L if integers (52 entry) 3 81 kT LO 25L read sign of first number of the sequence -1 + (s-10).2" 59 u 42 20L f-from 23' 1 }-eet 20' as or 1 for + or - LO 38L If instead of sign digit an N,J,F,L, A has 0,1,2,3, so obey link. ^ 50 26L Special vord to Q: let g. be the integer comprising 32 (llnk)F by 0' (q L <^ q 5 q U ) of 2 +5i Q Then Nfe^L) - | lO 1 ^" 39 1 a table . 6 89 LF 7 22 9L ~X Enter digit loop with A = -1 (so n_ = 0) 10 3F Fh F f A ■ 8 00 2F Fk F J n ± = d 1 -10 + 10(1+^ _ x ) 9 10 00 IF 1+0 F 11 IF ^ / -39 — 1 + 2 ?y n i 11 80 kF LO 25L -1 + 2~ 59 (d 1 -10) 12 36 7L Loop if d < 10 (digit, not sign) -store -1 + (s-10)2 ' (sign of next number) 1+0 2F 01 1+F g (Q previously shifted U+3i places left) 13 L4 lUL 1+2 15L g + 2*+L 1 i -39 set addresses of =■ 10 -2 1U 42 17L « . 50 2UL vf>st«* (address used by 13) 15 89 IF -1 16 50 ( )F IA F by 13' k-«-* 26 (17 or 19 )L by2' 1 H fraction/integer switch LOCATION ORDER ilOTBS 17 SO F « Fraction absolute value of fraction is 66 ( )F By I** 2"» (n 4 - \ 10 1 ♦ r^io 1 ) x 1 » — r rounded. 10 1 18 10 IF SJ 96lL (From 16 ') [ 2"» (| iO 1 ) * ' *• 19 kO ¥ 4? Integer store positively in LI F 20 kO IF store negatively in 1 L5 (0 or 1) by 1+ -correctly signed answer 21 kO (n)F L5 21L by 1, 22' store in sequence, and increase -address of store instruction by 1 22 iA L 23 k6 21L L5 2F - -1 + (s-10) • 2~ 59 2k 26 kh -*k loop 00 F | 10" 25 00 500 000 000 OOOF -39 -1 + 10.2 Jy 80 F 26 00 10F Bpecial constant for Q 01 1229F 27 59 3258F during input loop I- 5 \ ^ \ x ° 5 \ «* \ 10 7 \ 10 11 I- 8 00 F 28 29 30 31 32 33 3^ 00 500 F 00 F 00 5F 00 F 00 50 OOOF 00 F 00 50 F 00 F 00 5000 OOOF 00 F 00 50 000 000 OOOF 00 F 00 50 000 000 F 00 F 00 5 000 F |io" ■12 371 LOCATION 55 56 57 58 ORDER 00 F 00 500 OOP OOP F NOTES N12 00 F 00 500 OOP F 00 F 00 5 OOP OOP OOOF 80 F 00 2F I 10* |xo« £ io 10 -1 + 2.2 -59 372 TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE ACCURACY SPEED USE If Q contains: 50 nF 50 qF 52 nF 50 qF 54 lOOp+nF 50 qF 56 lOOp+nF 50 qF APPENDIX 16 ILLIAC LIBRARY DESCRIPTION OF Pl6: PRINT DECIMAL INTEGERS AND FRACTIONS LIBRARY ROUTINE_ Infraprint (DOI or SADOl) Closed with one program parameter 56 ? 16 - 21^ 1 ? 0, 1 to 12 digit exactly rounded fractions or exact integers Punching time This INteger FRAction PRINT routine will print A to n-places (I to 12) correctly rounded (n digits or spaces if the integer is less than 10 , all digits if greater than 10 ), with (optional) decimal point anywhere, with non- significant zeros before the decimal point (whether this point is printed or not) replaced by spaces, sign before the first non-space character, with a - sign for a negative number and your choice of -;-, space, or delay character for a positive number, and no extra spaces . Then before going to the R.H. order at q+1: A is printed as an n-place fraction with a sign -1- or -, with no zero suppression . A is printed as an n-place integer with sign + or - with zero suppression on all but the last digit. A is printed as an n-place fraction with sign + or - with a decimal point a fter p digits and zero suppression on the first p digits < p < n., A is printed as an n-place integer with sign + or - with a decimal point after p digits, and zero suppression before the decimal point* < p < n. JO, J2, 3k, j6 have the same effect as 50, 52, 5^, 56 except that a space is printed instead of a + sign for positive numbers. 373 Entering the routine at the right hand order at 1 rather than the left hand order at 0, with a J-type parameter causes a delay character to be punched for the sign if A is positive. This unsigned number entry omits the sign of a positive number , To obtain a space instead of a decimal point,, change the order pair at 511 (the 52nd word of the routine) to 92 963F 22 35L To obtain unrounded fractions instead of rounded fractions, change the order pair at 20L to 50 1? 75 F This routine does not print spaces a fter the number . REMARKS Fractions are converted to integers by a rounded multiplicatior. by 10 . ('The sign is the sign of the rounded number so a small enough negative fraction is printed as -:-0). The absolute value of the resulting integer is taken, and converted to 12 decimal digits which are omitted, replaced by spaces, or printed according to the following rules : 1. The last digit is always printed. 2. The last n digits are always printed if 50 or JO parameter was specified. 3. All digits following a decimal point are printed. H-o The first non-zero digit is printed even if it occurs before the last n digits, and all subsequent digits are printed. 5= If no digits have been printed, zeros before the last n digits are omitted, and zeros during the last n places are replaced by spaces. 37^ 6. The sign is printed Just before the first non-space character (which amy be a digit or a point). EXAMPLES Thus all digits of an integer are printed, and if a fraction after correct rounding vould equal 1 in absolute value, the fraction is printed to one sore place. The number 1 to 3 places is 1000. The only exception is n = 12, when -1 is printed ss meaning -+00000000000 -KOOO0O0OOOOO If integers or 12 place fractions are read back into the machine, the original numbers are recovered, without rounding - off error. The numbers -.001, l/2, .999, -1 would be printed via the following parameters as shown lgr 50 2F: 52 IF: J^ 3F: 5^ 103F; 5^ 303F: +00 -.001 -.01 -1. +50 • 500 f5.00 +500. +100 • 999 +9.99 +999. -100 -1.000 -10.00 -1000. The numbers 3x2~ :>9 , -2Lx2~ 59 , U50x2~ 59 , 1364x2" 59 would be printed via the following parameters as shown J2 kF: 56 IF: 56 1i04F: e +3 3 + •3 +3. -21 -21 -2.1 -21. +450 1+50 +U5.0 +U50. -136+ -156U -136. k -136k. DATE June 19, 1956 rt; 3/9/59 PROGRAMMED BY D. B. Gillies APPROVED BY J. P. Nash 375 LOCATION ORDER BOTES 00 K(P16 40 F ) Normal entry L5 3L \ 1 22 2L 1+0 F « Entry oaitting space on positive nusber 2 L5 8l 33 < 31' 4 k9' '(by 23' < — 51' No decimal point Rounded multiplication by ICr or 1 (with Bcallnf factor l/2) [ Test sign of rounded number If negative take the modulus And plant - sign (Or + sign from 30L) (or leave sign sp. or delay) Test 1 < number < 2 (different round -off ) Negative round -off Store positive number Print space or delayt Then plant + sign instead. Positive round -off Multiply by 2^/lC) 11 + (.21U2J2* 59 Test size of multiplier 1 < multiplier < 2 cause sign to nave J effect of +1 or -1 in multiplication. ] A= digit • 2 -59 Q « fractional part, Plant both halves of product Multiple (U-way) count 377 LOCATION ORDER NOTES 36 40 55L J 36 39L Prepare to print point? 37 00 29F No 36 39L Prepare to print even non-eignificant zero? 38 L3 F 36 41L "» 1 T No ' 41 This digit zero? 39 L3 2F >lfl' Don't print space he / ^ u Print space 22 48L >48' 47 00 F 00 100F < kk — Shift left 36 48 82 4F Print 50 52 L <^ky ,1+6' Multiply fraction by 10 to U 9 75 IF produce a digit in A, plus a 22 33L 33* frac 1 lonal part in Q 50 00 2F 09 65F 41' Print and enter count loop in ouch 51 92 6k 3F a \>j as to inhibit further 52 22 55L 00 F 35" 2- 5 9 d< cimal pts . 53 00 luF 2S 4015* 2»/lO U Constants LN 755F 378 ■TION 5 u 55 ORDER LL hojw 90 128 3F 00 F 00 F Count J ) NOTES P 16 intermediate storage for the multiple count. 379 TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE ACCURACY DURATION DESCRIPTION APPENDIX 17 ILLIAC LIBRARY DESCRIPTION OF Rl: COMPUTE 4a. LIBRARY ROUTINE R 1 - 116 Square Root (DOI or SADOl) Closed 9 0, 1, 2 + 2 -39 NOTE 1.3 n milliseconds, where 11 is defined by [( 1 -ft) I ( l + /0] 2n <2" 59 The argument a may consist of 39 digits or of 78 digits. The sign and 39 most significant digits should be in A but may be in address 1 if the routine is entered at the right hand side of the first word instead of at the normal left hand side. The 39 least significant digits (if any) must be in address 0. The program uses Newton's method by means of the relations x Q = a/2 + 1/2 x r and convergence is assumed to have occurred when (a/x ) - x = 2 (x . - x )•> 0. v ' n' a v n+1 n' — The Illiac will stop if a < or if a = 1 - 2~ : '. = x + [a/x - x ] / 2 n+1 n ' n n ' Rt: 7/20/59 DATE Oct. 23 , 1953 Rt. 3/18/58 CODED BY APPROVED D. J. Wheeler BY J. P. Nash 380 LOCATION ORDER I NOTES OOK (Rl) 1 '■ ho IF K5 F Store a 1 1+2 8L 51 IF Plant link 2 10 IF SJ F x Q = a/2 + 1/2 3 1+0 2F 50 F From 7 to 2F h L5 IP 66 2F a to A and Q 5 S5 F LO 2F x , - x to A n+1 n 6 10 IF 56 8L End test 7 ik 2F 26 3L . Re-enter loop 8 L5 2F ya"to A 22 F by 1 Link 381 TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE ACCURACY DURATION DESCRIPTION APPENDIX 18 ILLIAC LIBRARY DESCRIPTION OF Sh LIBRARY ROUTINE 3 ^ - 212 COMPUTE e Exponential (D.O.I, or SADOl) Closed, standard entry 21 0, 1, 2 -12 Maximum error: 5 x 10 (see description) 11.3 m seconds (max) (see description) This routine replaces x, the contents of A before x entry by e . The quantity x is in the range -1 < x < 0. The computation is performed by evaluating x a continued fraction expansion for e . The expansion used is: (1) -i— - 1/2 ♦ (xA) ( lj2 m x ) 2 ^ F/g ) vhare (2) F 2 x T^lo" 2 l*.l&.16 U -16-16 £-♦ • N. Macon, "On the Computation of Exponential and Hyperbolic Function Using Continued Fractions", Jour. ACM, pp 262 - 267, October 1955- 382 This routine Is so written that the first 5 tens of 7 (eo». 2) are used in computing e . It is possible to modify this, however, by changing the first digit la instruction 1TL, [i.e. the 5 in 56F OOF] to k, J, or 2. The saaller the number used in place of ?, the shorter the duration of the computation but the greater the error. A simplified vara ion of the dependency of speed and accuracy is given by the tables below: TABLE I Digit mx. Error Duration 5 5 x 10- 12 11.3 ■ sec. k 5 x 10" 9 9.7 ■ aec. 3 5 x 10 -6 8.1 ■ sec. 2 5 x 10* 5 6.5 ■ sec. for -1 < x < 0. It should be noted that the error Increases with x approaching -1. Thus for x In the range -1/2 < x < we have the following table: TABLE II Di£it 5 it 3 2 Mix. Error 5 x 10 5 x 10 5 x 10 5 x 10" •12 -11 -10 Duration Speed Table I. as Xgr DAT E V26/56 RT: 10/29/58 PROGRAMMED BY Jack Goldberg APPROVED BY J. P. Nash 383 LOCATION GRDBR ROTES to K(S4) 40 P K5 F Set Bxit 1 4? 16L L5 F 2 10 2F 50 F Form x/2 3 40 F 7J F L- o Form x /4 J 4 40 IF 41 2F 5 L5 171 40 19L 6 50 2F 85 F 7 10 3F L4 19L t -Compute F 8 40 20L L5 IF 9 10 5F 66 20L 10 L5 19L LO 18L Teat for end of F 'compulation. 11 40 19L LO 18L 12 32 6L L9 F 1/2 - x/2 13 54 F 40 20L 1/2 - x/2 + F/2 1* 50 2F L5 F 15 66 20L SJ F *' i i l / n 1/2 - x/2 ♦ F/2 1/2 16 00 IF • : 22 F J 8 4 38U LOCATIOff cron ■OTB 17 18 19 20 58F 00 F 10 F 00 F 00 F 00 F 00 F 00 F Constant ■ ll/l6 Constant • l/l6 -Teaporary location* 6k 385 TITUS tot NUMBER OF WCRD6 TEMPORARY STORAGE DURATION ACCURACY DESCRIPTION REMARKS EXAMPLES METHOD APPENDIX 19 ILLIAC LIBRARY DESCRIPTION OF T5 COMPUTE SIN- COS UBBAJBT ROUTIH E T5 > 157 Sine-CoaiAa Routine (D.O.I or SADOl) Cjbofced 21 0/1, 2 9 milliseconds 2-58 Given ©/* in A, the routine places (l/2j sin in A when a standard entry is usedo (1) If A contains l/2 + 0/x, the quantity 1/2 cos will be obtained. (2) If ©/* overflows in A from left shifts or addition the result is unaffected because sin (0 4- 2n a) = sin 0. (l) If memory location q contains 0/«, (l/2) cos 9 may be obtained with the entry LJ q 50 P p + r- (2) To find sin 3.82 radians when memory location q contains O.382 and memory location r contains lO/^tu, we proceed as follows, Ignoring the overflow in A. p - 1 50 q 75 r p 00 2? 50 p p + 1 26 - (l) Given in radians we evaluate sin (0/2) by a Tchebyscheff polynomial expansion to the Taylor series expansion of the sine function, using Librajry routine KA-1. 386 (2) If is scaled so that -1 < 2"°© < 1, we form 2 n (2""©/^ - ©A (>«xi 2)) - 0«/"»r • (3) Using the identity Bina»sin('Tr-a)we obtain ©« » with -1/2 £ 0> ' /or * 1/2 such that sin 0' » - ain ©• * sin 0. ERROR ANALYSIS (l) In word 4 we develop -4 (©Aft) . Consider |©/nl < 1/2. This quantity possesses up to 38 signifioant binary digits. W« form (©/"rr) < 1/4 and shift left t-.ace, introducing thereby at most an error of 2 , since q, contains a significant binary digit. (2) We next develop the polynomial: 1/2 sin © - ©Ar [^(2©/^ ) 12 ♦ ^(20/rr) 10 ♦ a 9 (2©/-rr) 8 * a 7 (2©/'Tr) 6 ♦ ^2Q/^) U ♦ a 3 (2©/'7r) 2 ♦ «J This is accomplished by the recursion relation: s «o 3 i*i K/ "i } 3 i a y(j-i2,ii,9,...D At each one of these steps we introduce a round-off 2 error due to the multiplication. Letting (20/tt) » x, we obtain: 1/2 sin ■ (a^o* ♦ \\* * a o x * *n* ♦ *« x * *» x * *i ♦ 2-^°(x 5 ♦ x 4 ♦ x 3 ♦ x 2 ♦ x ♦ 1) 0/7T ♦ 2- 40 ] Since x cannot exceed 1 and \0/tt<^ 1/2 we have aa error 3.2 +2 . The maximum total generated error is therefore 2 . (3) There will also be developed a propogated error due 2 to the inaccuracy of the quantity 4(©/7r) • We will admit only the error result- 2 ing from the terra a (20/tt) in equation (l) due to the relative small contribu- tions prop^ated by the other terns. 387 Thus: a 5 (2©/«) 2 = ok[k O 2 /* 2 + 2" 59 ] - .k<&/*f ± (.^)2" 59 . The propagated error is therefore? (,k)2~ ' (k) The total maximum error is therefore: •58 + (.k)2~^ = (2 + .10 2'" = (2.102 39 ►-39 (5) A sample of calculations for the sine of a number -12 of arguments was found to be in error at most 5 x 10 which is less than the maximum, error indicated above. (6) Finally, we consider the case |©/x | = l/2. The -39 error was found experimentally to be less than 2 . DAT E 11/29/5U RTs h/5/60 PROGRAMMED B Y Werner L. Frank APPROVED BY J. P. Nash ns 388 LOCATION ORDER Nous K5 14L Store 0/-7T 1 i»2 12L Plant link L9 F 1/2 - Q/T 2 40 P LS F 1/2 - ll/2 - O/rrl - Q*/t 3 40 F 50 F -1/2 - ©'/rr^l/2 4 71 F 00 2F -4 (O'Ar) 2 5 40 IF L5 L 6 42 7L 50 13L 7 79 IF -4 a n (0./^) 2 ♦ a^ L4 (1A)L 6,9' e 40 2F 50 2F 9 F5 7L 42 7L 10 LO 20L TMt ?6 7L 11 LJ 9L Prepare round off 74 F 1/4 sin 12 00 IF 1/2 Bin 22 ( ) F 1 13 00 P oo 27232J •^ - .27232 x 10" 7 14 NO f 00 499998202409J •^ - .1797591 x 10" 5 15 00 F 00 80219199J 1 *q - .80219199 x 10" 4 T! 389 LOCATION ORDER NOTES 16 NO F 00 A97659123501J •^ - .2340876499 x 10" 2 17 00 F 00 3984631300U a 5 - .39846313004 x 10" 1 18 NO F 00 177017951-58J a 3 - - .785398163397 19 40 F 00 285398163397J ^ - .785398163397 20 L9 IF U 20L End constant T5 390 APPENDIX 20 ILLIAC LIBRARY DESCRIPTION OF Y5 : DRUM TRANSFER TITLE: TYPES NUMBER OF WORDS? TEMPORARY STORAGE: DURATION: DESCRIPTION: LIBRARY ROUTIN E Y «> - 291 Transfer Blocks of Words between the Drum and the Williams Memory . Closed subroutine with 3 program parameters. 35 10 + l»3r milliseconds to record or play back, where r is the number of words transferred . The entries to this routine are identical to those used by routine Y 1 - 199- The entry p JO n 50 p p + 1 26 — 00 q p + 2 00 r will cause the block of r words starting at location n in the Williams Memory to be recorded on the drum starting at drum location q. A sum check constant will be re- corded at q + r. Control will be returned to the right hand side of p + 2. The entry P 50 n 50 p p + 1 26 — 00 q p + 2 00 r will cause the block of r words starting at drum location q to be placed in the Williams memory starting at drum location n. A sum check constant must be in q + r on the drum, This sum check constant will be compared with the sum calculated from the words played back from 391 WARNING? NOTE 1: NOTE 2: the drum, and if the two do not agree, a second attempt will be made to play back the desired words. If the sum checking again fails, an error will be indicated by the machine stopping on an FF 0L0 on the left hand side of word 33 relative to the routine. At this point it is possible to execute a white switch start which will cause two more attempts to play back the desired words. If the sum check constant agrees with the calculated sum, control will be returned to the right hand side of p + 2 . This routine cannot be used for the playback of words recorded by routine Y 1, nor can it be used to record words which will later be played back by routine Y 1, since the two routines do not store the same quantities on the drum. It is also not practical to use the drum post mortem routine for printing words which have been recorded by this routine, as the successive differences of words are recorded rather than the words themselves. The contents of the accumulator after a sum check failure are not related to the actual error and will have the form Kl***O0000 • It should be noted that Y 5 is shorter (35 versus h-0 words) than Y 1. In addition Y 5 provides the same speed on record as on playback (10 + 1.3r ms . ) whereas Y 1 requires (10 + 1.8r ms . ) on record. These improvements are achieved through the storage of differences which allows the additional sum checking loop on the record option to be eliminated. ns DATE March 10, i960 PROGRAMMED BY B.D. Elliott APPROVED BY Qooi^x^J 392 LOCATION ORDER NOTES y 5 00K(Y5) K5 F 42 3L 1 1 F5 3L 42 5L 2 42 31L 00 19F 3 42 24L L5 F \ Set up 1+ L6 3i+L 40 26L 5 41 F L5 F 6 10 20F L4 26L / 7 40 29L « / KL F c^ = 1 for record 8 36 20L 7 L3 3^L Set switch for two playbacks 9 40 34l / 4l F Reenter for second trial 10 L5 24l * ■N 11 42 l4L L5 26L ^ > Set up playback 40 13L \ 12 LO 29L 36 29L 13 85 lip 00 F 14 L4 F 15 40 F 40 F F5 l4L r Playback 16 42 14L 17 F5 13L 22 11L ' / 393 LOCATION ORDER NOTES Y 5 Fl F ) 18 86 IIF 00 F \ Record check 19 23 31L 00 F 20 19 6f L4 29L ) 21 40 18L 19 6f Set up recording 22 L4 26L > 40 26L ^ 23 LO 18L 32 1TL 24 50 F L5 F 25 40 F SO F Record 26 86 IIF 00 F 1 During playback is Q0 27 F5 24L 42 24L \ 28 F5 26L 22 22L J 29 85 IIF 00 F } 30 L4 F 40 F 31 F3 F J 32 F > Link 32 LI 34L < ) 36 9L ► Check for two attempts 33 FF 240F • ) 26 9L White switch fot two more attempts 34 KO 4085L Constant for forming drum orders OC F Also used as binary switch 39^ APPENDIX 21 ILLIAC LIBRARY DESCRIPTION OF PI: SOLUTION OF A SYSTEM OF ORDINARY DIFFERENTIAL EQUATIONS ILLINOIS CODE F 1 - 11* TITLE TYPE NUMBER OF WORDS TEMPORARY STORAGE PARAMETERS STORAGE LOCATIONS 3 6 7 Solution of a System of Ordinary Differential Equations (Originally Code 27) (SADOI Only) Closed - with one program parameter Location P p+1 Program 00 mF 50 pF 26 xF The first word of Routine F 1 - Ilk is at x. 41 0, 1, 2, 3 The locations 3 to 7 must contain the following parameters before and during the input of this subroutine. CONTENTS USE OOF 00 aF N(a + i) are the variables y (i « 0, 1, ..., n - 1) Originally the initial values are placed here. OOF CO bF N(b + i) are the scaled derivatives, 2*hyJ (=2 m hf 1 ), (i = 0, 1, 2, ..., n - 1), calculated by the auxiliary subroutine* b > a + n-l Locations c + i, (i = 0, 1, . .., n-l) are used as temporary storage for this subroutine. These locations must be cleared to rero before this integration subroutine is entered for the first time, c > b + n-l. n is the number of differential equations to be solved. d is the location of the first word of the auxiliary subroutine. OOF 00 cF OOF 00 nF OOF 00 dF 395 DURATION DESCRIPTION T = 7 + n(l5 + O.lm) Atms where T = time in milliseconds to perform one step of integration, t = time in milliseconds for the auxiliary subroutine. This subroutine will handle a set of n simultaneous first order ordinary differential equations, in which each deriv- ative is expressed explicitly in terms of the variables •' y n-l> y' = f (y , y ± , y{ = f x (y , y v •■-, 7 nml ) K-i = f n -i (y o> y i' — « y n -i ) Any differential equation or set of differential equations to be solved must first be expressed in the above form before this subroutine can be applied. For example, the second order differential equation 2 y = w y must be written as two first order differential equations y = wy i y i = wy o where y, = y and y_ = y'/ w - Each time this subroutine is called into use, it will carry out one integration step of length h. Each of the integrals y. (i = 0, 1, 2, ..., n-l) is replaced by its value at the end of a step of length h. In doing so, this subroutine employs an auxiliary closed subroutine which evaluates the functions f , f , f , ..., f from the given values of y . The coder must write this auxiliary subroutine for his Individual problem since it defines the equations being solved and, this depends entirely on his specific problem. The purpose of the auxiliary subroutine is to calculate and store in locations b+i, (i = 0, 1, 2, ..., n-l), the quantities hf multiplied by a suitable scale factor 2 . h is the increment of the independent variable and m is a positive integer to be chosen as large as possible without having any of the quantities 2°^. exceed capacity anywhere 396 throughout the range of integration. The factor 2 is introduced to increase the accuracy of the integration subroutine. The variables, y , must all be scaled so that they are less than one throughout the range of integration before they are used in the auxiliary sub- routine. Also for maximum accuracy, one should store 2 h instead of just h. This auxiliary subroutine must be located in a sequence of locations beginning with location d, where d is defined by the parameter S7« In integrating over one step, the integration subroutine will call in the auxiliary subroutine four times. This integration subroutine requires 3n arbitrary storage locations. The n consecutive locations a + i, (i = 0, 1, 2, ..., n-1; a arbitrary), are used to store the variables y . It is in these locations that the initial values are to be placed. It is also in these locations that the final results are found. The n consecutive locations b + i, (i = 0, 1, 2, ..., n-1; b > a + n-l), are used to store the scaled deriva- tives, 2 n' ( = 2 nf.), which are calculated by the auxiliary subroutine. The n consecutive locations c + i (i = 0, 1, 2, ..., n-1; c > b + n-1) are used for temporary storage by the integration subroutine. These locations will hold the quantities 2 q (See page 7)- The numbers left in these locations at the end of an integration step are 3.2 times the roundoff errors of the quantities y . These numbers are taken into account during the following step and serve to prevent the rapid accumulation of roundoff errors . As a result the effective numerical accuracy is m digits more than the capacity of the storage locations. Therefore, It is important that the locations c + i, (i = 0, 1, 2, ..., n-1) be cleared to zero before the integration subroutine Is entered. Otherwise, this integration subroutine will add spurious corrections to the variables . Thus before the 397 integration subroutine can be entered, the main routine must clear the temporary storage locations c + i to zero and set the initial values of the variables y in locations a + i . SUMMARY Supposing that, in the course of his routine, a coder has to solve a set of differential equations over a specified range given the initial value of the independent variable, a possible procedure would be the following: (1) Reduce the given set of differential equations to a set of n first order differential equations. (2) Calculate the initial values of the dependent variables, y . (3) Scale all the functions so that all the values y are less than one throughout the range of integration. (h) Choose a proper value of h (See note I). (5) Choose m properly. (6) Determine the parameters to be placed in S3 - S7, observing that a < b < c. (7) Write an auxiliary subroutine which evaluates the functions 2 nf. and stores them in locations b + i. (8) Make certain that the main routine sets the scaled initial values in locations a + i, and clears the temporary storage locations c + i to zero before the integration subroutine is entered. With respect to the solution of a set of differential equations, a program can be broken up into four parts: (1) Locations 3 through 7 which contain the parameters, (2) The main routine, (3) The integration subroutine (Code F 1 - 11 M (k) The auxiliary subroutine. 398 THE INDEPENDENT VARIABLE If the independent variable x occurs in the functions f or if it is required during an integration as an index, then it must be obtained by integrating the equation x' =1. The independent variable x is then treated as an additional dependent variable, for which the auxiliary subroutine has to provide the quantity 2%' = 2 n. However, this latter quantity may be planted at the beginning of the integration in the appropriate location (e.g. in location b) and left there, so that the auxiliary subroutine is relieved of the task. If the independent variable does not appear in any of the f 's but is merely wanted for indication purposes, it is quicker to use a simple counter in the main routine . NOTES I) Accuracy: The truncation error in one step is of the 5 order of h . Ordinarily, that is for a small set of well -2 5 behaved equations, its magnitude is about 10 h ; for large sets or difficult equations it may be greater. Over the range of integration this error will amount to about h /l00. Roundoff errors accumulate at a rate corresponding to the keeping of (39 + m) binary digits. The choice of the length of the increment h is governed largely by the accuracy desired. An increase in the length of h will result in a decrease in accuracy and in operating time. Likewise, a decrease in the length of h will result in an increase in both accuracy and operating time. However, no further increase in accuracy can be gained by choosing Q h < 2 because of the introduced truncation error. But, if the functions are very sensitive to variations in y . , or if the number of equations is very large, smaller steps will probably be necessary with, of course, a corresponding increase in the time required. Now, the process used in the 399 integration subroutine is a fourth order one. Thus, 1/15 of the following difference, (the value of y calculated using an interval of length h) -(the value of y calculated using an interval of length 2h) is an approximation of the error. Il) Adjustment of the increment h: There exist essentially two ways of adjusting the increment a) One may double or halve the increment by varying the value of m in the main routine. This may be done over the complete range of integration or just over part of it . When only the parameter 00 mF in the link between the main routine and the auxiliary subroutine is changed to 00 (m+l)F and the auxiliary subroutine is unaltered, the length of the increment is halved. Likewise, when only the parameter 00 mF is changed to 00 (m-l)F the length of the increment is doubled. The auxiliary subroutine is not altered since 2 n = 2 h/2. If one adjusts the increment over the complete range, adjusting only the value of m is sufficient. However, if one wishes to adjust the length of the increment within the range of integration, one must also adjust all the quantities in locations c + i. Otherwise, one will introduce roundoff errors in y. of the magnitude, 2 (old value of h - new value of h) x 2~ Now by also doubling the quantities in c + i when one halves the increment one will introduce no roundoff error. Similarly, by halving the quantities in c + i when one doubles the length of the increment, one will introduce no roundoff error. If one clears the locations c + i, one introduces -1+0 roundoff errors of magnitude 2 400 b) One may alter the length of the increment in any ratio by adjusting the scaling factor 2 n in the auxiliary subroutine. Here also one may adjust the length of the increment within the range of integration. Now it is not necessary to adjust the quantities in c + i. If, however.. 2 n becomes small, then roundoff errors are introduced by inaccuracies in the auxiliary subroutine. Thus one should not keep 2 n small when integrating over large ranges unless the loss of accuracy and time does not matter. Ill) Often it is desired to evaluate functions involving expressions like sin x or J (x). These expressions can be evaluated by solving extra distinct differential equations along with the desired ones. For example, 2 2 d /dx (sin x)/2 = -(sin x)/2. Thus we can evaluate (sin x)/2 by using the extra pair of equations y 1 . = 2^ y' = -^"hy . 'n+1 ^n J n ^n+1 and suitable initial conditions. METHOD USED FOR INTEGRATION IN THE ROUTINE Given a set of differential equations, y i = f i ( y ,y l ,y 2 , "" ,y n-l^ ^ = °' lf 2 ' '"' n " 1 ^ The process used in the integration is defined by the following equations k u " 2V i (y oj' y ij' -' Vi j' p-m y i,j+l ~ y i,j + d r i,j+l q j • i =■ Q... . + 3r. , + (C . - l) k., . , -i,j+l H ij ' i,j v j i, J+ i with the following table of values 401 J B J C. J -1/2 2 1/2 1 -d/2 )^ 2 1 d/2 J 1 ^ 2 (1/2 ) 1/2 1 -d/2) l/2 3 -5/6 2 1/2 Of the double subscripts itsed in the above equations, the first subscript, i, indicates which variable is being considered, and the second Subscript, j, indicate which of the four parts of one step ifc being performed . The auxiliary subroutine evaluates the quantities k., . . In the above equations, only the quantities q. , and y , are carried 1,4 1 ,4 over from step to step. The quantities r are calculated in the course of one step; they are not carried directly from step to step. When j = 4, we replace it by zero, increase i by 1, and terminate the step. For one step, the sequence of operations is as follows: J = o i = 0, 1, 2, . . ., n-1 J = 1 i = 0, 1, 2, .. ., n-1 J = 2 i = 0, 1, 2, . . ., n-1 J = 3 i = 0, 1, 2, . .., n-1 REFERENCES Gill, S., "A Process for the Step-by-Step Integration of Differential Equations in an Automatic Digital Computing Machine", Proceedings of the Cambridge Philosophical Society , volT"Vf 71951) PP- 96 - 108. Wilkes, M. V., Wheeler, D.J., and Gill, S., The Preparations of Programs for an Electronic Digital Computer Addison-Wesley Press, Inc. Cambridge, Mass., (1951 ) pp. 32-33, 56-57, 86-87* 132-134. DATE October 27, 1953 Rt . 3/19/59 CODED BY D.J. Wheeler REVISED B Y R. Polivka APPROVED BY J. P. Nash lgr 1+02 LOCATION ORDER ROTES 00 K(P1) 00 S3 00 fl4 00 85 00 86 01 29K L5 5F L4 6f 1 00 20F 46 571F 2 L5 4f LO 3F 3 42 573F 00 20F 4 46 573F L5 5F 5 LO 4F 42 574F 6 00 20F 46 574f 7 26 93F 00 F 8 64 f oo 35L c+n 9 80 S3 a oo S3 a 10 00 F b-a 00 F b-a 11 00 F c-b 00 F c-b 12 26 1469N 01 K S5 F Set shift addressee 46 8L = m l 46 llL I*3L 1 F 1 403 LOCATION ORDER NOTES 2 42 22L 22 21L Set link address 3 L5 K,j )F 40 IF From 21 By 20 4 L5 (k.^F 40 F By 18 5 LO (1)F By 23 6 LO IF 40 3F 50 (A )F By 24 (k i,j - b j V 7 7J 3F 8 l4 3F 10 (m)F 40 3F By < k U -»j«u> V l)2 " 9 L4 (y^F By 17 ' 10 k0 ^i,j + l )F L5 3F By 17 Step y i 11 50 2F 00 (m)F 40 3F By 1 Form r. , . 12 50 (Cj)F By 25 13 7J F " LO F L4 IF C, k, . - k. . 11+ L4 3F 15 L4 3F L4 3F q U + 3 r i,J + l 16 k0 K, J+ i> F L5 9L L4 13L By 19 17 42 9L 46 9L Increase all addresses depending 18 L4 39L 46 4l on i by 1 Fl i+o)+ LOCATION 19 20 21 22 23 21+ 25 26 27 28 29 30 31 32 33 3^ 35 36 ORDER IA l+OL 1+2 15L 1+6 3L LO 37L 36 3L L5 (33 )L 1+2 21L 32 ( )F 1+6 5L 10 10F L.1+ 18L 1+2 6L 1+6 12L 50 25L 26 S7 1+1 2F L5 38L 2b 17L 1+0 F 00 F NO F 00 F 1+0 F oo 2071 0678 80 F 00 2928 9321 80 F 00 1666 6666 LJ 1025F 06 1058L LJ 307 1 +F 06 3107L LF 2F 06 2081+L LJ 1025F 07 37L Oll+IK NOTES Fl By 22, From 2' By 2 1/2 •1/2 1186 J 88H+ J 6667 J -11, 1 25,3^L -9 2 27, 35L -8, 2 26, 36L -11, 1 28, 37L until i Increase ,1 from to 3 and then leave by link Adjust addresses which depend on j Call in auxiliary subroutine Clear 2F so that it can be used as zero. Start new i cycle . C 0' C 3 1 /f2 C 1 , A 2 -1 /7~2 A ] _, C 2 -5/6 A, _g _io -29 -39 Expressed in units uf 2 , 2 , 2 , 2 . Addresses used to set addresses to refer to the constants A^. C. and make the address in J J 5L, 1 or 2 according as B. 2 or 1, and to J stop the address in 21, dependent on j, and to stop when positive. APPENDIX 22 ILLIAC LIBRARY DESCRIPTION OF E3 : INTEGRATION BY SIMPSON'S RULE (FUNCTION VALUES) 405 TITLE: TYPE: NUMBER OF WORDS : TEMPORARY STORAGE: ACCURACY J DURATION; DESCRIPTION} ENTRY: AUXILIARY SUBROUTINE: RESULT: NOTE: LIBRARY ROUTIN E £1^186 Integration by Simpson's Rule (Function Values) (SADOI or DOI) Closed 38 Location -"39 + 2 + truncation error 3 + (k + d)n milliseconds where d is the number of milliseconds required to evaluate f with the auxiliary routine. This routine computes £ f\ f(x)dx by using the a approx imat ion ^ / f(x)dx » ±j (f Q + kt ± + 2f 2 + ... + f Q ) a where f « ^A 1 + a) is the value of f(x) calculated by an auxiliary routine at an odd number n + 1 b - a of equally spaced points a + i, i = 0, 1, 2, .,., n, where b > a. Place a in location and b in A and enter with <1 50 pF 50 qF q + 1 26 - 00 nF where p is the location of the closed auxiliary subroutine which calculates f(x). The auxiliary subroutine placed at p must be a closed routine which takes x from A and places f(x) in A. Control is returned to the left side of q + 2 with the result In A and Q. If f(x) is tabulated use Library Routine E 2. DATE June 2, 1955 RT: 6/17/60 CODED BY L. Isaacson APPROVED BY J. P. Nash nj 406 LOGATIDH | ORDER IfOTES 00 K(B3) lo r 40 31L b - a 1 L5 F 40 52L Store a 2 ^1 33L K5 6f Clear counter 3 1+2 5L L4 28L Plant q + 1 4 42 27L 46 10L Plant link 5 46 18L L5 ( )F 6 LO 30L 40 35L n 7 L4 35L L4 35L 8 40 34L 41 36L 3n 9 L5 32L 50 9L 10 26 ( )F 40 37L P 11 F5 33L ^0 33L Step m 12 FO 35L 32 24L Test (m + 1 - n) 1? 50 31L 75 33L 1U 10 IF 32 15L l c Lk 33L 66 35L 16 S5 F S4 F E 3 407 LOCATION ORDER BOTES 17 IA 32L 50 17L ■ + ! tb - * ) 18 26 ( )F 1+0 F 19 50 29L L5 37L 20 7 1 * F IA 36L 21 l+O 36L S5 F 22 1+0 37L L5 2L 23 LO 29L 1+2 29L - Binary switch 2k 26 11L 50 F 25 L5 37L 70 28L 26 Ll+ 36L 66 3kL 27 S5 F 26 ( )F Link 28 00 F 00 IF 29 00 F 00 1+F 30 26 L 00 F 31 00 F 00 F b - a 32 00 F 00 F a 33 00 F m 00 F 1 4o8 LOCATION ORDER HOTES fi 3 35 56 37 00 F 00 F 00 F 00 F 00 F 00 F 00 F 00 F 3n a f(x) 409 APPENDIX 23 ILLIAC LIBRARY DESCRIPTION OF Al : FLOATING DECIMAL ARITHMETIC ROUTINE LIBRARY ROUTINE A 1 - 63 TITLE Floating Decimal Arithmetic Routine TYPE Interpretive routine with l8 interpretive orders, entered as a closed routine, left by an 8J interpretive order. NUMBER OF WORDS 168 PURPOSE This routine manipulates numbers in the floating decimal form, that is numbers vhich are represented as A x ICr . It is of the interpretive type. This means that it selects parameters called interpretive orders which are written by the user one at a time and performs a calculation corresponding to each inter- pretive order. Interpretive orders carry out normal arithmetic operations such as addition and multiplication and some red tape operations such as counting and address changing. In general, one will use this routine to do computations which do not require the full speed of the computer but which are too time consuming to be done by hand. It is especially effective for problems with scaling difficulties. In a sense one may think of the floating decimal routine as converting the Illiac to a medium speed floating decimal computer having a very convenient order code. ACCURACY About 9 decimals TEMPORARY STORAGE 0, 1, 2 PRESET PARAMETERS S3 is used to specify two locations of non-temporary storage, S3 and 1S3, which are used for the floating decimal accumulator. METHOD OF USE The floating decimal routine is entered as a standard subroutine. Following the entry, i.e. after the transfer of control to the subroutine, one be- gins writing interpretive orders. These orderB each occupy one half word and consist of a pair of function digits followed by a single address. They therefore have the same form as standard machine orders and may be read by the Decimal Order Input with full use of the conventional terminating symbols. The first of the two function digits of an interpretive order describes the group characteristics of the order and may take values 0, 1,..., 8. Normal arithmetic interpretive orders have this digit equal to 8. The second of the two function digits describes the type of interpretive order. 410 ■UTBRHKBTIVK ORDER LIST WITH FIRST FUMCTIOH DIGIT b « 8 Let F be the floating decimal number la the floating accumulator and let F(n) be the floating decimal number In location n. 80 H Replace F by F - F(n). 81 n Replace F by -F(n). 82 n Transfer control to the right hand Interpretive order in n if F > 0. 83 n Transfer control to the left hand interpretive order in n if F > 0. 8k n Replace F by F + F(n). 85 n Replace F by F(n). 86 n Replace F by F/F(n). 87 n Replace F by F x F(n). 88 Replace F by one number read from the input tape punched as sign, any number of decimal digits, sign, and two decimal digits to represent the exponent. For example, .8971 * 10 would be punched as + 8971 + 10. 89 n Punch or print F as a sign, n decimal digits, sign, two decimal digits to represent the exponent and two spaces . This print out may be re- read by this routine. After F has been punched or printed it may not remain In the floating accumulator unmodified, n can take values 2 to 9* 8K n Replace F by n if < n < 200 88 n Replace F(n) by F. 8H n Replace F by |f| - |F(n)|. 8j n Transfer control to the ordinary Illiac order on the left hand side of n. This used to escape from the floating decimal subroutine. 8F n Give a carriage return and line feed and start a new block of printing having n columns . This order is only obeyed once for a partic ula r block of printing. At this time a counter is set up which will cause a carriage return and line feed to oqcut automatically from then an after every set of n numbers that is printed. 411 INTERPRETIVE ORDERS WITH b f 8. If the first function digit of an interpretive order is 0, 1,...,7 it will refer to one of a set of control registers or b- registera in the floating decimal routine which are similarly numbered. These registers are used for counting the number of passages through loops or cycles and for advancing addresses on successive passages. For this purpose a particular O-registers which may be used in a particular cycle contains two counting indice g^ and c, . These are both integers in the range to 1023. The index c is used for counting purposes to determine the number of passages through a loop. The index g, is used for advancing the addresses of interpretive arithmetic orders. Although the interpretive order with first function digit b is not actually altered in the memory it is obeyed as if g, were added to its address . The index g, is increased by one upon each passage through the cycle. The multiplicity of b-regis- ters allows one to program many loop6 within loops . ORDER LIST WITH n f 8 Replace F by F - F(n+fc) Replace F by -F(n+g. ) Replace g fa , c^ by g^ + 1, c^ + 1. Then transfer control to the right hand (if b2 n) or left hand inter- pretive (if b3 n) order in n if c,+l is negative. This transfer is used at the end of a loop. Replace F by F + F(n + g.) Replace F by F(n + g, ) Replace F by F/F(n+g fe ) Replace F by F x F(n+g fe ) Replace g, , c, by 0, -n. This interpretive order is used for pre- paring to cycle around a loop n times. Replace F(n + g.) by F Replace F by |f| - |F(n+g b )| Replace g. , c, by g. + n, c. . This interpretive order is used when one wishes to step addresses by some increment other than +1 in a loop. If one places bL 1022 in a loop the effect will be to decrease addresses by one on each passage. bL 1 will increase them by 2 etc. Replace g, c. by n, ex. where b is the last b-register referred to by some previous interpretive order. bO n bl n b2 n b3 n bl* n b5 n b6 n b7 n bK n bS n bN n bL n 8L n kl£ 8h 80 84 3- 82 83 DURATION OF IHDIVTDUAL IHTERPRETIVE ORDERS 5 milliseconds + m x (3/2). Where m is the number of shifts re- quired to convert A, p back to standard form. 2 milliseconds 3 milliseconds 87 5 milliseconds 86 6 millisecons 8K 3 milliseconds 88 3 milliseconds 8F 3 milliseconds 8L 2 milliseconds 8j 3 milliseconds When an interpretive order is preceeded by b / 8, add one millisecond to the above times . When one wishes to repeat a cycle of interpretive orders n times the interpretive order bK n may be written before entering the loop to set the counter c. to -n. The interpretive orders, in the loop will be obeyed n times if the loop is terminated with a b2 or b3 interpretive order to transfer control to the begin- ning of the loop. This transfer of control interpretive order will be obeyed n-1 times and disobeyed the nth time. The following examples illustrate the construction of such loops. EXAMPLE 1 Calculate x where x = F(4) 8K IF Set F - 1 2K 10F Set to cycle 10 times 87 k¥ c 2 = -10 23 1L Transfer control to 1 relative 9 times . EXAMPLE 2 Replace F(lOO + i) by F(200 + i) + F(300 + i) ? i s 0,1,..., 9 »H3 6 OK 10F 05 200F 7 0^ 300F OS 100F 8 02 6l g Q = 0, c Q = -10 F = F(200 + g Q ) F = F(200 + g Q ) + F(300 + g Q ) F(100 + g Q ) + F(200 + g Q ) + F(300 + g Q ) increase g_ by 1, transfer control 9 times to 6 relative. 19 EXAMPLE 3 Evaluate Z ax, where a = F(l00 + ij, x = F(lO). The operations 1=0 form (((a Q x + a^ x + a 2 ) x + a ) x + -- 2 8k f OK 20F 3 87 10F Ok 100F J* 03 3L Clear F Prepare to cycle 20 times multiply by x add F(100 + g Q ) EXAMPLE k Print 10 numbers each with 5 decimal figures in a block of 3 columns from 100 to 109- 22 8f 3F OK 10F 23 05 100F 89 5F 2k 03 23L EXAMPLE 5 Start block with 3 columns Print 10 numbers Place the number F(200 + i) in 300 + 2i for i = 0,1,... ,2k, 5 OK 25F IK F 05 2 OOF IS 300 F 7 1L 2F 03 6l 5 6l = o c Q - -25 advance g by 2 klk EXAMPLE 6 Place the number P(200 + i) in 500 - i for i « 0,1* > >• ,2k 5 OK 25F UC F 6 05 200F IS 300F 7 1L 102 3F 05 6l reduce g. by 1 increase g-. and c by 1 Use of Auxiliary Routines . It is often convenient to be able to leave the floating decimal routine so as to modify interpretive orders or to perform calculations which may be done more effectively outside of floating point. To leave the floating decimal routine one uses an 8j n order. (All standard floating decimal auxiliaries are entered in this way.) To return to floating decimal one should transfer control to the left hand side of word 29 of the floating decimal routine. The interpretive order following the 8j n order which was last obeyed will then be obeyed and so on. In this way it is not necessary to plant a link in auxi- liary subroutines. One may, in fact, think of the 8j n order as a subroutine order. In case any changes are made in the floating decimal accumulator while outside the floating decimal routine, control should be returned to the left hand side of word 19 rather than 29 so that this number may be standardized before reentry. Handling of Numbers Each nuaber is represented In the form A x ICr where 1 > |A | > l/lO, and 6k > p > -6k. In a single register of the memory the number A is placed in the 53 most significant binary digits (a Q , a.,..., i^) in the same way as an ordinary fraction is placed in the entire register. An accuracy of between 8 and 9 decimal digits is therefore achieved. The exponent p is stored as the integer p + 6k In the 7 least significant digits of the same register. For convenience the floating decimal accumulator uses two registers 33 and 1S3 for holding the number A x ICr . The fraction A/2 is in S5 and the integer p + 6^ is in 135. The only exeption to the above rules Is the number zero which can- not, of course, be represented as A x ICr 3 with |a| > 10. For this reason zero is handled in a special way. It is represented as a number with A » and p = -6k. ^15 This representation happens to correspond exactly vith the ordinary machine representation of zero. After each arithmetic interpretive order is obeyed the number in the floating decimal accumulator is standardized, i.e. the number of S3 representing A/2 is adjusted so 1 > |A| > l/lO and p is changed accordingly. To accomplish this control is transferred to word 19 in the floating decimal routine after each arithmetic order. If an interpretive store order is attempted when F has an exponent greater than 63 the machine will stop on the order 3^ p at location p, where p is word 72 of the routine. Important Words in the Routine . Word 2 in the floating decimal rou- tine determines the location of the current interpretive order. When obeying the left hand interpretive order in location n this word is 50 nF S5 20F and when obeying the right hand interpretive order in location n it is L5 nF 00 20F. Other words of interest are the b-registers which start at word 158 (for g_ and c Q ) and go to 165 (g„ and c_). These register hold g, and c, in the form 80 g^F 00 (2048 + c^) F. Warning When the same number is continually added to a sum, such as when an argument is being increased, the error can be quite large, because it is additive over a decade. For example, if we increase 10 to 100 by units we can get a maximum error of 90 x 2 ^ because the errors all have the same sign. If we ~*i h -33 increase 10 to 10 we can have a maximum error of 9*000 x 2 ^ . This can easily be prevented by writing an auxiliary subroutine to stabilize the fractional part of F, i.e. to replace it by the nearest multiple of say 10 '. Such a subroutine could be as follows m 50 S3 A contains nearest multiple of 10 Location 1 contains zero converts to fraction again m 50 S3 7J m+3F m + 1 50 IF 66 m+3F m + 2 S5 F 22 s+18F m + 3 00 F return to l8th order of Routine A-l I 00 20,000,OOOF 2 x 10 7 x 2~ 59 RT; 8/3/60 DATE November Id, 1953 BY David J Wheeler approved BY J. P. Nash 4i6 APPENDIX 24 ILLIAC LIBRARY DESCRIPTION OF A6: FLOATING DECIMAL ROUTINE AND AUXILIARIES Library Routine A 6 - 154 TITLE: TEMPORARY STORAGE: PURPOSE; ENTRY: Floating Decimal Routine and Auxiliaries (SADOI and DOI - Separate Version for Each) 0, 1, 2 and space 557 - 1023 used by routines. To make available on a single tape Library Routine A 1 and its auxiliaries for use vith a set of interpretive orders . Two methods of entry are possible: (1) If the set of interpretive orders has no directive, entry to Library Routine A 1 consists simply of transferring control to the left hand side of fixed location 428 by the order 26 428N. In this case the interpretive orders will be read in and stored in locations starting at 430) the control transfer will then cause the interpretive orders to be obeyed in the order in which they occur. (2) If the programmer wishes to place his interpretive orders elsewhere in the memory, he must precede them by a directive and the standard entry use of Library Routine A 1. DESCRIPTION OF THE PROGRAM The following routines are included; A 1, A 3, RA 1, TA 1, SA 2, TA 2, SA 3« These are stored in locations defined by parameters S3- 3K. (See below.) The constant-listing auxiliary XA 1 is placed in locations beginning at 944 and the sum check at 902. The parameters S 3 through SK are preset by the program and need not concern the programmer. For entry to auxiliaries, refer to the corresponding routines. Space available for the programmer depends on the entry. If the entry is made by method (l), interpretive orders will occupy locations starting at 430 and locations up to 55^ are available for them. krj ACCURACY PRESET PARAMETERS So the programmer can use locations unoccupied by interpretive orders together with locations from 3 to k2 -'■■) for any purpose he wishes. By the other method of entry, locations 3 to 556 are completely at the programmer's disposal. All routines have the same accuracy, for a given number, as the floating decimal routine. Referring To Floating accumulator Library Routine A 1 Floating Decimal Library Routin- A 3 Number Conversion Routine Library Routine RA 1 Square Root Auxiliary Library Routine TA 1 Sine Auxiliary Library Routine SA2 Exponential Auxiliary Library Routine SA 3 Natural Logarithm Auxiliary Library Routine TA 2 Arc Tangent Auxiliary THE SADOI-DRUM VERSION OF A 6 Like other subroutines on the drum, Ab is callei for by a modified directive, (A6) OOnK. Regardless of the value of n the subroutines comprising Ao are stored in the same locations indicated previously for the Tape-D. 0. I. version of At-. When A6 is called, SADOI automatically presets the parameters in 3 to 10, and the subroutines comprising Ac are then inserted, followed by u two words U?8 22 U28F 50 k2 8F 1*29 26 SU 33 430F Parameter Address S3, 1S3 557, 558 Sh 559 S5 727 S6 75^ SY 770 S8 7 « 822 SK 852 hl& The computer then stops on a 2U10J (sexadecimal) order . It should be noted that the drum version of A6 does not contain XA 1, the Constant Listing Auxiliary. A choice is then available: (1) White switch over the 2 1 4lOJ order. The assembled program is then placed in Williams Memory and a drum bootstrap start begins automatically. Whe.i the white switch is used and the first character on the tape is "0" the D.O.I, is placed in 999-102 3 of the Williams Memory and tape input is resumed. This choice permits use of the Constant Listing Auxiliary (Routine XA l) which will work only with D.O.I, and not with SADOI. It (Routine XA 1 ) should be placed on the tape so that it will be read in by the D.O.I, after use of the white switch. (See B below) (2) Black switch to execute the 2U10J order. SADOI automatically receives the directive 00 U3OK. Tape input begins 6*'-d words of the program are stored, beginning at 4%, until a new dir-'ctiv-- is received. A. .formally, for use with the black switch when the XA 1 is not desired, the program tape is made up in the following manner: J Title 1-hole delay KOK (to obtain SADOI ) (Ab) 00 K Program (with or without dir>ctiv-j 2k 999N 2b 1+23N Al will be^in interpreting at U30. B. Make up of the program tape for use with the white switch when the Constant Listing Auxiliary is desireu. J Title 1-hole delay KOK (A6) 00 K 1+19 Directive (preferably 00 9kkK) Constant Listing Auxiliary Directive (preferably 00 U3OK) Program 2k 999N) With 00 430K directive. If other directive 9fi UpPnI ^ s use( ^ a new en "try to A 1 must be written so it will begin interpreting properly. USE OF LIBRARY ROUTINE Dl (95) Locations from 900 onwards are available for the use of Library Routine D 1. It may be used by blocking orders in Library Routine A 1. If the fourth word (namely, 562) of A 1 is blocked, D 1 will print before each interpretive order is obeyed. The location of this interpretive order is given by the left hand address in location 561. The floating accumulator (557* 558) may be printed at this time. The interpretive order being obeyed appears on the left hand side of the accumulator. A typical specification might therefore be; 562 L Blocking order to 562 100 K Print 100 times 561 S6 Print location of interpretive order 900 SO Print interpretive order being obeyed 557 S5 Print floating accumulator 558 SN Contents ^28 N6 Start program (first method of entry) l«r Rt: 9/2V59 DATE ll/ll/5^ REVISED VTRI PROGRAMMED REVISED BY APPROVED BY REVISED BY APPROVED BX TEUP 10/1V58 BY D.J.Wheeler Lily Seshu J.P.Nash R. Flenner J.N.Snyder ft ttUlH.if-J ti ffl^nHHlMlii