Calculators

Manual / Guide · 1966

Wang LOCI-2 Reference Manual (December 1966)

Read the PDF ↗

The 108-page LOCI-2 reference manual: the W, A and L registers, logarithmic multiplication and division, storage registers, the program counter and card programs, decisions, loops, subroutines, Newton's method, and diagnostics.

Author
Wang Laboratories
Year
1966
Type
Manual / Guide
Credit
Scan: Rick Bensene, Old Calculator Web Museum, oldcalculatormuseum.com.

← Back to the Reference Library

Wang LOCI-2 Reference Manual (December 1966)

L38-66 Clil-2 Reference Manual L 836 NORTH STREET, TEWKSBURY, MASSACHUSETTS 01876 TEL. 617 851-7311 © 1966 ors. FAGE . | 1-2 REFERENCE MANUAL | Copyright December 1966 ‘ WANG LABORATORIES, INC. 836 NORTH STREET TEWKSBURY, MASSACHUSETTS 617 851-7311 138-66 | Wang GF et BRE os LOCI REFERENCE MANUAL Introduction I. The LOCI Machine Functions W - register A - register L - register Program Counter Storage Input/Output Teletype "c" Teletype oy" ("e") i. Programming the LOCI Introductory Notes Branching, Decisions Loops An Example of a Loop The Concept of a Subroutine A Second Example of a Loop, and also a Subroutine Example of An Iterative Process - Newton's Method Il. Appendices ~ Ay Standard Programs B. Operation Code Table C. Diagnostic Operating Instructions D. Diagnostic Programs Summary of Controls A. Switches B. Keys C. Indicator Lamps Wang cl ulevatieies Sue INTRODUCTION The LOCI is a desk-top computer with many unique and flexible features. The power of the LOCI comes from its ability to automatically generate logarithms and exponentials (anti-logs). With simple keyboard operations, it is possible to do not only +, -, and+, but also log X, CALE ond VE. To increase the power of the LOCI, these operations may be linked together by a pro- gram. Thus, those problems which require repeated iteration can be done very readily . The power of the program is considerably increased by the addition of a Decrement Counter and the Store and Restore branch commands. This manual serves to collate together some of the basic operation characteristics of the LOCI. Chapter I deals with the individual machine commands. Chapter II introduces the methods of programming. We note that Chapter II can do no more than simply introduce the idea of programming. The possible combinations in a program are infinite. Chapter III contains some miscellaneous information as an appendix. The final section is a summary of machine functions. Wang id abossbviee i The LOCI-2 is a desk-top computer consisting of the arithmetic processor, the storage registers, the keyboard, and the programming unit. We may visualize its logical organization as in Diagram l. > C }—_55 Pe ee ae $1 Keyboard oe Oaeanen Re | 82 Diagram 1 There are three working registers which are part of the arithmetic unit. The registers are the wrk register, the accumulator, and the lo- garithmic register, abbreviated, respectively, as the W-, A-, and L- re- gisters. All of the algebraic functions are carried out by manipulating the contents of these registers. January 65 Wang ft Tew Inc W-register. The W-register is the only one displayed visually. There are ten decimal digits of storage in the W-register, plus a sign and a one-digit decimal point indicator. In the display, the decimal point lights up in the proper position between the integer part and the decimal part of the number in W. ae We may consider the W-register as the point of input and output for | the LOCI-2. Data is entered into W, one digit at a time, either by a key-stroke or by the equivalent program command. (Henceforth, when we use the word "keystroke", it is understood that we include the equiva- lent program command.) The digits are entered starting at the left-hand, or high-order, end of W. A decimal point may be entered at any time, but only once for a given number. If a sequence of digits is entered without pressing the decimal key, the LOCI-2 tacitly assumes that the decimal point follows the last digit. Example 1. To enter the number 3.1416, simply key the sequence GB] CF] BD) 1H ). Example 2. To enter 64, we need the sequence [6] [4]. Example 3. To enter -32.2, key the sequence 2] G (2) ) . (Note that the [F] key simply changes the sign of W.) January 65 ig Bbvalicts Ee Special Notes. 1. January 65 The range of the display is from 10°? "to 10° 9.3,, (.00000 00001 to 99999 99999). When a number is being entered, the next digit will be blacked out. If the number in W is the result of a computation, i.e., it comes from A or L, the exponent may be beyond the range of the display. When the ex- ponent is between i and 1, the number is within the capacity of W, although no decimal point will be shown. When the number is outside of this last range, the error light will be turned on. The W-register is used in operations involving both A and L. Details may be found under those headings. Wang fe Ls ew Src. Commands involving W. Clear W Prime All arithmetic commands All input commands, including + , -*, and + W—A A—=W W—L L—=W W—=S), So, $3 Sy> So> S3—~ W wW—=DC DC —=— WwW W—= PC PC, DC store with W--=PC Test W= 0 Test W for - sign January 65 Whang Llores Oe A-register. The LOCI accumulator is also called the A-register. It holds the results of additions and subtractions. Thus, when the add key is pressed, the content of W is added to A. The result of the addition is stored in A, while wW retains its previous value. We abbreviate the description as follows, A+ W—eA Likewise, pressing the subtract key results in the following, A - W—eA The capacity of the A-register is identical to that of W, ten decimal] digits with the exponent range between io @ and io There is one important difference: in A, leading zeros are always suppressed. Thus, the number .00001 00000 would be stored as .10000 00000 with an ex- ponent of -4. This clearly increases the precision of intermediate results in A. For example, A may contain .10000 00001 x 1074 after some operation. After an A—®W operation, however, .00001 00000 will be dis- played in W, although .10000 00001 x 104 remains in A. Example. To add 2 and 15. w—A OES Example. To subtract 21 from 16.3. Od & G-4 OY OL. or alternatively, PY Od SOW eO A January 65 Wang chaloontorias, Sue Special Notes. 1. If an operation should cause the result to overflow the range of A, the error light will be turned on. Commands involving A. +- W—eA A=W A-*Sp SgwA Test A for 0 Prime January 65 Whang slabsnalares Src L-register, products, roots, etc. Much of the power of LOCI is derived from the operation of the L-register, and we shall consider it in some detail. This register is used to "accumulate" products, just as the A-register accumulated sums. More precisely, L accumulates the sum of logarithms. Thus, when the [X] key is pressed, the natural log of the number in W is generated and added to the contents of L. We abbreviate this statement as follows: X~L+ In(W)—=L. Other commands in the same class are described below; —-~L- 1n(W)—=L, O~.L + 21n(w)—=L, YOw - 21n(w)—+L, v7 ~L + $1ln(W)—e=L, Yirw L = '1n(W)—=L. After performing the above operations, W is automatically cleared to zeros. Should we be curious to know the value of the number whose log is in L, we may press the in key. This causes the anti-log of L to be generated and stored in W, or, simply - in) (L)—=w. L is cleared to zeros at the end of the operation. We assume that W—+L and L—»W are self-explanatory. Note that L-=W also clears L to zeros. January 65 Wang oh abonalonies, Sue: Example. Example. Example. Example. January 65 Assume that L contains zeros, corresponding to the log of 1, and that we wish to compute 2x3. After keystrokes [2] [x] , 1n(2) is in L. Then, after the keys [B] [x) , 1n(2) + 1n(3) = 1n(6) will be in L. To find the result, simply press fun 4. This displays 6 in W, clearing L to zeros, simultaneously, for the next operation. ) To compute the expression 21 x ie +/9.1, the following sequence is needed: 2 & Oo) @ @ fo] _L) Gl G25 Luy= 4] It is sometimes useful to consider L as con- taining the exponent of e. That is, L cor- responds to the number eb. The examples. below illustrate this concept. To find the value of e. WL) (L contains 1, corresponding to e*.) [un- J (W contains 2.71828 18284.) To find e ©. (1 yw—-b [LN7 (W contains 2.71828 18284.) (W contains -2.71828 18284.) —+L) (L contains -e.) N- (W contains e~& = .06598 8 0310.) Wang Lbcalastes See Example. Example. To find the tenth root of 1024. (19/7024 = 2.) ali {0) [2] [4 “x (L contains 1n(1024).) La=w (W contains 1n(1024).) fx! (L contains Inln(1024).) Hi EH (L contains 1n1n(1024) - 1n(10).) LN (W contains 1n(1024)/10.) {w- =L! (L contains 1n(1024)/10.) iun7 E (W contains result.) to find the llth power of 2. (211 = 2048) (2) Fx! (Lew (W contains 1n(2).) Xx (L contains Inln(2).) a x, (L contains In(11) + InIn(2).) Ln” + (W contains 11 1n(2).) iL (L contains 11 1n(2).) acme | (W contains 211.) Special Notes. January 65 1. The L-register consists of 12 decimal digits of storage and two sign bits. Of the 12 digits, two are for the characteristic, and the re- maining 10 are for the mantissa. One sign bit indicates whether the log is positive or nega- tive, i.e., whether the number e! is greater or less than 1 in magnitude (hence, the L Test command). The other sign bit indicates the sign to be attached to the number e/ when the anti-log is taken. Thus, we may consider the L-register as corresponding to the number se tee . Mmmmmmmmmmn , Wang el besnicbonias Bre January 65 where c stands for a digit of the characteristic and m stands for a digit of the mantissa. With this organization, some interesting anomalies arise in the operation of the machine. These are noted below. As the decimal point position is fixed, leading zeros are not suppressed in L. This is in con- trast with the A-register. As a result, leadiny zeros may appear before the decimal point, when the L—»W operation is performed. Thus, if we key the sequence (3) [x] L-» wl] , the number 01.098 61228 will appear in W, instead of 1.098 61228. Conversely, when the W-» L operation is per- formed, the number in W may be right shifted 1 or 2 digits for decimal alignment. For example, the sequence [.] {I}! W-=Ll, will put 00.100 000000 in L. However, after the operation, 00.100 00000 will appear in W. Note that a loss in precision may result from either the L—-W or the W-»L operation. In the former case, the llth digit of L will be lost, as W has a 10-digit capacity. In the latter case, one or two low-order digits may be I-10 Wang Kalovatories 5 lost to W, while one digit may be lost to L. Assume, for example, that W contains .10000 00011. After a WL, W will retain 00.100 00000, while L will have 00.100 000001. Suppose W initially has 1.1000 00002. Then, gfter a WL, 01.100 00000 remains in W. Meanwhile, L sustains no loss and contains 01.100 000002. 5. The operation of the L-register does not permit its value to exceed the range from -41.999 999999 to +41.999 999999. This corresponds approxi- mately to the interval 10715 to 1015 _ If, in the course of a computation, this range is ex- ceeded, the characteristic will be reset to +40, +41, or +42 in a more or less random fashion. At the same time, the machine-cycles for the of- fending command will be halted, and a residue may be found in W. No error indication will be given, although any attempt to take an anti- log at this time will result in an error signal. Loosely speaking, we may consider the neighbor- hood around +40 as the limit of capacity. Multi- plication by zero leaves L around -41, while division by zero leaves L around +41. Note that, after appropriate scaling to reduce the L value January 65 t-i1l Wang sl abevclorias, Gan to about +23, corresponding to sort? an anti- log operation can again be performed to display a proper number in W. (Cf. Note #3 on the W-register.) The anti-log of a value in the interval from -41 to -23 generates a zero in W. 6. If the number in W is outside the range of L, and a W—=L command is given, the error light will be turned on. 7. In performing x, —, (1, and 1/M, the LOCI abides by the usual sign conventions. For example, (-2)x(-3) = +6, and (-2)x(-3)? = -18. 8. When a negative number is in W and either the fg, or the 14~ key is pressed, the log of the absolute value is generated. 9. The process of generating logarithms and anti- logarithms introduces some round-off and trun- cation errors. In general, each operation may introduce an error in the tenth digit, and oc- casionally the error may propagate to the ninth digit. Commands involving L. Xs —,O, 1/C,7~, 14— tn Ww-—-L L—W Test L for - exponent Prime “ January 65 I - 12 Wang ol id ivalortes Bie Program Counter (PC) The Program Counter, or PC, is a two digit decimal counter which indicates the next program step to be performed (see page II - 2). It may be compared with a ruler that we may use to indicate our position when looking up entries in a finely printed table. When a program is being executed, the PC generally advances automatically by one count after selecting a program command. For example, if the PC were started at value 00, it will automatically run through the sequence 01, 02, 03, ... Since there are 80 steps on a program card, the PC can assume the values from 00 - 79, To provide for a second card reader, there is an "X" bit associated with the PC. To indicate the first card reader, the X-bit is zero, while it is a one to indicate the second reader. Thus, to indicate step 10 in the first reader, the PC has a value of 10, with X equal to 0. To indicate step 10 in the second reader, the PC also has the value 10, but with X equal to 1. Several methods of setting a value into the PC are available, We shall consider them in turn, 1. Po, Py, P2, P3. The operation, or keystroke, Po presets the Pc to 00 in the first reader and runs the program. Similarly, the operations Pj, P27, and P3 sets the PC to 03, 06, and 09 respectively. These keys offer four different ways of starting a program. (See Section II for more details.) April 65 I-13 Wang slalovadaitss a 2. April 65 W—> PC. This command causes the high-order two digits of W to be loaded into the PC. This is done regardless of decimal point position. For example, it W contains either +31000 0000.0 or +3.1000 00000, performing a W =» PC sets PC to 31. If the sign of W is positive, execution of a W -} PC will set the X bit to 0. Conversely if W is negative, the X bit will be set to l. W — XPC. This command unconditionally sets the sign of W to negative, and then performs a W => PC. Thus, W —> XPC unconditionally selects the second reader. Store & Jump. The execution of this command causes the following events to take place: a. PC — PCS, b. DC - DCS, c. W <> PC. For example, if PC, DC, and W contain 10, 20, and 31000 00000 respectively, and a Store & Jump is performed, the numbers 10 and 20 would be stored into PCS and DCS respectively, while the value 31 would go into the PC. Thus, the command stores the values in PC & DC, then changes the PC sequence. Both this command and the next one will be discussed more fully in Section II. I-14 Wang Br ie a Sag April 65 Recall PC & DC. The recall operation exchanges the contents of PC and PCS and also puts the DCS contents into DC. This is abbreviated as follows: Pcs § PC, DCS = DC. One effect of this is to restore a previously stored state into the PC and DC. If, in the example given above, a Recall PC & DC is given soon after the Store & Jump, tne values 10 and 20 would be restored into the PC and DC respec= tively. The diagram below is illustrative: Step Command Step Command 07 3 . 08 1 ° 09 Store & Jum —————} 31 in Gta ME ° ain 35 Restore Again, illustrative examples can be found in Section II. I-15 Whang ssh ch shslortes Inc. Storage The LOCI is available with 2, 4, or 16 storage registers. Each storage register is capable of storing a variable in its entirety, consisting of 10 digits, plus one digit of exponent and a sign. Once a variable is trans- ferred into a storage register, the variable may be read out at any time. It is not erased after being read. The only way to change its value is to transfer another variable into the same register. (We could also unplug the power cord, I suppose.) Consider first the LOCI with 4 storage registers, These registers are christened as S,, Sj, So, and S3 respectively. Their association with the arithmetic registers is shown below: | a -—{_50 _J There are eight commands for transferring values in and out of these registers. 1. Ae- So. The contents of A are transferred into W. A remains unchanged. 2. So-- A. The contents of Sg are transferred into A. So remains unchanged, 3. Wee Sj. The contents of W are transferred into S}. W remains unchanged. 4, Sy-- W. The contents of Sj are transferred into W. S, remains unchanged, May 65 I - 16 Wang Lo bivatines, ieee 5. Wo S». Similar to 3. 6. Som W, Similar to 4. 7. W> S,. Similar to 3. & Sa W. Similar to 4, For LOCI-2a, which has 16 storage registers, the arrangement is as ? follows: : Dal) fet ee fo Poe) ae aes eed = | a | a 83 | | S7 | es } ec Thus, registers S,> Sy, Sg, and Si2 are associated with A, while the other 12 are associated with W. The registers are organized into four groups of four each, Thus Sy - S3 is one group, and the others are S, ~ S7, Sg - S}4, and S}9 - Syg. A Memory Selection Counter (MSC) which can assume the values from 0, 4, 8, or 12 designates which group is currently active. The eight keys described above operate upon the 4 registers in the active group. The following table is descriptive of the method. May 65 I-17 Wang ol ahanaletay Dan MSC _ value 0 4 8 12 A> S, A S, A> Sg A> $12 Soo A Su A Sg A Sy2-9 A w= Sy Ww Ss w= So w= $13 Equivalent S73 W S59 W Som W 8139 W operations W—> So w= S6 W=o Si9 w= S14 “So W Sg W S107 W S14 W w= $3 ws $7 We $11 w= $15 S3—> W S73 W $119 W Sis> W ARNE The MSC is reset to 00 upon execution of a Gt or CLW. It may be stepped to the next higher value by a STEP MSC (Code 10) command. Thus if the MSC has a value of 8, and we push the STEP MSC key, its new value would be 12, The counter will ring around to 00 from the value of 12. Decision Command The decision commands are useful for testing programmed conditions. For flexibility of programming, the LOCI has six decision commands, In executing all these commands, except for TEST ERROR, the PC advances to the next step if the condition is not met while PC advances by 4 counts if the condition is met. In the case of the error condition, the PC May 65 I- 18 Wang shakeralestes Sue advances by 4 counts if there is no error, and it advances by 1 count if there is an error registered. Note that the 3 count gap is exactly what we need to branch to some other point in the program ( See Section ~* II, Page 3 ) 1. Test DC = 0, If DC is zero, advance 4 steps. If not, advance ia 1 step. 2. Test A=0, If A is zero, advance 4 steps. If not, advance ‘ Ay 1 step. 3. Test W= 0, If W is zero, advance 4 steps. If not, advance 1 step. 4. Test W-, If W is negative, advance 4 steps. If it is positive, advance 1 step. 5. Test L-, If the exponent of L is negative, advance 4 steps, otherwise, advance 1 step. 6. Test Error. If the Error Light is not on, advance 4 steps. If the light is on, continue to next step. May 65 I-19 Whang tnbovalosies, See Input/Output Commands The LOCI may be equipped with certain standard input/output devices such as the Teletype Model 33ASR or a column printer. It is also possible to multiplex a number of input devices as well as a number of output devices. We shall consider first the three basic input/output commands. Then the Teletype and multiplex options will be examined in some detail. 1. May 65 WRITE (77). This command sends the contents of the W-register to the output channel. The exponent and sign are sent along with the ten-digit mantissa. On the Teletype unit, for example, a WRITE may cause the W-register contents to be printed as below: +. Wo Wy. . - - Wo DE We b, where Wy... » Wo are the 10 digits of W, and We is the exponent. CR (75). This command is normally used for returning the carriage and spacing an extra line on a typewriter, or simply for spacing an extra line on a colum printer. For other types of devices, the CR command may be used for some other control function, READ (76). The READ command is basically used to input data from external auxiliary equipment. When a READ command is encountered, the following sequence of events occurs: A, Switch control to external device, i.e., don't advance PC any longer. I - 20 Wang i TE Be Sac. B. Read one command from device, oo C. Perform the code read in B as follows: i. If the code is RUN, switch control back to main program in card reader, Thus the card program resumes at the last PC setting, one count after the READ command that activated the tape. ii, If the code is P,, Pj, P2 or P3, set appropri~ ate value (00, 03, 06, or 09) into PC and switch control to the card reader. iii. For any other code (e.g., +, -, x, etc.), execute it and repeat step B. It is clear that this is a very flexible arrangement. Thus the external device may be used as a method of data entry. It may also be used to control a long program. In that case, the loop portion of the program may be put in the card reader to save time. May 65 I-21 Wang oh chovilacies Es Teletype Option C A standard input/output option on the LOCI is the Teletype Model 33ASR. It has four functional features: tape punch and paper-tape reader. output typewriter, input keyboard, paper- The ASA 8-level code convention is followed (see APPENDIX B). 1. May 65 The typewriter is of 80 colum width, and a WRITE (77) command from the LOCI will print 16 digits of the W-register as explained in the Input/Output section. Since a WRITE does not automatically begin a new line, two consecutive WRITEs will print the two numbers on the same line. Up to four numbers may be printed on a line. To begin a new line, we may use a CR (75) command, By using the WRITE and CR commands judiciously, the LOCI can be used to compute and print a table. A switch is available to allow insertion of table headings. The following example shows a tabulation of SIN (X) and COS (X), where X is given in degrees. Xx SINCX) COS¢X) +.0000000000 EO +.-0000000000 EO +-+1000000000 E1 +.1000000000 E2 +41736481769 EO ++9848077526 EO +e2000000000 EQ +43422001541 EO ++9396926233 EO +-3N00000000 E2 +-4999999999 EQ +-48660254N38 EO +e4000000000 E2 ++6427876101 EQ ++7660444429 EO +e5N00000000 E2 +-+47660444442 EQ +46427876101 EO +.e600N00N000 E2 +-8660254038 EO +-4999999999 EO +e7000000NNO F2 +49396926211 EQ +43420201441 EO +.e8000000000 E2 +-9848077540 EQ ++1736481769 EO +#.9000000000 E2 +-19000000N00 £1 +-N0N000N0NN00 EO I = 22 el abinilocies Sas 2. 3. May 65 Used as an input source, the Teletype keyboard becomes a second source of manual control, similar to the LOCI keyboard. Every Teletype key corresponds to a LOCI operation, (cf, APPENDIX B). F Each LOCI operation is printed upon the associated Teletype key. Note that a record of the operations performed is printed 8 when the Teletype keyboard is used for control, S$ The paper-tape punch may be used to record either a program or ‘. printed data or tape, An independent switch governs the punch. 3 When the switch is on, a WRITE will punch the contents of W on tape as well as print it on the typewriter. In the off position, only the typewriter is operated. The paper tape reader can be operated as an input device, either for a program or for data, We can understand this most readily by considering it as an extension of the keyboard or card reader. Each LOCI operation code is represented by a unique Teletype 8-level code. Appendix B gives the correspondence, For example, pushing the O key on the LOCI is equivalent to reading the tape cone 1010 0110. Whenever a READ is encountered in the card program, control is Stress Analysis - LOCI Program Flat Circular Disk switched to the paper-tape reader. Conversely, when the tape reader e ‘ encounters a RUN, P,, Pj, Po or Ps, control reverts back to the card program, (Note Input/Output section p. I = 20.) We may note oe: at this point the special case when data is punched on paper tape to be read by a card program. In that case, each data point can be punched simply as a numeral with a decimal point, Following the r last digit of each point, there should be a command to terminate I - 23 Wang ol nbesatories Dac the read, This must be one of the following RUN, Py, Pj, P2 or Pa. Exactly which one depends on the program, naturally. Consider the following sample program which simply has the loop: A) read a data point; B) add it to the accumulated sum; C) print the sum; D) repeat A). Step _No. Command 00 READ 01 + 02 Aa W Card Program 03 CR 04 WRITE 0S Po A typical set of four input points on tape may be as follows: 1011 0010 1010 1110 1011 0010 1011 0011 1011 1010 1010 1110 CR = deed 1011 0000 1011 0100 1011 0101 1011 0110 Tape input auro 1011 1010 1011 0101 1010 1110 1011 0910 1011 0001 2S ns o uw May Wang 7 eee Be Baus RUN 1011 1010 6 1011 0110 . 1010 1110 1 1011 0001 RUN 1011 1010 STOP 1011 1111 The program may be started by first pushing the PRIME key, then pushing the PB key. After reading each of the numbers 2,23, 0456, 5.21, and 6,1, the program will print the subtotal and read the next code, After printing the last sum, it will read the STOP code and halt. May 65 I - 25 Wang ol abovalories Jouce L28 - 65 LOCI Option "h" ("e") Teletype 33ASR The option “e" Teletype is designed for a greater versatility than option "c", which is superceded by this new model. As in the original model, the Teletype has a typewriter, paper- tape reader and paper-tape punch. Important improvements are incorporated: the ability to format the typewriter output, the ability to read the punched output, and the ability to type alphabetic data on the typewriter. Output-Ty pewriter un Physically, the Control Unit for the "e" version is external to the LOCI. Control of the Teletype printer (72 columns) from the LOCI is effected by the LOAD Output Multiplex command. As illustrated below, there are two output channels and an input channel . "e"Control Unit ‘ormat pul) LOCI * Laelia sipiit Channel Teletype P<——[La—<— — — — -- eA ___—_ To select a channel, we put a one-digit channel designating number, with a "—" sign, in the W-register and send it to the "e" Control Unit by a LOAD Output Multiplex Command (OMX35). This establishes the channel connection and all subsequent WRITE (11) commands will address the channel until a new channel is selected by the OMX command. Channel Functions Channel 1 is assigned to the Format Control Register. When Channel 1 is selected, and a WRITE is given, this register stores the first three high-order digits of W (WWW XX XXXXX) for controlling the format of subsequent typewriter output. The first digit W,, specifies the number of digits preceding the decimal point, the second digit W1 controls the number of digits after the decimal point, and the last digit W2 indicates the number of words of data printed on a line be- fore an automatic carriage return is given. An example given later will be illustrative. The same format holds for subsequent WRITEs until the register is reloaded. The typewriter is on Channel 2. After an OMX (35) for Channel 2 has been given, a WRITE (11) will send the contents of W to the typewriter. The output format is as follows: eee Lace, Me ge ‘ W, W, Format Control S — sign of number, + or - ; = — blank space if number is positive; (S3) if number is negative, This is a non-printing code which will be converted to a + code. 1- 26 ry A P) Wang ol abovabontas, Ine. L28 - 44 es cS — A non-printing code ($6) which will be translated into a RUN code; & — blank space. Note that the number of digits before and after the decimal point are governed by the Format Control register . Consider the following example. Assume that we wish to print a table of two columns. Each number is to have three places before the decimal point and four places after. The Format Register may be loaded as follows: 1 21 Select = ee Channel 1 : OMX 3 3 23 3-4-2 into 4 24 Format 2 22 Register Write 35 Suppose that storage registers S}, Sg, $3, and Sg contain 5, 98.73465128. 7.5 and -104 7500000 respectively. To print these out under control of the above format we may use the following instruction sequence: | 2 21 Select | : 33 Channel 2 OMX 35 SI—W 53 Write SI WRITE 11 ey Write $2 a i tl Write $3 | WRITE 11 SOA 51 Aw 45 Write SO WRITE 11 leer Wang cl ulowalinies Suzi L28 - 66 =3.= The two lines of output would appear as follows on the typewriter: +44 5.00004 & +A%98.7346 24 +4 47.5000A A - 104.75004 4 Note that the carriage return is automatic. If at this point, we should give a CR (75) command, we would naturally double-space after the last line. An explicit CR(75) command will start a new line, regardless of whether the current line is terminated or not. It also resets the count at the beginning of the line so that the first number after a CR always is printed at the beginning of a line. While it takes a few instructions to set-up a format, this may be done on a separate set-up card or a strip of tape. Thus, no program steps will be wasted in the body of the program itself. This set-up may be done manually from the Teletype keyboard by striking those keys corresponding to the LOCI commands when the keyboard is in control of the LOCI. In the example above, we may simply strike the following keys: LOCI Teletype Command Key ] 1 + ; er OMX = 3 3 4 4 2 2 WRITE ) There is also a Channel 0. When this channel is selected, a WRITE command simply causes 17 spaces to be generated on the tyoewriter and the paper tape. This offers an addi- tional means of format control . Output - Paper Tape The paper tape punch is mechanically linked in parallel to the typewriter. It can be engaged by pushing down the key marked "on", and disengaged by pushing down the key marked "off". The keys are located directly above the punch unit. | - 28 Wang aeslelies Sos 28 = 46 =-4- REL OFF a= / im B. SP. ON ———— Because of the way in which the punch is linked to the typewriter, everything appearing on the typewriter will be punched when the punch is "on". The code used by the Model 33A SR is the 8-level ASA Cll code. Pushing the "REL" key will allow the paper to move freely. Each time the "B. SP" key is pushed, the paper moves back by one line. Input - Paper Tape The model "e" Paper -tape reader is activated by a READ (76) command in the LOCI. Once a READ has been given, control of the LOCI is transferred to the tape reader and remains there until a RUN, Po, P1, P2, or P3 code is encountered. Then the control reverts back to the card readers just as if the corresponding key is pushed manually . Once the tape reader is in control, it may operate in one of the followirg three modes: Mode 0, for program input. This means that all codes punched on the tape are sent to LOCI. The typewriter is inactive unless a WRITE is given Mode 1, for data input. This means that all codes are blocked except the cigits 0-9," .",";",and":". Note that these codes correspond to the numbers, decimal point, the "+" command, and the RUN commana. Again the typewriter is inactive until a WRITE is given. Mode 2, for typing headings. In this mode, no codes are sent to the LOC!, ana the typewriter is activated. Thus, all of the lines ounched on the tape are printed, including alphabetic information. Once the reader is ina particular mode, it remains in that mode until it receives a control code to change into a new mode. In Teletype code, these codes are given by Tape Channel Teletype Mode Code 8) 7 6 5 AS 2 Keys 0 se 1 0-0. SO oe iCtr.) (X) ] $1 M50! 05 Or Oat (Ctr) 1% 2 $2 Te OS Oe i hes O) ch, O iCtr. (Z) |=2? ] Vang ji TEU c. y. L28 - 66 eel The (Ctr.) key is similar to the (Shift) key, and assigns a new code to the keys X, Y and Z. The control code can be given either from the tape itself or from the Teletype keyboard. Control Switches on CU-3 The Teletype CU-3 control unit has several switches. 1. Power ON-OFF - This switch turns the power either on or off. It controls the power on all of the outlets on the CU-3. 2. Tape - Keyboard - This switch is used to select whether the tape reader or the keyboard is used to control the LOCI. Normally in the running of a program, the tape reader ison. However, sometimes it is desirable to control the system from the keyboard. This occurs when we want to manually change the reading mode of the LOCI. For example, we may be running a tape program in Mode 0. As men- tioned earlier, the keyboard is inactive in this mode. It may be desirable, how- ever, to re-punch part of the program because an error has been discovered. The only way to release the keyboard is to turn on the keyboard control switch . 3. Normal - Step - This isa tape reader control switch. When the switch is on "Normal", the tape reader will operate normally. That is, it will automatically sequence through the codes on the tape as described earlier. If the switch is on "Step", the tape reader will stop after sending one code to the LOCI. That is, we must press the "READ" key once for each line of code punched on the paper tape. This mode is used mostly to check-out tape programs. | - 30 Wang obaleiatontea ee Programming the LOCI. A simple LOCI program may be considered as an extension of some keyboard operations. That is, we merely think of the sequence of keys that must be pushed to perform a calculation, then write it down on a piece of paper. This constitutes a primitive program. For example, the sequence of keystrokes required to calculate e~2+1 would be In the same way, a program to compute e~*, where X is any number in W, is simply = W-——L ty71 Stop While we may call these sequences of symbols as programs, they are not in a form communicable to LOCI. By searching in the "dictionary", - we may find the LOCI-2 code corresponding to each of the keystroke symbols. The code may then be punched upon a program card. To punch the code upon a program card, break the digits of the code into the sum of 40, 20, 10, 4, 2, and 1; then punch a hole at each marked position which is needed to make up the sum. For example, the code for W——L is 46, which is equal to 40+4+2. It is, therefore, punched as follows: O° mm January 65 = 1 Whang shadivateltax Wis. The LOCI-2 codes for the above programs are: Step Step No. Command Code No. Command Code 00 2 22 00 + 33 ol : 16 01 Yael 46 02 1 21 02 uwnsl 14 ’ _ 03 # 33 03 Stop 37 04 W-=L 46 05 wt 14 06 Stop 37 When a program is punched upon a card, each conmand in the program occupies one numbered step. At any instant during the execution of the program, the Program Counter indicates the step to be next performed. For example, let us assume that at some point the PC value is 21; then the command punched at step 2] will be performed next. In the two il- lustrations above, the programs occupy steps 00-06 and 00-03. Thus, if the machine is in the AUTO mode, and if the Po key is activated, the PC will advance by one count after selecting each command. When the Stop code is sclected, the PC will advance no further until it is activated again, manuajly, from the keyboard. This may be accomplished by pushing any one of the P buttons, or by merely pushing the Run key, which will start the program from the existing PC position. Januar: 65 1d} 2 Whang ol nbarabontes, Se Changing the Program Sequence. While the PC generally advances one count at a time, it is possible to break this somewhat monotonous sequence and branch abruptly to some non-contiguous step. The command W-»PC accomplishes this by shifting the first two left-hand digits of W, regardless of decimal point position, into PC. For example, suppose that W contains the number 31000 00004, and that PC just selected step number 22, where we find the code for W-» PC. At the completion of this operation, we would find 31 deposited in PC, instead of 23. The next command, of course, would be taken from step 31. A command such as W-»PC gives the flexibility of branching from anywhere in the program to anywhere else. Making Decisions. The LOCI-2 has six commands which are used to make decisions. These are the test commands which are used to check for the existence of certain conditions. In general, if the condition exists when the command is executed, the PC value will be advanced by three additional counts. Otherwise, it will be advanced by one, as usual. Consider the operation to test DC for 0. Suppose that the command were found at step 72 (i.e., PC was at 72). Then, if DC contains aJl zeros, PC is increased by three extra counts to 76. Otherwise, if DC were not zero, PC is increased by the normal one count to 73. The diagram below is illustrative. January 65 Li 23: Wang chaboralones soe Step No. Command Code 72 DCT 70 | 73 5 25 74 8 ' 30 | 75 W—=PC 40 pc # 0 76 S-—-W 53 . . »- DO=0 Another decision command deserving special attention is the test for negative exponent in the L-register. This offers a way of checking the magnitude of numbers, as the exponent will be negative if the number corresponding to the L-register value is less than one in magnitude. As. an illustration, assume that L has some unknown value, and we wish to establish if it corresponds to the natural log of a number greater than 10°", The following sequence of steps may be used: Step No. Comma nd Code 00 1 21 01 0 20 02 0 20 03 40 06 04 Test L 74 05 3 23 | 06 5 25 Zi 07 W—-PC 40 le“| 1074 e-| € 1074 NOTE: L denotes value of L before multiplication by (100)? January 65 Il - 4 Whang ah ahinalades, Sue. Programming a Loop. A program loop is generally understood as a section of program, or a sequence of commands, which may be repeatedly performed. That is, the PC runs through the sequence a successive number of iterations. A simple example of a loop is as follows: Step No. Command Code 10 1 21 1l 0 20 12 W—-+PC 40 ° Thus, steps 10 and 11 put "10" in W, and step 12 puts this in PC, which brings us back to step 10. An even "tighter" loop is given below: Step No. Command Code 10 1 21 | ll 2 22 12 Ww -PC 40 O In this example, steps 10 and 11 put "12" in W, and step 12 puts this in PC. Thus, the program is stalled forever at step 12! Non- terminating loops such as these are generally neither intentional nor desirable. A constructive program loop usually has some provision for making a decision so as to break away from the circle. Consider the following ‘example which computes (11!): January 65 Il - 5 Step No. 00 ol 02 03 04 05 06 07 08 09 10 ll 12 Comma nd Prime ony 1 W—= DC EN DC—=W x Decrement DC Test 0 4 W-—=PC SS ty7l | Stop Comment Set 11 in DC Ee 20 Sse cee RES? we Subtract 1 from DC, and test if it is zero. DC not zero, go to step 04 for another iteration. DC is zero, display result and stop. The next example checks for the magnitude of a number N, whose log is in L. January 65 Assume that we know |N|> 1. Step No. 24 Command Clear A | =~ kor + L test 5 W—>PC .y AW Stop II - 6 Wang ol abovatortis Sine. The idea behind the program is quite simple: divide the contents of L repeatedly, until the result corresponds to a number less than 1 in magnitude. We count the number of divisions by adding 1 to A every time a division is performed. When the characteristic of L becomes negative, then A contains the correct count of magnitude. At this point, the PC will be set to step 34, after performing the "L test" command. January 65 ‘6 Ce f Wang RN aN Sot An Example of a Loop (The SIN (X) Program) We can calculate the function SIN (X) by using a truncated Taylor series as follows: x? 5 13 a> Se en SIN) = X= Sp Frm ee hay (1) This can be re-written as follows: 2 2 2 2 2 x awk De ape SIN OO = Xmas lm goe + toga Oo taxa) @) The value X, in radians, can be put into a storage register. If we refer to the program $100, we find that the loop for the program es