Digital PDFs
Documents
Guest
Register
Log In
DEC-08-XINPA-A-D
December 2000
417 pages
Original
19MB
view
download
Document:
intrPgm 75
Order Number:
DEC-08-XINPA-A-D
Revision:
Pages:
417
Original Filename:
https://svn.so-much-stuff.com/svn/trunk/pdp8/src/dec/dec-08-xinpa/dec-08-xinpa-a-d.pdf
OCR Text
A . ‘ i . 3» . < ‘. O 3- A ‘ x l .1 , I I": ‘ 1 ‘ >3 ,‘-,. . "v “ x , J- . H ’ .h‘ . . . a . _ ~ ._ . y . ".4.. \ n.2,. "#4l V 5. . i . g. . 1 ‘ introduction to programming Chapter 1. 2. 3. COMPUTER PROGRAMMING FUNDAMENTALS Computer Fundamentals Programming Fundamentals Elementary Programming Techniques ON-LINE OPERATIONS 9'1" System Description and Operation Loading, Editing, and Debugging ADVANCED PROGRAMMING TECHNIQUES 9.“? Input/ Output Programming DECtape Programming Floating-Point Packages Eflfifllfifl '~ . - programming ‘ prepared by small systems soFtware ' , - documentation group digital equipment corporation pdp-s handbook series First Edition, January 1969 Second Printing, July 1969 Second Edition, September 1970 Third Edition, May 1972 Fourth Edition, September 1973 Fifth Edition, April 1975 The and availability of the software products de— scribed in this manual are subject to change without notice. The availability or performance of some features of the software prod— ucts may depend on a specific configuration of‘equipment. Consequently, DEC makes no claim and shall not be liable for the accuracy of the software products. Distribution of software products shall be in accordance with the then standard policy for each such software product. description ‘ Copyright © 1970, 1971, 1972, 1973,1975 Digital Equipment Corporation following are registered trademarks of Digital Equipment Corporation, Maynard, Massachusetts: The DIGITAL CDP KAI 0 . COMPUTER DNC EDGRIN LAB LAB-8 PS/ 8 QUICKPOINT ‘LAB-S/e RAD-8 RSTS COMTEX EDUSYSTEM LAB-K COMSYST FLIP CHIP OMNIBUS RSX 08/8 RTM DDT g FOCAL DEC GLC—S DECCOMM IDAC DECTAPE IDACS DIBOL INDAC 7 p SABR PDP 7,; a PHA 4 ’I‘XPESET 8. UNIBUS Foweord As few as five years ago, the suggestion that a computer or com- puter—based system could be readily available to users at all levels of technical knowledge and ability still evoked surprise and concern among many. To help convey our position that programming a minicomputer was not a restricted undertaking, we introduced in January of 1969 our first major handbook dealing specifically with the fundamentals of machine and assembly language program— ming on a minicomputer—Jntroduction to Programming. Since , that time, the demand for this handbook by users in every field and occupation, experienced programmer and novice alike, has clearly proven the value of such a book. - ' In addition to Introduction 1‘0 Programming, we include several other volumes in our PDP—S handbook series. The Small Com— puter Handbook provides extensiVe technical information concern- ing hardware options, interfacing, system operation and installation planning; this handbook is invaluable to those who will develop and maintain a minicomputer installation. The EduSySrem Handbook contains a complete self-instruction course in the use of the BASIC programming language, plus user guides to each of the existing EduSystems—systems designed specifically for classroom use. Finally, the. forthcoming OS/ 8 Handbook will present comprehensive information dealing with DEC’s complete computer system for the PDP—S—OS/ 8. OS/ 8 provides the programmer with an extended library of system programs, including a text editor, octal debugging program, assemblers, loaders, and FOR- TRAN IV. , Once again, I wish to thank all programmers, writers, teachers and students who have contributed to , our handbooks Through continue producing extensive low- cost your support gramming information for PDP-8 computers. we can pro— MK/% Kenneth H. Olsen ' President, Digital Equipment Corporation ' iii . ERROR REPORTING If you find any questions errors or comments in this handbook, or if you have anyfl concerning the clarity or completeness-of this handbook, please direct your remarks to: Digital Equipment Corporation Software Communications, Parker Street Maynard, Massachusetts 01754 IntroduCtion to Programming is DEC’s introductory computer programming handbook. The first five chapters provide a thorough V explanation of computer mathematics and an introdiJction to machine language and assembly language programming and to the basics of program loading and error correction (debugging). The experienced programmer may choose. to skip the first five chapters and begin .reading the Advanced Programming Techniques described in Chapters 6, 7, and 8. These chapters describe input/ output (I/O) programming techniques, DECtape programming techniques, and DEC’s floating-point packages. BINARY ARITHMETIC The binary number system is the basic concept behind digital . . , 7 computers. The.numbers 0 and 1 can easily be substituted for the two physical states associated with computer hardware: a switch is either on (1) or ofi (0), an area in the computer’s memory is. either magnetized (1) or not magnetized (0). In computer pro- gramming terminolOgy, the binary digits 0 and 1 are sometimes called bits (binary digits). Binary numbers are the machine language of computers. All computations, no matter how complex, performed by digital computers are made in binary arithmetic; therefore, students of computer programming must be thoroughly familiar with the binary system before they can begin to write pro- Chapter 1 and part of Chapter 2 provide an excellent introduction to binary arithmetic. grams. ASSEMBLY LANGUAGE PROGRAMMING Since it is quite burdensome to write programs in strings of 12-bit binary numbers (called words) an assembly language was developed. Assembly language enables the programmer to substi— tute English-like mnemonics for the binary numbers. For example, V . the mnemonic J MP (for jump) is interpreted by the computer as the 12-bit binary number 101 000 000 000. The three bits in each of the four groups are given the octal values 4, 2, and 1,. reading from left to right, so that if all three bits of a group were set to 1 (111), the octal value would be 7- (4+2+1=7). Thus the octal value for JMP is 5000 (101‘ binary =4+0+1 octal 101 000 000 000 5 0 0 0 ' = 5). Assembly language programming is discussed in Chapters 2, 3, and 5. PDP-8/ E SYSTEM DESCRIPTION AND USE The programs presented in this handbook are designed to run on a PDP-S/E computer. The PDP-8/ E and the peripheral equipment which comprises the PDP—S/E' system are described in detail in Chapter 4. The program commands which cause the PDP—8/E to accept data from one of its peripherals or to send data to one of its peripherals are called input/ output commands. Input/ output com— mands are discussed in Chapter 6. One of the most important peripheral devices is the DECtapev unit. The DECtape unit serves as an auxiliary magnetic tape data storage facility. DECtape is easier to use than ordinary computer magnetic tape because it allowsthe user to store information atw fixed positions which may be directly addressed. DECtape pro—, gramming is presented in Chapter 7. DEC’s floating-point packages provide for easy performance of operations such as addition, subtraction, multi-V plication, and division,- while maintaining a high? degree of precision. Floating-point numbers represent quantities in the form of a fractional number multiplied by the number base 10 (for decimal) with an exponent (e.g., 12 .12x102). Floating—point representation is a great help to computer programmers because it allows them to use and save very large and very small numbers by saving only the significant digits and computing an exponent to account: basic arithmetic = vi . , trailing zeroes. The floating-point packages are fully explained in Chapter 8. ‘for leading and COMMON PROGRAMMING TERMS Such words as loop, jump, nesting, and array have special mean— ings to computer programmers. Familiarity with these terms is prerequisite to an understanding of the information presented in this handbook. The Index/Glossary at the end of the handbook defines many of the commonly used computer programming terms. vii CHAPTER 1 Introduction COMPUTER FUNDAMENTALS ‘1-1 ........................................ The Computer Challenge. 1-1 ................................................ Computer Applications Computer Capabilities and Limitations Number System Priiner 1-2 ...... 1—4 .......................... .1-5 .................... Binary Number System Octal Number System .., 1—6 ................................................. Arithmetic p Operations Logic Operation Primer The AND Operation The OR Operation ........... ". 1-29 .......................................... 1-29 . ..... ....... ................................. ........................................ .................................... .............................................................. ....... I. ................................. .................................................................. ........................................................................ ............................. Computer Data Formats Characters .................................... ...................................................... .................................................... Number Representations 1-30 ‘ - ....................... Memory Unit Input Unit Output Unit 1-23 _. ................................ ' General Organiza'tion of the PDP-8 Control Unit ................................ .............................................. The Exclusive OR Operation Arithmetic Unit 1-18 1-20 ........................................... ........... Alphabetic 1 -15 ....................................... ................................. Negative Numbers and Subtraction Multiplication and Division . _ 1-11 ...................................................... Fractions .; ‘ p ' .................................................. ix _ , 1-30 1-31 1-32 1-32 1-3’3 1-33 1-,33 1-34 1-34 1-34 ‘ PROGRAMMING FUNDAMENTALS CHAPTER 2 Program Coding Binary Coding :. Octal Coding Mnemonic Coding 2-2 .................................................................. 2-2 ................................................................ 2-2 .................................................................... 2-3 ............................................................ ‘ _ PDP-8 Organization and Structure Input and Output Units Arithmetic Unit Control Unit ...... i x ' 2-5 ........................... ..... .................... ........................................................ 2—5 ........ 2-6 2-7 .................................................................. 2-8 .......................................... 2-9 ................................................................................ TAD 2-9 ................................................................................ DCA 2-10 ................................................................................ JMP 2-10 ................................................................................ 2-10 .................................................................................. JMS 2-12 ................................................................................ ' ‘ Addressing PDP-8 Memory Pages Indirect Addressing 2-13 .......................................................................... 2-13 .................................................... ................................................ Operate Microinstructions Group 1 Microinstructions Group 2 Microinstructions 2-15 '. 2-18 .................................................. __ Mi'croprogramming . ' Memory Reference Instructions 182 ........................ .................................................................... Memory Unit AND 2-4 ‘ ........ 2-18 .............................................. ‘ ...... 1 ....................... 2-21 ................ , 2-23 .............................................................. Combining “MiCroinstruetions ............. ,. Illegal Combinations Combining Skip Microinstructions . .; “’7—23 ....................... ................................... ...' ‘ 72—23 ................... 2-25 ‘ Order of Execution of Combined MicroinstructiOns‘ Exercises .......... ................... , CHAPTER 3 2-26 ........ _ 2-28 t .............................................. ELEMENTARY PROGRAMMING TECHNIQUES ' ‘ Programming Phases .................................................... ...... ‘ ‘ 3-2 ‘ Flowcharting ........................................................... x: gm. ....... 3-3 Example 1—Straight—Line Programming Example 2—eProgram—Branching 3-4 ........................ p 3-4 ............................. Coding a Program Location 3-6 ‘ ............ ................................................ Assignment ................ ................... . Symbolic Addresses Symbolic Programming Conventions ‘....'. 3—6 .............. ........................................................ Programming Arithmetic Operations Arithmetic Overflow Subtraction V 3-10 .................................. ' 3-11. ......... 3-13 ....................................... ........................... . PoWers of Two Writing Subroutines ........... Address Modification l 3-13 ........................... 3-14 ...................................... .......................... '. 3-7 3-8 .............................. ........................................... Multiplication and Division Double-Precision Arithmetic “ 3-16 ..................................... 3-16 ................................................ 3—l9r_ ........................................................ ' Inserting Comments and Headings ' Looping a Program Autoindexing l .................................... ....... , 3-27 3-29 ....................................................... Program Branching 3-30 A ....................... ....................................... 3-34 ......................................................................... CHAPTER 4 _ 3-24 p ............................................................. Program Delays Exercises ........... 3-22 ...... ................................ SYSTEM DESCRIPTION AND OPERATION Programiner’s Console Operation Manual Program Loading ......... 4-1 ................ ' 4-6 ........................................ ............ i ‘ Keyboard/ Printer Console Devices Teletype Operation Teletype Control Knob Teletype Keyboard Teletype Printer Teletype Paper Tape Reader Teletype Paper Tape Punch Generating a Symbolic Tape ....................... ............. .............................................................. 4-9 4-10 4—11 ............................................ ' .............................. ............................ .............................................. ............ ........... 4-12 4-13 4-13 4-14 ....... xi ........ 4—14 Paper Tape Formats Paper Tape Loader Programs ............................. 4-15 .......................................... 4-18 Peripheral Equipment and Options Unit High- Speed Paper Tape Reader and Punch Extended Memory DECtape System 4- 18 ...................................... A-18 ............ ......... ..................................... 4—20 ...... ‘ 4—21 ................................................... DECdisk Systems Extended Arithmetic Exercises 4—23 ...................... Element 4-24 ........................................ 4-24 .............................................................................. CHAPTER 5 Introduction LOADING, EDITING AND DEBUGGING 5-1 ........................................................................ i Loaders ‘5-1 ................................................................ ................ RIM Loader 5-2 Binary Loader Self-starting Binary Loader M18—E Hardware Bootstrap 5—5 .................................................................. 5-9 ......... 5—9 ............................................ Symbolic Editor Introduction 5-11 .................................................................. 5-11 .................................................................... Modes of Operation Command Structure 5 -12 ' ............... ......................................... .................................... 5-13 .................................................. 5-18 Special Characters and Functions Switch Register Options Command Repertoire 5-19,“ ......... , ' ......................... ............................. 5-28 ................................................................ 5—35 Operating Procedures Error Messages 5—12 ........................................................ Example of Use Summary of Editor Operations 5—35 .............................................................. ............ 5-38 ........................... ' ............................................................ 5-42 .................................. 5-42 Debugging Programs Debugging Without DDT or ODT Debugging With DDT 5-43 .......................... , ............................. p Loading DDT Symbol TableeTapes Storage Requirements ................................. ; .................................. ................................................ . ....... 5-43 5-44 5-48 xii ' 5-48 Definitions Mode Control .: Program Examination andModification Example Program Debugged......-. Command Summary 5-49 ....... ............................................. 5-50 ........................ ................................... 563» _. 5-65 ....................................................... Internal Symbol Table " 5-67 ............................. .............._. ........ ‘ ‘ » Debugging With ODT Features 5-68 ........................................................ 5—68 ......................................................................... V Using ODT .f Operation and Storage 5 -69 ' .................. ..................................... ............. Commands . ' Additional Techniques ............ .......... .................. 541 CHAPTER 6 5-80A ......................................... ......... . \ Programming Notes Summary Introduction 5—69 ' .......... ...................................................................... Command Summary 5—82 .......................................... 5-83 ...................... .......................... INPUT / OUTPUT PROGRAMNIING ................................. , 6-1 ...................................... Programmed Data Transfers 6-2 ...................... ‘ IOT Instruction Format Checking Ready Status 6-2 .................................................. 6-3 .................................................... ' - Instruction Uses 6-3 ................................................ .............. ' ASCII Code 6-4 - ................................... Programming the Teletype Unit Keyboard/ Reader Instructions. Printer/Punch Instructions Format Routines ‘. ................ 6-4 ....................... ,6‘-4 ........................................ 6-6 .............. 6-8 ................................................ Text Routines 6-8 ........................ Numeric Translation Routines 6-11 ..................................... Program Interrupt Facility Programming an Interrupt Multiple Device Interrupt Programming A Software Priority Interrupt System Multiple Interrupt Demonstration. Program .................................................. 6-22 , 6-24 .............................................. - ........................ Data Break ..... .......................................................................... Accessing Data . ................................................................ xiii 6-28 6-30 6-31 6-407 6—40 ‘ Data Break Single-Cycle Cycle Stealing 3—Cycle Data Break ................................................ .................................................................. Exercises ............................................ .............................................................................. CHAPTER 7 Introduction DECTAPE 6-40 6—42 642 6-43 PROGRAMMlNG ........................................................................ Data Blocks .......... 7—1 7-1 M Data Channels Standard .............................. ...................................... 7-2 7-2 DECtapes DECtape Control Unit ........................................................ DECtape Status Registers Status Register B Status Register A ‘ .............. ...................................... ............................................................ ............................................................ DECtape IO’I‘ Instructions .................................................. Programmed DECtape Operation Use of the DECtape Flag ........ , ...... .................................................... 7-4 7—4 7-6 7-6 7—9 7-11 7-13 ' Selecting Direction A ........................................... ................... 7 —14 .................................................. 7 ~14 Reversing Direction ........ , r Accessing Data Blocks ................. ......... Allocating Storage Areas .................................................... Programming for Error‘Conditions Programming for Interrupts IDTAPE Subroutine .................................... 7—15 7-15 7 -16 .......................................... .. ..... 7~16 ............................................................ 7 -17 , ................................................. 7-19 ..................... 7—20 ........................................................ 7—21 DECtape System Software DECtape Subroutines ‘ ..... DWAIT Subroutine ........... SEARCH Subroutine‘ ' .......................................... ............ xiv 7-21 READ and WRITE-Subroutines .................................... DECtape copy Program DECtape Formatting Program .............................. ........................................ DECtape Library System The Directory Using the Library System TCOI Bootstrap Loader .................. .................................................... ............. ‘. ‘ .................................. .............. a ......... ...................... ................... 7-25' 7—26 7-27 7 ~28 ................................................. 7-327-33’ 7-34 FLOATING-POINT PACKAGES CHAPTERS 8-1 Introduction Assembly Instructions ................................. . ...................... Floating-Point Notation Normalization ...................................................... .................................................................. Number Representation .................................................. Using the Floating-Point Package Floating Input and Output User Subroutines Floating Switch Floating Halt .............. ‘ ........... ................................... Use of F182 and Auto-Indexing .................................... ............................................................ ................................................................ 8-2‘ 8-4 8-5 8-6 8-7 8 -17 8-20 8—22 8-26 ' .......................................................... ........ ' 7-23 7—31 ........... ....... TDS-E DECtape Subroutine Assembly Parameters Calling Sequence 7—22 Single Instruction vs Interpretive Mode ................................ 8-27 8—27 i Error Traps ............................ ......................... ...... ............. _ Extended Function Algorithms ‘ ............................................ Execution Time for EAE Operations .............................. ExecutiOn Time for EAE Extended Functions Execution Time for Non-EAE Operations ................ ................... Accuracy of Extended Functions Core Storage Maps .................................... .......................................................... Summary of Floating-Point Instructions Memory Reference Instructions Expanded Instructions ............................ ........................................ 8-31 8-35 8—36 8-36 8—37 8-38 8-40 8-40 ’ ......................... .......... XV ’8-29 8-41 APPENDIX A Answers to Selected Exercises ' ...................... ........................ A-l . APPENDIX B Character Codes B-l .......................................................... ........ s ‘ APPENDIX C Flowchart Guide C-l ......... APPENDIX D , PDP-S Instruction Set D-l - ........................................... ............... ' APPENDIX E Read-In Mode Loader Binary Loader E-l .............................................. ...................................................................... . E-3 » ‘ APPENDIX F Miscellaneous Tables ........, ........................ F—1 APPENDIX G Digital Equipment Computer Users Society xvi ........................ G—l ' - Fndaa-umentls j computer Fundamentals programming Fundamentals —__ ' elementary programming techniques _ — _ ' computerFUndamentals INTRODUCTION During the past 20 years, the computer revolution has dramatically changed our world, and it promises to bring about even greater changes ‘ . in the years ahead. The general purpose, digital computers being built today are much faster, smaller and more reliable and can be produced at lower cost than the earlier computers. But even more significant breakthroughs have come in the many new ways we have learned to use cemputers. The first big electronic computers were usually employed as super calculators to solve complex mathematical problems that had been im- possible to attack, before.- In recent years, computer programmers have begun using computers for non-numerical operations, such as control systems, communications, and data handling and-processing. In these Operations, the computer system processes vast quantities of data at high speed. The Computer Challenge that a computer can be programmed to do any problem that can be defined..The key word here is defined, which It has been said problem can be broken down into a series of steps that can be Written as a sequence of cemputer instrucmeans that the solution of the tions. The definition of some problems, such as the translation of natu— ral languages, has turned out to be very difficult. A few years ago it thought that computer programs Could be written to translate French into English, for example. As a matter of fact, it is quite easy to translate a list of French words into English words with similar meanings. However, it is very diflicult to precisely translate sentences because of the many shades of meanings associated with individualwas words and word combinations. For this reason, it “is not practical to 1—1 . try to communicate with a computer using a conventional spoken lan' ' guage. While natural languages are impractical for computeruse, program- . ming languages, such as FOCAL, ALGOL, and FORTRAN with their precisely defined structure and syntax, greatly simplify communication with a computer. Programming languages are problem oriented"~and contain familiar words and expressions; thus, by using a programminglanguage, it is possible to learn to. write programs after a relatively short training period. Since most computer manufacturers have adopted standard programming languages and implemented the use of these,languages on their computers, a given program can. be executed on a large number of computers. PDP—8 programmers use FORTRAN and ALGOL—8 for scientificand engineering problems and use FOCAL—8 and BASIC—8 for shorter numerical calculations. Computer languages have been developed for programmed control of machine tools, computer typesetting, music composition, data acquisition, and many other applications. It is likely that there will be many more new programming languages in the future. Each new language development will enable the user to more easily apply the power of the computer to his particular problem or task. Who can be a programmer? In the early days of computer program— ming, most programmers were mathematicians. However, as this text illustrates, most programming requires only an elementary ability to handle arithmetic and logical operations. Perhaps the most basic re— quirement for programming is the ability to reason logically. The rapid expansion of the computer field in the last decade has 1 . :made the resources of the computer available to hundreds of thousands of people and has provided many new career opportunities. Computer Applications A computer, like any other machine, is used because it does certain tasks better and more efficiently than humans. Specifically, it can reinformation and process it faster than a human. Often, this speed means that weeks or months of pencil and paper work can ceive . more method requiring only minutes of computer time. Therefore, .computers are used when the time saved by using a combe replaced by a puter offsets its cost. Further, because of its capacity to handle large volumes of data in a very short time, a computer may be the only means of resolving problems where time is of the essence. Because of the advantages of high speed and high capacity, computers are being. used more and more in business, industry, and research. Most com- puter applications can be classified as either business uses, which usually. 1-2 - rely upon the computer’ s capacity to store and quickly retrieve large - amounts of information, or scientific uses, which require accuracy and speed in performing mathematical calculations. Both of these are performed on general purpose computers. Some examples of computer, applications are given below. Solving Design Problems. The computer is a very useful calculating tool for the design engineer. The wing design of a supersonic aircraft, for example, depends upon many factors. The designer describes each of these factors in the form of mathematical equations in a program- ming language. The computer can then be usedto solve these equations. Scientific and Laboratory Experiments. In scientific and laboratory experiments, computers are used to evaluate and store information from numerous types of electronic sensing devices. Computers are particularly useful in" such systems as telemetry where signals must be quickly recorded or they are lost. These applications require rapid and accurate processing for both fixed conditions and dynamic situations. Automatic Processes. The computer is a useful tool for manufacturing'and inspecting products automatically. A compUter may be programmed to run and control milling machines, turret lathes, and many other machine tools with more rapid and accurate response than is humanly possible. It can be programmed toinspect a part as it is being made and adjust the machine tool as needed. If an'incoming part is defective, the computer may be programmed to reject it and start the next part. _ ' Training by Simulation. It is often expensive, dangerous and impractical to train a large group of men under actual Conditions to fly a commercial airplane, control a satellite, or operate a space vehicle. A computer can simulate all of these conditions for a trainee, respond to his actions, and report the results of the training. The trainee can therefore receive many hours of on-the-job training without risk to himself, others, or the expensive equipment involved. - Applications, such as those given above often require the processing of both analog and digital information. Analog information consists of continuous physical quantities that can be easily generated and controlled, such as electrical voltages or shaft rotations. Digital information, however, consists of discrete numerical values, which represent the variables of a problem. Normally, analog values are converted to equivalent digital values for arithmetic calculations to solve problems. Some computers, such as the LINC-S, combine the analog digital characteristics in'one computer system. 1-3 . Computer Capabilities and Limitations A computer is a machine and, as all machines, it must be directed and controlled in order to perform a useful task. Until a program is prepared and stored in the computer’s core memory, the computer “knows” absolutely nothing, not even' how to receive input. Thus, no matter how good a particular computer may be, it must be “told” what to do. The usefulness of a computer therefore can not be fully realized until the capabilities (and the limitations) of the computer are recognized. Repetitive operation—A computer can perform similar operations thousands of times, Without beeOming'bored, tired or careless. Speed—A computer processes information at enormous speeds, which are directly related to the ingenuity of the designer and the programmer. Modem computers can solve problems millions of times faster than a skilled mathematician. , Flexibility—General purpose computers may be programmed to solve many types of problems. Accuracy—Computers may be programmed to calculate answers with a desired level of accuracy as specified by the programmer. Intuition—A computer has no intuition. It can only proceed as it is directed. A man may suddenly find the answers to a problem without working out the details, but a computer must proceed as ' ' ordered. The remainder of this chapter is devoted to the general organization of the computer and the manner in which it handles data. Included are the number systems used in programming together with the arithmetic and logical operations of the computer. This information provides a of com— desire a basic background for necessary all who appreciation 'puters and their uses, and it is a prerequisite to machine-language" programming, coVeredin chapters 2 through 5. 1—4 ‘ NUMBER SYSTEM PRIMER , The concept of writing numbers, counting, and performing the basic. operations of addition, subtraction, multiplication, and division has been directly developed by man. Every person is introduced to these concepts during his formal education. One of the most important ‘ ,. development was the invention of the decimal» factors in scientific - numberng system. The system of counting in units of tens probably developed because man has ten fingers. The use of the number 10 as the base of our number system is not of prime importance; any standard unit would do as well. The main use of a number system in early times was measuring quantities and keeping records, not performing mathematical calculations. As the sciences developed,- old numbering ' . systems became more and more outdated. The lack of an adequate numerical system greatly hampered the scientific development of early ‘ ‘ civilizations, ' = Two basic concepts simplified the operations needed to manipulate numbers; the concept of position, and the numeral zero. The concept" of position consists of assigning to a number a value which depends. both ‘ on the symbol and on its position in the whole number. For example, the digit 5 has a different value in each of the three numbers 135, 152, and 504. In the first number, the digit 5‘has its‘original value 5; in the second, it has the value 'of 50; and in the last number, it has the value of 500, Or 5 tirnes 10 times 10. Sometimes a position in a number does not have avalue between ‘1 and 9. If this position were simply left out, there would be no difference in notation between , 709 and 79. This is where the numeral zero fills the gap. In the number 709, there are 7 hundreds, 0 tens and 9 units. Thus, by using the i concept of position and the numeral 0, arithmetic becomes quite easy. A few basic definitions are needed before proceeding to see how .77 these concepts apply to digital computers. ' Unit—The standard utilized in COunting separate items is the unit. Quantity—The absolute or physical amount of units. Number—A number is a symbol used to represent a quantity. Number System—A number system is a means of representing All numbers. modern number systems use quantities using a set of the zero to indicate no units, and other symbols to indicate quan—I tities. The base or radix Of a numbersystem is the number of symbols it contains, including zero. For example the decimal number. system is base or radix 10, because it contains 10 different symbols (viz., 0,1,2,3,4,5,6,7,8,‘ and 9)., I - 15 , Binary Number System The fundamental requirement of a computer is. the ability to physi- cally represent numbers and to perform operations on the numbers thus represented. Although computers which are based on other num— ber systems have been built, modern digital computers are all based the binary (base 2) system. To represent ten different numbers (0,1,2, 9) the computer must possess tenidifierent states with which to associate a digit value. However, most physical quantities have only two states: a light bulb is on or off; switches are on or 06; holes on . . . , ‘ in paper tape or cards are punched or not punched; current is positive ‘f or negative; material is magnetized 'or demagnetized; etc. Because it can be represented by only two such physical states, the binary number system is used in computers. To understand the binary number system upon which the digital computer operates, an analysis of the concepts underlying the decimal number system is beneficial. POSITION COEFFICIENT In the decimal numbering system (base 10), the value of a numeral depends noon the numeral’s position in a number, for example: 347 : 3x-100=300 10: 40 4x 7x 1: 7 327 The value of each position in a number is known as its position coeflicient. It is also called the digit position weighting value, weighting value, or weight, for short. A sample decimal weighting table follows: . 103 102 101 10° and, as shown above, 347:3 X 102+4 X101+7X100. Weighting tables appear to serve no useful purpose in our familar deci— mal numbering system, but their purpose becomes apparent when we consider the binary or base 2 numbering system. In binary we have only two digits, 0 and 1. In order to represent the numbersl to 10, we must utilize a enunt-and—carry principle familar to, us from the decimal 1-6 system (so familiar we are not always aware that we use it).‘To count from 0 to 10 in decimal, we count as follows: \OOQONUI-h-WNl—‘O with a carry to the 101 colum 10 Continuing the counting, when we reach 0 in the units column again, carry another 1 to the tens column. This process is continued until the tens column becomes 0 and a 1 is carried into the hundreds column, we as shown below: - 0 10 90 1 11 91 2 12 13 92 93 94 95 96 97 3 4 5 14 _ '15 - _ 6 16 7 17 8 18 19 20 9 10 one carry 98 . 99 . ' 100 two carries one carry COUNTING IN BINARY NUMBERS In the binary number system, the carry principle is used with only two digity‘symbols, namely 0 and 1. Thus, the numbers used in the binary number System. to count up to a decimal value of 10 are the following. ‘ ' ' ' Binary Decimal O (0) (1) (2) 1 , \ ' 10 11 (3) 100 (4) (5) 101 Decimal Binary . 110 111. 1000 , p . 1001 1010 _ ' When using more than one number system, it is customary to subscript numbers with the applicable base (e.g., 1012:510) 1-7 (6) (7) (8) (9) (10) . ” used to convert binary numbers to the A weighting table is familiar decimal system 24 2‘3 22 21 20 1 0 l O l lI (Weight Table) (Binary Number) Digit more Position Coefficient = 1 X l = l : O X 2 Z 0 = I X 4 : 4 = O X 8 2 0 = 1 X 16 : 16 Decimal Number .—: 21 It should be obvious that the binary weighting table can be extended, like the decimal table, as far as desired. In general, to find the value of a binary number, multiply each digit by its position coeflicient and then add all of the products. ARRANGEMENTS OF VALUES " By convention, weighting values are always arranged in the same manner; the highest on the extreme left and the lowest on the extreme right. Therefore, the position coefficient begins at l and increases from right to left. This convention has two very practical advantages. The first advantage is that it allows the elimination of the weighting table, as such. It is not necessary to label each binary number with weighting values, as the digit on the extreme right is always multiplied by l, the digit to its left is always multiplied by 2, the next by 4, etc. The second advantage is the elimination of some of the Os. Whether a 0 is to the right or left, it will never add to the value of the binary number. Some Os are required, however, as any US to the right of the highest valued l are utilized as spaces or place keepers, to keep the ls in their correct positions. The 0s to the left, how ever, provide no information about 0001010111: be discarded, thus the number and the may number 1010111 The PDP-8 family computers operate upon 12-bit (binary digit) numbers. This means that the numbers from 0 to 1111111111112 (409510) can be directly represented. SIGNIFICANT DIGITS The “leftmost” 1 in a binary number is called the most Significant digit. This is abbreviated MSD. It is called the “most significant” in that it is multiplied by the highest position coefficient. The least sig- nificant digit; or_ LSD, is the extreme right digit. It may be a l or 0, and has the lowest weighting value, namely 1. The terms LSD and 1—8 - ' MSD have the same meaning in the decimal system as in the binary sys- tem, as shown below. 1 . 1 MSD 0 1 0 , Ulb—dl-d OBQLSD 0 0 0 1 4 ._ 0 1 1 3 9 7,1 CONVERSION OF DECIMAL TO BINARY There are two commonly used methods for converting decimal num-. bers to binary equivalents. The reader may choose whichever method he finds easier to use. ' 1. Subtraction of Powers Method—To convert any decimal number to its binary equivalent by the subtraction of powers method, proceed ' as follows. Subtract the highest possible power of two from the decimal number, and place a “l” in the appropriate weighting position of the partially ~ completed binary number. Continue this procedure until the decimal number is reduced to 0. If, after the first subtraction, the next lower power of 2 cannot be subtracted, place a 0 in the appropriate weighting position. Example: '42,, ? = 42 _ ——32 *— 10 _ binary ~- 10 2 8 —2 2 0 . 25 24 23 22 21 Power 2O _ 32 1 l6 8 4 2 1 Value O 1 0 1 O Binary - . Therefore, 4210 2. Division : 1010102. Method—To convert a decimal number to binary by the division method, proceed as follows. Divide the decimal number by 2. If there is a remainder, put a 1 in the LSD of the partially formed binary number; if there is no remainder, put a 0 in the LSD of the binary number. Divide the quotient from the first division by 2, and repeat the process. If there is a remainder, 1—9 record a 1; if there is no remainder, record a 0. Continue until the quotient has been reduced to 0. Example: 4710 = ?Binary Quotient , . Remainder ' EIJZJE’IEQ N Therefore, 4710 = .23 1 11 1 5 1 2 1 1 0 0 1 1011112. EXERCISES Decimal—to-Binary Conversion numbers to their binary equivalents. a. l 510 11. 12. 1 8m p—a P.“>‘.°‘E-":‘>.WE\’T‘ 4210 1 00m 2 3 5m _ 14. 15. 1 10 16. 29410 1 1 7m 8 610 409010 17. 18. '19. 20. 1967” Binary to Decimal Conversion numbers to their decimal equivalents. b. 9°9SAPE’N‘N“ 1102 1012 11101102 10111102 01101102 111112 10102 1101112 9. 10. 11. V . 12. 13. 14. 15. 16. Convert the following decimal 4095m 1502m 377m 501m 828m 907m 4000m 3456.0 2273” 13. ' —— ' —- Convert the following binary 110110111012 1110001110012 1110101101002 1111111101112 1010110101012 1111112 0001010012 1111111111112 1-10 ‘ Octal Number System probably quite evident at this time that the binary number system, although quite nice for computers, is a little cumbersome for human usage. It is very easy for humans to make errors in reading and writing quantities of large binary numbers. The octal or base 8 numbering system helps to alleviate this problem. The base 8 or octal number system utilizes the digits 0 through 7. in forming numbers. The count—and-carry method mentioned earlier applies here also. Table 1-1 shows the octal “numbers with their decimal and binary equivalents. It is Table 1—1 Decimal-Octal-Binary Equivalents. L Decimal Octal Binary Decimal 0 0 0 7 7 111 1 1 1 8 10 1000 2 2 10 9 11 1001 3 3 .11 10 12 1010 4 4 100 11 13 1011 5 5 101 12 _14 1100 6 6 110 13 15 1101 . Octal , Binary The octal number system eliminates manyof the problems involved in handling the binary number system used by a computer. To make the 12-bit numbers of the PDP—8 computers easier to handle, they are often separated into four 3- bit groups. These 3-bit groups can be represented by one octal digit using the previous - seen below. Abinary number is table of equivalents as 11010111101 separated into 3-bit groups by starting with the LSD end of the number and supplying leading zeros if necessary: . 011010111101 The binary groups are then replaced by their. octal equivalents: 011.; 3. 0102: 25 11 12: 78 1012: 53 and the binary number is converted to its octal equivalent: 3 2 7 5. Conversely, an octal number can be expanded to a binary number using the same table of equivalents. ' - 53078: 101 011 1—11 000 111. . OCTAL-TO-DECIMAL CONVERSION Octal numbers may be converted to decimal by multiplying each digit by its weight or position coefficient and then adding the resulting products. The position co‘eflficients in this case are powers of 8, which is the base of the octal number system. Example: 2167i: ‘.7 decimal 7X8027X 1: 21678:: 8: +6><81=6>< 64: +l><82:1>< +2 X 83 2: 2 X 512 = 7 48 64 +1024 1143 Therefore, 2167g :' 114310. DECIMAL-TO-OCTAL CONVERSION There are two commonly used methods for converting decimal num- bers to their octal equivalents. The reader may choose the method which he prefers. SUBTRACT ION OF POWERS METHOD. The following procedure is followed to convert a decimal number to its octal equivalent. Subtract from the decimal number the highest possible value of the form a8”, where a is a number between 1 and 7, and n is an integer. Record the value of a. Continue'to subtract decreasing powers of 8 (recording the value of a each time) until the decimal number is reduced to zero. Record a value of a=0 for all powers of 8 which could not be subtrac- ted. Table l—2tmay’ be used to convert any number which can be represented by 12—bits (409510 or less). Appendix F contains a similar ' table forceneerting larger numbers. Example: _ 259110 2 ‘2 octal I 2591 —2560:5><83:5><512 31 31 74 A— l f 0:0xs2zox — 54 r ll 3X81: 3 7 7 7X80:7><1 0 Therefore, 259110 :2 l5037 50378. 1-12 ' Octal-Decimal Conversion Table 1-2 Position Coefficients 3:3: 7 (Multipliers) 5 ' Position/ 8n . 2 1 0 1 5 4 3 6 i 7 y lst (230)11 0 1 2 3 _‘4 5 32 6 _7 40 48 56 256 320 384 448. 2,048 2,560 3,072 3,584 - ~ 2nd (81) 0 8 16 24 3rd (83) 0 64 128 192 4th (83)} 0 512 1,024 1,536 - DIVISION METHOD. A second method for converting a decimal number to its octal equivalent is by successive division by 8. Divide the decimal number by 8 and record the remainder as the least significant digit of the octal equivalent. Continue dividing by 8, recording the re— mainders as the successively higher significant digits until the quotient is reduced to zero. Example: 13761, = ‘2 octal . Quotient 8)1376 Remainder '0 172 i _ ‘ 87—172 21 8)21 2 8T2 0' 4 . ‘ ' 5 h 2—1 2 - Therefore, 137610 : 2540,. 1—13 I 5 4 0 EXERCISES 3. . Convert the following binary numbers to their octal equivalents. 1. 1110 2.. 0110 3. 111 4. 1011111011 5. 6. 7. 100000 8. 011000 9. ' 110111110 . 11000111 10111111 10. 111111111111 11. 010110101011 12. 13. 111110110100 010100001011 14. 000010101101 15. 16. 110100100100 010011111010 b. Convert the following octal 354 2. 736 3. 15 4. 10 5. 7 6. 5424 7.307 8. 1101 9. L. q '10. 11. 12. ' 4 c. 14. 15 16. 70 64 7777 7765 3214 4532 fln3 1243 1 Convert the following decimal numbers to their octal equivalents. 1. d. 13. numbers to their binary equivalents. 796 7. 1080 2. 32 8. 1344 3. 4037 9. 4. 580 10. 5. 1000 11. 6. 3 12. 1512 3077 4056 4095 Convert the following octal numbers to their decimal equivalents. 7; 7773 8. 7777 9. 3257 1000 10. 4577 1200 11. 0012 742 12. 0256 1. 17 2. '3. 4. 5. 37 6. . 734 . 1—14 Fractions The. binary and octal number systems represent fraCtional parts Of numbers in a similar manner to the decimal system. Furthermore, frac— tions may be converted from one number system to another by the same techniques developed for converting whole numbersBefore investigating the mechanics of fraction conversion, consider what a fraction is. A fraction is a number between 0 and 1, or a number less than a unit. Until now only whole numbers in the following Octal. In three systems have been considered: decimal, binary, and each of these systems, the position of the symbol in the number denotes fl its power, and the symbol is the coefficient of that power. These are positive powers. For example, in the decimal system the number 598, 5 isthe coefficient of 102, 9 is the coefficient of 101, and 8 is the coeffi- cient of 10°. In binary and octal the same rule applies to using the powers of the base of the system. When working with fractions, important point to keep in mind is that fractions contain coefficients of negative powers, with the radix point being the dividing line between the non—negative and negative powers of the number system being used. Any number to, the immediate right of the radix point has a power of negative (minus) 1. The first digit of the fractional number is the MSD. For example, in an the decimal fraction .637; 6 is the coefficient of 101, 3 is the coeflicient of 102, and 7 is the coefficient Of 10's. The coefficient of a nega— tive pOwer of the base is actually the numerator of a proper fraction . ‘ whose denominator is the positive power of that base. For example, .610 (6 X 101) is equivalent to 6 divided by 101. or 6/10, and also .38 (3' X 8—1) is equivalent to 3 divided by 81 or 3/8. It should be ap— parent that this general rule applies to any base that may be considered. Table 1-3 contains proper fractions which have been changed to deci- mal, binary, and octal for comparison purposes. CONVERTING DECIMAL FRACTIONS - TO BINARY AND OCTAL FRACTIONS SUBTRACTION OF POWERS METHOD. One method of converting a decimal fraction to a different number system is the subtraction of powers method. In this method, subtractions of the highest possible negative power of a number in another system that is contained in the decimal fraction, are performed. In each subtraction, recording the power and itS coefficient gives the equivalent number in the other sys— “tem. When no subtraction is possible, a 0 is recorded. To convert a decimal fraction to a binary fraction, the powers of 2 are associated 1-15 Table 1-3 Fraction Equivalents Proper Decimal Octal Fraction Equivalent Equivalent Binary Equivalent ’ 1 ' 1/ 2 .5 .4 .1 1/ 4 .25 .20 .01 .125 .0625 .10 .001 .04 .0001 1/ 8 1/ 16 ‘ 1/32 1/64 1/ 128 1/ 256 .03125 .02 .00001 .015625 .0078125 .003 90625 .01 .000001 .004 .0000001 1/512 .001953125 1/ 1024 .0009765625 .002 .001 .0004 .00000001 .000000001 .0000000001 with coefficients of 0 or 1, since they are the only coefficients used in this system. In the octal system, the coefficients 0 through 7 are used. The following example and explanation will show the conversion of the decimal fraction .5625 to binary. .0625 ——.0625=2‘4 .5625 ——.5000‘:2‘1 .0000 .0625 , Negative Powers of 2 Decimal Equivalents 2-1 2-2 2‘3 2'4 .5000 .2500 .1250 .0625 1 0 O 1 V Bit Values of Answer : .1001 The largest negative power of 2 contained in the decimal fraction .5625 is 2'1, which is equivalent to decimal .5000; subtract .500010 from .562510 and record a l in the 2‘1 column. It is not possible to subtract 2’2 from the remainder, so record a 0 in the 2‘2 column, 2‘3 cannot be subtracted from the remainder, so record a 0 in the 2‘3 column; 2‘4 can be subtracted from the remainder, so record a 1 in the 2‘4 column. Thus, the binary equivalent of a decimal .5625 is .10012. Conversion to octal fractions follows the same procedure, but more than one subtraction of a given poWer of the base is possible; The number of times this subtraction is possible yields the coefficient of that particular power of the base. This method will not bejdemonstrated here, since it is very cumbersome, and easier methods are available. 1-16 VMULTIPLICATION METHOD. This method of conversion is fre—' quently used to change from a decimal fraction to another base. To convert, the decimal fraction is multiplied through by the base of the system being converted to. For example, convert decimal fraction .5625 to binary. Multiply the decimal fraction by 2. Since a whole number is obtained, recorda 1 in the 2‘1 column, discard the whoie number portion of the number, and multiply the remainder by 2 again. No whole\ number is obtained, so record a 0 in the 2‘3 column, and multiply the result by 2. No whole number is obtained, so record a 0 in the 2"” column, and multiply by 2 again. A whole number is obtained, so record a 1_ in the 2‘4 column. The remainder, nowreduced to 0, completes the conversion, and .5625“, is .10012. The following examples show the conversion just described, and the same decimal fraction converted to octal. Decimal to Binary Decimal to Octal .5625 - .5625 ' 2 8 - ' 4.5000 1.1250 . 2 8 p , .44<-——"- 4.0000 0.2500 , 2 i ‘ p 0.5000 , 2 .1001<—— 1.0000 CONVERTING BINARY AND OCTAL TO DECIMAL FRACTIONS EXPANSION METHOD. This method can be used in converting frac- tions from any base to a decimal fraction. Remember that the MSD is the first digit to the right of the radix point in a fractional number, and that it is multiplied by the base to the r—l power. The second digit is that digit multiplied by the base to the -2 power, etc. For example, to convert the binary fraction .10001 to decimal, proceed, as follows. The (2-1) or 1/2, the second digit is 0 X (2‘2) 0r 0, the third digit is 0 X (23) or 0, the fourth digit is 0 X, (24) or 0, and the fifth digit is 1 X (2‘5) or 1/ 32. The binary numbers are multiplied by the respective powers and added together to get the answer. Thus 1/2 + 1/32 which is 16/32 +1/32 equals 17/32 or ,5312510. MSD is 1 X 1-17 ' The octal fraction .42 can be converted in the same manner, asfol- lows. The MSD is 4 X (8‘1) or 4/8-and 2 X (8‘2) or 2/64. The fractions are now added together to get the result; 4/8 + 2/64 or 16/32 + 1/32 :2 17/32 or .5312510. If you look carefully at the binary fraction .100012 and divide it into groups of 3 to convert to octal, you can see that .100012 does equal .428. Zeros may be added to the right of a fraction without changing the vaIUe. “SHORT CUT”¢METHOD. This is another method of converting frac— tions from another base to decimal. In this method, start at the LSD of the fraction and proceed to the MSD of the fraction, counting the powers of the base, the next higher power of the base will be utilized as a common denominator. The number is assumed to be a whole num- ber for counting purposes. The number .100012 would be converted as follows: .1 O 24 2.3 O 22 0 l 21 20 ' The MSD is 24 or 16, so the common denominator is the next higher power of 2, or 32. The numerator is converted as if it were a whole number. The result is then 17/32 which is .5312510.The same method with the octal fraction .42 should yield the same result. .4 2 81 8° The MSD is 81, or 8, so the common denominator is the next higher power of 8, or 64. Multiplying the digit values by the powers of the base and adding the products gives us the value of the numerator; thus, 4 X (81) —f— 2 X (8") : 34, and the fraction 34/64 equai‘s 531251... Arithmetic Operations with Binary and Octal Numbers Now that the reader understands the conversion techniques between the familiar decimal number system and the binary and octal number systems, arithmetic operations with binary and octal numbers will be described. The reader should remember that the binary numbers are used in the computer and that the octal numbers are usedas a means of representing the binary numbers conveniently. BINARY ADDITION Addition of binary numbers follows the same rules as decimal or other bases. In adding decimal 1 + 8 we have a sum of 9. This is the highest value digit. Adding one more requires the least significant digit 1-18 to become a 0 with a carry of 1 to the next place in the number. Simil-_ arly’, adding binary 0 + 1 we reach the highest value a} single digit can have in the. binary system, 51nd adding one more (1 + 1) requires a; carry to the next higher power (1 + 1__ 10) Take the binary numbers — 101 + 10 (5 + 2). 101 I +010 2 111 2. 510 210 710 _ 1,1 + 0 :1, and 0 +1: 1 with noicarries required. The answer is 111, which is 7. Suppose we add 111 to 101. O + 1 : 1 1 <—-carries 111 =2 +101 : 1100 = 710 510 1210 Now 1 + 1 :: 0 plus a carry of 1. In the second column, 1 plus the carry 1 : 0, plus another carry. The third column is 1 + 1 : 0 with a carry, plus the previous carry, or 1 + 1 + 1 is equal to 1 X 2"" + 1 X 22 or 8 + 4 : : 11, Our answer 1100 12, which is the correct solution for 7_ + 5. OCTAL ADDITION Addition for octal numbers should be no problem if we keep in mind the following basic rules for addition. If the sum of any column is equal to or greater than the base 1. of the system being used, the base must be subtracted from the sum to obtain the final result of the column. 2. If the sum of any column is equal to or greater than the base, there Will be a carry to the next column equal to the number of times the base was subtracted.- If the result of any column is less than the 3. base, the base is not subtracted and no carry will be generated. Examples: 58 Z +,33 I 510 310 "—8" — 3 , 1 8 To. 6 58 3s 10 8 = : , 2910 5110 —8—8 = ‘81, _ 1 2 '1-19 0,, = 80,, Negative Numbers and Subtraction Up to this point only positive numbers have been considered. Negative numbers and subtraction can be handled in the binary system in either of two ways: direct binary subtraction or by the two’s comple_ ment method. BINARY SUBTRACTION (DIRECT) Binary numbers may be directly subtracted in a manner similar to decimal subtraction. The essential differenee is that if a borrow is re- quired, it isequal to the base of the system or 2. 110 : _‘101 : 001 = 610 510 110 To subtract 1 from 0 in the first column, a borrow of 1 was made from the second column which eflectively added 2 to the first column. After the borrow, 2 1 : 1 in the first column; in the second column 0 0 : 0; and in the third column 1 1 : 0. The same‘numbers ——~ —— which —— using the twos complement method are subtracted directly in the following example. were subtracted 011 001 B 100 010 ’ 010 010 010 111 A 000 111 001 011 B-A TWO’S COMPLEMENT ARITHMETIC To see how negative numbers are handled in‘the computer, consider mechanicai register, such as a car miieage indicator, being rotated backwards. A Sedigit register approaching and passing through zero a ' would read the following. 00005 00004 00003 00002 00001 00000 99999 99998 etc . 1-20 It should be clear that the number 99998 corresponds to —2. Fur- ther, if we add 00005 99998 1 00003 andignore the carry tothe left, we have effectively performed the operation of subtracting 5=—2=3 The number 99998 in this example is described as the ten’s complement _ of 2. Thus in the decimal number system, subtraction may be performed by adding the ten’s complement of the number to be subtracted. If a system of complements were to be used for representing negative — numbers, the minus sign could be omitted in negative numbers. Thus all numbers could be represented with five digits; 2 represented as 00002, and —2 represented as 99998. Using sucha system requires that a convention be established as to what is and is not a negative number. For example, if the mileage. indicator is turned back to 48732," is it a negative 51268, or a positive 48732? With an ability to represent a total of 100,000 different numbers (0 to 99999), it would seem reasonable touse half for positive numbers and half for negative num— bers Thus, in this situation, 0 to 49999 would be regarded as positive, and 50000 to 99999 would be regarded as negative. In this same manner, the two’s complement of binary numbers are.» used to represent negative numbers, and to carry out binary subtraction, in the PDP- 8 computer. In octal notation, numbers from 0000 to 3777 are regarded as positive and the numbers from 4000 to 7777 are re— garded as negative. The two’s complement of a numberIs defined as that number Which ' when added to the original number will result in a sum of zero. The binary number 110110110110 has 001001001010 as a two’s complement equal to shown1n the following addition. 110110110110 001 001 001 010 - l 000 000 000 000 The easiest method of finding a tWo s complement is to first obtain the one ’s which formed by setting each bit to the opposite complement, value. IS 101 000 110 111 010 111 001 000 Number . Onescomplement of the number 1-21 V The two’s complement of the _ number is then obtained by adding 1 to the one’s complement. 110001 001 001 11.0 010 110 001 110 001 +1 Number One’s complement of the number Add 1 110 Two’s complement of the number 101 Subtraction in the PDP-8 is performed using the two’s complement method. That is, to subtract A from B, A must be expressed as its two’s complement and then the value of B is added to it. Example: 010 010 010 111 101 001 Two’s complement ofA 011 001 100 010 B 1 000 111 001 011 B—A 101 (carry is ignored) A 101 . OCTAL SUBTRACT ION Subtraction is performed in the octal number system in two ways ‘ which are directly related to the subtractions in the binary system. Sub- traction may be performed directly or by the radix (base) complement method. OCTAL SUBTRACTION (DIRECT). Octal subtraction can be per- formed directly as illustrated in the following examples. 3567—2533: ? 2022—1234: ? 3567 —2533 —1234 1034 0566 2022 Whenever a borrow is needed in oetal subtraction, an 8 is borrowed as in the second example above. In the first column, an 8 is borrowed which is added to the 2 already in the first column and the 4 is sub>~~traeted from the resulting .10. lathe secondtcolumn, an .8. is borrowed, and added to the 1 which is already in the column (after the previous borrow) and the 3 is subtracted from the resulting _9. In the third column the 2 is subtracted from a borrowed I (originally a borrowed 8), and in the last column 1——1:0. EIGHT’S COMPLEMENT ARITHMETIC. Octal subtraction may be performed by adding the eight’s complement of the subtrahend to the minuend. The eight’s complement is obtained in the following manner. 3042 4735 +1 473 6 Number Seven’s complement of the number Add 1 to seven’s complement to obtain Eight’s' complement 1-22, , The seven’s complement of the number is obtained by setting each digit of the complement to the value of 7 minus the digit of the number, as seen above. The eight’s complement of the number is then obtained by adding 1 to the seven’s complement. To prove that the complement is intact a complement, the number is added to the complement. and a re— sult of Zero and an overflow of 1 is obtained. ' 3042 - +4736 - 1 0000 The following example uses the eight’s complement to subtract a number. 3567—2533: ? 2533 5244 Number Seven’s complement +1 5245 Eight’s complement 3567 Minuend .Eight 3 complement of subtrahend +5245 (carry is ignored)-—>l 1034 Difierence Multiplication and Division1n Binary and Octal Numbers Though multiplication in computers is usually aChieved by means other than formal multiplication, a formal method will be demonstrated as a teaching vehicle. BINARY MULTIPLICATION In binary multiplication, the partial product is moved one position to the left as each successive multiplier is used. This is done in the same _ ‘ manner as . in decimal multiplication. If the multiplier is a 0, the partial product can be a series of 0s as in example 2, or the next partial product can be moved two places to the left as in example 3, or three places as in example 4. Example 1. 46210 127m . Multiplicand Multiplier 3234 First partial product 924 Second partial product 462 Third partial product _ 2 58674 Product 1-23 Example 2. 1110110.; 1011;;~ 1110110 1110110 0000000 1110110 101000100102 Example 3. 11101102 10112 - 1110110 1110110 1110110 101000100102 Example 4. 11001110: 110012 11001110 11001110 11001110 10100000111102 Because of the difficult binary additions resulting from multiplications such as the previous examples, octal multiplication of the octal equivalents of binary numbers is often substituted. OCTAL MULTIPLICATION Multiplication of octal . numbers is the same as multiplication of decimal numbers as long as the result is less than 108. Obviously this could be a problem if it weren’t for the fact that an octal multiplication table can be set up, similar to the decimal multiplicatiOn table, to make " muitiplieatien of ectal numbers quite simple Table l- 4 is a partially completed octal multiplication table that will be quite use- the‘ job of ful once you have filledin the blank squares. Using the completed octal multiplication table, the following prob- lems may be solved. 22613 X 128 = ? 2265; X 128 454 226 27348 1-24 "nbg<wi:? - ’ 12478x3058 _ 6503 0000 3765 405 203i ' Table 1-4‘ 0 2 1 - Octal Multiplication Table 3 4 5 6 7 0 a . 0 0 0_ 0 0 0 0 0 0 1 0 1 2 3 4 5 6 7 2 0' 2 4 6 10 _3 0 3 6 11 14 7 16 25 - 4 5 6 0 7 BINARY DIVISION Once the reader has mastered binary. subtraction and multiplication, binary division is easily‘learned. The following problem solutions illustrate binary division. ' ‘" ' ' Divide 100102 10.; 1001 ‘ 10 510010 10 100102 18m : _ ll 10010 _ 102 - 00 00 01 00 10 10 0 1-25 210 :2 910 ’ Divide 1 1 102 14m —_ : 1 00;. _— : 410 3.510 11.1 100)11100 1111: 15m 100 'iib 100 ”166 100 0 OCTAL DIVISION Octal division uses the same principles as decimal division. All mul- tiplication and subtraction must however be done in octal. (Refer to the octal multiplication table.) The following problem solutions illustrate octal division. 621 5010 1714s _ “ 2.21 211 28 “ 31 z: 318 66 2510 z: )1714 22 562 2 154 6 - 2 154 154 '6 ""6 62 _ EXERCISES a. Perform the following binary additions. 1. 6. 10110 111001 1 -+101 _ +101101 +110 _- 2. 100111 10. 101 ‘— 100 7. +10 11011001 11. 1110 10010011 100 +11100011 ' 3. +11 11011 ~F0010 ' 8. . 4. 10110111 101 1 +1000 + 5. 1111 9. 1101 110111 - 100100 101 ' +11 +110001 1—26 11011011’ 12. _ 10111011 00101011 01010111 +01111101 b. Find the one’ s complement and the two’s complement of the fol- lowing numbers. ' c. 100 110 010 7. 000 000 000 111 111 8. 100 000 000 000 9. 100 000 010 010 10. 100 001 100 110 ‘11. 111 111 111 I, 12. 111 111 111 111 L 011 2. 010 111 011 3. 011 4. 000 000 000 000 5. 000 000 000 001 6. -000 100~100 100 1101000 000 '_ . Subtract the following binary numbers directly. 1. 101000001 2. 3. 101011010111 011111111101 4. 101111100111 010101110010 '_ 010111101 1010111010 0101110101 (1. e. Perform— the following subtractions by' the two’s complement method. Check your work by direct“ subtraction. Show all work. f‘ _011 011 011 011 9’!” P‘:h 000 111 111 111 011 111 111 101 001 101 111 110 011 111 111 111 —— 111.010 110 001 000 001 001 101 —— 100 011 —— 010 101 —— 001 100 101 011 -— 010 101 101 101 Multiply the following binary numbers. 1. 11011 2. X110 f. 110' 3. 1011101 101011101011 X101 X10000 Divide the following binary numbers. 1. 100 To‘ 2. 10000 100 1-27 3. . 1100100 10100 ' ‘ g. Add the following octal numbers. 1. 42 6. 127 -+53 7. 777 256 543 +724 +612 _ 2' _#§§ 4. ‘“ ' 8. 77‘ ' . 437 g 426 +1] 772 3. 34 5. +76 3357 747 +562 +575 h. Subtract the following octal numbers directly. 42 '1. 4. 4 7. 53 2543 * ~23 -—.2174 ,—-44 ‘ 2. 76 . —-34 3. 5. , 77 , 6. —6373 » 7000 —6573 ~11 i. 7500 8. 7474 —4777 following octal subtraetions by the eight’s complement method. Check your work by subtracting directly. Show all Perform the ,work. 1. 0377 2. 2345 3.1144 4. 3 3000 —- 0233 5. 2311 1456 6. 0044 1046 7. 3234 0011 8. llll — — -~ —— — —— — 2277 0017 2777 0777 j. Multiply the following octal numbers. 1. , 716 4. 14 x13 X472 __ —— 425 5. x377 X65 x4 2. 77 3. 65 571 6. x246 k. Prove the answers to the problems in (j) by division, as follows: Multiplicand >< Multiplier Product _ Multiplicand - Multiplier) Product 1-28 LOGIC OPERATION PRIMER v Computers use logic operations in addition to arithmetic operations to solve problems. The logic operations/have a direct relationship with the algebraic system to represent logic statements known as Boolean algebra. In logic, there are two basic. connectives that are used to express the relationship between two statements. the OR. The AND Operation The following simple circuit These are the AND and with two switches illustrates the AND operation. If current is allowed to flow through a switch, the switchIS said to have a value of 1. If the switch is open and current cannot flow, the switch has a value of 0. If the whole circuit is considered, it .will have a value of 1 (i. e., current may flow through and B are 1. Thisis the AND operation it) whenever both A c,/..,.____.,/o___._<g 0 B A F The AND operation is often stated A 0 B : F. The multiplication symbol (0) is used to represent the AND connective. The relationship be— tween the variables and the, resulting value of F is summarized in the following table. B 0 l O 1 i-a'o o When the AND operation is applied to binary numbers, a binary 1 will appear in the result if a binary 1 appeared1n the corresponding position of the two numbers. The AND operation can be used to mask out a portion of a 12—bit number. To Be To Be Retained Masked for Subsequent Out Operation f—“'~—flr—‘—*—'_1 010 101 010 101 000 000_ 111 (12—bit number) (mask) (result) 111 000 000 010 101 1-29 _ The OR Operation 1 A second logic operation is the OR (sometimes called the inclusive OR). Statements which are combined using the OR connective are illustrated by the following circuit diagram. ~—:/;>°"1—-—o Current in the above diagram may flow whenever either A or B (or both) is closed (F21 if A: 1, or B21, or A21 and B: 1 ). This operation is expressed by the plus (+) sign; ,thus A+B-_:F. The following table shows the resulting value of F for changing values of A and B. V‘" A B F 0 1 O 1 Thus, if A and B are the 12-bit numbers shown below, ' uated follows. as A : 011010 011111 B :: 100110 010 011 A+B H 111110011111 1s eval- A+B Remember that the “+” in the above example means “inclusive OR”, ' ' not “add ” The Exclusive OR Operation exclusive The third and last logic operation is the exclusive OR. The OR is similar to the inclusive OR with the exception that one set of conditions for A and B are excluded. This exclusion can be symbolized in‘the circuit diagram by connecting the two switches mechanically to- gether. This connection makes it impossible for the switches to be closed 1-30 7 simultaneously, although they may be open simultaneously or individu' ‘ ally. ' Thus, the Circuit is completed when A21 and B: 0, and when A40 and B:1 The results of the exclusive operation are sUmmarized ” in the OR table below. A O O 1 o 1 The exclusive OR of two 12-bit numbers is evaluated and labeled F ' in the following operation. A: 011010 011111 B : 100110 010 011 F :1 111 100 001 100 GENERAL ORGANIZATION OF THE PDP—8 Almost every general purpose digital computer has the basic units shown in Figure 1-1, on the following page. If a machine is to be called a computer, it must'have the capability of r ‘ _ performing some types of arithmetic operations. The element of a digital computer that meets this requirement is called the arithmetic unit. In order for the arithmeticunit to be able to do its required'task, it- must be told what to do. Therefore; a control unit is necessary. Since mathematical operations are performed by‘the arithmetic unit, it may be necessary to storeya partial answer while the unit'is computing another part of the problem. This stored'partial answer can then be used to solve other parts of the problem. It is'also helpful for the control unit and arithmetic unit to have information immediately available for their use, and for the use of other units within the computer. This ment is met by the portion of the computer unit, or core storage unit. 1-31, designated as require- the memory r'“—‘ F‘“ I I I i INPUT UNIT ——a I ' 1 i CONTROL ____ _ j UNIT " T I l l 4 INTERNAL o UTPUT STORAGE UNIT _, i r i L, Figure 1-1 ARITHMETIC UNIT PDP—8 General Organization The prime purpose of a digital computer is to serve humans in some manner. In order to do this there must be a method of transmitting our wants to the computer, and a means of receiving the results of the com- puter’s calculations. The portions of the computer that carry out these functions are the input and output units. Arithmetic Unit The arithmetic unit of a digital computer performs the actual work of computation and calculation. It carries out its job by counting series of pulses or by the use of logic circuits. Modern computers use com- ponents such as transistors and integrated circuits. Switches and relays were used previously, and were acceptable as far as theirability to'per— form computations was concerned. Modern computers, however, because of the speed desired, make use of smaller electronic components Whenever possible. . The arithmetic unit of the PDP—8 has, as its major component, a 12—bit accumulator, which is simply a register capable of storing a number of 12 binary digits. It is called the accumulator because it accumu— during the operation of the PDP—S. All arithmetic operations are performed in the accumulator of the PDP—S. lates partial sums Control Unit The control unit of a digital computer is an administrative or switch— ing section. It receives information entering the machine and decides how and when to perform operations. It tells the arithmetic unit what get the necessary information. It knows when the arithmetic unit has completed a calculation and it tells the arithmetic to do and where to unit what to do with the results, and what to do next. 1-32 The control unit itself knows whatto tell the arithmetic unit to do by interpretng a set of instructions. This set of instructions for the control ' unit is called a program and is stored in the computer memory. Memory Unit The memory unit, sometimes called the core storage unit contains information for the control unit (instructions) and for the arithmetic unit (data). The terms core storage and memory may be used inter‘ changeably. Some computer texts refer to external units as storage, such' as magnetic tapes\and disks, and to internal units as memory, such as magnetic cores The requirements of the internal storage units vary may to from greatly computer computer The PDP-8 memory unit is composed of magnetic cores which are often compared to tiny doughnuts. These magnetic cores record binary information by the direction in which they are magnetized (clockwise or counterclockwise). The memory unit is arranged in such a way that it can store 4096 “words” of binary information. These words are each 12,—bits in length. Each core storage location has an address, which is a unique number used by the control unit to specify that location. Storage of this type in which each location can be specified and reached as easily as any other is referred to as random-access storage. The other type of storage is sequential storage such as magnetic tape, in Which case some locations (those at the beginning of the tape) are easier to reach than others (those at the end of the tape) ‘ .. Input Unit Input devices are used to supply the values needed by the computer and the instructions to tell the computer how to operate on the values. Input unit requirements vary greatly from machine to machine. A manually operated keyboard may be sufficient for a small computer. Other computers requiring faster input use punched cards for data in-. puts. Some systems utilize removable plugboards that can be pre-wired to perform certain instructions. Input.may also be Via punched paper tape or magnetic tape, two forms of input common in PDP—8 systems. Output Unit ' Output devices record the results of the computer operations. These results may be recorded in a permanent form (e. g., as- aprintout on the teleprinter) or they may be used to initiate a physical action (e.g., to adjust a pressure valve setting). Many of the media used for input, such as paper tape, punched cards,-and magnetic tape, can also be used for Output. — ‘ 1-33 ‘ COMPUTER DATA FORMATS . The PDP-8 uses 12—bit words to represent data. Some of the formats in which this data is represented are described in the following para— graphs. Alphabetic Characters Computers are designed to operate upon the binary numbers which it conveniently represents with electronic components. There are occasions however when it is desirable to have the computer represent. alphabet and punctuation marks. Binary codes are used to represent such characters. For example, the reader is familiar with punched cards, which use a system of punched holes to represent characters of the information. Each of these codes associates some character with a particular binary number. The computer can store the binary number (not the character) in its memory. When so directed, the computer will out- put the binary code to a device which will interpret the code and print the character. Some specific binary codes used to represent alpha— numeric information (letters, numbers, and punctuation symbols) are I A presented in Appendix B. Number Representations The PDP- 8 operates upon 12—bit words (namely 0 to 111 111 111 1113, or 0 to 77778). By convention, one half of the numbers are con— sidered positive (0 to 011 111 111 1113, or 0 to 37778), and one half (100 000 000 000.2 to 111 111 111 1112 or 40005: to 7777s) are negative. Therefore the PDP-8 can directly represent the portion of the number line shown in Figure 1—2. considered 40008 4001a (-3777‘3) soooa (-20003) / 0\ 20003 3777,, 777., (— n Figure 1-2 PDP-8 Octal Number Line Notice that the first digit of the 12-bit binary numbers is in effect a “sign bit.” That is, bit 0 (the first bit) specifies the Sign of the number by the following rule. If bit 0 is a O, the number is positive; if bit 0 is a 1, the number is negative. This is the means by which the computer 1-34 * and, negative numbers. Thus, the zero is considered tests for positive positive. In figure 1-2 it should be noted that the number 4000 is peculiar in that it has no positive counterpart. (Expressed in octal, the “two’s complement” of 3776 is 4002; of 3777 is 4001; of 4000 is 4000.) . _ When the octal to decimal conversions are performed, the number line of Figure 1-2 is converted to the number line of Figure 1—3. Thus ‘ the PDP-S can represent directly the numbers between -—204819Hand +204710. This would seem to be a serious restriction. Throught‘two' techniques however this limitation is overcome. ' ""1 - 1"" 1‘ - +2047 0 2048 , Figure 1-3 PDP-S Decimal Number Line DOUBLE PRECISION NUMBERS The PDP—8 memory is made up of lZ-bit storage locations. Suppose however that ‘a number larger than 12-bits were to be stored. By using 12-bit storage locations, numbers between —-8,3 88,60810 and; 8,388,60710 may be represented directly. This method of representation- two is appropriately called double precision. The method could be extended precision and further if necessary. It should be noted that to add double precision numbers, tWo addi— to triple tions are needed. Double precision arithmetic is described in Chapter 3._ FLOATING POINT NUMBERS ' Another method of representing numbers in the PDP-8 with more than 12'-bit word is floating point notation. In this notation, a number is divided into tWo parts, namely a mantissa (number part) . one and an exponent (to some base). In the decimal number system for example, the number 12 can be written in the following ways. MANTISSA .12 - 1.2 _ EXPONENT 102 x 101 x ' 12. x 120. x 100 10—1 1200. x 1&2 . PDP-S floating point notation makes use of a representation similar to the ‘ ’ above with the exception that the exponent and the mantissa are binary 1-35 . numbers. The binary mantissa (number part) is stored in two locations and a third location stores the exponent. The exponent is selected such that the mantissa has no leading zeros, thereby retaining the number of significant digits. 1-36 maxinnini programming _ Fundamentals This chapter describes the three general types of computer instruc« tions and the way in which they are used in computer programs. The first type of instruction is distinguished by the fact that it operates upon memory location and must tell the computer where the data is located in core so that the computer can find it. This type of instruction is said to reference a location in core data that is stored in some memory; therefore, these instructions are often called instructions (MRI). memory reference When speaking of memory locations, it is very important that a clear distinction is made between theaddress of- a location and the contents of that location; A memory reference instruction refers to a location by a 12-bit address; hoWever, the instruction causes the computer to take specified action with the content of the location. Thus, although the address of a specific location in memory remains .the same, the content of the location is subject to change. In summary, a memory refer- some ence instruction uses a 12—bit address value to refer to' a memory location, and it operates on the 12—bit binary number stOred in the referenced memory location. The second type of instructions are the operate microinstructions, which perform a variety ofprogram operations without any need for reference to a memory location.” Instructions of this type are used to perform the following operations: clear the accumulator, test for neg— ative accumulator, halt program execution, etc. Many of these Operate microinstructions can be combined (microprogrammed) to increase the operating efficiency of the computer. The third general type of instructions are the input/output transfer (IOT) instructions. These instructionsperform the "transfer of infor— mation between a peripheral device and the computer memory. IOT. instructions are discussed in Chapter 5. 2-1 - PROGRAM CODING Binary numbers are the only language which the computer is able to underStand. It stores numbers in binary and does all its arithmetic operations in binary. What is more important to the programmer, how— eyer, is that in order for the computer to understand an instruction it must be represented in binary. The computer can not understand in‘ structions which use English language words. All instructions the form of binary numbers (binary code). must beIn Binary Coding The computer has a set of instructions in binary code which it “un derstands”. In other words, the circuitry of the machine is wired to react to these binary numbers in the a certain manner. These instructions have appearance as any other binary number; the computer can interpret the same binary configuration of 0’s and 1’s as data or as an same instruction. The programmer tells the computer whether to interpret the binary configuration as an instruction or as data by the way in which the configuration is encountered in the program. Suppose the computer has the following binary instruction‘set. Instruction A This binary number instructs the computer to add the contents of location 000 000 010 010 to the 001 000 010 010 accumulator. Instruction B 001 This binary number instructs the computer to add the contents of 000 010 111 location 000 000 010 111 to the accumulator. memory location with an address of 000 000 010 010 and the binary number 000 111 111 111 If instruction B is contained in is stored1n a location with an "ing program could be Written. a core address of 000 000 010 11.1, the followContent Location 000 000 010 010 '000 000 010'111 001 000 010 111 ‘ ' ‘ 000111111 111 If this program were to be executed, the number 000 111 111 111 would be added to the accumulator. Octal Coding binary configurations appear cumbersome and confusing, the reader will now understand why most programmers seldo'm use the binary number system in actual practice. Instead, they substitute the If _. 2—2 octal number system which was discussed in Chapter 1. The reader should not proceed until‘he understands these two number systems and the conversions between them. ' . Henceforth, octal numbers will be used to represent the binary numbers which-the computer uses. Although the programmer may use octal numbers to describe the binary numbers within the computer, it should. be remembered that the octal representation itself does not exist within the computer. 2 ~ - ‘ When the conversion to octal is performed, Instruction B becomes 10278 and the previous program becomes , Content ’ Location ‘ , . ' 1027. 0022. 0027,, . 0777.. To demonstrate that a computer cannot distinguish between'a num—7 her and an instruction, consider the following program. ' LOcation 0021 . Content 1022 - (Instruction A) (Instruction B) ' 0022 1027 _ ' 0027 . . 0777 ., (The number 777,.) \ Instruction A, which adds the contents of location 0022 to the accu- mulator, has been combined with the previous program. Upon execution of the program (assuming the initial accumulator value:0), the computer will executexinstruction A and add 10278 as a number to the accumulator obtaining a result of 1027... The computer will then execute the next instruction, which is 1027, causing the computer to add the contents of 0027 to the accumulator. After the execution of the two instructions the number 20268 is in the accumulator. Thus, the above program caused the number 10278 to be used as an instruction and as a number by the computer. ' Mnemonic Coding _ Coding binary coding, is nevertheless very inconvenient. The programmer must learn a complete set of octal numbers which have no logical con-_ nection with the operations they represent. The coding is diflicult for the programmer when he is writing the program, and this difiiculty is compounded when he is trying to debug or correct a program. There is no easy way to remember the correspondence between an octal number and a computer operation. a program in octal numbers, although an improvement upon ‘ 2-3 To simplify the process of writing or reading a program, each instruction is often represented by a simple 3- or 4-letter mnemonic symbol. These mnemonic symbols are considerably easier to relate to a computer operation because the letters often suggest the definition of the instruction. The programmer is now able to write a prOgram in a language of letters and numbers which suggests the meaning of each instruction. _ The cOmputer still does not understand any language except binary numbers. Now, however, a program can be written in a symbolic lan- guage and translated into the binary code of the computer because of the one-to-one correspondence between the binary instructions and the mnemonics. This translation could be done by hand, defeating the purpose of mnemonic instructions, or the computer could be used to do the translating for the programmer. Using a binary code to represent alpha- betic characters as described in Chapter 1, the programmer is able to store alphabetic information in the computer memory. By instructing the computer to perform a translation, substituting binary numbers for the alphabetic characters, a program is generated in the binary code of the computer. This process of translation is called “assembling” a program. The program that performs the translation is called an assembler. Although the assembler is described in detail in Chapter '6, it is well to make some observations about the assembler at this point. 1. The assembler itself must be written in binary code, not I mnemonics. 2. It performs a one-to—one translation of mnemonic codes into binary numbers. 3. ' It allows programs to be written in a symbolic language which is easier for the prOgrammer to understand and remember. . L A specific mnemonic language for the PDP-8, called PAL (Program The neitt secis introduced this i’é‘téi’in“ Assembly LangUage), chapter. tion describes the general PDP-8 characteristics and components. This information is necessary to an understanding of the PDP-8 instructions and their uses within a program. PDP-S ORGANIZATION AND STRUCTURE The PDP-S is a high—speed, general purpose digital computer which 12-bit binary numbers. It is a single—address parallel machine using two’s complement arithmetic. It is composed of the five basic computer units which were discussed in Chapter 1. The com— operates on 2—4! ‘ ponents Of the five Units and their interrelationships are shown in Figure 2-1. For simplicity, the input and output units have been combined. I INPUT/ OUTPUT I UNITS I I ARITHMETIC I UNIT I I CONSOLE : ACCUM‘ . I I MEMORY ADDRESS ‘ :, REGISTER MEMORY ‘ BUFFER REGISTER I I | INSTRUCTION I I REGISTER -l . _ I I _ | | I _ COUNT ER I ”LATOR | I ETC. I UNIT I I TYPE, DISK, DECTAPE, MEMORY I | I PROGRAM . . ‘ TELE— 7 | I LINK l OUTPUT DEVICES , . . INPUT/ UNIT I | I I CONTROL I | I I I I Elli); GENERATOR Figure 2-1 | | | CORE 4096 MEMORY I2—BIT WORDS Block Diagram 'of the PDP-S Input and Output Units The input and output units are combined in Figure 2—1 because in many cases the same device acts as both an input and an output unit: The Teletype-console, for example, can. be.uSed to input information which'will be accepted by the computer, or it can accept processed in-” formation and print it as output. Thus, the two units Of input and output are very Often joined and referred to as input/output or simply I/O. Chapter 5 describes the methods of transmitting data as either input or output; but for the present, the reader can assume that the computer is able to accept information from devices such as those listed in the block . diagram and to return Toutput information to the devices. The PDP-8 console allows the programmer direct access to core memory and the program counter by setting a series of switches, as described in detail in Chapter 4. Arithmetic Unit A The second unit contained in the PDP-8 block diagram is the arith— metic unit. This unit, as shown in-the diagram, accepts data from input - devices and transmits-processed data tO the output devices. as well. Pri- marily, however, the unit performs calculations under the direction of the control unit. The Arithmetic Unit in the PDP-8 consists Of accumulator and a link bit. ‘ 2—5 an ACCUMULATOR (AC) The prime component of the arithmetic unit is a 12—bit register called the accumulator. It is surrounded by the electronic circuits which per- form the binary operations under the direction of the control unit. Its name comes from thefact that it accumulates partial sums during the execution of a program. Because the accumulator is only twelve bits in length, whenever a binary addition causes a carry out of the most sig— nificant bit, the carry is lost from the accumulator. This carry is re; ' ‘ corded by the link bit. LINK (L) Attached logically to the accumulator is a 1-bit register, called the link, which is complemented by any carry out of the accumulator. In other words, if a carry results from an addition of the most significant bit in the accumulator, this carry results in a link value change from 0 to l, or 1 to 0, depending upon the original state of the link. Below is a diagram of the accumulator and link. The twelve bits of the accumulator are numbered 0 to 11, with bit 0 being the most sig— nificant bit. The bits of the AC and L can be either binary 0’s or l’s as shown below. ACCUMULATOR UNK o o o I I o 2 3 4 5 s 7 o o o o o‘ o e 9 IO M o o o o III'IIIIIIIII '\ MOST SIGNIFICANT BIT / LEAST SIGNIFICANT BIT Control Unit The instruction register, major state generator, and program counter can be identified as part of the control unit. These registers keep track of what the computer is now doing and what it will do next. thus specifying the flow of the program from beginning to end. PROGRAM COUNTER (PC) ’ The program counter is used by the PDP—S control unit to record the locations in memory (addresses) of the- instructions to be executed. The PC always contains the address of the next instruction to be executed. . Ordinarily, instructions are stored in numerically consecutive locations and the program counter is set to the address of the next in- struction to be executed merely by increasing itself by 1 with each successive instruction. When an instruction causing transfer of command to. another portion of the stored program is encountered, the PC is set 2—6 to the appropriate address. \The PC must be initially set by input to specify the starting address of a program, but further actions are controlled by program instructions. INSTRUCTION REGISTER (IR) The 3—bit instruction register is used by the control unit to specify the main characteristics of the instruction being executed. The three significant bits of the current instruction are loaded into the IR each time an instruction is loaded into the memory buffer register fromcore memory. These three hits contain the operation code which specifies the main characteristics of an instruction. The other details are specified by the remaining nine bits (called the operand) of the most instruction. MAJOR STATE GENERATOR The major state generator establishes the proper states in sequence for the instruction being executed. One or more of the following three major states are entered serially to execute eaCh programmed instruc— tion. During a Fetch state, an instruction is loaded from core memory, at the address specified by the program counter, into the memory buffer register. The Defer state is used in conjunction with indirect ad,dressing-to obtain the effective address, as discussed under “Indirect Addressing” later in this chapter. During the Execute state, the instruction in the memory buffer register is performed. Memory Unit The PDP-8 basic memory unit consists of 4 ,096 12-bit words of magnetic core memory, a 12-bit memory address register, and a 12—bit memory bufier register. The memory unit may be expanded in units of 4,096 words up to a maximum of 32,768 words. CORE MEMORY The memory provides storage for the instructions to be performed and informationto be processed. It is a form of random access core storage, meaning that any specific location can be reached in memory readily as any other. The basic PDP—S memory contains 4,096 12-bit magnetic core words. These 4,096 words require that'12-bit addresses be used to specify the address for each location uniquely. MEMORY BUFFER REGISTER (MB) All transfers of instructions or informatiOn between Core memory and the processor registers (AC, PC, and IR) are temporarily held in the memory bufier register. Thus, the MB holds all Words that go into and out of memory, updates the program counter, sets the instruction register, sets the memory address register, and accepts as from or provides information to the accumulator. 2—7 information MEMORY ADDRESS REGISTER (MA) . - The address specified by a memory reference instruction is held in the memory address register. It is also used to specify the address of the next instruction to be brought out of memory and performed. It can be used to directly address all of core memory. The MA can be set by the memory buffer register. or by input through the program counter register, or by the program counter itself. . MEMORY REFERENCE INSTRUCTIONS The standard set of instructions for the PDP-8 includes eight basic . instructions. The first six of these instructions are introduced in the following paragraphs and are presented in both octal and mnemonic form with a description of the action of each instruction. The memory reference instructions (MRI) require an operand to specify the address of the location to which the instruction refers. The manner in which locations are specified for the PDP—S is discussed in detail under “Page Addressing” later in this chapter. In the following discussion, the first three bits (the first octal digit) of an MRI are used to specify the instruction to be performed. (The last nine bits, three 'octal digits, of the 12—bit word are used to specify the address of the referenced location——that is, the operand.) The six memory reference instructions are listed below with their mnemonic and octal equivalents as well as their memory cycle times. Octal Mnemonicg' Value Instruction Logical AND Two’s Complement Add Deposit and Clear the Accumulator Jump Increment and Skip if Zero Jump to Subroutine 1 AND Memory Cycles‘ Onnn 2 lnnn 2 DCA 3nnn 2 J MP Snnn 1 TAD ' 182 _ JMS 2mm 2 4min 2 , PDPMemory cycle time for the PDP~8 and -8/l is 1.5 microseconds; for the 8/L, it is 1.6; for the PDP-S/S, it is 8 microseconds. (Indirect addressmg re- quires an additional memory cycle.) 2The mnemonic code is binary code. meaningful to 2-8 and translated by an assembler into - AND (0nnn8) _ The AND instruction causes bit——-by bit a Boolean AND operation between the contents of the accumulator and the data word specified by the instruction. The result is left in the accumulator as illustrated below. LINK LINK The to ¢ 12) I25 I a I 1: cl I I I £2! 0 AC I I I (25 c6 125 I I I ¢ ¢ 52> DATAWORD (25 a | a ¢ (25- {26 I | 15 ¢ 2: Acmssum following points should be noted with respect to the AND instruction. 1. A 1 appears in the AC only when a 1 is present in both the AC (The data word is often referred to as a and the data word ‘ i mask); 2. The state of the link bit is not affected by the AND instruction; ‘ and - 3. The data word in the referenced location is not altered. TAD (lnnng) - , The TAD instruction performs a binary addition between the speci— . fied data word and the contents of the accumulator, leaving the result of the addition in the accumulator. If a carry out of the most significant bit of the accumulator should occur, the state of the link bit is comple— mented. The add instruction is called a Two’s Complement Add to re— mind the programmer that negative numbers must be expressed as the two’s complement of the positive value. The following figure illustrates '- the operation of the TAD instruction. LINKI LINK Q! ¢¢¢¢¢¢¢¢¢l¢lACIf5 II I I I I' I I I I ¢I DATAWORDI—3 I25 (25 at a! a (25 (25 (a 25 I AC(RESULT)Z+2 (1 2-9 o The following points should be remembered when using the instruction: . TAD of Negative numbers must be expressed as a two’s complement the positive value of the number; 2. A carry out of the accumulator will complement the link; and 1. 3. The data word1n the referenced locationis not affected. DCA (3nnn5) The DCA instruction stores the contents of the AC1n the referenced location, destroying the original contents of the location. The AC is then set to all zeroes. The following example shows the contents of the accumulator, link, and location 225 before and after executing the in— struction DCA 225. DCA 225 AC Loc. 225 Link ' ' Before Execution After Execution 1234 1 0000 1 . 7654 1234 The following facts should be kept in mind when using the DCA in- struction: 1. The state of the link bit is not altered; 2. The AC is cleared; and 3. The original contents of the addressed location are replaced by the value of the AC. - JMP (Sunns) The JMP instruction loads the effective address of the instruction into the program counter, thereby changing the program sequence since the PC specifies the next instruction to be performed. In the following example, execution of the instruction in location 250 (J MP 300) causes the program to jump over the instructions in locations 251 through 277 and immediately transfer control to LOcatiOn Content 250 JMP 300 . the instruction in location 300. (This instruction transfers program control to location 300.) . DCA 330 300 NOTE: The JMP instruction does not affect the contents of the AC or link. ISZ (2nnn8) . The ISZ instruction adds a 1 to the referenced data word and then examines the result of the addition. If a zero result occurs, the instruction following the ISZ is skipped. If the result is not zero, the instruction 2-10 following the ISZ is performed. In either case, the result of the addition , replaces the original data wOrd in memory. The example in Figure 2—2 illustrates one method of adding the contents of a given location to the AC a specified number of times (multiplying) by using an ISZ instruc— tion to increment a tally. The elfect of this example is to multiply the contents of location 275 by 2. (To add the contents of a given location to the AC twice, using the ISZ loop, as shown in Figure 2—2, requires more instructions than merely repeating the TAD instruction. However, when adding the contents four or more times, use of the ISZ loop requires fewer instructions.) In the first pass of the example, execution of ISZ 250 increments the contents of location 250 from 7776 to 7777 and then transfers control to the following instruction (JMP 200). In the second pass, execution of ISZ 250 increments the contents of loca— tion 250 from 7777 to 0000 and transfers control to the instruction in location 203, skipping over location 202. CODING FOR ISZ LOOP Location Content 200 TAD 275 201 ISZ 250 ' 202 JMP 200 ' 203 DCA 276 ' 250 . 7776' 0100' 275 276 0000 ~ SEQUENCE OF EXECUTION FOR ISZ LOOP Content After Instruction EXecution Location ' AC Content ‘ 250 275 276 FIRST PASS 200 TAD 275 0100 7776 0100 0000 201 0100 7777 0100 0000 0100 7777 0100 0000 0200 7777 0000 0100 0000 . ISZ 250 JMP 200 202 SECOND PASS TAD 275 200 ISZ 250 201 JMP 200 202 DCA 276 203 I . 0200 4 0100 0000 ‘ . (Skipped during second pass) 0000 0000 0100 _ Figure 2-2. ISZ Instruction Incrementing a Tally 2—11 0200 The following points should be kept in mind when using the ISZ instruction: 1. The contents of the AC and link are not disturbed; 2. The original word is replaced in main memory by the incre- mented value; - 3. When using the ISZ for looping a specified number of times, the tally must be set to the negative of the desired number; and 4. The ISZ performs the incrementation first and then checks for a zero result. JMS (4nnn8) A program written to perform a specific operation often includes sets of instructions which perform intermediate tasks. These intermediate tasks may be finding a square root, or typing a character on a keyboard. Such operations are often performed many times in the running of one program and may be coded as subroutines. To eliminate the need of writing the complete set of instructions each time the operation must be performed, the J MS (jump to subroutine) instruction is used. The J MS instruction stores a pointer address in the first location of the subroutine and transfers control to the second location of the subroutine. After the subroutine is executed, the pointer address identifies the next instruc— tion to be executed. Thus, the programmer has at his disposal a ‘simple means of exiting from the normal flow of his program to perform an intermediate task and a means of return to the correct location upon completion of the task. (This return is accomplished using indirect ad— dressing, which is discussed later in t .i-s chapter.) The following exam— ple illustrates the action of the J MS instruction. Location Content PROGRAM 200 JMS 350 . (This instruction stores 0201 in location 350 and'transfers program control to location 351.) 201 DCA 270 (This instruction stores the contents of the AC in location 270 upon return from the subroutine.) 2-12 SUBROUTINE 350‘ - 0000 ~ ' 351 iii 375 J MP I 350 1' - (This location is assumedgto have an initialgvalue of 0000; after JMS 350 is executed, it is 0201.) (First instruction of subroutine) (Last instruction of subroutine) The following should be kept in mind when using the J MS: 1. The value of the PC (the address of the JMS instruction +1) is always stored in the first location of the subroutine, replacing ' the original contents; Program control is always transferred to the location designated by the operand +1 (second location of the subroutine); 3. [The normal return from a subroutine is made by using an in—' 2. direct J MP to the first location of the subroutine .(JMP I 350 in the above example); (Indirect addressing, as discussed later _ in this chapter, effectively transfers control to location 201.); 4. When the results of the subroutine processing are contained in the AC and are to be used in the main program, they must be stored upon return from the subroutine before further calculations are performed. (In the above example, the results of the " subroutine processing are stored in location 270.) ADDRESSING‘ When the memory reference instructions were introduced, it was stated that nine bits are allocated to specify the operand (the address referenced by the instruction). The method used to reference a memory location using these nine bits will now be discussed. PDP-8 ' Memory Pages As previously described, the format of an MRI is three bits (0, l, and 2) fer the operation code and the remaining nine bits the operand. However, a full twelve bits are needed to uniquely address the 4,096 (10,000 Octal) locations that are contained in the PDP-S memory unit. To make the best use of the available nine bits, the PDP-8 utilizes a logical division of memory into blocks (pages) of 2008 locations each, as shown in the following table. 2-13 = Memory Memory Page Locations 0 0-1 77 20 4000-4177 1 200-377 21 4200-4377 4400—45 77 4600—4777 Page 2 400-5 7 7 22 3 600-77 7 23 4 1000-1177 1200-1377 14004577 1600-1777 5 6 7 10 Locations 24 27 5000-5177 5200-5 377 5400-5577 5600-5777 30 31 32 6200-63 77 6400-6577 25 26 ~ 12 2000-2177 2200—2377 2400-257 7 13 2600-2777 33 6600-6777 14 34 15 16 3000-3177 3 200-3377 3400-3577 35 17 3600-3777 37 7000-7177 7200-7377 7400-7577 7600-7777 .1 1 6000-6177 _ 36 Since there are 2008 locations on a page and seven bits can represent 2008 different numbers, seven bits (5 through 11 of the MRI) are used discussing the use of the page ad— dressing convention by an MRI, it should be emphasized that memory does not contain any physical page separations. The computer recog— nizes only absolute addresses and does not know what page it is on, or when it enters a different page. But, as will be seen, page addressing to specify the page address. Before allows the programmer to reference all of the 4,096“; locations of memory using only the nine available bits of an MRI. The format of an MRI is shown in Figure 2-3. OPERAND ' BIT - r POSITION I o o EITHERO ' ORI 3 o o I EACHBmS 2 I o I I.__r__1 , o o l a o I o I o I II IO 9 o I o I I I , I j PAGE ADDRESS ans OPERATION cone (0 TO I773) CURRENT PAGE 0R PAGE 0 an ADDRESS MODE BIT OZ DIRECT ADDRESSING 02 PAGE 0 I I INDIRECT ADDRESSING Figure 2-3. o I I 7 s 5 4 II CURRENT PAGE Format of a Memory Reference Instruction 2-14 As previously stated, bits 0 through 2 are the operation code for the . MRI; Bits 5 through 11 identify a specific location on a given page, but they do not identify the page itself. The page is specified by bit 4, often called the current page or page 0 bit. If bit 4 is a O, the page address is interpreted as a location on page 0. If bit 4 is a 1, the page address specified is interpreted to be on the current page (the page on which the MRI itself is stored). For example, if bits 5 through 11 represent 1238 and bit 4 is a 0, the location referenced is absolute address 1238. However, if bit 4 is a l and the current instruction isin a core memory ‘ location whose absolute address is between 4,6008 and 4,7778, the page address 1238 designates the absolute address 4,7238. Note that, as. shown in the following example, this characteristic of page addressing results in the octal coding for two instructions on different memory pages being identical when their operands reference the same relative location (page address) on their respective pages. TAD ’ Content. Location Mnemonic Octal Explanation 200 TAD 250 1250 TAD 250 and TAD 450 both mean-add the contents of location 50 on the current page (bit . . 400 TAD 450 1250 4 = 1) to the accumulator. Except when it is on page 0, a memory reference instruction can reference 4008 locations directly, namely those 2008 locations on the page containing the instruction itself and the 2008 locations on page 0, which can be addressed from any memory location. NOTE: If an MRI is stored in one of the first 2008 memory locations (0 to 1778), current page is page 0; therefore, only locations 0 to 1778 are directly addressable. Indirect Addressing , preceding section, the method of directly addressing 4003 memory locations by an MRI was described—namely those on page 0 In the and those on the current page. This section" describes the method for ' - ' addressing the other 7400S memory locations. Bit 3 of an MRI, shown in Figure 2—3 but nOt discussed in the preceding section, designates the address mode. When bit 3 is a 0, the operand is a direct address. When bit 3 is a 1, the operand is an indirect address. An indirect address (pointer address) identifies the location that contains the desired address (effective address). To address a location that is not directly address— able, the abSolute address of the desired location is stored in one of the 4008 directly addressable locations (pointer address); the pointer "address is written as the operand of the MRI; and the letter I is written 2-15 , between the mnemonic and the operand. _ ‘ (During assembly, the pres— ence of the I results in bit 3 of the MRI being set to 1.) Upon execution, the MRI will operate on the contents of the location identified by the address contained in the pointer location. The two examples in Figure 2-4 illustrate the difference between direct addressing and indirect addressing. The first example shows a TAD instruction that uses direct addressing to get data stored on page 0 in location 50; the second is a TAD instruction that uses indirect ad- dressing, with a pointer on page 0 in location 50, to obtain data stored in location 1275. (When references are made to them from various pages, constants, and pointer addresses can be stored on page 0 to 'avoid the necessity of storing them on each applicable page.) The octal value 0); the 1050,. in the first example, represents direct addressing (bit 3 octal value 1450, in the second example, represents indirect addressing (bit 3: 1). Both examples assume that the accumulator has previously : been cleared. Location Content TAD 200 50 (TAD 50 \Address . 501275 QDam , . . ‘ 1275 10503) Instruction . , = (Number) To Be Acted Upon By Instruction Address (Content of location 1275 is not used in 20 the execution of the instruction in location 200.) 1275 after executing the instruction in loca- NOTE: AC : tion 200. LoCation Content 200 TAD I 50 , . . . 50 . . : \Pointer Designates Indirect Addressing Instruction . . (TAD I 50 14505) Address 1275 Q . 2 ‘1275 Effective Address Pointer Address \Data (Number) To Be Acted Upon By Instruction ’ NOTE: AC : Effective Address 20 after executing the instruction in location- 200- Figure 2-4. Comparison of Direct and Indirect Addressing _2-16 I following three examples illustrate some additional ways in which indirect'addressing can be used. As shown in example 1-,- indirect addressing makes it possible to transfer program control ofi'page 0 (to any desired memory location). (Similarly, indirect addressing makes-it possible for other memory reference instructions to address any of the 4,09610 memory locations.) Example 2 shows a DCA instruction that uses indirect addressing with a pointer 'on the current page. The pointer in this case designates a location off the current page (location 227) in which the data is to be stored. (A pointer address is normally stored on the current page when all references to the designated location are from thecurrent page.) Indirect addressing provides the means for returning to a main program from a subroutine, as shown in example 3. Indirect addressing is also effectively used in manipulating tables ‘of data as described and illustrated in conjunction with autoindexing in Chapter 3. The EXAMPLE 1 Content Location 75 JMP I 100 /, 6000 ~ \ / . . 6000 DCA . . . . (JMPI 1002550011) Pointer Address Designates Indirect Addressing Instruction p Address Effective Pointer Address 100 ‘ K Next Instruction To Be Executed ‘ Effective Address NOTE: Execution of the instruction in location 75 causes pro-. ‘gram control to be transferred to location 6000, and the next instruction to be executed is the DCA 6100 instruction. EXAMPLE 2 [N ’ Location Content 450 j DCA 1' 577 577 _ ; '(DCA1577: 3777,.) Pointer Address Designates Indirect Addressing Instruction , N \1 \ Effective Address . 227 ‘ ' Pointer Address nnnn\ \Data ' - (Number) Stored By Effective Address Instruction NOTE: Execution of the instruction in location 450 causes the contents of :the accumulator to be-stored- 'in-Iocation ‘ 227. 2-17_ EXAMPLE 3 Location Content 207 210 TAD 250 (JMS I 70 ‘: 4470“) (The next instruction to be executed upon return from the subroutine.) 70 2000 “(Starting address of the subroutine JMS I 70 stored here.) 2000 200i (Return address stored here by JMS instruction.) (First instruction of subroutine.) aaaa ‘ 2077 NOTES: iii J MP I 2000 ' (Last instruction of subroutine.) ' 1. Execution of the instruction in location 207 causes the address 210 to be stored in location 2000 and the instru‘ction in location 2001 to be executed next. Execution of the subroutine proceeds until the last instruction (JMP I 2000) causes control to be transferred back to the main program, continuing with the execution of the instruction stored in location 210. 2. A JMS instruction that uses indirect addressing is useful when the subroutine is too large to store on the current page. 3. Storing the pointer address on page 0 enables instructions on various pages to have access to the subroutine. OPERATE MICROINSTRUCTIONS The operate instructions (octal operation code 2: 7) allow the pro— manipulate and/ or test the data that is located in the accumulator and link bit. A large number of different instructions are possible with one operation code because the operand bits are not needed to specify an address as they are in an MRI and can be used to specify different instructions. The operate instructions are separated into two groups: Group 1, which contains manipulation instructions, and Group 2, which is primarily concerned with testing operations. Group 1 instructions are discussed first. grammer to _ Group 1 Microinstrucfions The Group 1 microinstructions manipulate ”the contents of the accu— mulator and link. These instructions are microprogrammable; that is, they can be combined to perform specialized operations with other Group 1 instructions. Microprogramming is discussed later in this chapter. ‘ , 2-18 I2345678'9I0II O | l CLA CLL CMA CML RAR RAL i OPERATION CODE __ Q'I ROTATE ONE PLACE I I ROTATE TWO PLACES ZERO SPECIFIES . ‘% IAC GROUP | - The preceding diagram illustrates the manner in which a PDP-8 in- struction word is interpreted when it is used to represent'a Group 1 operate microinstruction. As previously mentioned, 78 is the operation code for operate microinstructions; therefore, bits 0 through 2 are all 1’s. Since a reference to core memory is not necessary for the operation of microinstructions, bits 3 _ through 11 are not used to reference an address. Bit 3 contains a 0 to signify that this is a Group 1 instruction, and the remaining. bits are used to specify the operations to be performed by the instruction. The operation of each individual instruction specified by these bits is described below. - Clear the accumulator. If bit 4.~is a 1, the CLA . instruction sets the accumulator to all zeroes. CLL Clear the link. If bit 5 is-a 1, the link bit is set to 0. ‘ Complement the accumulator. If bit 6 is a 1, the accumulator is set to the 1’s complement of its original value; that is, all 1’s become 0’s, and all 0’s become 1’s. Complement the link. If bit 7 is a 1, the state of the link bit CMA CML is reversed. RAR » - - _ ‘ Rotate the-accumulator and link right. If bit 8 is a 1 and bit 10 is a O, the instruction treats the AC and L as a closed . loop and shifts all bits in the loop one position to the right. This operation is illustrated by the following diagram. Ac L ' I RTR o. o o I -l I o o o o 'o 0 ~I o o o I l I. o o o o o J BEFORE RAR AFTER RAR Rotate the accumulator and link twice right. If 'bit 8 is a 1’ and'b'it 10 is also a 1, asth of two places to the right is executed. Both the ‘RAR and RTR instructions use what is . commonly called a circular shift, meaning that any bit rotated offbne end of the accumulator will reappear at the other end. This operation is illustrated below. 2—19 BEFORE RTR l I Ll AFTER RTR I RAL Rotate the accumulator and link left. If bit 9 is a 1 and bit 10 is a 0, this instruction treats the AC and L as a closed loop and shifts all bits in the loop one position to the‘left, performing a circular shift to the left. Rotate the accumulator and link twice left. If bit 9 is a 1 and bit 10 is a 1 also, the instruction rotates each bit two positions to the left. (The RAL and RTL microinstructions shift the bits in the reverse direction of that directed by the RTL RAR and RTR microinstructions.) IAC ~ Increment the accumulator. When bit _11 is a I, the con— I tents of the AC is increased by 1. No operation. If bits 0 through 2 contain operation code NOP. 78, and the remaining bits contain zeros, no operation is performed and program control is transferred to the next instruction in sequence. A summary of Group 1 instructions, including their octal forms, is given below. Mnemonic1 Octal2 NOP .7000 CLA CLL CMA CML RAR RAL 7200 RTR RTL IAC 1 Mnemonic code. 7100 7040 7020 7010 7004 A 7012 7006 7001 Sequence?- Operation No operation -- 1 Clear AC Clear link bit Complement AC 1 2 Complement link bit Rotate AC and L right one position 2 Rotate AC and L left one ”position 4 4 . Rotate AC and L right two positions 4 Rotate AC and L left two positions Increment AC 4 ' code is meaningful to and translated y 3 by an assembler into binary _ 2. Octal numbers conveniently represent binary instructions. 3 Sequence numbers indicate the order in which the operations V are performed- by the PDP~8/ I and PDP-S/ L (sequence. 1 operations arcrperformed first, sequence 2 operations are performed next, etc..). ‘ , 2-20 Groupz Microinstructions Group 2 operate microinstructions are often referred to as the “skip microinstructions” because they enable the programmer to perform tests on the accumulator and link and to skip the next instruction de— pending upon the results of the test. They are usually followed in a program by a JMP (or possibly a JMS) instruction. A skip instruction causes the computer to check for a specific condition, and, if it is pres— ent, to skip the next instruction. If the condition were not present, the - ‘ ‘ next instruction be would executed. l 2 3 4 l l I CLA OPERATION CODE 78 5 6 7 8 SM SZA SNL O/I SPA SNA SZL SKP VALUE OF BIT 8 DETERMINES THE ACTION SPECIFIED BY BITS 5 6,8 7 , CONTAINS A I To SPECIFY / / l0 H OS R HLT O 9 CONTAINS A 0 ' To SPECIFY GROUP 2 / GROUP 2 - _ REVERSE SENSING BIT O. SMA SZA BISNL ARE ENABLED :,SPA SNA aSZL ARE ENABLEO (UNCONDITIONAL SKIP WHEN BITS 5,6,8 7 ARE O’S) The available instructions are selected by bit assignment as shown in the above diagram. The operation of each individual instruction fied by these bitsis deScribed below. CLA Clear the accumulator If bit 4 is a 1, the instruction sets the accumulator to all zeros SMA speci- ‘ Skip on minus accumulator. If bit 51s a l and bit 8IS a O, the next instruction is skipped if the accumulator is less than zero. SPA Skip on positive accumulator. If bit 5 is a 1 and bit 8 is a l, the next instruction is skipped if the accumulator is greater than or equal to zero. SZA Skip on zero accumulator. It hit 6 is a 1 and bit 8 is a 0, the next instruction is skipped if the accumulator is zero. SNA Skip on nonzero accumulator. 1f bit 6 is a 1 and bit 8 is a 1 also, the next instruction is skipped if the accumulator is not zero. 2-2 1 ' SNL SZL ‘ SKP ; . OSR Skip on nonzero link. If bit 7 is a 1 and bit 8 is a 0, the next instructidn is skipped when the link bit is a 1. Skip on zero link If bit 7 is a 1 and bit 8 is a 1, the next instruction is skipped when the link bit'is a O. Unconditional skip. If bit 8 is a 1 and bit 5, 6 and 7 are all zeros, the next instruction is skipped. (Bit 8 is a reverse sensing bit when bits 5, 6 or 7 are used—see SMA, SPA, SZA, SNA, SNL, and SZL above.) Inclusive OR of switch register with AC. If bit 9 is a 1, an inclusive OR operation is performed between the content of the accumulator and the console switch register. The re— sult is left in the accumulator and the original content of the accumulator is destroyed. In short, the inclusive OR operation consists of the comparison of the corresponding bit positions of the two numbers and the insertion of a 1 in the result if a 1 appears in the corresponding bit position in either number. See Chapter 1 for further discussion. The action of the instruction’ is illustrated below. LINKD [ilololololnloli[OIIIOIIJACCUMULATOR [1 [ololllolllolojolill [OJSWITCHREGISTER LINKE HLT [ilololiloliloTqulxlil'aJResuumAc Halt. If bit 10 is a 1, the computer will stop at the conclu— sion of the current machine cycle. A summary of Group 2 instructions, including their octal representa- tion, is given in the following table. " ' . "Mnemonic "Octal CLA SMA SPA» 7600 7500 Clear the accumulator Skip on minus accumulator 7510 Skip on Sequence ‘ Operation 2 ., 1 positive accumulator 1 (or AC : 0) SZA 7440 SNA 7450 7420 SNL SZL SKP OSR 7430 7410 7404 Skip on zero accumulator Skipon nonzero accumulator Skip on nonzero link Skip on zero link Skip unconditionally Inclusive OR, switch register with AC HLT 7402 Halts the program 2-22 1 . 1 1 1 1 3 ' ' 3 MICROPROGRAMMING BecausePDP-S instructions of Group 1 and Group 2 'are determined by bit assignment, these instructions maybe combined, or microprogrammed, to form new instructions enabling the computer to do more operations in less time. l" - — Combining Microinstructions The programmer should make certain that the program clears. the accumulator and link before'any arithmetic operations are performed. To perform this task, the program might include the followinginstructions (given in both octal and mnemonic form). 7200 (octal) 7100 (octal) CLA CLL _ However, when the Group 1 instruction format is analyzed, the follow— ' ing is observed. l | l O CLA C'LL OPERATION CODE LMUST BE A I TO SPECIFY CLL ' ' - MUST BE A ITO SPECIFY CLA MUST BE A 0 TO SF‘ECIEY GROUP | Since the CLA and the CLL instructions occupy separate bit posi- tions, they may be expressed in the same instruction, thus combining the two operations into one instruction. This instruction would be written as follows. CLA CLL 7300 (octal) ' In this manner, many operate microinstructions can be combined mak- ing the execution of the program much more efficient. The assembler for the PDP-8 will combine the instructions properly when they are written as above, that is, on the same coding line, and separated by a space. Illegal Combinations Microprogramming, although very efficient, can also be troublesome for the new programmer. There are many violations of coding which the assembler will not accept. 2-23 One rule to remember is: “If you can’t code it, the computer can’t do it.” In other words, the programmer could write a string of mnemonic microinstructions, but unless these microinstructions can be coded correctly in octal representation, they cannot be performed. To illustrate this fact, suppose the programmer would like to complement the accu: mulator (CMA), complement the link (CML), and then skip on a nonzero link (SNL). He could write the following. CMA CML SNL These instructions require the following bit assignments. O l 2 3 CMA l i l O CML l l l O | SNL l l l l | 4 5 6 7 8 9 to II l 0 The three microinstructions cannot be combined in one instruction because bit 3 is required to be a 0 and a 1 simultaneously. Therefore, no instructions may be used which combine Group 1 and Group 2 microinstructions because bit 3 usage is not'compatible. The CMA and CML“ can, however, be combined because their bit assignments are com- patible. The combination would be as follows. CMA CML 7060 (octal) To perform the original set of three operations, two instructions are ‘ needed. CMA CML SNL - 7060 (octal) 7420 (octal) Because Group 1 and Group 2 microinstructions cannot be combined, the commonly used microinstruction CLA is a member of both groups. Clearing the AC is often required in a program and it is very convenient to be able to microprogram the CLA with the members of i ‘ both groups. The problem of bit assignment also arises when some instructions within a group are combined. For example, in Group 1 the rotate instructions specify the number of places to be rotated by the state of bit 10. If bit 10 is a 0, rotate one place; if bit 10 is a 1, rotate two places. Thus, the instruction ,,RAL can not be combined with RTL because bit 10 would be required to have two difierent,_values at once. If the pro2-24 . grammer wishes to rotate right three places,'he must use two separate instructions. RAR RTR , . 7010 (octal) 7012 . (octal) Although he can write the instruction “RAR RTR”, it cannot be correctly converted to octal by the assembler because of the conflict1n bit 10; therefore, it is illegal. Combining Skip Microinstructions Group 2 operate microinstructions use bit 8 to determine the instruc-_ tion specified by bits 5, 6, and 7 as previously described. If bit 8 is a 0, the instructions SMA, SZA, and SNL are specified. If bit 8 is a l, the instructions SPA, SNA, and SZL are specified. Thus, SMA cannot be combined with SZL because of the opposite values of bit 8. The skip condition for combined microinstructions is established‘by the skip conditions of the individual mcroinstructions in accordance with the rules for logic operations (see “Logic Primer” in Chapter 1). 0R GROUP—SMA OR SZA 0R SNL If bit 8 is a 0, the instruction skips on the logical OR of the condi— tions specified by the separate microinstructions. The next instruction is skipped if any of the stated conditions exist. For example, the com— bined microinstruction SMA SNL will skip under the following conditions: 1. The accumulator is negative, the link is zero. 2. The link is nonzero, the accumulator is not negative. 3. The accumulator is negative and the link is nonzero. (It will not skip if all conditions fail.) This manner of combining the test conditions is described as the logical OR of the conditions. AND GROUP—SPA AND SNA AND SZL specifies the group of microinstructions SPA, 'SNA, and SZL which combine to form instructions which act according to the logical AND of the conditions. In other words, the next instruction is skipped only if all conditions are satisfied. For example, the instruction SPA SZL will cause a skip of the nextinstruction only if the accumulator is positive and the link is zero. (It will not ski-p if either A value of bit 8: 1 of the conditions fail ) programmer is not able to specify the NOTES 1. The of combination. The SMA, SZA, SNL conditions manner are always combined by the logical OR, and the SPA, SNA, SZL conditions are always joined by a logical AND. 2. Since the SPA microinStruction will skip on either positive or a zero accumulator, to skip on a strictly positive (positive, nonzero) accumulator a the combined microinstruction SPA SNA is used. 2-25 Order of Execution of Combined Microinstructions ' The combined microinstructions are performed by the computer in a very definite sequence. When written separately, the order of execution of the instructions is the order in which they are encountered in the pro: ' gram. In writing a combined instruction of Group 1 or Group 2 micro— instructions, the order written has no bearing upon the order of execution. This should be clear, because the combined instruction is a 12—bit binary number with certain bits set to a value of .1. The order in which the bits are set to i has no bearing on the final execution of the I whole binary word. The definite sequence, however, varies between members of the PDP-S computer family. The sequence given here applies to the PDP- 8/1 and PDP-S/L. The applicable information for other members of p, the PDP-8 family is given in Appendix E. The order of execution for PDP—8 / I and PDP-8/ L microinstructions is as follows. GROUP 1 CLA, CLL—Clear the accumulator and/or" clear the link are the first actions performed. They are effectively Event 1 . performed simultaneously and yet independently. CMA, CML—Complement the accumulator and/ or complement the link. These operations are also effectively performed simultaneously and independently. IAC—Increment the accumulator. This operation is performed third allowing a number in the AC to be complemented and then incremented by 1, thereby forming the two’s complement, or negative, of the number. Event 2 Event 3 RAR, RAL, RTR, RTL—The rotate instructions are per- Event 4 formed last in sequence. Because of the bit assignment previously discussed,‘only one of the four operations may be performed in each combined instruction. I GROUP 2 Either SMA or SZA or SNL when bit 8 is a 0. Both SPA Event 1 and SNA and SZL when hit 8 is a 1. Combined micro- specifying a skip are performed first. The microinstructions are combined to form one specific test, therefore, skip instructions are efiectively performed simultaneously. Because of bit 8, only members of one skip group may be instructions ‘ , . combined in an instruction. - 2—26 Event 2 ' CLA—Clear the accunfulator. This instruction 'is performed second in sequence thus allowing different arith- meticoperations to be performed after testing (see Event 1) without the necessity of clearing the accumulator with a separate instruction before some subsequent arithmetic operation. OSR—Inclusive OR between the switch register and the AC. This instruction is performed third in sequence, .. I ‘ ' Event 3 , allowing the AC to be cleared first, and then loaded from , _ :Event 4 the switch register. HLT—The HLT is performed last to allow any other operations to be concluded before the program stops. This is the order in which all combined instructions are performed. operations in a different order, the instructions must be written separately as shown in the following example. One might think that the following combined microinstruction would clear the accumulator, perform an inclusive OR between the SR and the AC, and then skip on a nonzero accumulator. In order to perform ' CLA OSR SNA However, the instruction would not perform in that proper manner, because the SNA wOuld be executed first. In order to perform the skip last, the instructions must be separated as follows. CLA OSR SNA Microprogramming requires that the programmer carefully code mnemonics legally so that the instruction does in fact do what he desires it to do. The sequence in which the operations are performed and the legality of combinations is crucial to PDP—S programming. The following is a list of commonly used combined microinstructions, some of whichhave been assigned a separate mnemonic; ' . I Instruction . Explanation CIA CLA CLL CMA IAC Clear the accumulator and link. Complement and increment the accumulator. (Sets the accumulator equal to its own ‘nega— LAS CLA OSR Load accumulator from switches. (Loads the accumulator with the value of the CLL CML CLA IAC CLA CMA Set the link (to a 1). "— tive.) ~ switch register.) . STL *' ——- _ Sets the- accumulator to a 1. Sets the accumulator to a —1. 2-27 In summary, the basic rules for combining operate microinstructions are given below. 1. Group 1 and Group 2 microinstructions cannot be combined. (Group 1) cannot be Combined with 2. Rotate microinstructions each other. 3. OR Group (SMA, SZA, or SNL) microinstructions cannot be combined with AND GroupJSPA, SNA, structions. ' 4. OR Group microinstructions are SZL) microin— or combined as the logical OR of their respective skip conditions. AND Group microinstructions are combined as the logical AND of their respective skip conditions. 5. Order of execution for combined instructions (PDP-8/ I and PDP-S / L only) is listed below. ' Group 2 Group 1 l. CLA,’ CLL l. 2. CmdA,CmdL 2. 3. IA“: 3. SMA/ SZA/ SNL or SPA/ SNA/ SZL (flak ()SR. 4. ILAR,RIU;I§TR,RJT, 4. IiLT EXERCISES .1. The following is a list of current addresses and locations to be addressed. Determine whether the second location should be di- rectly or indirectly addressed from the first. Current Address a. 2456 Location to be Addressed 2577 b. 1500 1600 c. 1230 0050 0030 f. 6555 6555 6400 6600 d. e. 01 20 g. 4343 h. i. 2742 4100 2450 2507 5507 j. 3200 3377 2-28' 2. ”What. type of instruction is each of the following (MRI, operate Group 1 or operate Group 2 microinstruction)? 7430 19‘s» rm 3. . 7240 7000 4706 7700 Why are each of the following not legal instruCtions for the PDP-S? a. 4._ 0024 15007 b. 6509 c. 1581 d. 635 e. 7778 What is the effect of each of the following octal instructions? Octal M nemonic - V Operation . 0000 9‘.” 4010' 2300 9.0 1777 3500 rm 5400 1030 5. r'r‘P‘w 2577, 5273 3150 Separate the following octal instructions into microinstruction ' mnemonics. ' 7260 9“.» 7112 7440 11.0 7632 7550 rm 7007 <20 6. 7770 Write the octal representation‘for each-location in the following program. What are the contents of the accumulator and locations 205, 206, and 207 after execution of the program? Location. Mnemonic 0200 CLA TAD 0205 TAD 0206 0201 0202 - 0203 0204 0205 0206 DCA 0207 HLT 0207 0000 1537 2241 2-29 ' Octal 7. Write the octal form of the following microinstructions. Identify . any illegal combinations. CLA CLL CMA CML CLL RTL HLT 9‘? 9-9 5‘? _ SPA CLA CLA IAC RTL CLA IAC RAL RTL SMA SZA CLA SMA SZL *‘F'PWP .8. CLA OSR HLT CLA OSR IAC CLA SMA SZA What instructions could be used to perform a skip only if the accumulator is zero and the link is nonzero? 9. 10. Why is it not possible to write one combined microinstruction that will load the accumulator from the console switch register, and then test that number, skipping on a positive value? Write the following programs. a. Program starts in location 0200 and adds 2 and 8. Give both mnemonic and octal representations. b. Program beginning in location 400 which interchanges the con- . tents of locations 550 and 551. Give both mnemonic and octal representations. ll. Write programs to add three numbers A, B, and C in the specified locations below and put the result in the given address for the SUM. All programs start in location 200. Give octal and mnemonic coding. .A B C SUN! a. 0030 0031 0032 0033 b. 0300 0301 0302 0303 c. 3000 3001 3002 3003 2—30 elementary programming techniques ‘ Mastery of the instruction set is the first step in learning to‘program the PDP—8 family“ computers. The next step is to learn to use the in? struction set to obtain correct results and to obtain them efficiently. This is best done by studying the following programming techniques. Exam— ples, which should further familiarize the reader with the instructions and their uses, are given to illustrate each technique. The modern digital computer is capable of storing information, per- forming calculations, making decisions based on the results and arriving at a final solution to a given problem. The computer cannot, however, ' perform these tasks without direction. Each step which the computer is to perform must first be worked out by the programmer. _ The programmer must write a program, ~which is a list of instructions for the computer to follow to arrive at a solution for a given problem. This list of instructions is based on a computational methOd, sometimes called an - algorithm, to solve the problem. The list of instructions is placed in the computer memory to activate the applicable circuitry so that the computer can process the problem: This chapter describes the procedure to be followed when writing a program to be used on the PDP-8 family of computers 3-1 PROGRAMMING PHASES In order to successfully solve a problem with a computer, the programmer proceeds through the five programming phases listed below: 1. Definition of the problem to be solved, S‘P‘H’P Determination of the most feasible solution method, Design and analysis of the solutiOn—flowcharting, Coding the solution in the programming language, and Program checkout. The definition of the problem is not always obvious. A great amount of time and energy can be wasted if the problem is not adequately de- fined. When the problem is to sum four numbers,'the defining phase is obvious. However, when the problem is to monitor and control a per— formance test for semiconductors, a precise definition of the problem is necessary. The question that must be answered in this “What precisely is the program to accomplish?” phase is: Determining the method to be followed is the second important phase in solving a problem with a computer. There are perhaps an infinite number of methods to solve a problem, and the selection of one method over another is often influenced by the computer system to be used. Having decided upon a method based on the definition of the problem and the capabilities of the computer system, the programmer must develop the method into a workable solution. The programmer must design and analyze the solution by identifying the necessary steps to solve the problems and arranging them in a logical order, thus implementing the method. Flchharting is a graphical representing the logical steps of the Solution. The flowcharting technique is effective in providing an overview of the logical flow of a solution, thereby enabling further analysis and evaluation of alternative approaches. means of ' " ' ' ” Having designed the problem solution, the programmer begins coding the solution in the programming language. This phase is commonly called programming but is actually coding and is only one part of the programming process. When the program has been coded and the pro— gram instructions have been stored in the computer memory, the 'problem can be solved. At this point, however, the programming process is rarely complete. There are very few programs written which initially function as expected. Whenever the program does nOt work properly, the programmer is forced to begin the fifth step of programming, that of checking out or “debugging” the program. 3—2 The program checkout phase requires the programmer to methodi— cally retrace the flow of the instructions step—by-step to find any. program errors that may exist. The programmer cannot 'tell a computer: “You know what I mean!”, as he might say in .daily life. The computer. does not know what is meant until it is told, and once given a set of instructions, the computer follows them precisely. If needed instructions. are left out orcoding is done inCorrectly, the results may be surprising. These flaws, or “bugs” as they are often called, must be found and corrected. There are many different approaches to finding bugs in a— program; however, the chosen approach must be organized and pains— takingly methodical if it is to be successful. Several techniques for de— bugging programs for the PDP-8 family of computers are described in Chapter 6. 7 " - FLOWCHARTING ' A simple problem to add three numbers together is solved in a few, easily determined steps. A programmer could sit at his desk and Write out three or four instructions for the computer to solve the problem. However, he probably could have added the same three numbers with, paper and pencil in much less time than-it took him to write the program. Thus, the problems which the programmer is usually asked to solve are much more complex than the addition of three numbers,'b.ecause the value of the computer is in the solution of problems which are inconvenient or time consuming by human standards. When a more complex problem is to be solved by a computer, the program involves many steps, and writing it often becomes long and". confusing. A method for solving a problem which is written in words and mathematical equations-is extremely hard to follow, and coding computer instructions from 'such a document would be equally difficult. A technique called flowcharting is used to simplify the writing of pro— grams; A flowchart is a graphical representation of a given problem, indicating the logical sequence of operations that the computer is to» perform. Having a diagram of the logical flow of a program is a tree, mendous advantage tothe programmer when he is determining the method toflbe used for solving a problem, as well as when he writes the coded program instructions. In addition, the flowchart is often a valuable aid when the programmer checks-the written program for errors. 3—3 . _ _ The flowchart is basically a collection of boxes and lines. The bOXCS indicate what is to be done and the lines indicate the sequence of the boxes. The boxes are of various shapes which represent the action to be performed in the program. Appendix C is a guide to the flowchart symbols and procedures which are used in this text. The following are examples of flowcharts for specific problems, illus—H' trating methods of attacking problems with a computer program as well as illustrating floweharting techniques. Example 1 adds three numbers together. Example 2 puts three numbers in increasing order. Example 1 Example — Straight-Line Programming 1 is an illustration of straight-line programming. As the flowchart shows, there is a straight—line progression through the process- ing steps with no change in course. The value of X, which is equal to A+B+C is in the accumulator when the program stops. CLEAR ACCUMULATOR l GET A mro ACCUMULATOR l ADD 8 l ADD C Example I —- Add Three Numbers Program Branching Example 2 Example 2 is designed to arrange three numbers in increasing order. ——- The program must branch to interchange numbers that are out of order. (Branching, a common feature of programming, is-dcscribed in detail later in this chapter.) Note that the arithmeticoperations-of sub— traction are done in the accumulator, which must'be cleared initially. 3-4 ‘ START CLEAR THE ACCUMULATOR I GET FIRST NUMBER INTO ACCUMULATOR I SUBTRACT SECOND NUMBER IS AC ~ POSITIVE ? INTERCHANGE ISTANDZND NUMBERS COMPARE 2ND AND 3RD NUMBERS As ABOVE - * I _ IS Ac POSITIVE ? INTERCHANGE - 2ND 'AND 3RD NUMBERS COMPARE IST AND 2ND NUMBERS AS ABOVE ' - ' ‘ IS AC POSITIVE :2 INTERCHANGE 1SrAN02ND NUMBERS N0 Example 2 ‘———- Arrange Three Numbers in Increasing Order 3-5 CODING A PROGRAM The introduction of Chapter 2' enabled the programmer to write a symbolic program using meaningful mnemonic codes rather than the octal representation of the instructions. The programmer could now write mnemonic programs such as the following example, which multiplies 1810 by 3610 using successive addition. , an 200/ 201/ TAD 210 202/ CIA 203/ 204/ 205/ 206/ 207/ 210/ DCA 212 assembler in CLA CLL (Initialize) (Set up a Tally equal to —1 810 to count the additions of 36) ' TAD 211 182 212 J MP 204 HLT 0022 21 1/ 0044 212/ 0000 . (Add 36) (Skip if Tally is 0) (Add another 36 if not done) (Stop after 18 times) (Equal to 1810) (Equal to 36m) (Holds the tally) Writing the above program was greatly simplified because mnemonic codes were used for the octal instructions. However, writing down the absolute address of each instruction is clearly an inconvenience. If the programmer later adds or deletes instructions, thus altering the location assignments of his program, he has to rewrite those instructions whose operands refer to the altered assignments. If the programmer wishes to move the program to a-different section of memory, he must rewrite the program. Since such changes must be made often, especially in large programs, a better means of assigning locations isneeded. The assem— bler provides this better means. Location Assignment As in the previous program example, most programs are written in successive memory locations. If the programmer assigned an absolute location to the first instruction, the assembler could be told to assign the next instructions to the following locations in order. In programming the PDP-8, the initial location is denoted by a precedent asterisk (*). The assembler maintains a current location counter By which it assigns successive locatiOns to instructions. The asterisk causes the current location counter to be set to the value following the asterisk. With this as shown improvement incorporated, the previous example appears in the following example. ’ . 13—6 *200 ‘CLA_CLL, 134r) 210 CLA I)Cv\ 212 THAI) 211 ISZ 212. 114? 204 IILT‘ ‘ 0022 0044 , 0000 NOTE: In this example, CLA CLL is stored in location successive instructions are stored1n 201, 202, etc. Symbolic Addresses The programmer does not at the outset 200 and the know Which locations he will use to store constants or the tally. Therefore he must leave blanks after each MRI and come back to fill these in after he has assigned locations tolth'ese numbers. In the previous program, he must count the number' of locations after the assigned initial address in order to assign the correct values to the MRI operands. Actually this is not necessary, because he may assign symbolic names (a symbol followed by a comma is a symbolic address) to the locations to which he must refer, and the assembler will assign address values for him. The assembler maintains symbol table in which it records the octal values of all symbolic addresses. With symbolic address name tags, the program is as shown a below. *200 ' . START, CLA CLL TAD A CIA DCA TALLY TAD B MULT, - - . ISZ TALLY J MP MU'LT HLT A, B, TALLY, $ _ 0022 0044 0000 NOTES: 1. The dollar sign is the terminal character for the assembler. 1 2. The comma after a symbol (e. g., START,) indicates to the assembler that the symbol is a symbolic address. 3-7 ‘ Symbolic Programming Conventions Any sequence of letters (A, B, C Z) and digits (0, 1,, 9) beginning with a letter and terminated by a delimiting character (see Table 3-1) is a symbol. For example, the mnemonic codes for the . . . , . . . , PDP—8 instructions are symbols for which the assembler retains octal equivalents in a permanent symbol table. User—defined symbols (stored in the external symbol table) may be of any length; however, only the first six characters are considered, and any additional characters are ignored. (Symbols which are identical in their first six characters are considered identical.) Any sequence of digits followed by a delimiting character forms a number. The assembler will accept numbers which are octal or decimal. The radix is initially set to octal and remains octal unless otherwise specified. The pseudo-instruction DECIMAL may be inserted in the» coding to instruct the assembler to interpret all numbers as decimal until the next occurrence of the pseudo-instruction OCTAL in the coding. These pseudo-instructions affect all numbers included in the symbolic * to denote change of origin. program including those preceeded by an Each symbol or number written in a PDP-8 program must represent a 12—bit binary value in order to be interpreted by the assembler. The special characters in Table 3-1 are used to specify operations to be performed by the assembler upon symbols or numbers in PDP-8 symbolic programs. The comma after a symbol in a line of coding (e. g., MULT, TAD B) indicates to the assembler that the value of. MULT is the address of the location in which the instruction is stored. When an instruction that references MULT (now a symbolic address) is encountered, the assembler supplies the correct address value for MULT. (Care must be taken that a symbolic address is never used twice in the same program and that all locations referenced by an MRl are identified somewhere in the program.) The space and tab are used to delimit a symbol or number. In a com- bined microinstruction such as CLA CLL, the space delimits the first mnemonic from the second, and the assembler combines the two mne— monic into one instruction. The space and tab similarly delimit the mne' monic from the symbolic address. TAD A ' or SPACE 3—8 TAD A . "‘— CTRL/TAB. Table 3-1 Special Characters for the PDP-8 Symbolic Language Character Keyboard ' SPACE U se Name ! combine symbols or numbers space (delimiting) (nonprinting) , CTRL/ TAB combine symbols or numbers or format the symbolic tape (delimiting) carriage return (nonprinting) plus terminate line (delimiting) ' + minus — comma , . tab (nonprinting) , RETURN ' _ combine symbols or numbers combine symbols or numbers assign symbolic address 2 equals define parameters * asterisk semicolon dollar sign set current location counter terminate coding line (delimiting) terminate pass (delimiting) has value equal to current location . ‘; $ point counter / slash ' A indicates start of a comment The carriage return is 'used to terminate a line of coding: The assembler will also recognize a semicolon as a line terminating character. ‘ $23 3 is the same as One of these two characters ‘ must be TAD A; TADB (i.e., semicolon or carriage return) used to separate each line of coding. The assembler will recognize the arithmetic in symbols + and conjunction with numbers or symbols, thereby enabling “address arith— metic”. For example, the instruction JMP START—H will cause the — computer to execute the instruction in the next location after START. The numbers specified in such instructions are subject to the pseudo— , f instructions DECIMAL and OCTAL, therefore the number is inter—-' l ,preted as an octal number unless the pseudo-instruction DECIMAL is in effect. The decimal point, or period, is a character which is interpreted by, the assembler as the value of the current location counter. This special symbol can be used as the operand of an instruction; for example, the instruction J MP .—1 causes the computer to execute the preceding in- struction. ' The equal sign is used to define symbols. This character is used to replace an undefined symbol with the value of a known quantity. For example, the programmer could define a “new instruction” NEGATE 3-9 by writing that NEGATE— CIA The programmer could then write _. the following instructions to subtract B from A. TAD B START, NEGATE TAD A NEGATE : HLT CIA The above coding would be assembled as if the instruction CIA had been included in the‘ actual coding. The slash is used to insert comments and headings as described later in this chapter. The dollar sign as previously noted, is a terminal character for the assembler itself. When this character is encountered, the assembler stops accepting input and terminates the assembly pass, as described in Chapter 6. These characters and conventions will be used throughout the re- mainder of this text to code programs in PAL III, the symbolic lan— guage of the PDP-8 family of computers. Thus, all examples given may be directly punched on paper tape as described in Chapter 4 and assembled by the procedure described in Chapter 6. PROGRAMMING ARITHMETIC OPERATIONS The instructions for the PDP—8 may be used to perform the basic arithmetic operations within the limits of the machine to represent the necessary numbers. That is, numbers may be added unless the sum ex: ceeds 409510 or 77778. When a sum exceeds the size of the accumulator, overflow occurs and incorrect answers result, This usually be detected by checking the value of the link bit; condition can The following instructions will add numbers and check for overflow, halting the program if the link is 1. ADD, CLA CLL TAD A TAD B SZL HLT DCA SUM 3-10 Since the link is initially cleared in the above example, a link value equal to 1 is an indication that the sum of the contents of locations A and B is too large to be represented by the 12-bit accumulator alone. The computer will halt if the overflow is detected with the actual sUm in the combined 13 bits of the accumulator and link. Arithmetic Overflow Since the PDP— 8 regards the numbers 0 through 37778 as positive numbers and the numbers 40008 through 77778 as negative numbers, the addition of two positive numbers could result in either a positive negative number depending upon the size of the numbers added. Arithmetic overflow is said to occur whenever two positive numbers add to form a negative 'number, as shown in the following example. or a (a positive number) (a positive number) 24338 +22118 46448 (considered PDP- 8) a negative number by the Likewise, two negative numbers could be added to ber as in the following example. yield positive a num— ' 5275. Disregarded—»1 3256 (—25038) (considered a number positive PDP-8) by' the _ Because of situations like those illustrated in the, two preceding ex- amples, the programmer must consider the size of the numbers used inprogrammed arithmetic operations.- If the programmer suSpects that overflow may occur in the result of an arithmetic operation, he should follow such an operation by a set of instructions to correct the error or at least to indicate that such an overflow occurred. _ The conditions outlined below may be used to test for arithmetic overflow. - . Signs of Numbers Added Overflow and Link Value Positive + Negative Positive +‘ Positive No overflow possible; link value ignored. Negative + Negative ' ‘ May result in negative sum; no change in link value. May result in positive sum; link is always complemented regardless of the sign of the result. The program coding on the next page uses the following facts, as- suming an initially cleared link, to quickly determine the sign of the sum of two unknown quantities, A and B. 3-11 - Result of Adding only Bit 0 of A mail of B Sign Sign of A of B Positive Negative 0 1 Negative O 1 Positive Positive Positive O Negative Negative 1 Link Value Bit 0 of AC O _ O / CODING TO ADD TWO NUMBERS / TESTING FOR ARITHMETIC OVERF LOW. START, CLA CLL TAD A AND MASK /MASK OUT ALL BUT BIT 0. /ADD B TO BIT 0 OF A. /LINK :2 I IMPLIES BOTH /ARE NEGATIVE. /ROTATE BIT O INTO LINK. /BIT 0 = 1 IMPLIES /OPPOSITE SIGNS. /BIT 0 = 0, BOTH POSITIVE. TAD B SZL OPPSGN, BTHNEG, JMP BTHNEG RAL SZL CLA JMP OPPSGN JMP BTHPOS TAD A TAD B DCA SUM HLT /SIGNS, THE ADDITION / CANNOT RESULT IN /OVERFLOW. CLA CLL TAD.A TAD B SMA JMP NEGERR BTHPOS, / IF A AND B ARE OF OPPOSITE DCA SUM HLT TAD A TAD B SPA /IF TWO NEGATIVE NUMBERS /ADD TO FORM A /POSITIVE NUMBER, /JMP TO ERROR ROUTINE. /OTHERWISE, STORE SUM. ‘ /IF TWO POSITIVE /NUMBERS ADD TO FORM JMP POSERR DCA SUM HLT SUM, MASK, A, B, POSERR, /A"NEGATIVE NUMBER, m1: /TO ERROR ROUTINE. /OTHERWISE, STORE SUM. O 4000 /ANY NUMBERS A AND B nnnn nnnn /ROUTINE TO SIGNAL /ARITHMETIC OVERFLOW /OF POSITIVE NUMBERS. /ROUTINE TO SIGNAL /ARITHMETIC OVERFLOW /OF NEGATIVE NUMBERS. NEGERR, 3-12 Subtraction Subtraction in the PDP-8 family of computers is accomplished by _ negating the subtrahend (replacing it by its two’s complement) and then adding it' to the minuend, ignoring the overflow if any. The following example shows the contents of the accumulator for each step of the subtraction process. Subtraction Program . Resulting Contents Accumulator Link 000 000 000 CLA CLL O 000 TAD B 0 000 000 011 CMA 0 111 IAC O TAD A 1‘ 100 001. 000 000 000 111 , 111 111 111 111 100 000 - (0000) (0037) (7740) (7741) (0007) I A, B, 0046 0037 (000 000 100 110) (000 000 011 111) (subtrahend) is brought into the accumulator, complemented (1’s complement) and incremented by 1 (to form the 2’s complement). (The 2’s complement could be obtained directly through the .one microinstruction CIA.) The number from which A is to be subtracted (minuend) is then added to the ac— Note that the number to be subtracted cumulator and the difference is obtained. If A were already in the accumulator from‘a previous calculation, an alternate procedure could be followed. The number A could be negated first, then B added to it to get B—A. Negating this result yields the same answer because (B——A) is equal to A—B. — Multiplication and Division A previous example illustrated the method of performing multiplica— tion with the basic PDP- 8 instructions, namely by repeated addition. Obviously, multiplication by this method is also subject to the limitation of overflow. The largest positive number which can be directly represented is 20471,J or 37778. Multiplication by repeated addition will properly handle positive and negative numbers within the limits of positive or negative arithmetic overflow. For example 77778 is the PDP—8 representation for —1. If it is multiplied by itself the answer should be +1. In other words, adding 77778 to itself 77778 times should leave (after carries from the most significant bit) the accumulator equal to 1. 3-13 ‘ . 7777 1st +7777 1 . 2nd 7776 . ' +7777 Disregarded 3rd 7775 1 Carries 1 0003 ‘ +7777 7776th 0002 1 7777th +7777 1 0001 , Thus, successive addition will work properly as a method of multiplying negative as well as positive numbers in the PDP-S family of com— puters. Similarly, division could be performed by repeated subtraction. This method of division could be used to obtain a quotient and remainder, because only whole numbers are directly represented in the PDP-S. There are, however, much more efficient means of multiplying and dividing numbers in the PDP-S. One means is through the extended arithmetic- element (EAE) option, which is described in Chapter 4. Multi— plication and division can also be performed through use of the floating point-packages, mathematical routines, and interpretive languages of the system software for the PDP-S. These “software” approaches to multiplication and division are described in Chapter 6 of this book. Double Precision Arithmetic Two memory location (24 bits) are used to express double precision. numbers. Using these 24 bits allows the representation of numbers in the range —8X 106 to 8X106. The following program adds two double precision numbers, obtaining a double precision result. Note that if the addition of AL and BL produces a carry, it will appear in the link. The accumulator is cleared by the DCA CL instruc— tion, and the RAL instruction moves the value of the link into the least significant bit position. The values of AH and BH are then added to the carry (if any) and the higher part of the answer is deposited in CH. 3-14 This technique may be extended to any‘order of multiple precision. ' *200 _ CLA CLL TAD AL TAD BL DUBADD, ‘ ‘ DCA CL RAL TAD AH TAD BH DCA CH AH, AL, BH,_ BL, CH, CL, $ HLT 1345 2167 0312 , " 0110 0 0 , 1 procedure is followed to subtract'two double precision numbers. The following program illustrates the technique. A similar *200 , DUBSUB, CLA CLL TAD BL CIA TAD AL. DCA CL ‘RAL DCA KEEP TAD BH CMA TAD AH TAD KEEP v DCA CH CLL HLT 1345 AH, AL, BH, BL, CH, CL, KEEP, $ - . 2167 0312 0110 0 0 0 The location KEEP is Used to save the contents of the link while the value of BH was complemented in the accumulator. To__ form a double precision two’scomplement number, a double precision one’s comple3-15 _ ment is formed and the 1 is added to it once. Thus, the value of BL is complemented using the CIA instruction, while the value of BH is complemented with the CMA instruction. The CLL instruction is used to clear the link and disregard the carry resulting from using two’s complement numbers to perform subtraCtion. _ Powers of Two - In the decimal number system, moving the decimal'point right (or left) multiplies (or divides) a number by powers of ten. In a similar way, _ rotatingfia binary. number multiplies (or divides) by powers of two. However, because of the logical connection between the accumulator and the link bit, care must be taken that unwanted digits do not reappear in the accumulator after the passage through the link. Multiplication by powers of two is performed by rotating the accumulator left;'division is performed by rotating the accumulator-right. Multiplicationand division by this method are subject to the limitation of 12-bit numbers (unless double precision is used). That is,. significant bits rotated out of the accumulator by multiplication or division are lost and incorrect results are therefore obtained. For example, the following program multiplies a number by 8 (23). *200 MULTS, NUMBER, $ CLA CLL TAD NUMBER CLL RAL CLL RAL CLL RAL DCA NUMBER HLT 0231 The program will replace the number 0231;; by 23mg. Notice that multiplying any number with four significant octal digits (such as 12348) using this program will yield incorrect results. WRITING SUBROUTINES _ Included in the memory reference instructions, given in Chapter 2, was the instruction JMS (jump to subroutine). This instruction is a modified J MP command which makes return to the point of departure from the main program possible. The J MS instruction automatically stores the location of the next instruction after the J MS in the location to which the program is instructed to jump, thereby enabling a return. 3-16 x The programmer need only terminate the subroutine with ,an indirect IMF to' the first location of the subroutine in order to return to the following the J MS instruction. The following simple next instruction program illustrates the use of a subroutine to double tained in the accumulator. _ a number con— (Main Program) ' CLA‘ CLL TAD N J MS DOUBLE DCA TWON START, (Get the number in the AC) (Jump to subroutine to double N) (First instruction after the subroutine) . ~ (Any number, N) ‘ N,~ TWON, nnnn DOUBLE, 0000 (2N will be sto'red here) nnnn _ (Subroutine) A DCA STORE (Save value of N) TAD- STORE (Get N back in the AC) CLL RAL SNL J MP I DOUBLE CLA CLL TAD STORE HLT 0000 , STORE, _ (Rotate left, multiplying by 2) (Did overflow occur?) _ (If overflow occurs, display the number to be doubled in the AC and then stop the computer.) . Notice that the first instruction of the subroutine'is loCated in the second location of the subroutine. Any instruction stored in location DOUBLE would be lost when the return addressis stored. Also note that the sub— ' routine as it is written must be located on page 0 or current page, because it is directly addressed. (A subroutine is often located on another page and addressed indirectly as the next example demonstrates.) The following program multiplies a number in the accumulator by a number stored in the location immediately following the JMS instruc' tion. 3-17 . (Main Program) *200 START, - CLA CLL TAD A DCA .+3 TAD B 1 MS I 30 (2000 . DCA PRDUCT PRDUCT, A, B, ‘ 0000 ‘ 0051 0027 ' *30 MULT (Subroutine) *6000 MULT, 0000 MTALLYy CIA DCA MTALLY TAD I MULT ISZ MTALLY IMP .—2 ISZ MULT J MP I MULT 0000 The preceding example illustrates the following important points. 1. The JMS I 30 instruction could be used anywhere in core memory to jump to this subroutine because the pointer word (stored in location 30) is located on page 0 and all pages of memory can reference page 0. 2. The period was used to denote the currentlocation in the in- structions DCA .+3 and 1MP .-——2. 3. Since the result of the subroutine is left in the AC when jump— ing back to the main program, the next instruction should store the result for future use. 4. The first instruction of the subroutine is in location MULT +1 since the next address in the main program is stored in MULT by the JMS instruction. 3—18 5. The first two instructions of the subroutine set the tally with the negative of the number in the AC. 6. The second number to be multiplied is brought into the sub- -, routine by the TAD I MULT instruction since it is stored in the location specified by the address that the J MS instruction automatically stores in the first location of the subroutine. This is a common technique for transferring information into a sub' routine. 7. The ISZ MTALLY instruction is» used in the subroutine to count the number of additions. The ISZ MULT instruction‘is _ used to increment the contents of MULT by one, thereby mak— ing the return jump (JMP I MULT) proceed to the next instruction after the location which held the number to be multi— plied. 8. An interesting modification of the previous program is achieved . by defining a “new operation” MLTPLY by including in the coding the statement MLTPLYzJMS I 30. The assembler would make a replacement such that any time the programmer writes MLTPLY, the computer would perform a jump to the subroutine and return to the program with the product in the ' AC. ADDRESS - MODIFICATION J A very powerful tool often used‘ by the programmer is address‘modi- - fication, meaning the inclusion of instructions in a program to modify the operand portion of ‘a memory reference instruCtion. It is a particularly useful technique when working with large blocks of stored data as illustrated by the two programs that follow. The first program sums 1008 numbers in locations 3008 to 3778. The program begins in location 2003- The block of 1008 numbers is sum— med using only one TAD instruction merely by repeatedly increment— ing and performing 'the instruction. The second eXample program moves‘ data between memory pages as well as performing an operation upon the data. The program computes the square. of the 2008 numbers in locations 40008 to 41773. The pro— " gram starts in location 2008. All numbers to be squared must not exceed 4510 or the square is too large to be represented in the normal ' format. 3-19 . START CLEAR AC ADD FIRST NUMBER % ‘ ; N0 ' L ADD .1 To me ADD INSTRUCHON‘ Program *200 START, ‘CLA CLL TAD K100 CIA ADD, DCA TALLY TAD 300 182 ADD ISZ TALLY JMP ADD DCA SUM ' , K100, TALLY, SUM, 55 HLT 0100 0000 0000 3—20 The second example illustrates the method of using indirect address- ing.in an address modification situation, It should be noted that in the first example the actual instruction perform the modification. In the second example, the modification was done' by : incrementing the contents of a location which was used for indirect addressing. The second example could be simplified further through use of autoindexing, a feature that‘will be discussed later. was incremented to I *200 START, I CLA CLL .TAD K200 , CIA I DCA TALLY TAD K4000 DCA NUM ' _TAD K4200 - DCA RESULT TAD I NUM AGAIN, JMS‘ SQUARE DCA IRESULT ISZ RESULT ISZ NUM ISZ TALLY JMP AGAIN HLT ' K200, TALLY, 0200 0000 K4000, 40000000 4200 0000 , NUM, K4200, RESULT, , *300 ~ , 0000 SQUARE, DCA STORE TAD STORE CIA _ - DCA‘COUNT‘ TAD STORE ISZ. COUNT STORE, JMP .--2 JMP I SQUARE 0000 COUNT, 0000? 3—21 I The reader should note that the first eight instructions of the second example are concerned with intializing the program. This intializing enables the stored program to be restarted several times and still operate on the correct locations. If the program had merely incremented locations K4000 and K4200 and utilized those locations for indirect addressing the program would only operate on the correct locations of the first running. On successive runnings the program would be opera— ting on successively higher locations in memory. With the program written as shown however the pointer words are automatically reset. This procedure is often referred to as “housekeeping.” INSERTING COMMENTS AND HEADINGS Because programs very seldom are written, used, and then forgotten, the programmer should strive to document his procedure and coding reasonably possible. There are many instances where changes or corrections must be made by people unfamiliar with a pro— gram, or more commonly the original programmer is asked to modify a program months after his original effort. In both cases, the success of the attempt to change the program depends largely upon the documen— tation provided by the original programmer. A complete and accurate flowchart is the first form of documentation. It is extremely important to document modifications made in the program by incorporating these changes in the flowchart as well. as much as is 1 Many times it is desired to include headings and dates to identify a program within the actual coding of the symbolic program. It is often helpful to add comments to simplify the reading of a symbolic program and to indicate the purpose of any less than obvious instruction. PDP- 8 programming allows comments and headings to be inserted simply by preceding any comments with a slash ( / ). following example illustrates the method used to insert com— ments and headings in a PDP-8 program. It also illustrates the use of a rotate instruction. The program takes a binary word stored in memory and counts the number of non-zero bits. Although the program may The have no useful application, it does serve to familiarize the reader with the structure of the accumulator and link bit and the action of a rotate instruction. The flowchart and comments will ”aid the reader to finder— 0 stand the program. 3-22 .: ‘ ( ) START GET THE NUMBER ROTATE LE F T CLEAR [INK INCREASE COUNT ' ‘ / COUNT THE BINARY ONES PROGRAM / 20 SEPTEMBER 1968 *200 , - ' V CLA CLL DCA COUNT TAD I WORD SNA HLT START, ROTATE, RAL SNL J MP ——2 CLL ISZ COUNT / SET COUNT TO 0. /GET THE WORD. I . /STOP IF THE WORD IS 0. /ROTATE ONE BIT INTO LINK. /WAS THE BIT : 0? /YES: ROTATE AGAIN. /NO: CLEAR LINK. /COUNT THE NUMBER OF l’S. ' SNA HLT J MP ROTATE ' COUNT, WORD, 0 / STOP IF THE WORD IS NOW 0. , ' ' - 3000 ' /ANY 12-BIT NUMBER. 3—23 The following points should be observed in the preceding example. 1. The word was'checked to see that it was non-zero to begin with. If this check were not made, a zero word would be rotated endlesslyby the remaining instructions in the program. 2. Because a rotate right instruction (RAR) would transfer the bits into the link just as the RAL instruction does, either could be used1n the above program. Both instructions use a circular shift of the accumulator and link bits.- L») ecause rotate thel ink bit i rotated int the accumulator by the instructions, the link must be cleared each time a 1 is rotated into it. LOOPING A PROGRAM As many of the examples given have already shown, the use of 'a program loop, in which a set of instructions is performed repeatedly, is common programming practice. Looping a program is one of the .most powerful tools at the programmer’s disposal. It enables him to perform similar operations many times using. the same instructions, thus saving memory locations because heneed not store the same instructions many times. Looping also makesa program more flexible because it is relatively easy to change the number of loops required for differring conditions by resetting a counter. It is good to remember that looping is little more than a jump to an earlier part of the program; however, the jump is usually conditioned upon changing program conditions. There are basically two methods of creating a program loop. The first method is using an ISZ (2nnn8) instruction to count the number of passes made through the loop. The ISZ is usually followed by a JMP instruction to the beginning of the loop. This technique is very efficient when the required number of passes determined. through the loop can be readily The second technique is .to use the Group 2 Operate Microinstructions to test conditions other than the number of passes which have Using this second technique, the program is required to loop until a specific condition is present in the accumulator or link bit, been made. rather than until a predetermined number of passes are made. To illustrate the use of an ISZ instruction in a program loop situa- tion, consider the following program which simply sets the contents of all addresses from 2000 to 2777 to zero. 3-24 - #200 3» CLA TAD CONST DCA COUNTTAD TTABLE. DCA STABLE DCA I.STABLE ISZ STABLE ISZ COUNT, CLEAR, , /SET COUNT TO —1000. -‘ ' . - . ’ JMP .-—-3 HLT CONST, COUNT, TTABLE, STABLE, 7000 /~SET STABLE TO 2000.. /CLEAR ONE LOCATION. /SELECT NEXT LOCATION. /IS OPERATION COMPLETE?-~ -/NO: REPEAT. /YES: HALT. /2.’S COMP OF 1000; 0 - TABLE ‘ /POINTERTO TABLE. 0 *2000 TABLE, $ 0 I Several points should _be=:car.efully noted; 1. The-first five instructions initialize the loop, but are not in it, The location COUNT is set to -1000 at the beginning,and 1 is added to it during each passage. of the loop. After the 1000th (octal) passage, COUNT goes to. zero, and the program skips the J MP instruction, .and executes the HLT instruction. On each previous occasion, it executed the J MP instruction. . In the list of constants follOwing the HLT instruction, TTABLE contains TABLE, which is in turn defined below as having the‘ value 2000,.- and containing 0. Therefore, STABLE contains ' 2000 initially. In order to understand this point it must be ref membered that an asterisk character causes the first locationafter the asterisk to be set to the value after the asterisk. There- fore, in the previous example CLEAR equals 200 and TABLE equals2000. ‘ . ISZ STABLE adds 1 to the contents of location STABLE, forming 2001 on the first pass, 2002-on the second pass, and SO on. Since it never reaches Zero, it will never skip. This is a very common use. It is said to be indexing the addressesfrom 2000 to 2777. (When using an ISZ instruction in this way, the programmer must be certain that it does not reach 0. Follow the ISZ instruction with a NOP if necessary.) 3-25 4. For every 182 instruction used in program, thereimust be two initializing instructions before the loop, and there must be a constant a and a counting location in a table of constants. This procedure allows the program to be rerun with the counting locations reset to the correct values. The following program utilizes a Group 2 skip instruction to create a loop. lhe program will search all of core memory to find the first occurrence of the octal number 1234. *0 ‘ ' NUMBER, *200 1234 - ’ BEGIN, CLA CLL TAD NUMBER CIA DCA COMPARE DCA ENTRY REPEAT, ISZ ENTRY CLA . /STORES MINUS NUMBER. /SETs ENTRY To 0. /INCREASES ENTRY. , . TAD I ENTRY /COMPARISON Is TAD COMPARE /DONE HERE. ' SZA CLA IMP REPEAT TAD ENTRY HLT ~ . . COMPARE, ENTRY, _ /ENTRY IS‘IN AC. o o $ The previous example is not very useful perhaps but it is interesting 'to note that the program will search itself as well as all other core memory locations. Also notice the following points with regard to the example. 1. The 182 ENTRY instruction is used to index the locations to be tested. The next instruction (CLA) is unnecessary, thus if ENTRY becomes zero during the course of the program, the program will not be affected. It is very important to protect against an 182 instruction going to zero and skipping a neces— sary part of index. a program, if the 182 is 3-26 being used to simply 2. The number to be searched for. was ,stored in location 0, and the search starts in location 1. TherefOre, the program will find at least one occurrence of the number” and will .halt after one complete pass through memory if not before. 3. The program could be modified to bound the area of the search. By setting the contents of ENTRY equal to one less than the desired start location and putting the number being searched for in the location following the last location to be searched, the program will search only the designated area of memory. 4. The program could be restarted at location REPEAT in order to find a second occurrence of 1234 after the program had _ halted with the first occurrence. AUTOINDEXING _ The PDP-8 family computers have eight special registers in page 0, namely locations 0010 through 0017. Whenever these locations are addressed indirectly by a memory reference instruction, the content of the register is incremented before it is used as the operand of the instruction. These locations can therefore be used in place of an ISZ instruction in an indexing application. Because of this unique action these eight locations are called autoindex registers. It is important to realize that autoindex registers act as any other location when addressed directly. The autoindexing feature is performed only when the location is addressed indirectly. The following example is a modification of the first program example in the preceding section with an autoindex register used in place of the 182 instruction. (The purpose of the program is to clear memory locations 2000 through 2777.) Carefully notice the difference between the two examples, especially that TABLE now has to be set to TABLE—1 since this is incremented by the autoindexing register before being used for the first time. This 3-27 point must be remembered when using an autoindex register. The register increments before the operation takes place, therefore it must always be set to one less than the first value of the addresses to be indexed. * 10 0 INDEX, *200 CLA TAD CONST CLEAR, DCA COUNT TAD TTABLE ' DCA INDEX DCA I INDEX 152 COUNT JMP —2 BLT CONST, COUNT, TTABLE, * 7000 0 TABLE—1 2000 TABLE, 15 0 The memory search example of the" preceding sectiOn could also be simplified using an autoindex register as shown below. *0 NUMBER, 1234 *10 . ENTRY, Notice that in this case ENTRY 0 originally equals 0 because its *200 BEGIN, content is incremented before CLA CLL TAD NUMBER being used to obtain data for CIA the DCA COMPARE DCA ENTRY REPEAT, TAD I ENTRY TAD COMPARE SZA CLA JMP REPEAT TAD ENTRY HLT COMPARE, $ 0. 3-28 comparison. ' PROGRAM DELAYS . " Because the development of a computenwas primarily sparked by a desire for speed in performing calculations, it seems inconsistent and ‘ self-defeating to slow the computer down with program delays. How—. ever, there are many occasions when a computer must be told to slow down or to wait for further information. This is because most peripheral . . equipment, and certainly the human operator, is very much slower than the computer program. A temporary delay may be introduced into the execution of a program when needed by causing the computer to enter one or more futile loops which it must traverse a fixed number of times before jumping out. It is often necessary to have a computer perform a temporary delay while a peripheral device is processing data to be submitted to the computer. The delays can be accurately timed so as not to waste any more computer'time than necessary. The following is a simple delay routine using the 182 instruction for an inner loop and an outer loop. The reader should rememberfwhen analyzing the example that the PDP—8 represents only positive numbers ' ' up to 3777., or 2047,... Therefore, the computer counts up to 20471.. and then continues to count starting at the next octal number 40003, which the computerinterprets as ——2048w. Successive increments of this number will finally bring the count to zero; Thus, a location could be used to cOunt from 1 up to O-by using an 152 instruction. 3 ' (main program) 0 TAD CONST DCACOUNT ISZ COUNTl JMP .-1 ISZ COUNT / START OF DELAY ROUTINE , /INNER /LOOP JMP .—3 CONST, 6030 COUNT, .0 COUNTL 0 /SETS DELAY . The inner loop consists of an 182 instruction with an execution time on the PDP-8/I of 3.0 microseconds (a microsecond is 10’6 seconds) JMP instructiOn with an execution time of 1.5 microseconds. Therefore, the inner loop takes 4.5 microseconds for one pass, and each and ' a time it is entered the program will traverse it 4096“, times before leav— ing. This means that a delay of 18.432 milliseconds (a millisecond is 3-29' . 10‘3 seconds) has occurred. if, as in the example above, the value of CONST is 60308, this loop will be entered 100010 times giving a total delay of 18.432 seconds. For any given purpose, a desired delay from milliseconds to seconds can be obtained precisely by varying the values of CONST and the initial value of COUNT‘l. Similar reasoning can be used to design delays for other'members of the PDP-8 family. ‘ A second type of delay, which waits for a device response, is "dis- cussed in Chapter 5. This type is not a timed delay but causes the com- \ puter to wait until it receives a response from an external device. PROGRAM BRANCHING I Very few meaningful programs are written which do not take ad— vantage of the computer’s ability to determine the future course the program should follow based upon intermediate results. The procedure of testing a condition and providing alternative paths for the program to travel for each of the different results possible is called branching a program. The Group 2 microinstructions presented in Chapter 2 are most often used for this purpose. The 182 instruction also provides a branch in a program. These instructions are often referred to as conditional skip instructions. The 152 instruction operates upon the contents of a memory location, while the Group 2 microinstructions test V the contents of the AC and L. A typical example of a conditional skip would be a program to com— pare A and B and to reverse their order if B is larger than A. { START , t FORM A-B I .3 ”0 RESULT YES SAVE A DUMMY IN NEG 7 STORE B W A'S LOCATION STOP STOREDUMMYIN 33 LOCATION 3-30 ”*200 TEST, 7 CLA CLL TAD B ' /SUBTRACT B - /FROM A CIA TAD A SMA CLA /HERE. HLT , /STOP HERE IF A IS GREATER OR EQUAL ‘ TAD A DCA DUMMY ' ‘ TAD B DCA A /THE REMAINDER OF /THE PROGRAM /DOES THE SWITCH. ' , TAD DUMMY DCA B ' . A, B, DUMMY, $ HLT 1234 2460 /SUBSTITUTE ANY POSITIVE /VALUES FOR A AND B. 0 , If A is less than B, their diflerence will be negative and the HALT will be skipped. The program will proceed to reverse the order of A and B. If A is greater than or equal to B, the program will halt. The concept illustrated by the above example can be included in a larger program that will take a set of elements and arrange them in increasing order. The following important concepts should be learned from the example. l. The program contains two loops to perform the sort. The inner» loop starts at TEST and is traversed 208 times‘to switch ad— jacent elements of the set. The outer loop begins at START and is re-entered until the elements are in the correct order. A “software flag” was created to signal the program that a switch has been performed on the last pass. The flag is checked upon every exit from the inner loop. If the flag is non—zero (equal. to —1), a reverse was performed on the last pass and the next pass is started. If the flag is zero, the set is now in ' ' .order and the program halts. . The flag is set to zero on each pass through the outer loop by depositing AC:O in it. It can only be set to a non—zero value by a pass through the REVERSE subroutine. The TALLY had to be set to ~(AMOUNT) +1 or in this case to —20,s because if the set contains n elements there are comparisons between an element and the immediately succeeding element, thus, in this case, TALLYz—ZOS. n——1 3—31 5. The following sort of five elements illustrates the technique used in the program. INHWAL ‘ PASS! @126) n9 (a PASSZ (9 C3) 0 0 -@ , ® @ ®© Q 53%; O Go t, Q) In performing the above sort, the program makes three passes. On the third pass thrOugh the table of data, thetflag is not raised; therefore, the program stops. ' ( START ) FORM NO am?” 2 as Yes 1NCREMENT SET FLAG Xg,_X2 [ 15 ‘ RESULT o. OR NEG 1' ‘ xl'xz X112 STOP CLEAR FLAG 3-32 1 *ZDD START, CLA CLL TAD AMOUNT TALLY CIA IAC /UP DCA IPASSES THRU TEST /CLEARS FLAG BEFORE DCA TALLY FLAG ‘ DCA .TAD N'- BEGIN /xr AND IPROPER x5 TAD I , EACH PASS To X2 M THE - VALUES /INITIALLY. /SUBTRACTION x2 CIA I LOOP. POINTERS THE ISET IAC THE COUNT TO -T /THESE INSTRUCTIONS X! DCA TAD A /AMOUNT .JAD BEGIN“ TEST: INSTRUCTIONS SET EOUAL To /THESE x1 THE FOR ~ /TEST IS /DONE HERE. _ SPA' SNA CLA SKP SWITCH IF JMS 152 REVERSE /DO XL ISET UP 152 X2 /THE NEXT PASS. 152 TALLY v/HAVE ALL JMP TAD TEST IND: KEEP FLAG /YES: HERE'ANY xOONE ON THE /YES; GO THRU -SZA JMP HLT AMOUNT, 21 TALLY, 0660 BEGIN, ZZGD X1, 6000 X2, @366 FLAG, @800 HOLD, 0600 START /N0: IS AC X'S THE X‘S TESTED? BEEN TESTING. STOP. POSITIVE. FOR , SWITCHES LAST PASS? PROGRAM 15 TABLE IN AGAIN. ORDER. \ REVERSE,DDD@ TAD I /SUBROUTINE TO SWITCH X'S X1 DCA HOLD TAD I X2 DCA I X1 TAD HOLD X2 DCA I CLA CLL DCA FLAG JMP I CMA /SETs /SET AC EOUAL T0 ELAG=~1 ON A -1. SWITCH. REVERSE 6. This program can perform a sorting for any specified block of data merely by specifying the octal number of entries to be . sorted in the location AMOUNT and by specifying the begin- ning address of the block in BEGIN. The data to be sorted must be placed in consecutive memory locations. 3—33 Exercises 1. Write a subroutine SUB to subtract the number in the AC from the number in the location after the JMS instruction that calls the subroutine. Return to the main program with the difference in the AC. Use a flowchart and comments to document the procedure. ' 2. Write two programs to put 0 into memory location 2000, 1 into 2001, 2 into 2002, etc., up to 7778 into 2777 using (a) an ISZ instruction for indexing and (b) autoindexing. Use fiowcharts and comments to document the procedure. 3. The following program was previously given to multiply two num— bers together. I *200 CLA CLL TAD A CIA DCA TALLY START, : . MULT, TAD B ISZ TALLY J MP MULT HLT g’ }substitutc 0000 TALLY, $ a. any numbers for A and B largest product that the PDP-8 can compute using What is the this program? . , Using the following value for A and B, verify that the program will . obtain the correct answers. Remember that any carry from the most significant bit is lost from the accumulator. b. c. d. A B 7756(—1810) 0027(2310) 0000 0005 7700( —6410) 0000 A X B program TRIADD which will add two triple precision numbers A+B:C. There are three parts to each number, namely 4. Write a AH (A high) AM (A medium), and AL (A low); BH, BM, and BL; CH, CM, and CL. Use a flowchart and comments to document the procedure. 3-34 ' write a program to perform a multiplication between two single- precision numbers to yield a double-precision product. Use comments and a flowchart to document the procedure. Write a program to multiply any number n by a power of 2 (the exponent is stored in location EXP), the product being expressed in double precision. Use comments and a flowchart to document the procedure. Write a program to find how many of the numbers stored in a table from address 3000 to address 3777 are negative. Use a flowchart and comments to document the procedure. Write a program that will run for exactly 20 seconds on or PDP-8/ I before it halts. Use a document the procedure. the PDP-8 flowchart and comments to ,. Modify the program written for exercise 8 such. that if bit 11 of the console switch register is a 1, the program runs for 20 seconds, and if it is a 0, the program runs for 40 seconds Hint: The OSR instruction must be used to check . the switch register. 10. The program on the next page rotates a bit left or right depend- ing on the value of bit 0 and faster or slower depending on the value of the remaining bits. Analyze the program and comment each instruction to indicate its use in the program. ' 3-35 . ' - *200 CLA CLL CML ROTATE, BEGIN, .7 HLT DCA SAVEAC RAL DCA SAVEL TAD MASK » ' OSR DCA COUNT GO, INSTR, OSR RAL SZL CLA JMS LEFT J MS RIGHT CLL TAD SAVEL RAR TAD SAVEAC RAR ISZ COUNTR JMP .—l 182 COUNT J MP .—3 J MP BEGIN SAVEAC, SAVEL, MASK, 0 COUNTR, 0 0 COUNT, LEFT, RIGHT, KRAR, KRAL, , 0 7000 0 182 LEFT TAD KRAL DCA INSTR JMP I LEFT 0 TAD KRAR DCA INSTR JMP I RIGHT 7010 7004 3-36 onahn # system description - and - -_ ' . operation loading editing ’ and debugging - + ehopt4er system description . and _ » _ operation A PDP-S / E system is composed of the computer (programmer’s console), a keyboard/ printer terminal and possibly other peripheral equipment. While normal operation of a computer system is . _w by programmed control, manual operation is necessary for many tasks. This chapter describes the manual control and operationof the PDP-8/E and provides an introduction to the more common ‘ peripheral devices which may be included in a PDP-8/E system. Chapter 6 describes the programmed control of peripheral devices and the means for transferring information between peripheral equipment and the central processor. ’ ‘ - PROGRAMME-R’s CONSOLE OPERATION The programmer’s console allows manual control cf the cem" puter and provides the most elementary means of storing a program in memory. It consists of switches and indicator lamps which enable the programmer to examine or alter the contents of memory locations and determine the current status of a running program. The PDP-S/E programmer’s console is shown in Figure 4-1. For reference purposes, the switches and indicators Table 4—1. are identified in ’ - 4—1 - I L O O O O O O O O O O O O O O O O O e m m In a: 23$ now: w in) m we om on or: 4 5 s 1 o s to n r n my: a? 0 I z I 0 O sq Eu] I O O 0 O O O O O Inn-1'3: m O 5"“ :"us In no nos Anon Elm Law AM Figure 4-1 57m W412“- “GET“ PDP-S/ E Programmér’s Console 4—2 SM a Table 4-1 ‘ Control Programmer’s Console Control and Indicator Functions or Indicator Function OFF/ POWER/ PANEL LOCK In the counter-clockwise, or OFF position, this key operated switch disconnects all primary power to the computer;‘In--the POWER, or vertical position, it applies power a I, the computer and all manual controls. In the PANEL LOCK, or to clockwise position, it applies power. to the computer, the and the RUN switch register light only. In this position, a running program is protected from inadyertent ' switch operation. .When this switch is up, the Omnibus SW line is high.(logical 1). When it is down, the SW line is SW ' low. This switch is used by special peripheral routines. ' . (SR) SWITCH REGISTER may be loaded with a 12—bit binary number by setting the twelve switches either up, for' a 1, or down, for a 0. The SWITCH REGISTER ADDR Pressing LOAD switch the ADDRess LOAD loads the contents of the SR into the central processor MA register and forces the processor to ' enter a fetch state. This causes the contents of the core memory loca-' tion designated by the SR to be loaded into the MB register. EXTD Pressing the EXTendeD ADDRess' ADDR LOAD LOAD switch loads the contents of SR bits 6-8 into the instruction field register and the contents of SR. bits 9-11 into the data field ' register. CLEAR Pressing the CLEAR switch loads binary 0 into bits 0-11 of the accumulator, the link, all I/O device flag registers, and the interrupt a 4-3 request flag register. This is equivalent All executing a CAF (Clear Flags) instruction. to Pressing the CONTinue switch sets .CONT the run filp-fiop and issues a memory start to begin program execution at the address specified by the current contents of the central processor MA register. Pressing the EXAMine switch loads the contents of core memory at the address specified by the MA.register into the MB register and then increments the MA register and the PC. Repeated operation of this switch permits the contents of sequential core memory locations to be examined. EXAM Pressing HALT clears the run flipflop and causes the computer to stop at the beginning of the next fetch state. Operating the computer with HALT depressed causes one machine cycle to be executed when- HALT the ever CONTinue switch is pressed. Pressing SINGle STEP clears the flip-flop and causes the com- SING” STEP run to puter execute and halt at the one instruction beginning of the next fetch state. the DEPosit switch loads the contents of the SR into the MB DEP Lifting register and into core memory at the address specified by the current of the central processor register, then increments the contents MA ' PC and the MA registers. This facilitates manual storage of information in sequential core memory locations. EMA The 3-bit Extended Memory Address register displays the memory field designation of the memory field currently being accessed. 4-4 _ MEMORY ADDRESS The MEMORY ADDRESS register displays the contents of the central processor MA register. It combines with the EMA register to provide the 15-bit address of the next core location to be. accessed. The RUN indicator is lit whenever all machine timing circuits are ac- RUN tivated and capable of executing instructions. Indicator Selector Switch 6-position rotary knob desigwhich of six possible registers (or combinations of regisThis- nates to be loaded 12-bit adjacent display. ters) is into the Setting this knob to: BUS Displays the logical state of the data gating lines which connect the major registers. MQ Displays the contents of the multiplier quotient register. ' Displays the contents of the MB MD register. This indicates the last information read from written or into core memory. I AC Displays the contents of the cumulator. ac- ~ ‘ STATUS. ‘ Indicator Light/ Bit Position Turned On to The link contains a binary 1. The Greater Than Flag (GTF) is raised. 1 2 3 4 6-8 9-11 Indicate: * 0. 5 Each display light is turned on to indicate the designated condition: . The interrupt request line is asserted. A processor condition which prevents program interrupts has been initiated by software. The interrupt enable flip- flop is on. The user mode line is asserted. register. Displays the contents of the instruction Displays the contents of the data field register. field 4-5 STATE — With the Indicator Selector knob in the STATE position, each display light is turned on to indicate the following condition: Indicator Light/ Bit . Turned on to indicate: Position Currently in fetch state. Currently in defer state. Currently in execute state. Displays the contents of the instruction register. 0 1 2 3-5 . 6 The MD DIR line is asserted. The BREAK DATA CONT line is asserted.” The SW line is asserted. The PAUSE I/ 0 line is asserted. The BREAK IN PROG line is asserted. The BREAK CYCLE line is asserted. ,. - 7 ' 8 9 10 11 Note: The function of the various transmission lines cited and their associated control logic is documented in the Small Computer Handbook. MANUAL PROGRAM LOADING After writing a program, the programmer must store the instructions in memory before they can be executed. One means of accomplishing this is to load the octal value of each instruction directly into core memory from the programmer’s console. The following procedure will initialize the programmers console for manual program loading. 1. Place OFF/POWER/PANEL LOCK switch in the the POWER position. 2. Load 0000 into the switch register. (all Switches in the down position)._ 3. Place all other switches in the up position, except for the spring—loaded DEPosit switch. 4. Turn off all peripheral devices. Once the programmer’s console has been initialized, a program may be loaded manually by following the instructions in Figure 4-2. Figures 4-3 and 4—4 give: further instructions for checking and 4-6 running the stored program; These: procedures 'will also permit a single core memory location to be examined or altered. The content of the desired location is considered to be a one-Word “program,” in this case, and the left-hand (clockwise) loops in the flow charts are never taken. < INITIALlZE l 7 SET INDICATOR SELECTOR KNOB TO MD F SET SR To PROGRAM'S FIRST ADDRESS V PRESS ADDR LOAD V SET SR T0 PROGRAM'S FIRST BINARY INSTRUCTION 7 LIFT DEP SET SR T0 PROGRAM'S NEXT INSTRUCTION ‘ROGRAM IS LOADED _ Figure 4-2 Manually Loading a Program 4—7 I I INITIALIZE I SET INDICATOR SELECTOR KNOB T0 MD SET SR 1:0 PROGRAM S FIRST ADDRESS SET SR TO VALUE OF MA—I PRESS ADDR LOAD IPRESS PRESS EXAM ADDR LOAD I SET SR TO CORRECT INSTRUCTION LIFT DEP ALL INSTRUCTIONS CHE?)KED Figure 4-3 Checking a Stored Program INITIALIZE II SET SR TO ADDRESS OF PROGRAMS FIRST INSTRUCTION EwEEAEI PRESS CLEAR AND CONT PROGRAM IS RUNNING Figure 4-4 Running a Stored Program 4-8 KEYBOARD/ PRINTER CONSOLE DEVICES The techniques described in the previous section permit direct interaction between the operator and the computer. This type of interaction is very convenient for many special applications such— as program modification and debugging, data modification and controlled program execution. In general, however, a keyboard/ printer peripheral device is also necessary so that routine input/ output operations may proceed at the fastest possible rate of speed. The VTOS Display Terminal (Figure 4-5) and the LA-30 DEC— writer Data Terminal (Figure 4—6) are console devices which per— mit fast, convenient interaction between the operator and the com- puter. They are the recommended medium for most routine input/h output operations. These devices are described in the Small Computer Handbook. The LT—'33 Teletype may also be Used as a console device. Teletype operation is described in the following sections. Figure 4-5 VTOS Display Terminal 4-9 . Figure 4-6 LA—30 DEeriter Data Terminal _ TELETYPE OPERATION consists of printer; keyboard; paper and The reader, tape paper tape punch. Teletype unit can operate under program control or manual control. Programmed operation of the Teletype unit is described in detail in Chapter 6. Opera— tion of the Teletype unit as an independent device for generating The LT—33 Teletype a paper tapes is described later in this section. and. their functions are listed below. 4-10 Major components ‘ " rorrr REL. 8. SP. ON START 'STOP FREE '- - ‘- ' i on: . ’ LINE Figure 4-7 LT-33 0 LOCAL Teletype Console Teletype Control Knob Teletype console (see Figure] 4-7 ) has the following three positions. The control knob of the LT—33 LINE Teletype console is energized and connected the computer as an input/ output device under computer control. The - to OFF The Teletype console is de-energized. LOCAL The Teletype console is energized for off-line operation under control of the Teletype and switches exclusively. 4-11 keyboard ©®®©©H®O©©OO OWOQW COCOQOQQCDWQ .©©©©®®©©©. L l SPACE Figure 4-8 Teletype Keyboard Teletype Keyboard The Teletype keyboard shown in Figure 4-8 is similar to a typewriter keyboard, except that some nonprinting characters are included asupper case elements. When typing upper case characters or symbols such as $, % or it, which appear on the upper portion of numeric keys and certain alphabetic keys, the SHIFT key is held depressed while the desired character or symbol key is operated. When typing the nonprinting operational functions which appear on the upper portion of some alphabetic keys, the control (CTRL) key is held depressed while the desired key is operated. Table 4-2 lists several commonly used keys that have special functions in the symbolic language of PDP-S series computers. Table 4-2 Special Keyboard Functions ‘ Key SPACE Function Space Use Used to combine and delimit symbols or numbers in a - symbolic program. RETURN Carriage Return Used to terminate input. HERE 18 Blank Tape . . 4—12 line of a - Used to generate leader/ trailer tape. Effective in L0CAL control mode only. Special Keyboard Functions. Table 4-2 (cont’d) ' Key Function . ‘ RUBOUT Use Used for Rubout deleting erroneous characters. Punches channels. CTRL/ SHIFT/ REPT/ P Code 200 LINE FEED Line Feed all eight Used for- leader/ trailer on BIN format tapes. Keys must be released in reverse order: P, REPT, SHIFT, CTRL. Follows carriage return to ad—' vance printer one line. . Used to type the characters and symbols which appear on the upper portion of certain SHIFT keys. Teletype Printer The Teletype printer operates at a maximum rate of ten char— _' acters per second. When the Teletype unit is on line (LINE control mode), all printed copy is generated under program"'.control by the computer. When the Teletype unit is off line (LOCAL control mede), all printed copy is generated automatically whenever a key is typed. - - _ _ ' ’ Teletype Paper Tape Reader The Teletype paper tape reader (also called the low-speed reader) is used to read data'punched on paper tape into core memory. The data is read from an eight-channel, perforated paper tape at a maximum rate of ten characters per second. Operation is controlled by a three-position switch, shownin Figure 4-7. The control positions are described below. - START Activates the reader; reader gaged and operative. ’ STOP sprocket wheel is Deactivates the reader; reader sprocket wheel is en- gaged but not operative. FREE en- Deactivates the ’ disengaged. - ‘ reader; reader sprocket wheel is . 4-13 Teletype Paper Tape Punch The paper tape punch is used to perforate eight—channel, rolled, oiled paper tape at a maximum rate of ten characters per second. ' .The punch controls are shown in Figure 4-7 and described below. REL. .Disengages loading. the tape to allow tape removal or _ B.SP. Backspaces the tape one space for each firm depression of the B.SP. button. ON Activates the paper tape punch. OFF Deactivates the paper tape punch. CHANNELS 3 2 B 7 6 5 4 1 WW Data is recorded ' . ' . ' . ' ° ' ‘ . ' . . ' +C°LUMN (punched) on paper tape by groups of holes arranged in a definite format along the length of the tape. The tape is divided into channels, which run the length of the tape, and into columns, which extend across the width of the tape, as shown in the adjacent diagram. The paper‘ tape readers and punches used with PDP-8 series computers accept eight-channel paper tape- SPROCKET HOLE Generating A Symbolic. Tape Symbolic tapes to be used as input to the Assembler are most conveniently prepared on—line, using the Symbolic Editor. This program, described in Chapter 5, has several formatting and error4-14 . correcting features which greatly facilitate the process of writing and editing symbolic tapes. If it is not possible to generate a ‘sym- 3 bolic tape on—line, the following procedure may be employed to generate such a tape on the Teletype. This procedure is best employed on an isolated Teletype unit, when the computer is un‘ available. Teletype Control Knbb to LOCAL and turn the paper tape punch ON In LOCAL mode the Teletype unit and functions much like an is independent of the computer electric typewriter. '2. Press the HERE IS key to several inches of leader 1. Set the . produce tape. 3. ' 4. - - Type out the symbolic program, following the conventions described in Chapter 3 To correct an error, press B. SP. until the error is under the print/ punch station, then press RUBOUT until the error and all subsequent characters have been deleted. The erroneous character and all subsequent characters may now be retyped. Press the HERE IS key to produce several inches of trailer following the symbolic program, then remove the tape by tearing it against the plastic cover of the punch. The following procedure is ASCII-coded employed to obtain a ' listing of an symbolic tape. 1. Set the paper tape reader switch to STOP or FREE. 2. Release the plastic cover of the reader unit and place the tape over the read station with the small the sprocket wheel. Close the cover. sprocket , holes over , 3. Set the Teletype Control Knob to LOCAL. 4. Push the paper. tape reader switch to START and release. A printed copy of the tape will be produced on the Teletype. If the paper tape punch is ON, a duplicate of. the tape will also be generated. ' ‘ Paper Tape FormatsManual use of the toggle switches on the programmer’s console is a tedious and inefficient means of loading a program. This procedure is necessary in some instances, however, because PDP-8 4-15 . ' series computers must be programmed before any form of input to the memory unit is possible. For example, before any paper tape can be used to input information into the computer, the memory unit must contain a stored program which will interpret the paper tape code and store the interpreted data in core memory. This loader program must often be entered into core with the console switches. Before a loader program can be written to accept information, the format in which the data is represented on paper tape must be established. There are three basic paper tape formats commonly used by PDP-8 series computers. The scribe and illustrate these formats. O O O 0 o o o . o o c o O o o o . o o o . T 310 H 311 I o 323 S 240 o . . o 311 I . 323 s . 301 A 240 . . 324 O o o o o . . O ' . . o o 0 o . g . o o 323 s o o =- 303 C 3” 1 3” I . P 0 ’ ' ‘ ' ° ' o o o o O O 240 °' :: 1 o 0 0 ° . zz: o o 0 . 3?: (F) 322 R o 315 M o o“ o following paragraphs de- o 0 § 301 A 324 T ASCII FORMAT The USA Standard Code for Information Interchange (ASCII) format uses all eight channels1 of the paper tape to represent a single character (letter, number, or symbol) as shown in the diagram at left. The complete code is given in Appendix Bl. Channel 8 is normally designated for. parity check. The Teletype units used with PDP-S series computers do not generate parity, and Channel 8 is always punched. 4-16 {— . CHANNEL 7 z ' ' z: ' ° : RIM (READ IN MODE) FORMAT VRIM format tape uses pairs of columns to represent : :17 LOCATION adjacent words directly. 12-bit binary : 3’: to represent either addresses ':'::°:' 5:; information to .be stored. A’ channel 7 punch indicates that : I _. : 1:: CONTENTS the column and the folbe inter-‘ lowing column ':'::°:: g; LOCATION 'preted address specify: ing the location at which the :: :3 information contained in the CONTENTS Channels 1 through 6 are used or LOCATION current are ° ' to an as CONTENTS 77 ........ ° °" ' . 00. z z z : 3; ° . . ° g, 50 ' OOOOOOIOOOO OO 00 OO o 02 o 56 _ o 77 .0 76 ,. O O o o O leader and tape RIM format tape in channel 8 (BINARY) FORMAT Binary format is similar to RIM ORIGIN format except that only the first address in a series of consecuINSTRUpTION tive addresses is specified. A INSTRUCTION Channel 7 punch indicates that BIN 32 0. The for FIELD SETTING 00 o stored. trailer must E o CONTENTS following two columns is to be be punched 2; LOCATION only (octal 200). g o o LOCATION . 00 77 0 OI O 77 o 45 WW" the current column and the fol- INSTRUCTION lowing column are to be inter- preted as an address. Successive 'pairs of columns are stored in INSTRUCTION sequential locations following this address until another ChanINSTRUCTION nel 7 punch is encountered. A INSTRUCTION INSTRUCTION Channel 7 and a channel 8 punch designate the current" colmemory field specifi¥ INSTRUCTION umn INSTRUCTION cation. Leader/ trailer tape must be punched in channel 8 only. 4—17 as a Paper Tape Loader Programs Each of the threepaper tape formats has its own primary ap— The ASCII is used format for plication. symbolic programs which provide input to the AsSembler. As described in the previous Chapters, the Assembler translates ASCII—coded mnemonic instructions and symbolic addresses into binary instructions and 211380111te addresses. Once this translation has been performed, format tape is generated. - a binary Binary format tapes are the usual means of loading assembled programs into PDP—8 core memory. Binary tapes are loaded under program control, using the BIN Loader, which is an 83—instruction program that must be placed in core before any binary format tape may be loaded. RIM format is easier to load than BIN _ format because RIM format supplies a core address for every instruction. If the BIN Loader is not in core, the l7-instruction RIM Loader may be tog— gled into core from the programmer’s console and used to load a RIM format tape of the BIN Loader. RIM Loader instructions and corresponding core memory locations are listed in Appendix E which also includes directions for storing and using the RIM and BIN Loaders. Chapter 5 contains further discussion of the use of , paper tape loaders. PERIPHERAL EQUIPMENT AND OPTIONS PDP-S/E computers are used in many different environments interfaced with many different peripheral devices. The Teletype unit is the most common peripheral device, but other and ‘ ' are equipment and options often incorporated in a system with the PDP-S/E include high—speed paper tape reader and punch units, DECtape, DECdisk, extended memory, and the extended arithmetic element (EAE). These options give the basic PDP-S/E new capabilities of which the programmer should ,be aware. The purpose and features of each of these following sections. options are described in the High- Speed Paper Tape Reader and Punch Unit Loading a long paper tape program into core memory with the low—speed reader of the LT— 33 Teletype unit is very time consuming. Punching a long program on paper tape from an assembly program is also very slow. If handling of lengthy paper tapes is commonly required, much computer time is wasted while low4—18 A speed input/output devices read or punch data. The high-speed paper tape reader and punch unit performs paper tape input and output at a considerably faster rate than the low-speed reader and punch. It is of great value in any system that relies on paper tape as a primary medium of data and program storage. ' ihH-Specd Papar Tape Unit The high-speed paper tape reader and punch unit is available in twoversions: the raCk mounted PCS—EA illustrated in Figure 4—9,. and the table top PCS—EB. Both units consist of a PRS-E highspeed paper tape reader and a PC8—E high-speed paper tape punch, mounted on a single chassis. The reader and punch are also available separately The high—speed reader accepts input data from eight—channel, , ~ , fan-folded, non-oiled paper tape at a maximum rate of 300 characters per second, or thirty times the LT-33 maximum input rate. The high-speed punch records output data at a maximum rate of , 50 characters per second. All reader and punch operations are executed on-line. They may be controlled directly by the Computer or from the keyboard through the computer. The reader and punch are each supplied with an ON/OFF rocker switch Which applies power to the respective units in the I 4-19 v ‘ ON position and disconnects power in the OFF position. Each device is also provided with a FEED switch which advances the tape without reading, in the case of the reader, or advances tape with only the feed holes punched, in the case of the‘punch unit. The reader is supplied with a control knob‘which may be turned counter- clockwise to raise the tape retaining lever and free the tape, or clockwise to lower this lever and engage the sprocket wheel. following procedure is employed to position tapes in the high-speed reader: The 1: Turn the control knob to raise the tape retaining lever. '2. Place a fan-folded tape in the right-hand bin. 3. Place several folds of leader in the left—hand bin and posi— tion the tape holes. so that the sprocket wheel engages the feed 4. Turn the control knob to lower the tape retaining lever. 5. Press the FEED switch 6. properly positioned. Tape is advanced and read by programmed computer in- briefly to ensure that the tape is. struction's. Extended Memory PDP—8 series computers have a basic core memory composed of 4096 twelve-bit words. Core memory may be expanded by the addition of up to seven 4096-word memory modules, providing a maximum storage capacity of up to 32,768 words. Each module is called a memory field; Memory fields are numbered from 0 to 7, with memory field 0 designating the original 4096 words of core. Core locations within each memory fieldare numbered from 0 to 77778 (409510). ‘ One twelve— bit data word is capable of addressing a maximum 4096, unique locations. However, PDP 8 series com— puters use two special 3—bit registers which permit 215, or 32,768, of 212, or locations to be addressed. During program execution the content of the instruction field register determines the memory field from which the operand of a directly addressed instruction should be taken. Any directly addressed TAD, AND, 182 or DCA will obtain its operand from the designated memory field, and any indirectly addressed TAD, 4—20 AND, ISZ or DCA will obtain its pointer from the designated ' memory field. After an indirectly addressed TAD, AND, ISZ or DCA instruc- tion obtains its pointer from the memory field designated by the instruction field register, it then obtains its operand in a similar designated by the data field register. The instruction field and data field registers are originally set by loading the desired binary designations into switch register bit positions 6-8 (instruction field register) and 9-11 (data field reg— ister), then pressing the EXT ADDR LOAD switch. These regis— manner from the memory field ters may also be loaded under program control. Aside from its more obvious applications, extended memory is Commonly used to store important system software. For example, the BIN Loader might be permanently stored in memory field 1. If the instruction field register is loaded with 001 and the data field register is loaded with 000, in this case, the BIN Loader will execute in memory field 1 and store a binary program (which is. sirnply data to the Loader) in memory field 0. DECtape System ' . DECtape provides optional auxiliary magnetic tape storage for PDP-8 series computers. A DECtape updating facility system consists of at least one DECtape control unit and One to eight TUS 6 DECtape transport units. In contrast to conventional magnetic tape devices which store information in sequential, variable-length positions, DECtape permits allocation of fixed, adr dressable positions for information storage. DECtape is bidirectional, although data is usually read in the same direction that it was written, and it records information on pairs of identical, noné adjacent channels, to minimize any chance of data loss. A standard PDP-8 DECtape contains 2702's blocks of 2018.12— bit data words each. This provides a total usable storage of 1563 ,3028 (or 190 ,14610) 12- bit words per standard tape. Nonstandard tapes may be prepared for special applications. The TUS 6 DECtape Transport Unit shownin Figure 4- 10 reads and writes the 10- channel magnetic tape. Tape movement may be controlled by program instructions or by manual operation of switches located on the front panel of the transport. Data is trans— ferred only under program control. The manual transport controls an "and _ are identified in Table 4-3. 4-21 TU56 Figure 4-10 TU56 DECtape Transport Controls Table 4-3 . DECtape Transport Unit Transport Control Position REMOTE Function This switch position energizes the DECtape transport and places it under program control. . ~ OFF . This switch position disables the DECtape transport. . This switch position energizes the DECtape transport and places it under operator control from external transport switches. LOCAL ’ _ A WRITE ENABLED This switch position enables the DECtape for search, read, and write activities. WRITE LOCK This switch position limits the DECtape transport to search and read activities only. (This prevents accidental destruction of permanent data.) Unit Selector - # The value Specified by this eight-position rotary dial identifies the transport to the control unit. With the transport in LOCAL mode, depressing this switch causes tape to feed onto the right hand spool. With the transport in LOCAL mode, depressing this switch causes tape to feed onto the left-hand Spool. ' 4—22 following operations will initialize ‘a DECtape transport unit for use under program control. It. is assumed that a preformatted DECtape (see Chapter 7) is employed. The 1. Set the REMOTE/ OFF / LOCAL switch to OFF. 2. Place a DECtape on the left spindle with the DECtape label _ out. . 3. Wind four turns of tape onto the right spindle. 4. Set the REMOTE/ OFF / LOCAL switch to‘LOCAL. 5. 6. .Wind a few turns of'tape onto the right spindle with the -> switch to make sure the tape is properly mounted. Dial the correct unit number on the unit selector dial. 7. Set the REMOTE/OFF/LOCAL switch to REMOTE. Se- lect either WRITE-ENABLE or WRITE LOCK. DECdisk Systems The DF32D DECdisk is a low-cost, random-access, bulk stor— age device and control mechanism with a storage capacity of 32,768 twelve-bit words. Data is transferred by means of the data break facility at a maximum rate of 34 microseconds per word. The DF32D system can accommodate up to three DS32D pander disks, providing an economical 131,072 Words storage capacity ex- of up to The R508 DECdisk and RF08 controller combination provides storage for 262, 144 words per disk. Up to four R508 disks may be driven by one controller, allowing a maximum system storage ca- pacity of over 1‘ million words. Data is transferred at a maximum rate of 16. 7 microseconds per word, and average access time is less than 20 milliseconds. The RK8 Disk Cartridge System consists of one RK08_- P Disk Interface Control which will drive up to four RK01 disk files. System capacity is 831,488 words per disk, or up to 3.3 million words with the maximum system configuration; The RK8 Disk System will transfer a full 4096 words in about 80 milliseconds.Extended Arithmetic Element , The KE8-E Extended Arithmetic Element (EAE) is an option for the PDP-8 / E which provides circuitry to perform arithmetic “operations that cannot be performed directly using the basic PDP8/E instruction set. The EAE microinstructions permit multipli4-23 - cation and division of unsigned integers to be performed directly. Other microinstructions perform arithmetic or logical shifts and normalization. EAE microinstructions also permit double precision numbers to be added, complemented, incremented and stored directly. The 12-bit Multiplier Quotient (MQ) Register is used in conjunction with the accumulator to perform multiplication, division and double-precision operations. The content of this register is displayed on the PDP-8/E programmer’s console when the indi—' _ ' cator selector knob is set to M0. A one—bit register called the Greater Than Flag (GTF) is used as an. extension of the MO Register during shift operations. The GTF is also used to compare signed numbers while a subtraction is performed. The state of the GTF is displayed by console indicator bit position‘l when the indicator selector knob is set to STATUS. The EAE option is essentially an increase in instruction capability. The additional instructions, which are microprogrammable, are included in Appendix D. These instructions can effect a significant reduction in core requirements and program execution time by eliminating iterative coding. In addition, the double precision instructions may be used to good advantage for input buffering operations and whenever full 12-bit addressing is desired. ”EXERCISES 1. Toggle into memory and run the programs written in Chap— ter 2 for exercises 6 and 10. 2. Toggle the RIM Loader (Appendix E ) into memory using the console switches. Verify the contents of memory with the EXAM switch. 3. program to set the contents of locations 2000 through 2007 to the value of the switch register and then Write a halt. Toggle it in and verify that it works. 4. program to accept two numbers from the switch register and add them displaying their contents in the acWrite a (Hint: precede each OSR instruction with a HLT. After setting the switch register, activate the CONT key.) Translate the program into octal and toggle it into cumulator. memory. Verify that it works properly. 4-24 loading editing and debugging INTRODUCTION This . chapter introduces the reader to on—line operations with Digital Computers. It describes how to load progIMS into core both manually and by the use of available loaders, .how to‘ create and edit programs, and how to debug and correct programs after assembly or compilation. Most PDP-8/E systems require the use of at least some of the programs in this chapter. The loaders—— RIM, Binary, Self-Starting Binary, and Hardware Bootstrap, the Symbolic Editor, and the debugging programs—CDT and DDT, are discussed thoroughly; The information on the Editor, ODT, and DDT applies to these programs as they are provided on a Paper Tape System. (Undercertain other systems, such as OS/S, modifications may have been made to these programs either to meet restrictions or to provide the user with an even more powerAny changes or modifications are described in the apprOpriate manual ) core - ful version. LOADERS A loader is - _ a short program or routine which, when in core, enables the computer to acCept and store other programs. DEC offers the user the following basic loaders: 5-1 . 1. any Read—In-Mode (RIM) Loader—used to load into core programs punched on paper tape in RIM format, in particu- lar, the Binary Loader. 2. Binary (BIN) Loader—used to load into core memory any programs punched on paper tape in Binary format. 3. Self-Starting Binary (SS BIN) Loader—used to automati— cally load or load and start a program in Binary format. (SS BIN may be merged onto the beginning of a tape to provide quick and easy loading.) 4. MI8—E Hardware Bootstrap Option—a hardware option purchased by the user containing a bootstrap for pre-loaded a particular configuration. - RIM Loader . When a computer in the PDP—8 series is first received by the customer, its core‘memory. is completely demagnetized. With the exception of the Hardware Bootstrap option (discussed later) which may have been purchased with the system, the computer “knows” nothing, not even how to accept input. However, it is possible to manually load data directly into core using the programmer console switches. The RIM Loader is the first, and often only, program loaded in this manner, and allows the computer to receive and store in core paper tape in RIM coded format. (This otherstinary and ASCII—are described in data punched format, and two on detail in Chapter 4.) The RIM Loader is used in particular to load the Binary and Self-Starting Binary Loaders. There are two RIM Loader programs—one for input from the low-speed (Teletype) paper tape reader, and the other for input from the high—speed reader. Table 5-1 lists the octali instructions for these programs. The loading and verifying procedures are detailed in the flowcharts in Figures 5-1 and 5-2. (These flowcharts are also contained in Appendix E.) After loading RIM, it is a good programming practice to verify that all instructions have been entered properly. \ 5-2 ' _ When loaded, the RIM loader occupies absolute locations 7756 through 7776. I I INITIALIZE I SET ROTARY SELECTOR SWITCH TO MD I SET SWITCHES 6-8 TO DESIRED INSTRUCTION FIEIJD* ET SWITCHES 9-11 TO DATA FIEL DESIRED!’ SROULD *DECTAPE USERS LOAD RIM INTO FIELD O _ PRESS EXTD ADDR LOAD ' SET SR TO 7756 I PRESS ADDR LOAD SET SR= FIRST INSTRUCTION LIFI‘ DEP SET SR= NEXT INSTRUCTICN LIFT DEP RIM IS LOADED Figure 5-1 Loading the RIM Loader '5-3 iNiTIALiZE [ SET ROTARY INDICATOR SWITCH TO MD SET SWITCHES 6-8 TO FIELD IN WHICH RIM HAS BEEN LOADED PRESS 5x113 ADDR I LOAD SET SR=7756 l PRESS ADDR LOAD PRESS EXAM ALL CHEgKED PRESS ADDR LOAD RIM IS LOADED SET SR= CORRECT INSTRUCTION LIFT DEP , Figure 5-2 Checking the RIM Loader 5-4 Table 5-1 RIM Loader Programs ‘ Instruction I Location . Low-Speed Reader High-Speed Reader 6032 6014 V 7756 - 7757 7760 ' V ‘7761 7762 7763 7764 6031 5357 6036 7106' _6011 - ' 7006 77657766 . 7510 5357' - - 7006 27767 6031 - . " 7770 [5367 ‘ 7771 7772 7773 7774 7775 7776 a. 5357 - 6034 7420 3776 . 6016 7106 7006 7510 5374 7006 6011 5367 6016 7420 _ \3776 V _3376 ‘ , ' 5356 0000 _ 3376 5357 0000 Binary Loader The Binary Loader is a short utility program which, when in core, instructs the computer to read-binary—coded data punched on paper tape and store it in core memory. BIN is used primarily to load DEC-supplied binary programs and binary tapes produced by PDP—S/ E assembly programs such as PAL III and MACRO-8. BIN is furnished to the programmer on punched paper tape in ~ . RIM ‘coded format; therefore, RIM must be in core before BIN can be loaded. When loading BIN, the input device (low-speed or high—speed reader) must be the same as that selected when loading RIM, and RIM and BIN must be loaded into the same field. Once stored in core, BIN resides 011 the last page of core, occupying absolute locations 7625 through 7752 and 7777 of the field in which it was loaded. BIN was placed on the last page of all DEC’s that it would alwaysbe available for use, as software (with the exception 'of the Disk Monitor and OS/ 8) is careful not to use this page. The programmer must be aware that core so if he writes a program whiCh uses the last page of core, BIN will be destroyed when the program is run, and both RIM and BIN must be reloaded before another program can be loaded into the computer. Figure 5—3 details the method of loading BIN. 575 V 1 "-1 SEE FIGURE 5-1 LOAD RN SET ROTARY SELECTOR SWITCH 7T0 MD J, SET SWITGO‘E 5-8 To F|ELD WMCH WNTAENS RIM l SET swncngs 9-H TO HELD IN wmcn BIN IS TO BE LOADED PUT am LOAOER m R' *IVITH LEADER/TRAILER WEE THE READ D‘EAD YES Figure 5-3 Loading the Binary Loader 5-6 The programmer is now able to load deseribed in Figure 5-4. binary tapes Iusing the ' method Wm SET ROTARY SELECTW SWITCH TO AC i. SET SMTCHES 6-8 To FIELD IN WHICH BIN IS LOADED YES ' Figure 5—4 QJECT TAPE IS LOADED Loading A Binary Tape Using BIN 5-7 0—me , _ RIM )uul SEE FIGURES 54.5-2 SET ROTARY SELECTOR SWITCH TO AC l SET SWlTCHES 6-H TO FIELD WHICH CONTAINS RM 1 PRESS EXTD AWR LOAD SET 5R= 7756 PRESS ADDR LOAD TURN TTY TO LINE ‘ PUT SSBIN IN HSR TSSBIN IN LSR SET LSR TO START PRESS CLEAR AND CONT PRESS CWT Figure ‘5-5 , Using 88‘ BIN with the RIM Ldader‘ 5—8 Self-Starting Binary Loader The Self—Starting Binary Loader reads binary format paper tapes from either the high-speed or low-speed reader and, providing a starting address has been specified, automatically starts the program at the completion of loading. 1 ~ SS BIN itself is a RIM format program and is loaded with the RIM Loader or the hardware bootstrap, generally as the first part of a two-part tape. (The second part of this tape is the object program or data to be loaded, and1s separated from SS physically BIN by leader / tra11er code.) . Many DEC— supplied programs are now being distributed as self—loading binaries that include a starting address for automatic, starting and loading. However, SS BIN may be used independently, in which case the binary object tape must be manually loaded, if a starting address has been specified, it will be automatically started ~ The user may generate his own self-loading binaries; the pro- cedures involved in this process and other detailed information concerning SS BIN are contained in the library write-up DEC-8E-__ XBINA—A-D, which is available from the Software Distribution Center. SS BIN occupies locations 7600 through 7755 and location: 7777 of the memory field into which it has been loaded. Figure 5-5 describes instructions for loading the SS BIN and object ‘ , tape(s). M18-E Hardware Bootstrap Loader The MI8-E Hardware Bootstrap Loader is available a hardware option the PDP—S/E which provides a specific bootstrap loader stored in read-only—memory as a RIM format program. on Using this option, the user can automatically bootstrap into core, any DEC—supported system contained in any one of the configura— tions listed in Table 5-2. (The Bootstrap Loader option and the configuration are decided by the customer when he orders his system.) As can be seen from this table, the hardware bootstrap saves the user the necessity of manually toggling the RIM loader into memory (as described in Figure 5-1) and in most cases, provides additional bootstrapping capabilities as well. To operate the Bootstrap Loader, the user need only follow the procedure outlined in Figure 5—6. ' ‘ 5—9 , Table 5-2 Hardware Bootstrap Loaders Option Designation MIS-E RIM Program Unencoded—The user may specify any RIM of his program choosing providing it occupies less than 32 words of core. ' MI8-EA M18-EB Paper Tape—Provides the bootstrapping of the low/high-speed RIM loader. MIS-EC DECtape—Provides the bootstrapping of a DECtape-based system. ‘ MI8-ED RK8—Provides the bootstrapping of a disk-based system. MIS-EE Typeset—Allows the bootstrapping of the PDP8/ E Typesetting system. MIS-EF EduSystem (low)——Provides the bootstrapping a system in the EduSystem series using the low-speed reader. of MIS-EG EduSystem (high)—Provides the bootstrapping of a system in the EduSystem series using the high-speed reader. TD8-E MIS-EH a ( DECtape—Ailows the bootstrapping of TD8-E DECtape-based system. > START MAKE SURE COMPUTER AM). . TERMINAL ARE ON—LINE PLACE TAPE ASSOCIATED WITH SYSTEM IN POSITION IF BOOTSTRAPPING AN EDUSYSTEM, SET SR TO CORRECT ADDRESS i Figure 5-6 Using the Hardware Bootstrap 5-10 SYMBOLIC EDITOR Introduction The Symbolic Editor (as used on a Paper Tape System) is used to create and modify symbolic (source) program tapes from the Teletype keyboard Thus tedious task of the preparing . source program tapes off-line is eliminated. The Symbolic Editor (hereafter, simply Editor), uses the Tele- type keyboard as a. very sophisticated typewriter. That is, as the program is typed, it is entered into core, where it can be checked, corrected, and modified. Then, when the user is readyto source generate the source program tape, Editor will respond to the ap— propriate command by producing a tape suitable for assembling . or ' compiling into an object (binary) tape which will, in‘turn, run ' on' the computer. Editor is a very helpful tool; still, it must be told precisely what to do. The user directs its operations by typing certain commands ' in the form of a single letter or a letter with arguments. All 00m— mands are executed by typing the RETURN key directly after the command Editor occupies about 1000 locations of. core and leaves all but the last page of core for the source program—allowing (in a 4K core) approximately 60 lines of heavily commented text or about 340 lines of text without comments (about 420010 characters). The source program is stored in the text buffer area of core. When the text buffer is ‘ full, Editor rings the Teletype bell. The buffer may then be enlarged, as explained later under Editing a Symbolic Tape, or the contents of the buffer may be punched (dumped) onto paper tape._ If punched on paper tape, the Editor may be re- (also explained later) and editing continues with a com— pletely refreshed (clear) text buffer. The rest of the source program can then be placed into core and punched out so that the entire source program is on one long tape, ready to be assembled started or compiled. Each line of text includes the terminating carriage feed combination which is lines in the bufier' are produced by return/line the RETURN key. All implicitly numbered in decimal, starting with 1. This implicit enumeration is continually'updated'by Editor to account for line insertions, moves, and deletions—a few of the 5-11 \ features available using Editor. For editing‘and listing purposes, each line is referred to by its current implicit decimal line number. Text may be entered into core using the Teletype or high-speed paper tape reader (Editor does not distinguish paper tape from keyboard input; it perceives only symbolic input). Loading and - operating instructions are contained toward the end of the chapter. Modes of Gperation To distinguish between editing commands and the actual text entered in the buffer, Editor operates either in command mode'or text mode. In command mode all input typed on the to be ' keyboard is interpreted as commands to Editor to perform some operation or allow some operation to be performed on the text stored in the bufier. In text mode, all typed input is interpreted as text to replace, be inserted into, or be appended to the contents of the text buffer. TRANSITION BETWEEN MODES Immediately after being loaded into core memory and started, Editor is in command mode; that is Editor is waiting for a command. The desired command code is then typed and terminated by the RETURN key, which instructs the Editor to carry out the command. With Editor in text mode (through use of the Insert or Append commands) corrections or insertions may be typed to the text. To terminate text mode, a form feed, (CTRL/FORM combination) ‘or CTRL/G may be entered, instructing the Editor to «return to command mode; Editor answers by ringing the Teletype bell to indicate the transition back to command mode. Command” Stmcture A command directs Editor to perform a desired. operation. Each command consists of a or single letter, preceded by zero, one, two three arguments. The command letter tells Editor what to do; the arguments usually specify which numbered line or lines of text are affected. Commands to Editor must take one of the following forms, where E represents any command letter. , NOTE Except where specified, each line typed by must be entered to the computer by typing the RETURN key. the user 5—12 ‘ Table 5-3 Command Structure Command Type Of Command Format Meaning E Perform operationE. N0 Argument One Argument Perform Operation E on the ref- nE ' erenced line. Two Arguments Perform m,nE operation E on lines m (m < 11). through n, inclusive Three Arguments by MOVE command only (move lines m through n to be- m,n$jE» Used fore line j). - . The arguments m and n, which refer to numbered lines in memory, must be positive, and n must be greater than In. Two arguments must be separated by'a comma, but no comma is allowed between the arguments and the command. Special Characters and Functions A number of Teletype keys have special operating functions. These keys and their associated functions are listed ‘below: RETURN 'KEY _ _ In both command and text modes, typing the RETURN key signals Editor to process the information just typed. In command mode, it allows Editor to execute the command just typed. A com— mand will not be executed until it is terminated by the RETURN key (with the exception of 2, explained later). In text mode, RETURN causes the line of text which it follows to be entered ' into the text buffer. A typed line is not actually part of the buffer until terminated by the RETURN key. ERASE (CTRL/U) The erase character (CTRL/U combination) is used for error recoveries in both command and, text modes. It is generated by holding down the CTRL key while typing a U and is not-echoed on the Teletype. When used- in text mode, CT RL/ U cancels everything to the left of itself back to the beginning of the line; Editor performs a carriage return/line feed (CR/LF). The user then continues typing on the next line. When used in command mode, CTRL/ U cancels the entire command; Editor prints a ? and per— 5—13 x, V forms a CR/LF.IThe erase character cannot cancel past a CR/LF in either command or text mode. For example: Command Mode: A? Text Mode: THIS HERE , IS A TEXT MODE EXAMPLE The Editor automatically performs carriage return/line feed after CTRL/ U is struck. In the first example above, CTRL/ U was typed immediately after “A”, in the second example it was typed immediately after “THIS”. a RUBOUT KEY Rubout is used in modes with error recovery in both command and text When executing a READ command exception. from the paper tape reader, rubouts are ignored below) (explained one completely and do not go into the buffer. It is necessary for the READ command to disable the rubout function since all tab characters on paper tape are, for timing purposes, followed by rubouts which would destroy the tabs. Rubouts are not stored in the text buffer but are inserted by Editor following all tab characters on ' the output tape. At any other time in text mode typing the RUBOUT key echoes (\) and deletes the last typed character. Repeated rubouts delete, from right to left up to, but not including, the CR/ LF‘ which separates the current line from the previous one. For example: a backslash THE QUUICK\\\\ICK BROWN FOX will be entered in the bufferas: THE QUICK BROWN FOX When used in command mode, RUBOUT is equivalent to the CTRL/ U and cancels the entire command; Editor then prints a ?, performs a CR/LF, and waits for the user to type another command. . i . 5-14 ‘ ' .FORM FEED '(CTRL/FORM) . Form feed signals Editor to return to command mode. A form feed character is generated by pressing the CTRL key While typing the FORM (/L) key. This combination is typed while in text mode to indicate that the desired text has been entered and that Editor should 'now return to command mode. Editor ‘ rings the Teletype bell in response to a CTRL/FORM to indicate that it is back in command mode. If Editor is already in command mode when CTRL/FORM is typed, no bell will sound, CTRL/BELL (/G) is equivalent to CTRL/FORM (except in the case of a SEARCH command as explained later). DOT (.) Editor keeps track of the implicit decimal number of the. line on which it is currently operating. At any given time the dot, which is produced by typing the period key, stands 'for this number and may be used as an argument to a command. For example: . 1. means list the current line, and o'll.+lL means list the line preceding the current line, the current line, and the line following it, then update the current line counter to the decimal number: of the last line printed. The current line counter, represented by the dot, is generally updated as' follows: After a READ or APPEND command, dot is equal to the .1. number of the last linein the buffer After an INSERT or CHANGE command, dot is equal to 2. - 3. ,4. the number of the last line entered. _ After a LIST or SEARCH command, dot is equal to the number of the last line listed. After a DELETE command, dot is equaHo the number of the line immediately after the deletion. 9.01 After a KILL command, dot is equal to 0. After a GET command, dot is equal to the number of the line printed by the GET. 5-15 . 7. After a MOVE command, dot is not updated and remains whatever it was before the command. SLASH (/) The symbol slash (/ ) has a value equal to the decimal number of the last line in the buffer. It may also be used as an argument to a command. For example: IGJIL means list from line 10 to the end of the butter. '0 LINE FEED KEY Commands and lines of text are terminated by the RETURN key which generates a carriage return and a line feed combination. Line feed characters are completely ignored when input is on paper tape. During output, Editor automatically punches a line feed following each carriage return. Typing the LINE FEED while in command mode is equivalent to typing: ‘ .+1L and will cause Editor to print the line following the current one and to increment the value of the current line counter (dot) by one. ALT MODE KEY Typing the ALT MODE key while in command mode will also cause the line following the current line to be printed and the current line counter (dot) to be incremented by one. If the current line is also the last line in the buffer, typing either ALT MODE or LINE FEED will cause a “Mo be typed by Editor indicating that there is no next line. (Some Teletypes have an escape key (ESC) in place of the ALT MODE; the function is. identical for both ESCape and ALT MODE.) RIGHT ANGLE BRACKET (>) Typing the right angle bracket (>) while in command mode is equivalent to typing: .+lL 5-16 ’ , and will cause Editor to echo > and then print the line following the current line. The value of the current line counter is increased by one so that it refers to the last line printed. LEFT ANGLE BRACKET (<) . Typing the left angle bracket (<) while in command mode is equivalent to typing: o-lL and will cause Editor to echo < and then print the line preceding the current line. The value of the currentline counter is decreased by one so that it refers to the last line printed. EQUAL SIGN (2 ) The equal sign is used in conjunction with the line indicators, dot (. ) or slash (/). When typed in command mode it causes Editor to print the decimal valueof the argument preceding it. In this way the number “of the current line may be found (.=XXX), or the total number of lines in the buffer ( /: XXX) or the number of some particular line (/— S—XXX ) may counting from the beginning. 1 be determined without ~ COLON (z) Colon is a lower case character with exactly the same function as the equal sign (2). BLANK TAPE AND LEADER/TRAILER Both blank ,tape and leader/trailer (code 200) are completely ignored on an input tape as are line feed characters and rubouts. Line feeds andrubouts are automatically replaced wherever nec— essary on output, whereas blank tape and leader/trailer are not. TABULATION ( CTRL/ TAB) Editor is written in such a way as to simulate tab stops at eight Teletype paper. When the CTRL key held down simultaneously, Editor produces a tabulation. A tabulation consists of from one to eight spaces, de— pending on the number needed to bring the carriage to the next tab stop. Thus, the user may use Editor to produce neat columns on the hard copy (printed page) space intervals and I key are across the ._ 5-17 This tab function is used in connection with two switch register. options (for input and output) )to allow the user to produce and control tabulations in the text buffer during input and output Operations (see Switch Register Options below). On input (under a READ command) Editor can replace a group of two or more. spaces with a tabulation if the user chooses to set bit 0. On output 't will produce ei er a. ta character followed by a rubout (for timing purposes) or enough spaces to reach a tab stop, depending on the settings of bit 1. Editor cannot output tab characters unless tabulations have been entered in the buffer either from the keyboard or through'setting bit 0 on input. NOTE Location 0002 contains the negative (2’s complement) of the number of spaces used” to simulate'tab stops. To change the tabula— tion simply change the constant in location 0002 after loading the Editor. Switch Register Options register bits in conjunction With the actual input and output commands to control the reading and punching of paper tape. It is sometimes desirable to be able to interrupt a command before it finishes. For example, if you mistakenly gave a LIST command in place of a PUNCH command and you do not wish to wait) for the Teletype to list a large section of text; bit 2 on the console switch register allows you to interrupt any output command and return immediately to command mode. Table 5—4 lists the switch register bit options: Editor uses five switch Table 5-4- Position Bit . 0 Switch Register Options Action and Explanation 0 Read the input tape exactly as it is. 1 Read the input tape taking note of spaces. Each time two or more successive spaces are found, substitute in the butter altabulation for that whole group of spaces. This option affects only the READ command. 5-18 Table 5-4' Switch Register Options (Cont) Action and Explanation Position Bit 1 z " , 0-. On punching (or listing) text from the buffer, tabulations are to be interpreted as an appro— 7 " priate number of spaces.‘ interpreted as a tab character followed by a rubout (211;377). Tabulations ~ are Normal Operation. All output commands completed as specified. Suppress list, punch, or search operation. If at any time during execution of an output command this switch1s set to 1, output will cease, Editor will return immediately to command mode. (If this occurs while a line is being searched, any modifications to the line made during that search will be disregarded.) The current line counter (.) Will be equal-to the number of the line being printed or punched at that time. Until the switch-is set to 0, any further output command will be ignored. 10 Low-speed output. All punching will be done O via the Teletype punch. High-speed output.\A11 punching will be done via the high-speed punch. 11 READ command expects the source tape to be in the Teletype reader. DO NOT use the APPEND command Low-speed input. The 0 - to read tapes. High-speed input. The source tape will be read from the high-speed reader. Command Repertoire Commands to the Editor are grouped under three general head- ings: Input, Output, and Editing. Explanation of the three types of commands is given in- the following sections. Each command description will state if the Editor returns to command or text mode after completing the operation specified by the command. The Editor Will print an error message consisting of a question mark whenever the user has requested nonexistent information or 5-19 ‘ used an inconsistent or incorrect format in typing a command. For example, if a command requires two arguments, and only one (or none) is provided, the Editor will print ?, perform a carriage return/ line feed, and ignore the command as typed. Similarly, if a nonexistent command character is typed, the error message ? will be printed, followed by a carriage return/line feed; the command will be ignored. (However, if an argument is provided for a com— mand that does not require one, the argument will be ignored and the normal'function of the command performed.) For example: Message Explanation ' L The butter is empty. The user is asking 7 fer nonexistent information. 7. SL The arguments are in the wrong order. ? . nsmm The Editor cannot list backwards. This command requires two arguments ? before the 33, only one was provided. H Nonexistent command letter. , ? , INPUT COMMANDS lnput commands allow text to be entered into the text buffer either from the paper tape reader or the Teletype keyboard. The Editor is in text mode until a form feed (CTRL/FORM) is encountered. Table 5-5 Input Commands Command Action and Explanation R READ a page of text from paper tape reader. Depending on the position of switch register bit 11, reading will be done from either the high-speed or the Teletype reader. The Editor will read information from the input tape until a form feed character (CTRL/ FORM key combination) is detected or until the Editor senses a text buffer full condition. All incoming text except the form feed is appended to the contents of the text buffer. Information already in the buffer remains there. In the case of input via the high-speed reader, the end of the tape‘will be interpreted as a form feed if an ‘ actual form feed character does not appear on the tape; 5-20 Table 5-5: Input Commands (Cont.__) Action and Explanation Command the Editor returns to command mode. In the case of input via the Teletype reader, a' form feed must be entered via the keyboard to return the Editor to command mode if an actual form feed character does not appear on the tape. If this is not done, the READ command is still in effect and all Subsequent commands will be interpreted erroneously as text and appended to what was just read from tape. Any rubout encountered during ' a READ command will be ignored. (See RUBOUT.) APPEND the incoming text from the Teletype keyboard to the information already in the buffer (the buffer may be empty initially thus allowing the user to create a new file). The Editor will enter the text mode upon receiving this command and the user may then type in any number of lines of text. The new text will be appended to the information already in the butter, if any, until the form" feed (CTRL/ FORM key combination) is typed. As mentioned, by giving the APPEND command with an empty buffer, a symbolic program may effectively be generated by entering the program via the keyboard. Any rubout encountered during execution of an AP- on-line PEND command will actually delete the last typed character. Repeated rubouts will delete from right to left up to but not beyond the beginning of. the current line. The APPEND command must not be used to readpaper tapes from the Teletype reader since every rubout on the tape will delete a character. nI INSERT before line 11, the text entered from the Teletype keyboard. The- Editor enters text mode to accept 1n,put and the first line typed becomes the new line 11. Both the line numbers of all lines following the insertion are increased by the; number of lines inserted; the value of the current line counter (.) is equal to the nUmber of the-last line .inserted. command mode, the To reenter CTRL/ FORM count and (form feed) the combination must be typed. This terall subsequent com- minates text mode; if not typed, mands will be interpreted erroneously as text and entered in the program immediately after the intended insertion. ' ' INSERT, without" an argument, will insert text be- fore line 1. ~5-21 NOTE In these commands, the Editor ignores ASCII codes 340 through 376. These codes include the codes for the lower case alphabet (ASCII 341-372). The Editor returns to command mode only. after the detection of a form feed or when Editor senses a buffer full condition a (see section on Editing Symbolic Tape). OUTPUT COMMANDS ‘ Output commands are subdivided into list and punch commands. List commands will cause the printout on” the Teletype of all or any part of the contents of the text butter to permit examination of the text. Punch commands provide for the output of leader trailer, form feeds, corrected text, or for the duplication of pages of an input tape. List or punch commands do not affect the contents of the buffer. List Commands The following commands cause part or all of the contents of the text buffer to be listed on the Teletype. Table 5-6 List Commands Command Action and Explanation L LIST the entire page. This causes the Editor to list the entire contents of the text buffer. nL LISI‘ line It. This line will be printed, followed by carriage return and a line feed. a m,nL‘ LIST lines m through n, inclusive (111 must be less than 11). Lines m through It will be printed onithe Teletype. The Editor remains in command mode after a list command and the value of the current line counter is updatedto be equal to the number of the last line printed. Punch Commands The following commands control the punching onto paper tape of leader/ trailer, text, and form feeds. 5-22 _ Note that the PUNCH and NEXT commands halt the computer before executing the command. This is intended to let the luser'be sure the control switches are set correctly before any tape is » punched. Pressing the CONTinue key on the console will cause the Editor to proceed with the command. The Editor remains in command mode after execution of any command which punches ‘ tape. The Editor is designed to minimize the possibility of illegal or . meaningless characters being punched into a source tape, therefore the illegal (nonexistant) codes 340-376 and 140-177, and most illegal control characters will not be punched. In this way a tape containing illegal characters may be corrected by simply reading it into the Editor and punching it out. Depending on the position of switch register bit 10 (see Table 5-4) punching will be done by. either the Teletype punch or the high-speed punch. ' ' Table 5—7 Command . Punch Action and Explanation P PUNCH the entire nP PUNCH line 11 only. contents of the text buffer. _ PUNCH lines In through n, inclusive (where m must be less than n). m,nP The above the text. F ' Commands commands ' - do not output ' a form feed character following FORM FEED. This command causes. the punching. of four blanks, a form feed character, and approxi-- mately two inches of blank tape. If using low-speed. punch, turn punch 01? before typing command then turn on immediately after typing carriage return. T TRAILER.~ This command causesabout fourinches of blank tape to" be punched. ‘If using low-speedpunch, turn punch 01? before typing command then after typing carriage return. turn on immediately The F and T commands do not halt the computer before punching tape. If using the low-speed punch, the user must therefore turn on the punch immediately after typing thecarriage return. The codes for a carriage return and line feed. may be punched-onto the tape in some _ instances. 5-23 _ Table 5-7 Punch Commands (Cont._) Command Action and Explanation N NEXT. This is a utility command which combines the functions of four commands. It punches the con: tents of the bufler, punches some blank tape, a form feed, more blank tape, kills the buffer, and reads in the next page of text from the reader specified by switch register bit 11 (i.e., it executes P, F, K, R). Executes the above sequence 11 times. The Editor halts only before the first punching. If n is greater than the number of pages of input tape the command will proceed in the specified sequence until it reads the end of the input tape, then it will return to command mode. (If using Teletype reader, when tap’e runs out type CT RL/ FORM to return to command nN mode.) NOTE Output operations may be interrupted by setting bit 2 of the switch register (see section on Switch Register Options). EDITING COMMANDS The following commands permit deletion, alteration, or expansion of text in the buffer. Table 5-8 Editing Commands Action and Explanation Command CHANGE line n. Line 11 is deleted, and thelEditor enters text mode to accept input. The user may now type in as many lines of text as he desires .in place nC « of the deleted line. Rubouts are recognized during any CHANGE operation. If more than one line is inserted, all subsequent lines will be automatically renumbered and the line count will be priately. m,nC CHANGE lines m through updated appro- n, inclusive (m must be numerically less than 11). Lines m through 11 are deleted and the Editor enters text mode allowing the type in any number of lines in their place. user to All subsequent lines will be automatically renum- bered to account for the change and the will be updated. 5-24 line count _ Table 5-8 Editing Commands (Cont.) Action and Explanation Command After any CHANGE operatiOn, return to com- mand mode is accomplished by typing a form feed ( CTRL/ FORM) to terminate input. After a CHANGE, the value of the current line counter (.) is equal to the number of the last line of the change. 1 DELETE line 11. Line n is removed from the text buffer. The numbers of all succeeding lines are re- nD ' duced by one, as is the line count. DELETE lines In through 11, inclusive. The line fol- m,nD lowing n becomes the new line In and the rest of the lines are renumbered accordingly. The value of the current line counter (.) is equal to the number of ' the line after the deleted line or lines. The Editor remains in command mode after all DELETE operations. - tag. GET and list the next line which begins with a .The Editor begins with the line following the cur.- tests for a line which does not bewith a tab, slash, or space. This will most often gin be a liner beginning with a tag. It might also be a line containing an'origin. For example: rent line and this is the current line TAD ' DCA /THIS HERE: IS A COMMENT this line would be printed by the command G la ' :22 _ *5836 this line would be printed next if .anéther G were typed. nG GET and list the next line which'begins with a tag starting the search with line n. The Editor begins with line 11 and tests it and each succeeding line as described above. Both G and nG update the current line counter after finding the specified line. However, if either version of the GET command reaches the end of the buffer before finding a line beginning with other than a tab, slash, or space, the current line counter retains the value it had before the GET was issued, and a ? ' is typed to indicate that no tagged line was found. 5-25. ' Table 5-8 Editing Commands (Cont) Action and Explanation Command The Editor remains in command mode after a GET command. ’ » KILL the entire page in the buffer. The values of the special characters / and are set to zero. The Editor remains in cemmand mode. . ‘ MOVE lines m through 11 inclusive to before line i (m must be numerically less than n and j may not be in the range between m and n). Lines m through 11 are moved from their current position and inserted before line j. The lines are renumbered after the move is completed although the value of the current line counter ‘(.) is unchanged. Moving lines does not use any additional bufler space. A line or group of lines may be moved to the end of the buffer by Specifying j as /+1. For example: 1,10$/ +1M. Since the MOVE command requires three arguments, it must have three arguments to move even one line. This is done by specifying the m,n$jM ,, ‘ same line number twice. Example: 5: 5 523M This will move line 5 to before line 23. The Editor remains in command mode after a MOVE command. ‘ n8 ~ SEARCH line n for the character specified after the carriage return which enters the command. Allow modification of line when this character is found. The SEARCH command is one of the most useful functions in the Editor. It is also structured somewhat difierently from the other Editor commands. After terminating the command nS with a carriage return the user has told the Editor to SEARCH line 11, but 'he hasn’t specified what to search for. The Editor is, therefore, waiting for the user to type a character. The character 'he types is taken as the object of the search but is not echoed. The Editor instead immediately begins printing the specified line. After typing the character for which it is searching, the Editor stops. All of the editing features are then of available to the user. He may proceed using the following options: any 1. Delete the entire printed portion of the line by typing CTRL/ U (erase), (a carriage return/ line feed18 generated) 5-26 Table 5-8 Editing Commands (Cent) Bit Action and Explanation Position _ 2. Delete the entire unprinted portion and terminate the line and the search TURN key. 3. Delete from by typing the RE- right to left one of the characters for each \‘ (rubout) typed. 4: Insert characters after the last one printed printed simply by typing them. 5. Insert a carriage return/ line feed, thus dividing the line into two, by typing the LINE FEED key. searching to the next occurrence of the search character by typing CTRL/ FORM When printing stops all options are again avail— able. 7. Change the search character and continue searching by typing CTRL/ BELL followed by _the new search character. Each time the Editor prints the character for ~which it is searching, printing stops and all or any combinations of the above operation may be carried. 6. Continue out. m,nS SEARCH lines m through n inclusive in the same as described above. The search character is inafter the carriage return and all of .the options put are available. The onlydifference is in option number 2; typing the RETURN key deletes the entire unprinted portion of the line and terminates that. line, but the search continues on the next line. By typing CTRL/ BELL to change search characters, all editing of a single linelmay be done in one pass. Clearly, typing CTRL/ BELL twice will cause»the search to proceed to termination, since the search character will now be BELL which is not stored in the buffer. way By typing S with _no arguments the entire buffer may be searched for occurrences of a single character. It must be remembered, however, that as with every CHANGE command, every SEARCH com» mand uses additional buffer space for storage of the 5-27 ,_ ' ' Table 5-8 Command Editing Commands (Cont.) Action and Explanation line. This is obviously necessary, since the program can have no prior knowledge of whether the size of the line will be less than, greater than, or new equal to that of the old line, and it must therefore assume that it will be larger. As the entire buffer is searched, a new image of the text is created in core that is guaranteed to occupy the same or less space than previously, since all deleted spaces have been removed. The Editor recognizes this and immediately moves the text image back to the top of the butter space. Thus, the only prerequisite to condensing the text image is that there be enough core space left to contain another image of the edited text. The options available to the user are the same as described for ' m,nS. Operating Procedures After the Editor has been loaded, it may be used to read into the text buffer a page of the symbolic program to be corrected. Corrections and additions may be either entered from the Teletype keyboard or inserted from paper tape via the reader. The corrected lines, groups of lines, or be listed or punched. the entire page of text may then The following pages describe the sequence of operations neces- edit, and punch out a corrected symbolic program tape; an example of Editor usage is given at the end of this section. sary to load, LOADING AND OPERATING THE SYMBOLIC EDITOR The Symbolic Editor is loaded into core using the Binary Loader (or SS BIN). The loading procedure is illustrated in the flowchart in Figure 5-7. After loading, the user should select the desired switch register settings as detailed in Table 5—4. Loading of any symbolic tapes to be edited and all subsequent operations are performed through the use of the Editor by giving appropriate commands from the Teletype keyboard. The Editor resides1n core in locations 200-1624. 5-28 1 I LOAD BIN LOAD EDITOR _ {SEE FIGURE 5-3. "-T-‘isEE FIGURE 5-4 ----- ' SET SWITCHES 6—8 TO FIELD EDITOR IS IN PRESS EXTD ADDR LOAD SET SR = 0200 F—J H PREss‘ADOR LOAD TURN TTYTO LINE -- I PRESS CLEAR AND CONT WITH CR/LF \ SWITCH OPTIONS _ (SEE TABLE 5-4) EDITOR IS IN COMMAND MODE TYPE A AND RETURN KEYS TYPE SYMBOLIC PROGRAM I WHEN DONE TYPE CTRL/FORM OR CTRL/G $3532 IN COMMAND MODE Figure 5-7 Loading the Editor and Génerating Program On-Line 5—29 a Symbolic - GENERATING A SYMBOLIC PROGRAM OFF-LINE The flowchart in Figure 5—8 shows how to generate a symbolic program ofi-line using the LT—33 low—speed punch. This procedure is generally much slower than using the symbolic Editor, but in (such as creating extremely short programs) may prove adyantageous. Leader/trailer made up of 200 code (rather than the blank tape produced by. the HERE IS key) may be generated off-line by pressing (in order) the SHIFT, CTRL, REPT and @ keys and holding all down simultaneously. some cases ( INITIALIZE ) TURN TTY TO LOCAL TYPE RETURN AND LINE FEED KEYS TYPE SYMKIJC PROGRAM * 10m YES TYPE RETURN AND LINE FEED KEYS Fl HERE IS KEY fl UH TURN LSP OFF E REMOVE TAPE Figure 5-8 Generating a Symbolic Program Oif~Line 5-30 ' LOADING A SYMBOLIC TAPE USING THE EDITOR: The flowchart in Figure_5—9 shows the user the method followed loading a symbolic tape using either the. low-speed or highspeed reader. The Editor will continue reading a tape until a form feed code is encountered (see Input Commands). Upon recog—‘ nizing the form, feed character, the Editor enters command mode and rings the Teletype bell to indicate that it is ready to accept a in command. CAUTION When using the Teletype reader, if the form feed code is encountered before the symbolic tape has completely read in (as indicated by the ringing of the bell), turn ofl the paper tape reader. Otherwise, characters on tape will be interpreted as commands to the Edi— tar. The section of tape read in up to the .form feed code should then .be edited first before proceeding with the remainder of the I tape. , ----‘-I|_SEE LOAD EDITOR LQW- HIGHSPEED SPEED SELECT OPTION IN TABLE 5-4 SELECT OPTION 5-4 -IN TABLE TURN HSR ON ' TURN TTY To LINE PUT TAPE 1N HSR_ FIGURE 5-7 PUT TAPE IN - _ TYPE K TYPEK (To CLEAR BUFFER) AND R COMMANDS (To SLEAR BUFFER) BELL FENEG§31EFENDN° N TYPE CTRL/FORM g ® ' mnN LSR To on: SYMBOLIC TAPE IS LOADED EDITOR IS IN COMMAND MODE Figure 5-9 Loading a Symbolic Tape Using Editor 5-3 1 RESTART PROCEDURE . If the user stops the computer for any reason, the Editor may be restarted. The user has the option of either clearing the text buffer or restarting so that the text in the butter is not disturbed. 1. To clear the bufier, place 0176 in the switch register; press ADDR LOAD, CLEAR and CONT. To restart without clearing the buffer, set 0177 in the switch register; press ADDR LOAD, CLEAR and CONT. 2. Set 0200in the switch register. 3. Press ADDR, LOAD, CLEAR and CONT. The Editor is restarted and in command mode. EDITING A SYMBOLIC TAPE The actual editing procedure depends, of course, on a particular requirements. The general procedure is illustrated in the example presented shortly. For input, editing, and output commands to the Editor, refer .to the detailed explanation of. the command structure, command repertoire, and special characters and functions under Operating Features, or see the corresponding summaries of commands and special characters at the end of the chapter. Observe also the following operating notes and precau- user’s tions. 1. Terminate each command to the Editor by typing the RETURN key. This directs the Editorto execute the command. 2. After a command to insert, change, or append text to a sym- bolic program has been executed, the Editor remains in the mode until the operator types the CTRL/FORM key combination on the teletypewriter. This combination generates the form feed code, which tells the Editor to return to text command mode. 3. The Editor senses a bufier full condition (buffer capacity is approximately 60 lines of generously commented text or 340 lines uncommented) when, after completing input of a text line, it finds that characters have been packed in the last 128 locations in the text buffer. When this condition occurs, Editor rings the Teletype bell five times and exits to command mode. The user then has a choice of deleting text and con- tinuing editing as normal or attempting to input more than 5-32 200 additional characters. After each alarm will precede a line, the buffer full return to command mode. When no ' more characters can be packed, Editor will again ring five times and exit from the input routine. Any further attempts to input text Will be answered in the same manner until dele- tions have been executed to make room for text input. Al- , , though characters may be received through the input device, they probably will not be appended as text. If Editor runs out of buffer space while searching a line, the unsearched portion of the line may be lost or the text line counter may be incorrectly set during the buffer full exit so that Editor thinks there is one more line of text in the buffer than actually exists. Occurrence of the latter will cause an error return after or during any output operation involving the last line, (for example, an N operation will be terminated as soon as the text butler is punched). 'After the error return the line counter will contain the correct value. ' Users should note that all such problems may be avoided by logically segmenting a program on paper tape into “pages” of 50 to 60 lines. This is done by punching groups a form feed character (see Output of 50 lines followed Commands). by anytime .. by pressing the HALT~ key; to continue press the CONTinue key. 4. The Editor may be stopped at PUNCHING THE CORRECTED SYMBOLIC TAPE punching out the corrected symbolic tape depends to some extent on the user’s requirements. The general sequence is given below and in the flowchart in Figure 5-10. ”The procedure, for 1.- As desired, enter output commands to punch blank tape for leader/ trailer purposes (T), form feeds (F), the appropriate lines of text (m,nP) or the entire text bufler (P). 2. Following the Punch command, the computer will halt, giv- ing the user the opportunity to‘ check the switch register (see Table 5-4). and to turn on the appropriate punch if he has not done so already. Punching is intiated by pressing the CONTinue key on the programmer’s console. 5-33 ‘ NOTE If the low—speed punch is used, it should be turned off during the typing of commands, as otherwise these codes will be punched on the symbolictape. 3. program does not delete it from memory. The page remains in the text buffer in core until the KILL command (K) is given to erase it. If it is desired Punching the symbolic to read another tape into the bufler,'the user must first de- lete the entire page of text (K). Remember that the recommended page length, as delimited by the form feed, is ap— proximately 60 lines of heavily commented text. However, the Editor will accept more text if necessary. COMPLETED SCIJRCE PROGRAM N TEXT BFFER ~ HGH' SPEED L §w1ltfi ® EGlSTER omou (SEE TAKE 5-4) LOW- SPEED SELECT SWITCH REGISTER OPTION (SEE TABLE 5-4) TYPE T COMMAND AND TURN 5? ON SET HSP 0N l TYPE T WMMAND AFTER LENIR TAPE lS PUNCHED. SET LSP OFF l TYPE PUNCH COMMAND (P,nP, 0Rm.nP) SET LSP ON TYPE F . 7—1 TYPE F COHMANO AND WICKLY SET LSP ON “Ir SETLSPOFF T m AND TURN LSP ON COMMAND TYPE T COMMAND TEXT |S PUNCHED AFTER TRAILER, TURN PUNCH on SET LSP OFF REMOVE TAPE Figure 5-10 Generating a Symbolic Tape Using Editor 5-34 Error Messages The proper rules for giving» commands must be observed during editing, as is explained under Operating Features. If commands are given in an incorrect format or if arguments are either missing,’ erroneous, or extraneous, the Editor will respond by printing a question mark. Notice that some commands can legitimately take from zero to two arguments, and one takes three. In general, if an argument is either missing or extraneous, the Editor prints 7 and ignores the command. Similarly, if a negative argument is encoun— tered or an illegitimate command string is typed, the Editor again responds with the error message ?. - Example of Use The following detailed example of the editing of a page of text is intended to familiarize the user with the-basic operations of the Symbolic Editor. Where details of the loading sequence and operating procedures are not shown, it is assumed that the user has followed the Correct procedures previously explained. This example concerns a program for adding up numbers stored in locations 200,, through 2073 of the computer, with the answer to be stored in lOcation 4108. The program is to start in location 600. The program listing18 shown below. IADD UP NUMBERS *6flfl BEGN: ITO ' HLT _ . START THE HIT PROGRAM: "CONTINUE" ON THE CONSOLE . / /THE NEXT FIVE INSTRUCTIONS I-NIT.IALIZE M16 ILOAD AC DCA COUNTR_ xpur INTO TAD rwonuw /LOAD AC DCA POINTR /pur INTO TAD ROUTINE wirH THE NUMBER-~1n COUNTER wrru ' . THE ACCUMULATOR THE ICLEAR CLA FIRST ADDRESS POINTER ,/ [THE EEGN. NEXT SEVEN INSTRUCTIONS POINTR ARE THE NEXT PROGRAM TAD 1 ISZ POINTR IINDEX POINTER rsz COUNTR IINDEX COUNTER, JMP BEGN /N0;CONTINUE DOA 1 ANSWER HLT JMP xaoo IYESESTORE IHALT BEGN+l 5435 ITSELF NUMBER 15 ADDING ANSWER It ZERO? ’ / /THE NEXT THREE REGISTERS CONTAIN THE CUNSTANTS MIG: -!fl INEGATIUE Twouun. ANSWER 2am FIRST TALLY ADDRESS IN NUMBER BUFFER - are / /THE NEXT COUNTR, a .PGINTR. a Two REGISTERS ARE RESERVED FUR VARIABLES 5 Assume that this program has been assembled using the PAL III Symbolic Assembler. printed the following: DT BEGN AT “686 HA ADDRES AT 6616 ”A ANSWER AT 0612 AT 0616 BEGN UA On pass 1, however, the assembler 060$ BUFFER COUNTR 662G UA FIRST AT 0616 UA 1N AT @616 Mlfl $615 POINTR 062! TWOHUN 6616 The message DT BEGN at 0606 signifies that the programmer mistakenly used identical tags to specify two different addresses. An inspection of the program listing above shows that has the tag BEGN has, indeed, been duplicated. It appears in line 3 of the listing as BEGN, HLT, then in line 14, starting with BEGN, (Since the line numbers are implicit only, they are not shown in the example; they may be obtained by counting from the top down.)To correct the situation, the Symbolic Editor was read in by the Binary Loader, as explained earlier under Loading Sequence. The symbolic tape to be corrected was then loaded by the Editor using-the READ (R) command, and a series of editing commands were given. TAD I’ POINTR. . , 5-36 ‘ R 14L EEGN, 14c . 1 TAD /ADD POINTR NEXT NUMEER . , ~ ADDR, - IADD PorNrR TAD 1 JMP BEGN amp ADDR NEXT-NUMBER' 17L . . INOBCONTINUE ADDING 170 13,18L /No;coNr1NUE _ /THE NEXT ADDR. SEVEN INSTRUCTIONS TAD I ISZ POINTR ISZ COUNTR . ARE /ADD POINTR TRE.pRoGRAm NEXT ITSELF NUMBER /1NDEx POINTER /INDEX COUNTER. IS IT ZERO? _ JMP ADDR DCA I INOICUNTINUE _ 25L ANswER ANswER /YES;STURE ANswER _ are .S , ANSUER. 410 ' 24L TWOHUN, 2mg . FIRST 240 _ rUOHUN, IFIRST 25g._ Apia-+21. ADDRESS IN BUFFER _ M10, —ia 1w0RUN, zoo ANSUER, 41g / BUFFER IN ADDRESS 'INEGATIVE IFIRST , TALLY ADDRESS NUMBER IN BUFFER . . _ . \ Having made the desired corrections, the programmer finally asks the Editor to list the entire text by giving the LIST (L) com-mand, but still withholds the PUNCH command (P), pending final corrections. A new program listing isprinted Out and the entire text is preserved in the butter. The programmer now punches the entire text onto paper tape by giving the PUNCH (P) command and depressing CONTinue on the console. The text Will be printed as follows on the Teleprinter (by theLIST command). 5—3'7 IADD UP NUMBERS #666 BEGN. /To HLT START THE PROGRAM: "CONTINUE" HIT CONSOLE THE ON ' I . ITHE NEXT INSTRUCTIONS FIVE I INITIALIZE CLA ICLEAR TAD MIG ILOAD AC DCA IPUT INTO COUNTR ILOAD AC DCA IPUT INTO POINTR ROUTINE ACCUMULATOR THE TAD TWOHUN THE THE NUMBER WITH -Ifl COUNTER FIRST WITH ADDRESS POINTER / /THE NEXT ADDR: SEVEN INSTRUCTIONS ARE THE NEXT PROGRAM TAD I ISZ POINTR IINDEX POINTER ISZ COUNTR IINDEX COUNTER: JMP ADDR INDIGONTINUE DCA I POINTR IADD ANSWMR [YESJSTORE . ITSELF NUMBER IS IT ZERO? ANSWER ' HLT JMP IHALT BEGN+I / [THE NEXT THREE REGISTERS CONTAIN -IG INEGATIUE TUOHUN: 260 IFIRST MSUER: 41G MIG: THE CONSTANTS NUMBER TALLY ADDRESS IN BUFFER / ITHE NEXT COUNTR; fl POINTR; fl TWO REGISTERS ARE RESERVED FOR VARIABLES 5 Once the program is corrected, it can be used as input to the PAL III assembler. The pass 1 result of assembling this program is: ADDR ‘ 0656 ANSWER 6617 BEGN 0600 COUNTR @626 M18 POINTR' 062! TVOHUN 0616 9615 Smmmnnyrfifihnnhoficikfikthpenuflnm SPECIAL KEYS Function Key RETURN key Text Imode—-Enter the line in the text bufier. Command mode—Execute the command. 5—38 CTRL/ U keys mode—Cancel the entire line of text, continue typing on next line. Command mode—Cancel command. Editor issues a ? carriage return/ l1ne feed. Text ' and RUBOUT key Text mode—Delete from right to left one character for each rubouttyped. Does past the beginning of the line. Is not in effect during a READ not delete _ command Command mode—Same as CTRL/ U Form Feed. (CT RL/ FORM) Text. mode—End of input, of input, return to Command mode. CTRL/G Text mode—End return to command mode. Dot (.) Command mode—Current. line counter used as argument alone or in combina- tions with —I_— or —— and a number (as ' in'., .+.5L) Slash (/ ) LINE FEED key Command mode—Value equal to number of last line1n buffer. Used as argument (as in /— 5 ,/L.) mode—Used in SEARCH command to insert a CR/LF combination into the line being searched. Command mode——Li'st the next line Text (equivalent to .+1L). ALT MODE key or ESCape key Command modal-List the next line (equivalent to +1'L). Right Angle Bracket (>) Command mode—Same as ALT MODE Left Angle Bracket (<) Command mode-é—List the previous line key (equivalent to .—1L). Equal Sign (=) . . Command mode—«Used. in conjunction. with and / to obtain their value . (.227). - equal sign. Colon (2) Command mode—Same as Tabulation ( CTRL/ TAB ). Text: mode—Provides a tabulation which, on output, is interpreted as spaces or a tab character/rubout combination de- pending on a switch option. 5-39 . SWITCH OPTIONS Switch Position 0 0 Meaning Read input tape as is Convert spaces to tabulations on input 1 Output tabulations as spaces Output tab character rubout combination for each 0 l. 1 ‘ tabulation 2 10 0 Normal operation 0 Suppress output 0 Low-speed output High-speed output 1 0 11 Low-speed input High-speed input 1 COMMAND SUMMARY Command Format(s) READ R Meaning Read incoming text from reader and ap- pend to buffer until a form feed isencountered. APPEND A ‘ Append incoming text from keyboard to any already in buffer until a form feed ' is encOuntered. LIST List the entire buffer. L‘ PUNCH nL List line n. m,nL List lines m through 11 inclusive. .- Upon striking CONTinue key on console, punch the entire buffer. P Halt. nP Halt. m,nP Halt. Upon CONTinue, punch lines 111 through It inclusive. Upon CONTinue, punch line 11. Punch trailer, punch a form feed (FORM FEED F (214), punch trailer. TRAILER T NEXT N Punch four inches of trailer. Punch the entire buffer and a form feed, Read the next page. Kill the buffer nN KILL. ' ' K and Repeat the above sequences n times. » Kill the buffer. 5—40 FormattS) Command Meaning _ I Delete line n of the text. -nD DELETE ‘ Delete lines In through n inclusive. m,nD » - ‘ INSERT Insert before line 1 all the' text from the I keyboard until a form feed is entered. Insert before line 11 until a form feed is entered. nI - ‘ - CHANGE nC . m,nC Delete line n, replace it with any number of lines from the keyboard until a form feed is entered. Delete lines m through 11, replace from ' keyboard as above until form feed is entered. ' MOVE m,n$kM Move lines 111 through 11 inclusive to be— ' fore line k. GET - Get and list the next" line beginning with G a tag. 1 nG Get and list the next line which begins with a tag (starting the search with line n) . SEARCH , s Search the entire butter for the character specified (but not echoed) after the carriage return. Allow modifiCation when found. 118 Search line 11, as above, a110w modifica\ tion. m,nS Search lines 111 through 11 inclusive, allow ' modification. 5-41 ' . DEBUGGING PROGRAMS . Dynamic Debugging Technique (DDT) and Octal Debugging Technique (ODT) are the two debugging programs for the PDP-S/E. Dynamic debugging programs are service programs which allow the programmer to run his binary‘program. on! the computer and use the Teletype keyboard to control program execution, examine registers, change their contents, and make alterations to a program. A symbolic program can be assembled correctly and still con- tain logical errors, i.e., errors which cause the program to do something other than what is intended. The assembler checks for certain syntax errors, but not logical errors. (Syntax errors include undefined tags, misspelled tags and incorrect formats, e.g., omission of a required operand.) Logical errors are detected only when the program is running on the computer. Debugging Without DDT or ODT If the programmer feels sure that his program is correct and ready for use, he can simply load the program and let it run until it stops (if it stops). And if the program doesn’t produce the cor— rect results, the programmer without a DDT program can use the console switches to examine ‘ ‘ . - specific locations one-by—one to try to find the error(s) throUgh interpreting the console lights. There are two hazards to this approach. First, by the time the program stops the error may have caused all pertinent information, including itself, to be altered or eliminated. Second, the program may not stop at all; it might continue to run in an infinite loop, and such loops are not always easy to detect. Added to these problems are the difficulties of interpreting binary console displays and translating them into symbolic expressions related to the user’s program listing. Further, adding corrections to a prOgram in the form of patches (altered and added instructions or routines) requires seemingly endless manip— ulation of the console switches. In all this, the chance of pro— grammer error at the console is large and is likely to obscure any real gain made from debugging. The programmer can use the program assembly listing to men- tally execute his program. This method is frequently used with very short programs, very short only—~human memory cannot retain every step and instruction in even a fairly short program; it cannot match a computer memory. '5—42 ‘ - What is neededto conveniently and ' accurately debug a user program is a service program which will assume the tasks the programmer would have to perform if he used the console switches. DDT and ODT are such debugging programs. DEBUGGING WITH DDT . , The Dynamic Debugging Technique for the PDP—S/E'facilitates program debugging by alloWing the user to examine core memory locations (registers) and change and correct their contents, place and remove strategic halts and automatically restore and execute the instructions replaced by the halts. Communication is-carried Teletype keyboard using defined commands and the symbolic language of. the source program or octal representation, with DDT performing. all. translation to and from the binary rep- out via the resentation. . Tracking down a subtle error in a complex section of coding is a laborious and frustrating job if done. by hand, but with the breakpoint facility (explained later) of DDT, the user can interrupt the operation of his program at any point and examine the . state of the program and computer. In this way, sources of trouble can be isolated and corrected. _ By .the time the programmer is ready to start debugging a new program at the'computer, he should have at the console: , 1. The binary tape of the program to be debugged. 2. The symbol definition tape which was part of the assembly output from pass 1. 3. A list of the symbols and their definitions. 4. A complete octal/ symbolic program listing. ‘ binary tape of the DDT program, which is loaded into core memory using the BIN Loader. 5. A LOADING DDT The BIN Loader- is used to load DDT and the object program (program to be debugged) into core. Refer to Figure 5— 3 for the procedure used in loading BIN, and Figure 5-4 for details concerning using BIN to load binary format programs. DDT requires locations 0004 and 5237—7577 (23418 loca— tions): The permanent symbol table requires locations 5000—5237, and 'the external symbol table is allotted locations 3030—5000 (250 symbol capacity). The starting address is 5400. 5—43 ' The flowchart in Figure 5—11 presents the basic loading pro— cedure for both DDT and the binary tape of the program (to be debugged. ‘ —————-———-——_ LOAD OBJECT """ infer/id LOAD ODT ‘W ,______.____._____ —-— — - fl SEE FIGURE 5-4 SET SR= 5400 PRESS ADDR LOAD 1 PRESS CLEAR AND CONTINUE YES Figure 5-1 1 DDT AND OBJECT TAPE ARE LOADED Loading DDT and Object Program The following are now in core memory: 1. The DDT program, which occupies upper memory between ' registers 5240 and 75 77, inclusive. 2. The user’s program(s) which must not overlap the area occupied by DDT or its permanent symbol table. 3. A table of symbol definitions, extending downward from lo— cation 5237 to 5004. This table includes the definitions for all of the PDP-8 memory reference instructions, operate in- structions, ten basic IOT instructiOns, and the combined operations CIA and LAS. Symbol Table Tapes Part of the punched output of a MACRO—8 or PAL assembly may be a tape containing the symbol definitions of the assembled program The definitions from a symbol tape are entered into 5-44 the DDT external symbol table by the procedure outlined in Figure 5- 12. Only the LT—33 reader may be used. Reading will continue until the end of the tape is reached or until a total of 250 symbol definitions have been read. If this “maximum limit is reached, no further symbols may be added to the table until some have been deleted, even if the limit is reached in the middle of a tape. However, the user may proceed with debugging by typing EOT (CTRL/D), then turning the reader ofi and pressing CONTinue. The remaining symbols left unread will not be1n the table. TURN TTY TO LINE UT SYMBOL TABLE TAPE IN LSR WITH LEADER/TRAILER OVER READ HEAD ‘ TYPE ALT MODE AND THEN 3 KEYS —_—-—.—_J "“l [R TYPE I SET LSR TO START REngE' N RELOAD DDT AND OBJECT TAPE ? TAPE STOPS ' ISET l LSR T0 FREE I DEPRESS CONT SET OCTAL ADDRESS TYPED IS LOWER LIMIT OF EXTERNAL SYMBOL TABLE ‘ T5}? 3” ‘3 EXTERNAL SYMBOL TABLE LOADED Figure 5-12 Loading External Symbol Table Tapes (LSR Only) ' 5-45 DEFINING NEW SYMBOLS Often, during the course of a debugging run, the user will want to add symbols to the external table. This is especially so when he adds a sequence of instructions to his program as a patch elsewhere in memory. The patch is usually identified by asymbol which is the address tag of the first instruction in the patch. In order to use the symbol in subsequent debugging operations, he must add its definition to the external table as explained in the following flowchart: new “ WITH DDT-8 IN COMMAND MODE LOAD EXTERNAL SYMBOL TABLE — ___ fl SEE FIGURE 5 12 _ TLLI SET SRIMOO HU TYPE [R TYPE RETURN AND LINE FEED KEYS HU TYPE NEW SYMBOL TYPE 1 OR MORE SPACES I TYPE OCTAL VALUE OF DEFINITION OF SYMBOL MORE SYMBOLS ?, ‘7va RETURN AND LINE FEED KEYS Ill TYPE EOT (CTRL/D PRESS CONT ADDRESS TYPED IS LOWER LIMIT OF EXTERNAL SYMBOL TABLE E NEW SYMBOLS ARE ENTERED Figure 5-13 Appending New Symbols to External Symbol Table 5-46 ‘ To define the symbols PATCH-l and PATCHZ, the operations will appear as follows (Assume that the current For example: limit of the table1s 4775 ): (CR/LF) PATCH! 619 PATCHZ 628 ' - 4665 - (CR/LF) (CR/LE) (BOT) (Press CONTinue) (new limit of the table) ' _ If the user makes an error while typing a definition, he cannot use *- to eliminate .the information. The erroneous definition must be entered. , A symbol already in the table may not symbols can be added. be redefined. Only new - - NOTE carriage return/line feed pairs may not be inserted between definitions; they will cause errors in subsequent table lookups when DDT is operating. Extra ' A new or updated symbol tape may be created off-line using the method described in Figure 5- 8 in the section concerning the Symbolic Editor To completely expunge the external symbol table (for instance, when starting a new debugging run with DDT already1n memory), the following command1s used: {X On receipt of this command, DDT removes all definitions in the external table, types a carriage return and line feed, and prints the new lower limit of the (now empty) external symbol table. DDT is then ready to accept another command. The permanent tableis unaflected - 5-47 _ Storage. Requirements The operating portion of DDT occupies storage in upper memory from location 5240 to location 7577, inclusive. The permanent symbol table extends downward in memory from location 5237 to location 5004, inclusive. This table contains the definitions of the mnemonics for all the basic memory reference instructions, the operate class instructions of both Group 1 and Group 2, the com- bined instruction CIA and LAS, the symbol I fortindirect address— ing, and the basic IOT instructions: KCC, KRS, KRB, KSF, TSF, TCF, TPC, TLS, ION, and IOF.'There is a list of all the symbols and definitions in the permanent table at the end of this section on DDT. Space is reserved for the user’s symbol table immediately below the permanent table. A maximum of 250 such external symbols is allowed; hence if the user’s table is filled, the lower limit of space occupied by DDT is 3030. However, space not used for external symbols is available to the user. Each new symbol defined on-line uses locations in the external table. During operation, DDT uses location 4 on page 0 for the break- point link; thus this register is not available to the user. Definitions A symbol is a string of up to six letters and numerals, the first of which must be a letter. The following are legal symbols: FIMAGE, K2, X464PQ, PMLA. The following are not accept‘ able: ‘ F2.8 Does not begin with a letter Contains an illegal character AN PRC A space cannot be imbedded in a symbol GANDALF More than six characters 4WD string of up to four octal digits (integers). Hence, a number may have a maximum value of 77773. The digits 8 and 9, however, may be used only as characters in a symbol. An expression is a symbol, an integer, or a sequence of. symbols and integers separated by any of the following operators: A number is + — a An operator designating addition (arithmetic plus). An operator designating subtraction (arithmetic minus). 5-48 space t . ' An operator which indicates that the remainder of the expression is to be treated as the address part of an instruction All Other characters, except those for DDT Control commands, are illegal. If two or more spaces appear in succession, all. but the first are ignored Thus, TAD TEM and TAD TEM are identical expres- 'sions. DDT will respdnd to an extra carriage return (CR) with a car- riage return/line feed combination (CR/LF); the extra CR’s are otherwise ignored The following errors will cause DDT to print a question mark the point of the (?) .andignore all the information typed error and the between previous tab or CR. 1. Undefined symbol; illegal symbol. 2. v Illegal character. 3. Undefined control command. ’ 4. Cross—page addressing. Mode Control Any expression containing a symbol is symbolic; an expression containing only integers is octal. The programmer is free to use whichever mode of DDTis most convenient for the information he i is typing. On output, DDT will print exclusively in one mode or the other, as determined by one of the commands described below. NOTE When DDT is first set into operation, the output mode is symbolic. “[” corresponds to typing the ALT MODE (or ESC) key. Command Meaning ‘ [0 This command causes DDT to print any subsequent item of information as an octal integer. Typed input may be symbolic or octal. If LOC: 2642 thenthe following commands will both print the same answer: LDC/1263 2642/1263 5-49 This command .causes DDT to print- any subsequent [S item of information-as a symbolic expression. Typed . input may be symbolic or octal. If LOC ‘= 2642 and the contents of LOC = TAD ‘DATA+4, then: LOC/TAD DATA+0604 2642/TAD DATA+6554 If the user wishes to find (the octal value of a symbolic ~expres— typed by himself or by DDT without changing the output ‘mode, he may use the following command: sion . 2 Typed immediately after a symbolic expression, this will cause DDT to print the value of the expression as an octal integer. For example: LOC=2642 LOC/TAD DATA+6$04 =1263 In the second example above, the prevailing output mode is symbolic and remains so after the use of the equal sign. OUTPUT When operating in symbolic mode, DDT will always attempt. to make a symbolic expression out of the contents of an opened register, regardless of whether the contents are intended toibe such or not. For example, if register DATA contains the number 6115, opening the register will result in the following line: DATA/lOTfGllS The user can use the equal sign to ascertain the octal value: DATA/IOT+@115 =6115 Program Examination and Modification The commands and operations in Table 5-9 allow the user to examine and change the contents of any register in the PDP-8/E core memory. 5-50 / , ' NOTE Be careful not toopen and modify any reg- ister within the DDT symbol table or pro- itself, DDT does not protect itself against such intrusions, whichwill inevitably gram cause errors in operation. ' Table 5-9 DDT Commands Command Meaning This is the register examination character. Typed immediately after an expression, it causes DDT to print the contents of the register whose address is specified by that expression. For example, if the user types: ' ' LOCI DDT will type out the contents of LDC,” thus: LOG/TAD nATA+snaa The may' now change the contents of the user ‘ register if _he wishes: LOG/TAD carriage return (CR) DATA+GBG4 JMP LOC+IQ This causes DDT to close the opened register after making the specified changes (if any) in its‘ contents. For example: LOG/TAD DATA+BGG4 JMP LOC+lfl Typing additional CR’s will have no effect on the operation of DDT. line feed If, after examining and/ or modifying the (LF) tents of con- location, the user wishes to open the location, he types a line feed instead of a CR. The Open register is closed, and DDT then opens the next location, printing the a next sequence 5-51 ’ ' Table 5-9 DDT Command Commands (Cont.) Meaning ‘ address, a back slash to indicate that the register was not opened by the user, the contents of the new register, and another five spaces. For example, assume that after examining and changirg the contents of LOC, the user wishes to examine the contents of LOC-l—l: LDC/TAD DATA+aaaa LOC+l/DCA Loc+1e amp (1J0 DATA ' The register LOC+1 is now open. Line feed may be used at any time, eVen 'if the last location examined has been closed or if other operations have intervened. For example, if the following sequence of operations occurs: LDC/TAD DATA+93$fl JMP .+19 [0 DDT will still open register LOC—H. The break- point address (explained shortly) has no effect on the counter within DDT which keeps track of the last opened register. If instead of changing the c0ntents of T (up arrow) ’ register, a the user wishes to examine the register addressed by those contents, he types T, as follows: LDC/TAD DATA+GG$4 DATA+AIOPR+337 The register DATA+4 isis intended for now Note that this operation unmodified locations. If the typing sOme modifying ' open. use with types it after information, the location user addressed will be the onewhich is changed. For example, if the following sequence occurs: LOG/TAD DATA+0664 JMP Loc+1ni the information will be placed in DATA+4, so that the‘next line, printed by DDT, will look like this: DATA+4\JMP LOC+GGIQ 5-52 Table 5-9 DDT Commands (Cont) Command ' Meaning The register LOC will not be changed. An indirect address modifier will not be interrupted by the T operation. If, for example, the register LOC contained TAD I DATA+4, and the user typed Tas in the previous example, DDT would still open the register DATA+4. The dot is used as a symbol whose value is the address of the last previous register opened, and can be used in several ways: (dot) 1. To check the results of a modification. LOC/TAD’DATA+06@4 LOC+16 JMP LOC+GGIG= -/JMP ' ‘ 2. To refer to the currently Open register. LOC/TAD 3. DATA+GGG4 JMP .+l@ To execute any command starting at an address relative to the last opened register. LOC/TAD ornaments .' .+-1a amp C'SEG <— ( back arrow) An error may be deleted by typing a back arrow. All information between the <- and the previous tab or CR is ignored; DDT responds by printing '\ a tab. For example: LOC/TAD DATA+$ZB4 JMP LC“ JMP CROSS-PAGE ADDRESSES When the user types an ~+lfl . . instruction to be placed in an open the address of that instruction must be in the same register, page the address which contains the open register. If such a crosspage address is attempted, DDT will signal an error by typing ? as and will ignore the information. For example: if LOC : 2642 and XPAG ~= 2770, the following sequence would result in an error indication : LOC/TAD DATA‘Gflfla DCA XPAG+20 ? 5-53 The expression XPAG+20 is equal to 3010, which is outside the page containing LOC. The location LOC will be closed without modification. Conversely, an expression containing symbols defined outside the page is acceptable if its value is in the current page. For ex2642 and XPAG 3010, the following sequence ample if LOC 20 has a value Which brings it within is acceptable, since XPAG = = - the current page: ' ' DCA LOG/TAD DATA+6804 XEAG-2G USING COMBINED OPERATE OR IOT INSTRUCTIONS Except for CIA and LAS, combined Operate and IOT instructions are not. defined in the DDT permanent symbol table. To, enter such instructions into an open register, the combination must contain no more than two mnemonics, the second of which must be CLA. Any other combination will be treated as an error, and the information will be ignored. For example, the following at- tempt is an error: XPAG/CLA CLA CMA ? This attempt is correct: XPAG/CLA CMA CLA If the desired combination does not include CLA, the user may do one of two things; He can define the combined operation as a new symbol whose value is the combined operation code. For ex- ample, the operation CLL RAR can be defined as a symbol, say, CLAR, whose value is 7110. Alternatively, the user may enter the combined operation as an expression containing the symbol OPR. For example, the opera— tion CLL RAR can be entered as OPR+110. The user may simuse the symbol IOT in entering new I/ O combinations. ilarly _ SPECIAL LOCATIONS There are five registers within DDT which hold information of interest to the user. These registers may be opened and their contents changed. 5—54 _ open any of the following special locations, type the ALT To MODE (or ESCape) key followed by the name of the location.- DDT- will print a backslash_:(\) followed by the _.contents of the location. The contents may be altered; at this point in' the , special same way as any ordinary location. Location Meaning A contents of the When a breakpoint is encountered, accumulator, C(AC), at that point are placed in this the. register. C(L), Where L‘When a breakpointis encountered, the means the link bit, at that point are placed1n this reg-~ Y ister. I This register contains the address of the lower limit of a word C(L) = 0001. ' L , search. Initially, This register contains the address of the upper limit of. a word search. Initially, C(U)— 5000. U — ‘ M This register contains the mask usedm a word search, Initially, C(M) = 7777. ~ The use of these registers is explained in the following pages. . Program Execution and Control The commands described1n Table 5- 10 allow the user to control the execution of his program. - Table 5-10 DDT Execution Commands Command k[G Meaning This command causes DDT to begin the execution of starting with the instruction in the is specified by the expression k. address whose register If a breakpoint (see below) has been requested, it is inserted just before control is passed to the prothe user’s program, gram. For example, if the user types: BGINEG 5-55 user’s - Table 5-10 (Cont) DDT Execution Commands Command: Meaning DDT will transfer control to location BGIN. LikeWisei: -“' G FILIv -will cause the. user’s program to start in the fifth regis.ter preceding the one labeled F ILI. 3 Using [G without an argument is an error. DDT will ignore the command, and type '.7 to indicate the mistake. ' ' k[B This causes DDT to insert a breakpoint at the location specified by the expression k. The breakpoint is not placed immediately, however. When this command is typed, DDT stores the value of the address indicated by k. Then, when the user next types either a [G or a [C (see below) command, the breakpoint is placed just > before control passes to the user’s program. At that time the sequence of operations performed by DDT is as follows: 1. The contents of location k are saved in a special register. 2. In place of the instruction in location k, DDT sub, stitutes the instruction, JMP I 4 Location 4 contains the address of a special breakpoint handling subroutine within DDT. 3. After the breakpoint has been placed, DDT passes control to the user’s program. When, during execution, the ‘user’s program encouncontaining the breakpoint, control is immediately passed (via location 4)‘ to the breakpoint subroutine in DDT. The C (AC) and C(L) at the point of the interruption are saved in the special registers A and Y, respectively. DDT then prints out the address of the register containing the breakpoint, followed by a ters the location right parenthesis and the contents of A as an octal number. Control has now returned to DDT, and the user is free to examine and modify his program. Only one breakpoint may be in effect at one time. As soon as the user requests a new breakpoint using the B command, any previous existing breakpointis removed. To eliminate the breakpoint entirely, the command is typed without an argument, thus: [B- 5-56 Table 5-10 (Cont) DDT Execution Commands Command Meaning , When the breakpoint is removed, the original contents of the break location are restored. After the breakpoint has occurred and the user has ‘ examined his program and made the changes he wishes, he can cause his program to continue from the point of the break by means of the following command: [C This continue command causes DDT first to execute the ‘instruction which was originally in the break location, and then pass control to the next location in the user’s program. The breakpoint remains in effect. The following example illustrates the use of the three commands V _~ just described. Explanations are to the right of the commands. FILI§7EB V BGINEG Breakpoint inserted at location FILI+7. Program execution is initiated at BGIN; program runs until breakpoint location is encountered. FILI+GGG7)7721 DDT prints the address of the break location and the contents of. the AC at the time of the break; note that location FILI+7 is not opened. The user performs such ification as he desires [C examination and mod- The user’s program continues, beginning with the execution of the- instruction originally in' FILI+7; the breakpoint remains in effect. Often the user would like to place a breakpoint at a location within a loop in his program. Since loops can run to thousands of repetitions, some means must be available to prevent a break‘from occurring every time the location is encountered. This is done using the [C command; after the breakpoint is encountered the first time, the user can specify how many times the loop must be executed before another break is to occur, as follows: After the 5-57 ‘ first breakpoint occurrence, the user wishes to wait for 2503 repe- titions before the next break. The breakpoint is inserted. FILI +7 t B ‘ User program execution begins. BGIN t G 0 F11. r mac 7 ) 7 721 The first breakpoint occurs. zsgtc The program continues; the next breakpoint will not occur until the location FILI+7 has been encountered 250 times. Finneganasaa The next break occurs after 250 times through the loop. RESTRICTIONS ON USE OF BREAKPOINTS The user must not place a breakpoint at any of the following places in his program: 1. Within any section of the program which operates with the program interrupt enabled. 2. At any location that contains an instruction which is modified during the course of the program. For example, the program contains structions: Bl 152 B TAD A a sequence which includes the following in- A breakpoint may not be inserted at location B. When the user’s program comes to a halt, control may be returned to DDT by setting the switch register to 5400 and pressing ADDR LOAD, CLEAR and CONTinue. 3. In a location containing a subroutine jump (J MS) which is followed by one or more arguments for that subroutine. A breakpoint maybe inserted at the point of a subroutine call if the JMS instruction is not followed by any subrOutine arguments, but the breakpoint may not be removed until control has returned from the subroutine to the calling program. WORD SEARCHES The searching operations are used to determine if a given quan- tity is present in any of the locations of a particular section of memory. The search is, initiated by the following command: ' 5-58 I Command Meaning . DDT will perform a word search and print the ad- k[W dress and contents of every register in the desired section of memory whose contents are equal to the: oi the expression k. If the expression k is omitted, a search for the quantity 0000 masked by value C(M) is assumed. The conditions for any search are set by the following criteria: 1. The contents of every location searched are masked by the special register M, using the Boolean AND operation. The resulting logical product is then compared. with the value of k. If the two quantities are identical, the address and contents of the examined location are printed at the Teletype. contents of the ' I 2. The search is conducted over that section of memory whose lower limit is given by C(L), and whose upper limit is given by C(U), except for the special Case described in the next paragraph. 3. If C(M) = 7777 and the expression k contains any symbol in its address 'part (for instance, ISZ FILI+5; FILI is the symbol), the search will be conducted only on the page for which that symbol is defined, regardless of the search limits specified by C(L) and C( U). For any other case; including that where the address tag of k is defined for page 0, the search is conducted according to the limits set. 'A search never alters the contents of any location examined. Addresses and location contents are printed as symbolic ex- pressibns or octal integers, according to the mode at the time of the search. 5-59 'For example: Search locations 2000 to 4000 for all occurrences of an ISZ instruction. [L\00@l [U\5G00 2066 4ZGB [M\7777 ISZEU 7060 The addresses rather than tags are printed when symbols are'not defined. 2632\ISZ 2135 2953\152 2135 0317 2111\152 The search will continue until all registers containing an ISZ are found. Note that the setting of the mask limits the investigation to the first three bits of each register, so that only instruction codes are considered. Third example: Obtain a dump of any section of memory. The search is conducted between the limits set, and the addresses and contents of all registers in the searched section are printed. EL\BGEI [U\5065 2600 3668 3 [M\7777 [U . 2660\0069 2601\CLA 2602\TAD 2616 ' The search will'conti'nu'e to the specified limit, printing the con- tents of every register. Note the following points: The mask is set to 0 to insure that results of every comparison are the same, i.e., 0. The search is conducted for all registers containing 0, so that the results of each comparison are equal to the desired quantity, 0. Always remember that the contents of the registers themselves are not altered. 5-60 . PUNCHING BINARY TAPES _ , After making the desired corrections and changes, the user may punch out a new binary tape of his program. This allows the debugged program to be used immediately, without waiting for the programmer to incorporate the corrections in the source program and then reassemble‘the program. The punching procedure given in Figure 5-l4 may be used for either the Teletype console punch .or the optional high—speed punch. The punching procedure uses the Command. following commands: Meaning This command is used to obtaina segment of leader- [T trailer. This command a;b[P causes punch a block of DDT to binary tape with the information contained in the memory designated by the expressions a (lower limit) and b (upper limit), inclusive. section of core a and b may be any kind of acceptable terms (refer to Definitions at the beginning of this . This command is used at the end of [E . section). punching opera— tions and causes DDT to punch a checksurn block, ' ' followed by a length of trailer tape. NOTE The user should not try to punch the section ‘of memory between 5000 and 7600 which contains DDT. . If the user wishes to restart DDT before he has punched a Com- plete tape (i.e., betWeen data blocks) he must set the console switches‘to 5401 to preserve the checksum. Subsequent restarts must also be set to 5401 until the checksum- block has been ' punched. - , . _ . . At any other time DDT may be restarted at location 5400. - 5-61 ‘ START LOW- SPEED' ‘SETSR snow 0 TURN HSP TYPE SET SR BIT OTO‘ TURN LSP OFF ON [T TYPE PRESS com TURN LSP 0N WHEN PUNCHING IS COMPLETED. TYPE a;b[P - PRESS ET PRESS CONT WHEN PUNCHlNG IS COMPLETED, TURN LSP OFF com TYPE ugbtP PUNCH MORE BLOCKS TURN LSP ON [ TYPE CE PRESS CONT PR ES S CONT WHEN PUNCHING IS COMPLETED , TURN LSP OFF Yé”§8M$”L'E°T*E"B° REMOVE TAPE. ' I PUNCH MORE BLOCKS PRESS CONT Figure 5—14 Punching Binary Tapes (DDT) ' 5-62 Example Program Debugged I The following is the third pass assembly listing of a program which adds- five numbers and stores their result in the variable SUM. The programmer writes and assembles such a program (or complex), then loads the binaryvprogram into core along with DDT and the symbol table which was the output of assembly pmsL one more - - *200 0200 7200 0201 1213 0202 3215 DCA INDEx 0203 1214 TAD ADDR '0204 3225 DCA POINTER 0205 3216 DOA SUM 0206 0207 1625 TAD I 2215 0210 5206 OOMPSM, OLA /INIT1ALIZE LOOP /SET SUM TO ZERO /ADD THE INTERGERS LOOP FINISHED N TAD , _ LOOP, POINTR‘ ‘ ' ISZ INDEX /15 JMP LOOP /N0 DCA SUM 0211 3216 0212 7402 0213 7773 N:~1 -5 /MINUS 0214 0216 ADDR. LIST‘I /ADDRESS 0215 0000 INDEX: 0 0216 0000 SUM: 0 0217 0001 LIST, 0220 0002 2 .0221 0003 3 0222 0004 4 0223 0005 5 'HLT 1 /YES _' 0224 0017 0225 0000 . 1 NR 0F OF INTEGERS LIST /c0UNTER FOR LOOP /RESULT GOES HERE /LIST OF NUMBERS 17 L POINTR; 0 - - /AUTO INDEX POINTER /TO LIST In order to have DDT read in the symbol table,‘ the programmer the ALT MODE and R keys (which echo as [R). DDT typed echoes the symbol table as shown below, following which it prints the address of the lowest memory location which is occupied by a symbol definition. The programmer is now'ready to begin debugging the program. ' ' [R ADDR 0214 COMPSM 0200 INDEX 0215 LIST 0217 LOOP 02E6 N 0213 POINTR @225 SUM @216 4750 5—63 ' The user notices at this point that POINTR was stored in loca— tion 225 instead of location 17, the * was left out where word 224 presently is. To correct this, the interaction with the computer looks as follows: LOOP/TAD .IIAD I o-2/DCA I POINR - TAD I I7 @8l7 POINTR DCA 17 LOOP+ICB COMPSMEG LO0P+0G01)@@@l cc Loop+unn1>aons [c LO0P+@001)@6@6 [C Loop+noni)o@12 N-itB 'tc [Loop+non4>nnna SUM/AND 00]" =Q017 The user typed: LOOP/ which DDT returned the symbolic contents of the location labeled LOOP. The user changed POINTR to 17 and closed the location with the RETURN key. To check that the change had been made, the user typed: to 0/ ' where the dot indicates the current location, the slash (as above) allows the user to investigate the contents of the location. Since the contents were recorded, the user typed: 0-2 which refers to location 204 on the octal/symbolic listing. POINTR is changed to 17 in this instruction as well. The user then inserts a breakpoint at location 207 on the listing (addressed by indicating LOOP+1). To begin execution of the program the user types: COMPSMCG 5—64 COMPSM is the starting address 0f the program. [G is the command to DDT which says to transfer control to that location. DDT prints: L00p+aaai)aan1 When the breakpoint Occurs, DDT saves the contents 'of the AC. It then prints the address of the breakpoint, a right parenthesis, and the saved contents of the”, AC. The programmer sees that this . is the correct value after the first time through the loop, so he issues the command‘[C which causes the program to cycle through . the loop until it enc0unters the breakpoint again. Each time the user ' verifies the contents of the AC and has the program continue executing. Rather than check every cycle through the loop ‘( which in this case is short, but might be' very long), the user moves the breakpoint to the HLT instruction. The contents of the AC at that point was zero, which1s not important To check the value of SUM upon program completion, the user. types: SUM/ and the computer returns what it attempts to express as a symbolic instruction. When the user types the equal sign (= ), DDT returns the value of the symbolic instruction in octal. This debugging session was very simple; the error was obvious. This is seldom the case, and with long or complex programs sev— eral debugging runs. may be required. Being able to debug a pro— gram using symbolic expressions shortens the time required to arrive at a correct, workable program. Command Summary ' Command Action Separation character. Space + Arithmetic plus. ~ Arithmetic minus. —- ‘ / Location examination character. When it follows the address location, it causes the and its contents printed. _ 5-65 register to be opened _ carriage return Make line feed Make modifications, if any, close location, and open modifications, if any, and close location. ’ next sequential location. When it immediately follows a location printout,-it causes the location addressed therein to be opened. Type last quantity as an octal integer. Current location. Delete the line currently being typed. Sets DDT to print in symbolic mode. Sets DDT to print in octal mode. Word search for all occurrences of the expression N masked with C(M). N'[W Insert a breakpoint at the location specified by k. If address is specified, remove any breakpoint. k[B no n[ C Continue from a breakpoint n times I n is absent, it is assumed to be 1. k[G Go to the location specified by k. automatically. Action Command [R Read symbol tablelinto external symbol table or define symbols on line. [T Punch leader-trailer code. Punch‘ binary tape from memory bounded by the ad— a;b‘[P dresses a and b. Punch end of tape: checksum and trailer. [E following commands will open certain locations in DDT The whose contents are available to the user. Word Opened Command Accumulator storage (at breakpoints). [A Link storage (at breakpoints). [Y I [M Mark used in search. [L Lower limit of search. Upper limit of search. [U ‘ 5—66 Internal Symbol Table AND TAD ISZ DCA JMS = = : .0 7040 .7020 ._: : 7010, CMA' - 1000 2000 \ * 7 ' : : - : = 6001 : = ' = : = : ‘: = : KSF ': CLL : 6002 6031 7100 CML RAR RALV = 7004 RTR RTL = ,7012 ‘ 14000 : 2: CLA 3000 5000 6000 7000 7200 6032 6034 6036 6041 6042 6044 6046 '22 ICYF OPR KRS KRB TSF TCF TPC TLS ION IOF ,- ‘ IMP KCC ~ . . = 7006 :2 V7001- = 7500 2' 7440 =- 7510' . ’ ’ ‘ - . ' ’ " “ ~ , IAN: SMA SZA SPA SNA SNL SZL SKP OSR HLT CIA LAS I ' = 7450 7.420 7430 7410 7404 7402 = 7041 g: > = = , ‘ -: : __—— = ’ 7604 400 . f 5-67 DEBUGGING WITH CDT The Octal Debugging Technique is a debugging program which facilitates communication with and alteration of the object program. Communication is directed from the Teletype keyboard _ using octal numbers. ODT has the same capabilities as DDT except that the programmer must reference his program. using its octal representation instead of mnemonic symbols, and ODT commands are formulated differently. ODT occupies 6008 consecutive locations and one location on page zero, and can be loaded into either lower (starting address 1000) or upper (starting address 7000) core memory, depending on where the user’s program resides. That is, if the user program residesin the first few pages of memory, then ODT should be loaded in the upper pages of memory, and vice versa. As with DDT, the user program cannot occupy (overlay) any location used by ODT, including the breakpoint location (location 0004 on page zero). The programmer will probably discover CDT to be more useful and convenient than DDT once he has adjusted to the octal notation.“ Features ODT features include location examination and modification; binary punching (to the Teletype or‘high-speed punch) of user designated blocks of memory; octal core dumps to the Teletype using the word search mechanism, as in DDT; and instruction breakpoints to return control to OFF (breakpoints). ODT makes no use of the program interrupt facility and will not operate out— side of the core memory bank in which it is reading. The breakpoint is one of ODT’s most useful features. When de— bugging a program, it is often desirable to allow the program to run normally up to a predetermined point, at which the programmer may examine and possibly modify the contents of the accumulator (AC), the link (L), or various instructions or storage locations within his program, depending on the results he finds. To accomplish this, ODT acts as a monitor to the user program. The user decides how far he wishes the program to run and ODT inserts an instruction in the USEr’s program which, when encountered, causes control to transfer back to ODT. ODT imme- diately preserves in designated storage locations the contents of the AC and L at the break. It then prints out the location at which 5-68 the break occurred, as well as the contents of the AC at that point. ODT will then allow examination and modification of any location of the user’s program (or those locations containing the AC and L). The user may also move the breakpoint, and request that ODT continue running his program. This will caUse ODT to restore the trapped instruction and continue in the AC and L, execute the user’s program until the breakpoint is again encountered or the program is terminated normally. Using ODT ~ . . When the programmer is ready to start debugging a new program at the computer, he "should have at the console: 1. The binary tape of the new program. -2. A complete octal/ symbolic program listing. 3. A- binary tape of the ODT program I (either high or low ' ‘ version). To begin the debugging run, first be sure that the BIN Loader is in core memory, then load the CDT binary tape followed by the binary tape of the user program (see Figures 5-3 and.5-4 for a description of loading procedures with the BIN Loader). - . Operation and Storage STORAGE REQUIREMENTS ODT can be run in a standard-4K PDP—S series computer and requires 600 (Octal) consecutive core locations and one location (0004) on page zero.As distributed by the Software Distribution Center, it resides in memory between 7000 and 7577 (1000 and 1577 for the low version). ODT is page-relocatable. The source tape can be re—origined to the start of any memory page except page zero and assembled to reside in-the three pages following that location, assuming they are all in the same memory ' bank. . ' ODT uses location 4 on page zero‘as an intercom location between itself and the user’s program when executing a breakpoint. If the user wishes to change the location of the intercom word, he may do so by changing the value of ZPAT in'the source and reassembling. The intercom locationmust'remain on page zero. . 5-69 I LOADING AND CALLING PROCEDURES The user should note that ODT cannot be called as a subroutine. ODT is normally distributed as a binary tape with the source listing available on request from the DEC Software Distribution Cent-' er and is loaded with the BIN Loader as described in Figure 5-15. Load the binary tape of the program to be debugged in the same manner as ODT was loaded. Be sure the two do not overlap. STARTING PROCEDURE FOR ODT The starting _ address of DDT is the address of the symbol START. For standard library versions the high version starts at 7000 and the low at 1000. Set the starting address in the switch register. Press ADDRess LOAD, CLEAR and CONTinue. ODT will issue a carriage return and line feed to indicate that it is now running and awaiting com— mands from the keyboard. To restart ODT without clearing the checksum, set the address of START + 1 (7001 high version or 1001 low version) into the switch register and press ADDRess LOAD, CLEAR and ’ CONTinue on the computer console. LOAD OBAIECT -_ LOAD ODT SEE FIGURE 5-4 -- SEE FIGURE 5—4 ---— ? » _ ' I SETSR-TOOO I sersa-rooorl ' lPRESS ADDR LOAD l PRESS CLEAR AND CONT!“ OOTlSLOADED , mgr: Figure 5-15 Loading DDT and the Object Tape 5-70 Commands SPECIAL CHARACTERS Slash(/)——'0pen Preceding Location ~ The location examination character (/) causes the location ad- dressed by the octal number preceding the slash to be opened and its contents printed in octal. The open location can then be mod— ified by typing the desired octal number and closing thelOcation. Any octal number from 1 to 4' digits in length is legal inpfit. ‘Typing a fifth digit is an error and will cause the entire modification to be ignored and'a question mark to be printed by ODT. Typing / with no preceding argument causes the latest named loca— tion to be opened (again). Typing 0/ is interpreted as / with no argument. For example: ‘ ace/6e46 460/6646 2468? 4916/6646 12345? I6046 Return—Close Location If the use has typed a valid octal number after the content of location printed by ODT, typing the RETURN key 1s causes a the binary value of that number to replace the original contents of the opened location and the location to be closed. If nothing has been typed by the user, the location is closed but the— content of the location is not changed. For example: 400/6646 location 400‘. is unchanged. 4916/6846 2345 ,2345 6046 location 400 1s changed to contam 2345. . . . - replace 6046' in location 400. Typing another command will also close an opened register. For . example: ace/ecu 461/663] “BB/6M6 “”2346 2346 . location 400 is closed and unchanged and 401 is opened and changed to 2346.~ . Line Feed—Close Location, Open Next Location The LINE FEED key has the same effect'as the RETURN key, ' but, in addition, the next sequential locatiOn is opened and-its con— tents printed. For example: 5-71 location 400 is closed unchanged and 401 is zine/sane 64$! “”2 ’693‘ 152‘“ 1234 opened. User types change, 401 is closed containing 1234 and 402 is opened. 1(Shift/N )——-Close Location, Take Contents as Memory Reference and Open Same The up arrow will close an open location just as will the RETURN key. Further, it will interpret the contents of the location as a memory reference instruction, open the location referenced and print its contents. For example: i 404/3270 v 347“ ’“2 I 2 3270 5%“ symbolically is “DCA, this page, relative location 70,” so ODT opens location 470. s-{Shi}tz‘/0) Close Location, Open Indirectly The back arrow will also close the currently open location and then interpret its contents as the address of the location whose contents it is to print and open for modification. For example: 365/5760 ' 336,6 l0426 0426 15261 ‘- ILLEGAL CHARACTERS Any character that is neither a valid control character nor an octal digit, or is the fifth octal digit in a series, causes the current line to be ignored and a question mark printed. For example: ‘ ODT opens no location. 4 xr an? 466/4 671 I467! 67K? ODT ignores modification and closes location 406. CONTROL COMMANDS nnnnG—Trans-fer Control to User at Location nnnn ' Clear the AC then go to the location specified before the G. All indicators and registers will be initialized and the breakpoint, if any, will be inserted. Typing G alone will cause a jump to location 0. 5-72 n'nrmB—Set Breakpoint at User Location nmm ' InstruCts CDT to establish a breakpoint at the location spec- ified before the B. If B is typed alone, ODT removes any previ- ously established breakpoint and restores the original contents of the break location. A breakpoint may be changed to another location whenever ODTIs in control, by simply typing nnt where nnnn is the new location. Only one breakpoint may be in effect at one time; therefore, requeSting a new breakpoint removes any previously existing one. A restriction in this regardis that a breakpoint may not be set on any of the floating-point instructions which appear as. arguments of a J MS. For example: — ' " TAD 1 . ‘ « Den ans FADD , _ The Breakpomt legal here. Breakpoint illegal here. breakpoint (B) command does not make the actual ex- change of ODT instruction for user instruction, it only sets up the mechanism for‘doing so. The actual exchange does not occur until a “go to” or a “proceed from breakpoint? command is executed. » When, during execution, the user’s program encounters the loca— tion containing the breakpoint, control passes immediately to ODT (via location 0004). The C(AC) and‘C(L)' at the point of the interruption are saved in special locations accessible to ODT. The user instruction that the breakpoint was replacing is restored, be—_ fore the address of the trap and the content of the AC are printed. The restored instruction has not been executed at this time. It will not be executed until the‘ ‘proceed from breakpoint” Command is given. Any user location, including those containing the stored AC and Link, can now be modified in the usual manner. The break— point can also be moved or removed at this time. An example of usage follows the section “Cont-' inue and Iterate breakpoint Loop.” A—Open C(AC) and C(L) are When the breakpoint is encountered the saved for later restoration. Typing A after having encountered a breakpoint, opens for modification the location in which the AC - C(AC) was saved and, prints its contents. This location may, now be mod— I 5-73 . ified in the normal manner (see Slash) and the modification will be restored to the AC when the “proceed from breakpoint” com- mand is given. A (line feed)——0pen C(L) After opening the AC storage location, typing the LINE FEED key closes the AC storage location, then opens the Link storage [location for modification and prints its contents. The Link location may now be modified as usual (see Slash) and that modification Will be restored to the Link when the “proceed from the breakpoint” command is given. C—Proceed (Continue) From a Breakpoint . Typing C, after having encountered a breakpoint, causes CDT to insert the latest specified breakpoint (if any), restore the contents of the AC and Link, execute the instruction trapped by the previous breakpoint, and transfer control back to the user program at the appropriate location. The user program then runs until the breakpoint is again encountered. NOTE If a breakpoint set by ODT is not encoun— is tered while ODT (user’s) program, causes running the object the the break to instruction occur moved from the user’s which will not be re— program.“ nnnnC—Continue and .Iterate Loop nnnn Times Before Break The programmer may wish to establish the breakpoint at some location within a loop of his program. Since loops often run to many iterations, some means must be available to prevent a break from occurring each time the break location is encountered. This (where nnnn is an octal number). After having encountered the breakpoint for the first time, this command is the function of: nnnnC I specifies how many additional times the loop is to be iterated before another break is to occur. The break operations have been described previously in the section on the B command, Given the following program, which increases the value of the AC by increments of 1, the use of the Breakpoint command may be illustrated. ‘ 5-74 , #200 0200 7300 '0201 0204 0205 1206 2207 5202 5201 .402 0206 0207 0000. 0202 0203 , A. .B. 001 ‘ ONE; ONT, CLA CLL TAD ONE ISZ GMT amp B JMP HLT I 0 A ~ ' A B cut ONE 0201 0202 020? 0206 02013 2000 0201 (0000 c. 0201 C (0001 0201 (0002 4C 02%! (6007 . . CDT has been loaded and started A breakpoint. is inserted at location 0201 and execution stops here showing "the AC initially set-to 0000.. The 'use of the Proceed; command (C) executes the f program until the breakpoint is again encountered (after one com— plete loop) and-shows the AC to contain a value of'_0001. Again execution continues, incrementing the AC to 0002. At this point, the command 4C-is used, allowing execution of the loop to continue 4 more times (followingthe— initial encounter) before stop,ping» atthc breakpoint. The contents of the AC have now been , incremented to 0007. M—‘Open Search Mask - . Typing M causes CDT to open for modification the location containing the current value of the search mask and print its contents. Initially the mask is set to 7777-. It’m‘ay be changed by opening the mask location and typing the desired value after the value printed by ODT, then closing the location; M Line Feed—Open lower search limit The word immediately following the mask storage location contains the location at which the search is to begin? Typing the LINE FEED key to close the mask location causes the lower search limit to be opened for modification and its contents printed. Initially the 5—75 .. lower search limit is set to 0001. It may be changed by typing the desired lower limit after that printed by ODT, then closing the location. M Line Fcede—Open upper search limit The next sequential word contains the location with which the search is to terminate. Typing the LINE FEED key to close the lower search limit causes the upper search limit to be opened for 'modification and its contents printed. Initially, the upper search limit is the beginning of DDT itself, 7000 (1000 for low version). It may also be changed by typing the desired upper search limit after the one printed by ODT, then closing the location with the ‘- RETURN key. . nnnnW—Word Search The command nnnnW (where nnnn is an octal number) 'will cause CDT to conduct a search of a defined section of core, using the mask and the loWer and upper limits which the user has spec— ificd, as indicated abo"e. Word searching with ODT is similar to word searching with DDT. The searching operations are used to , ‘ determine if a given quantity is present in any of the locations of a particular section of memory. The searchIS conducted as follows: ODT masks the expression preceding the W and saves the result as the quantity for which it is searching. (All masking is done by performing a Boolean AND between the contents ofthe mask word, C(M), and the word containing the instruction to be masked.) ODT then masks each location within the user’s specified limits and compares the result to the quantity for which it is searching. If the two quantities are identical, the address and the actual unmasked contents of the matching location are printed and the search continues until the upper limit1s reached. A search never alters the contents of any location. For example: search locations 3000 to 4000 for all ISZ instructions, regardless of what location they refer to (i.e. search for all locations begin—ning with an octal 2). nnnn which the user types M7777 Change the mask to 7000, open lower 7am search limit. 7745.3/aea1 ' 3mm . Change the lower limit to 3000, open upper limit5-76 74 54/7666 Change the upper limit to 4000, close 4666 ' location. , 2.666»: . 2666 3657 /2467 3124 /2632 l2152 4666 . . . Imtiate the search for ISZ instructlons‘. /2561 . ~ . . These are 4 ISZ mstructlons in this section of core. PUNCH COMMANDS ‘ .T—Punch Leader Tape _ ODT capable of producing leader (code 200) tape on—line. IS ThisIS done by typing T and then turning ON the punch When enough leader has been punched, turn off the punch and hit the key on the computer console.- It is imperative that the punch be turned OFF before typing again on the Teletype keyboard, since anything typed will~ also be punched if the punch is left on. To issue any furthen commands reload the starting address (1000 or 7000), then press the ‘ADDR LOAD, CLEAR and CONTinue keys on the computer console. HALT , nnnn,mmmmP—Punch Binar'y To punch a binary core image of a particular section - of core, the above commandis used Where nnnn is the initial (octal) address and mmmm is thefinal (octal) address of the section of core to be punched. The computer will halt (with 7402' displayed) to allow the user to turn ON the punch. Pressing the CONTinue key on the console initiates the actual punching of the block. The punch— ing terminates without having punched a checksum, to allow subsequent blocks to be punched and to allow an all inclusive 'checksum to be punched at the end by a separate command. This procedureis optional, however, and the user may punch individually checksummed blocks. low-speed or Binary tapes may be punched using either the high-speed punches. If using the low-speed punch, it is imperative that the punch be turned OFF before typing commands, since the keyboard and punch are linked. Using the high-speed punch requires switch manipulation. The flowchart in Figure 5—16 details the procedures involved in punching binary tapes. i E—Punch Checksum and Trailer Given the E command, ODT will halt to allow the punch to be turned on. Pressing the CONTinue key on the console will cause it 5—77 _ TYPE PUNCH "MAID "nun-,mmmP RELOAD OOT SET SR=723| (H1614) SRI123! (LOW) SET SR- 6026 TTY $5.55 CR/LF SET 541-722!“ 5338122“ PfiESS MIR LOAD CLEAR AM) CONT VID'EN EWGH LEADER?“ a RAISE MLT SET WWHIGH) SRt 1203(LON) Figure 5-16 Punching Binary Tapes (ODT) 5-7 8 SET sn=7222musm WHEN SUFFIOENT TRAILER TURN LSP o'FF Vsa=1222uow DDR LOAD PRESS ADDR LOAD SET SR=6046 CLEAR AND CONT SET SR=6041 RAISE DEP SET SR=7DOOCHIGH) ODT SET SR=7231 (HIGH) SR= 123! (LOW) HIGH 0R Low ? PRESS ADDR LOAD CLEAR AND CONT I SET 5811000 5R=1000(LOW) SET SR=7000 I PRESS ADDR .LDAD PRESS CLEAR AND CONT TTY ISSUES CR/LF LIFT DEP om [S m COMMAND MODE Figure 5-16 Pufiching Binary Tapes (ODT) (cbnt) 5-79. to punch the accumulated checksum for the preceding block(s) of binary output followed by trailer (code 200) tape. When a sufficient length of trailer has been output, turn OFF the punch and press the HALT key on the console. To'continue using ODT, reload the starting address (1000 or 7000), then press the ADD LOAD, CLEAR and CONTinue keys on the console. The binary tape produced by ODT can now be loaded into core and run. However, the change-s shOuld'be made to the symbolic source tapes as soon as possible. Additional Techniques TTY I/O—FLAG Sometimes the program . being debugged may require that the Teletype (TTY) flag be up before it can continue output, i.e., the program output routine will be coded as follows: rsr JMP . -l TLS Since ODT normally leaves the TTY flag in an off state, the above coding will cause the program to loop at the JMP.-1. To avoid this, ODT may be modified to leave the TTY flag in the on state when transferring control through either a “go to” or a “con- tinue” command. This modification is location XCONT—3 make the actual XCONT—3 (normally change, load and modify it at accomplished by changing 7341) ODT as (7000) To usual Open location to a NOP as follows: 7341/6642, 76% l3“"6““2 7‘5““ (RETURN key) for high version . (RETURN key) for low version' CURRENT LOCATION _ The address of the current location or last location examined is remembered by DDT and remains the same, even after the com- mands G, C, B, T, E, and P. This location may be opened formspection merely by typing the slash ( / ) character. 0 5-80 . PROGRAMS WRITTEN IN ODT COMMANDS " ODT will also correctly read tapes prepared ofl-line(e.g., a tape punched with 1021/115717775 will cause location 1021 to be opened and changed to 1157; then the memory reference address - opened and changed to 7775. This procedure will work with breakpoints, continues, punch commands, etc. Thus, deébugging programs may be read into CDT, to execute the program, list locations of interest, modify locations, etc. 157 will be lNTERRUPT PROGRAM DEBUGGING ‘ODT executes an IOF when a breakpoint is encounteIed. (It does not do this when more iterations remain in an nnnnC com- mand.) This is done so that an interrupt will not occur when ODT prints the breakpoint information. ODT thus protects itself against ' spurious interrupts and may be used safelyin debugging programs that turn on the interrupt mode. However, the user must remember that ODT does not know whether the interrupt was on when the breakpoint was encountered, and hence it does not turn on the interrupt when'transferring control back to the program after receiving a “go” or a “continue” I command. ' OCTAL DUMP . _ By setting the search mask to zero and typing W, all locations between the search limits will be printed on the Teletype. An Octal Memory Dump program (DEC-8I-RZPA—D) is available from the Software Distribution Center upon request. INDIRECT REFERENCES When an indirect memory reference instruction is encountered, the actual address may be opened by typing t arid <- (SHIFT/N and SHIFT/O, respectively). Errors _ The only legal inputs are control characters and octal digits. Any other character will cause the character 'or line to be ignored and a question mark to be printed by ODT. Typing G alone is an error. It must be preceded by an address to which control will be transferred. This will elicit no question mark also if not preceded by an address, but will cause control to be transferred to location 0. r _ 5-81 , Typing any punch command with the punch ON is an error and will cause ASCII characters to be punched on the binary tape. . This means. the tape cannot be loaded and run properly. Programming Notes Summary ODT will not operate outside of the memory field in which it is located. ODT must begin at the start of a memory. page (other than page zero) and must be completely contained in one memory field. ODT will not turn on the. program interrupt, since it does not know if the user’s program is using the interrupt. It does, however, turn off the interrupt when a breakpoint is encountered, to prevent spurious interrupts. The user’s program must not use of reference any core locations- occupied or used by ODT, and vice versa. Register ZPAT is used as an intercom location by ODT when executing a breakpoint. In library distributed versions ZPAT 0004. This location must be left free by the user since it is filled . -= with an address within ODT which is used to transfer control between the user program and ODT. . Breakpoints are fully invisible to “open location” commands; however, breakpoints may not be placed in locations which the user program will modify in the course of execution. or the breakpoint will be destroyed. If a trap set by ODT is not encountered by the user’s program, the breakpoint instruction will not be removed. ODT can be used to debug programs using floating—point instructions, since the intercom location is 0004, and since breakpoints may be set on a 1 MS with arguments following. This version of DDT will operate on a Teletype with an ALT MODE key or an ESCape key. To restart ODT without clearing the checksum, see the section Starting Procedures for CDT. The high-speed punch may be used by patching three locations after typing the punch command. See the section on Binary Tapes from the High-Speed Punch. on 5-82 Command Summary nnnn/ Open location designated by the octal number nnnn. ' / Reopen latest opened location. RETURN key Close previously opened location. LINE FEED key Close location and open the next sequential one for modification. T (SHIFT/ N) Close location, take contents of that location as a memory/reference and open it. (SHIFT/O) Close location, open indirectly. Illegal character Current line typed types ? (CR/LP). by nnnnG Transfer program control to location nnnn. nnnnB Establish B Remove the breakpoint. <- A . a user is ignored, breakpoint at location 'nnnn. Open for modification the location in which the contents of AC were stOred when the was encountered. Proceed from a nnnnC ODT breakpoint breakpoint. Continue from a breakpoint and iterate past the breakpoint nnnn times before interrupting the user’s program at the breakpoint location. Open the search mask. M LINE FEED key Open lower search limit. LINE FEED key Open upper search limit. nnnnW Search the portion of core as defined by the upper and lower limits for the octal'value nnnn. T Punch leader. nnnn;mmmmP Punch a binary core image defined by the limits nnnn and mmmm. E Punch checksum and trailer. 5-83 . prggrgmmlng _ ' iprogramming nput'./out.r.>.ul'.w~ dectape programming ' Floating-point packages : . input/output programming INTRODUCTION Programming a computer to do calculations is of little use unless there is some means of obtaining the result of the calculations from the machine. In. most applications, it is also necessary to ~supply the computer with data before calculations may be performed.‘ A programmer must be able to translate information efficiently between the computer and the peripheral devices that supply input or serve as a means of - . There are three methods for the transfer of . ; output. information between , input/ output (I/O) devices and PDP—S series computers The. first two methods provide for computer control over the transfer. One such method is programmed transfer, in which. instructions .to accept or transmit information are included at some point in the ”program. Programmed transfers are program initiated and executed . under program control Information may also be transferred Via program interrupt, 1a standard feature of PDP—S series computers that allows I/O de- vices to signal the computer when they are ready to transfer information. The computer interrupts its normal flow, jumps to a : _ special routine which processes the information, and then returns tothe point at which the main program was interrupted. Program interrupt transfers are device initiated and executed under program control. _ Both programmed transfers and program interrupt transfers use a the accumulator as the bufi‘er, or storage area, for all data transfers. Since data may be transferred only between the accumulator and the device, only one'12—bit word at a time may be transferred by programmed transfer or by program interrupt. The third method of data transfer is the data break. A data 6-1 break is essentially device controlled and allows for direct exchange of large quantities of information between the I/O device and core memory. It differs from the previous two types of trans— fer in that there are no program instructions to handle the actual transfer, and the accumulator is not used as a buffer. Data break transfers are device initiated‘and device controlled. PROGRAMMED DATA TRANSFERS Programmed transfers of information are accomplished by pro— gram instructions. The instructions used are similar to the operate microinstructions in that there is no need to specify an address in memory. All programmed transfers occur directly between the accumulator and the I/O device. Since many different devices could be connected to one computer and each device might transfer information at some time, the instruction'5 must identify the proper device for each transfer. It must also nature of the function to be performed. specify the exact IOT Instruction Format . The instructions used to perform pregrammed data transfers called input/output transfer (IOT) instructions. An IOT instruction is a 12-bit word that has the following format: are 0 » . BIT POSITION. 1 1, 0 Q 0 ‘ ‘ ' D 0 O 1 ‘ T V OPERATION 9 fl 1 m; J k g 0 ‘ 1 1 J L V > CODE—J DEVICE SELECT lON CODE OPERATION SPECtFlCATlON BITS , An IOT instruction is divided into three parts: operation code, device selection code, and operation specification bits. The first three bits of the instruction contain the operation code. These bits are always set to 63 (110) to specify an IOT instruction. The .next six bits of the instruction contain the device selection code. This code is transmitted to all peripheral equipment whenever the IOT instruction is executed. A device selector within each peripheral monitors the device codes. When the selector recognizes 6-2 . code as that device’s assigned code; the device a three bits of the IOT instruction. accepts the last ‘ , The last three IOT instruction bits are the operation specifica- ‘tion bits, which‘may be set to specify up to eight functions or combinations of functions. If a device is capable of performing more functions than can be coded into the three operation specifi— cation bits, then more than one device code must be assigned to that device. - '- Checking Ready Status The computer operates much faster than'most peripheral devices. For this reason, I/O routines must check, the—status of a device before executing an IOT instruction to ensurethat the device is not still performing a previous operation. Device status .is signalled through a system of one-bit registers called flags. Every I/O device has a device flag which .is set to l as soon as the device finishes a‘current operation and is ready to begin a new operation. If the flag is cleared (set to 0), the device is still performing" the operation specified by the last IOT instruction received. Ready status is usually checked by means of a skip-on—flag IOT instruc— tion, such that the computer does not skip out of a waiting loop until the I/O device1s ready to begin a new operation. Instruction Uses In general, for each I/O device there are at least three instruc— tions: 13. ' _ \ An instruction to transfer information and/ or operate the device. ready 2. An instrUCtion to test the status of the device and skip on the ready (or not—ready) status of the device. 3. An instruction to clear or set the device flag. ' These instructions may be microprogrammed. In particular, the instructions to clear the flag and to operate the device are often ' combined. Specific instructions for various devices are presented1n the fol— lowing sections. The Teletype unit is described1n depth to illustrate the fundamentals of programming data transfers. The general techniques developed for the Teletype unit may be extended to other I I/O devices. _ 6-3 ASCII Code The ASCII code (American Standard Code for Information In- :terchange)15 describedin Appendix B. Many of the programs pre— sented in this chapter use ASCII code to transmit information to ..the PDP- 8/ E Note that the ASCII code for octal digits 0 through 7is the sum of the digit plus 2608. PROGRAMMING THE TELETYPE UNIT One of the most I/O devices is the Teletype unit, which consists of a keyboard, printer, paper tape reader, and paper tape punch. The Teletype unit can use either the keyboard or the paper tape reader to provide input information to the computer and either the printer or the paper tape punch to accept output information from the computer. The Teletype is therefore assigned two device codes. Functioning as an input device, the keyboard/reader is assigned the device code 038, and functioning as an output device, the printer/punch is assigned the device common code 043. ’Keyboard/ Reader Instructions Figure 6-1 shows the format for the keyboard/ reader IOT instruction. Table 6-1 lists the mnemonic bits 9,10 and 11. .V . . . k instructions used to set iio'ooopli‘fim J J k v _ T DEVlCE CODE'l03) KRS I KCC KSF Figure 6-1 . V , Keyboard / Reader Instruction Format Figure 62 shows a program using the keyboard/reader IOT instructions to read one ASCII character from the keyboard or paper tape reader. This program does- not print the character on the teleprinter; It merely stores the ASCII code for the character in core memory location STORE. 6—4 Table 6—1 A Keyboard/ Reader Instructions ‘ I Mnemonic KCF Octal Operation 6030 ' , Clear keyboard / reader flag without oper- ating the device. KSF Skip the next instruction if the keyboard/ reader flag is a 1. 6031 ‘ ' - ' Clear the accumulatdr and the reader flag. 6032 KCC ' 6034 KRS keyboard/ Read a character from the keyboard/ reader bufler. The keyboard / reader flag is set when the Operation is completed. . . ' ' 6035 KIE Enable the keyboard/reader to cause pro- gram interrupts if accumulator bit 11 is a 1. Disable the keyboard/reader from causing interrupts if accumulator bit 11 is a zero.1 KRB Clear the accumulator and the keyboard/ reader flag, and read a character from the 6036 keyboard/reader bufler. This instruction is -a microprogrammed combination of KCC and KRS. *ZOO . INPUT, KCC JMS DCA LISN STORE HLT— - O LISN, KSF ETORE, JMP KRB .-L JMP I _ LISN O Figure 6-2 1 Use /CLEAR KEYBOARD FLAG /ENTER SUBROUTINE /STORE ASCII CHARACTER /HALT UPON COMPLETION /LISN SUBROUTINE /KEYBOARD FLAG RAISED YET? /NO: CHECK AGAIN /YES: READ THE CHARACTER /RETURN TO MAINLINE /CHARACTER STORAGE Coding to Accept One ASCII Character of this instruction will be discussed later in this chapter. 6-5 ' The program begins with KCC instruction. In general, any program should begin by clearing the flags of all I/O devices to. a be used later in the program. If the above program is started at location 0200, it will proceed to the KSF, JMP.—-1 loop, and continue looping indefinitely until a key on the Teletype unit is pressed or a paper tape is loaded into the reader. As soon as the ASCII code for a character has been assembled in the keyboard/reader keyboard/reader flag is set and the program skips out of the waiting loop. The content of the bufler is then transferred into the accumulator, and the keyboard/ reader butter and flag are cleared. butler register, the ' Printer/ Punch Instructions Figure 6-3 shows the format for the printer/ punch IOT instructions. Table 6-2 lists the mnemonic instructions used to set bits 9, IO and 11. 1 k . 1’ 0 J 0 u 1 0 0 0. 0 0 1 J L V v QRERATION CODE (El—J ‘ 0 1 1 1 T DEVICE CODE (24) TPC TCF TSF Figure 6-3 Printer/ Punch Instruction Format The program presented in Figure 6-4 prints out one ASCII character which is stored in core memory location HOLD. It be- gins by clearing the accumulator and executing a TLS instruction. Thishas no effect on the printer/punch, since 000 is the ASCII code for a blank, but it serves to clear the printer/punch butter and then raise the device flag. If this instruction had not been in; cluded, the flag would never be raised and the program would remain in the TSF, JMP.—1 loop indefinitely. Instead, the flag is set as soon as execution of the first TLS instruction is complete, 6—6 Table 6-2 Printer/Punch . Instructions M‘nemonic Octal TFL 6040 Set the printer/ punch flag. TSF 6041 Skip the next instruction punch flagIS a 1. Operation _ if the printer/ ' TC-F- TPC ‘ 6042 Clear the printer/ punch flag. 6044 Load the contents of accUmulator bit positions 5 11 into the printer/ punch buffer and operate the pr1nter/ punch The ' printer/ punch flagis set when the operation is com— pleted. . ' 6045 TSK Skip the next sequential instruction if either the printer/ punch interrupt request flag or the keyboard/ reader interrupt request flag is set.2 M _ ' 6046 TLS Clear the printer/ punch flag, load the contents of accumulator bit positions 5-11 into printer/ punch buffer and operate the printer/ punch. This instruction is a microprogrammed combination of TCF and TPC. the *200 OUTPUT, . CLA TLS TAD JMS CLL‘ HOLD TYPE HLT_ TYPE, 0 TSF JMP TLS .‘1 CLA CLL I TYPE JMP :OLD, ‘ _ 24$ Figure 6-4 /CLEAR ACCUMULATOR AND LINK /RAISE PRINTER FLAG /GET THE CHARACTER /ENTER SUBROUTINE /HALT UPON COMPLETION /TYPE SUBROUTINE /PRINTER FLAG RAISED YET? /N0: CHECK AGAIN /YES: PRINT THE CHARACTER /CLEAR ACCUMULATOR AND LINK /RETURN TO MAINLINE /STORED ASCII CHARACTER Coding to Print One ASCII Character 2 Use of this instruction will be discussed later in this chapter. 6-7 permitting the program to escape the skip loop and execute the second TLS instruction. Finally, the program again clears the accumulator. It is advisable to clear the accumulator at the end of any subroutine, unless meaningful data is contained in it. Format Routines , Input and output routines are often written in the form of subroutines similar to the TYPE-subroutine in the previoiJs example. Figure 6-5 presents a carriage return/ line feed subroutine that calls the TYPE subroutine to execute a carriage return and line feed on the teleprinter. Similar subroutines could be Written to tab space the carriage a given number of spaces or to ring the bell of the Teletype by using the respective codes» for these nonprinting characters. If such subroutines are commonly used in a program, they should be placed on page, ‘0 (or a pointer to the subroutine should be placed on page 0) to facilitate reaching the routine from all memory locations. ‘*5@0 - CRLF, CLL CLA K215, K212, TYPE, /CRLF SUBROUTINE /CLEAR ACCUMULATOR AND LINK ~/RAISE PRINTER FLAG /GET ASCII CARRIAGE RETURN /PRINT IT /GET ASCII LINE FEED /PRINT IT /RETURN TO MAINLINE /ASCII CARRIAGE RETURN /ASCII LINE FEED /TYPE SUBROUTINE /PRINTER FLAG RAISED YET? /NO: CHECK AGAIN /YES: TYPE THE CHARACTER /CLEAR ACCUMULATOR AND LINK IRETURN 0 ‘ “ TLS TAD JMS TAD JMS JMP 215 212 6 TSF .JMP TLS CLA JMP ‘ K215 TYPE K2l2 TYPE I CRLF : _ .-1 CLL I TYPE $ t Figure 6—5 Carriage Return/Line Feed Subroutine Text Routines The examples in Figures 6-2 and 6—4 may be expanded. to ac- cept and print than character. Figures 6—6 and 6-7 illustrate one such expansion. These two programs are compatible in that the characters accepted by the first program may be typed more one 6-8 out by running the second program. The program in Figure 6-6 continuesto accept character input until a dollar sign ($) is typed at the keyboard. It then stores 0000 in the next core location and halts. The program 'in Figure 6—7 types the characters whose ASCII codes were stored by the first program, and halts when a location with contents equal to zero is reached. Both programs use . beginning at 2000 as a storage bufier for the ASCII' characters. The following flowcharts illustrate the techniques used in the program coding. locations SET BUFFER POINTER T0 FIRST LOCATION EXECUTE TLS TO CLEAR BUFFER - CHECK FLAG AGAIN AND SET FLAG IS KEYBOARD FLAG SET . I. ? SET BUFFER POINTER T0 FIRST LOCATION YES I ACCEPT ONE CHARACTER RETURN CARRIAGE I I STORE ONE CHARACTER IN BUFFER ‘ GET NEXT ASCII cone ‘ ‘ PRINT THE CHARACTER INCREASE THE BUFFER VPOINTER TYPE OUT CHARACTER IS THE CHARACTER I A .3. ? INCREASE BUFFER POINTER YES ' STORE ZEROS OVER '8' 6-9 ' *ZDD CLL TAD BUFF DCA BUFFPT KSF JMP ;-l CLA START, LISN, KRB TLS DCA TAD TAD BUFFPT BUFFPT MDOLAR I I SNA JMP CLA CLL DCA I BUFFPT BUFF, BUFFPT , /AND LINK INITIALIZE_POINTER /KEYBOARD_STRUCK YET? /NO: CHECK AGAIN /YES: GET THE CHARACTER /ACKNOWLEDGE IT ON PRINTER /STORE THE CHARACTER /CHECK FOR TERMINAL /DOLLAR SIGN ($) /IS CHARACTER A "$"? /YES: STORE ZERO OVER $ /NO: INCREMENT POINTER /GET ANOTHER CHARACTER /CLEAR ACCUMULATOR /STORE ZERO IN LAST /BUFFER LOCATION AND HALT /BUFFER BEGINS AT /CORE LOCATION ZODD /TWO'S COMPLEMENT OF @244 _ DONE ISZ BUFFPT JMP LISN DONE,, /CLEAR ACCUMULATOR AND /SET UP BUFFER SPACE HLT 2ZOD D MDOLAR, 7534 $ Figure 6-6 Program to Accept ASCII Characters *38% START, CHRTYP, CLA CLL TLS TAD BUFF DCA BUFFPT JMS' CRLF TAD I BUFFPT SNA HLT JMS TYPE ISZ BUFFPT JMP CHRTYP CRLF, D JMS K215 TYPE TAD K212 JMS ‘JM TYPE I CRLF TAD TYPE, 8 /PRINT . TSF JMP .‘1 TLS CLA CLL JMP I TYPE 2066 BUFF, BUFFPT, D 215 K215, 212 K212, Figure’ 6-7 /CLEAR ACCUMULATOR AND LINK /RAISE PRINTER FLAG /SET UP BUFFER SPACE AND /INITIALIZE BUFFER POINTER /RETURN CARRIAGE /GET A CHARACTER /IS IT ALL ZEROS? /YES: HALT /NO: TYPE THE CHARACTER /INCREMENT BUFFER POINTER /GET ANOTHER CHARACTER ICRLF SUBROUTINE /GET ASCII CARRIAGE RETURN IT /GET ASCII LINE FEED /PRINT'IT /AND RETURN /TYPE SUBROUTINE /PRINTER READY YET? 'lNO: CHECK AGAIN /YES: TYPE CHARACTER ICLEAR ACCUMULATOR /AND RETURN /BUFFER BEGINS AT /CORE LOCATION ZDDO /ASCII CARRIAGE RETURN /ASCII LINE FEED Program to Print Out ASCII Characters 6-10 The program to print ASCII characters may be specialized to‘ print a specific message, as in the program example of Figure 6-8. This routine uses aut’oindex registers in place of the ISZ instruction. It types, “HELLOI”. *3OO O HELLO, CLA TLS TAD CLL CHARAC DCA IRI TAD M6 DCA COUNT TAD I IRl JMS TYPE ISZ COUNTJMP NEXT JMP I HELLO O TSF' * NEXT, TYPE, /FOR GETTING CHARACTERS /SET UP COUNTER FOR /TYPING CHARACTERS /GET A CHARACTER /TYPE IT /DONE YET? /NO} TYPE ANOTHER /YES: RETURN TO MAINLINE /TYPE SUBROUTINE “/PRINTER FLAG RAISED YET? /NO: CHECK AGAIN /YES: PRINT A CHARACTER ' _ A - JMP .-1 TLS CLA. JMP I TYPE ' CHARAC, . ' 510 SOS 314 514 517 241 _ /CLEAR ACCUMULATOR /AND RETURN /INITIAL VALUE OF IRl /H /E /L /L /O /! /CHARACTER COUNT /CHARACTER COUNTER /AUTOINDEX REGISTER ' , . ' , - - - -6 M6, COUNT,- O IRIZIO $ /MESSAGE SUBROUTINE /CLEAR ACCUMULATOR AND LINK /RAISE PRINTER FLAG /SET UP AUTOINDEX REGISTER - » . _ Figure 6-8 Subroutine to Print the Message, “HELLO!” Numeric Translation Routines A The ASCII code for a number must be converted to octal representation before the computer may use the number in calculations. For example, 6 is represented by the ASCII code 266. When the Teletype key for 6 is typed, the code 266 is transmitted to the computer upon execution of the next KRB instruction. ,Two methods may be used to remove the 260 from and obtain the octal number itself. an ASCII-coded number One method is to‘ clear the first eight bits of the ASCII-coded 6-11 number by using the AND instruction and an appropriate mask. If » 178 is ANDed with the coded number, as shown below, the octal value of the number is recovered. Instruction Operation Comment 000 010 110 110 ASCII Code 266 in accumulator, MASK: 17. AND MASK 000 000 001 111 000 000 000 110 accumulator after AND instruction is executed. Contents of The second method of stripping an ASCII-coded number is to ' subtract 2603 from the character code. This is accomplished by TADing the two’s complement of 2608 to the coded number, as shown below. Instruction Operation. Comment TAD M260 000 010 110 110 ASCII Code 266 in accumulator. M260: 75208 (2’s comp of 260) 111 101 010 000 000 000 000 110 Contents of accumulator after TAD instruction is executed. Figure 6-9 shows two programs which accept and store an octal digit, using the LISN subroutine presented in Figure 6-2. This process may be reversed to print out a digit which is stored in memory by adding 2608 to the digit, as illustrated in the program of Figure 6-10. This program calls the TYPE subroutine of Figure 6—4 to print out the binary number 7. /USING THE AND /INSTRUCTION /USING *zee *zee NUMIN, . KCC /INSTRUCTION NUMIN, ' JMS LISN AND MASK DCA HOLD HLI . HOLD, MASK, 55 e 17 TAD THE ch JMS LISN TAD mesa DCA HOLD HLT HOLD, M260, 9 . 752m 35 Figure ”6.9 "Two Methods of Converting ASCII Code to Binary 6-12 *200 NUMOUT, /CLEAR ACCUMULATOR AND LINK /RAISE PRINTER FLAG /GET NUMBER /CONVERT T0 ASCII /PR1NT THE NUMBER CLA CLL TLs TAD NUMBER . . TAD KESO , JMS TYPE NUMBER, K260, /AND HALT /NUMBER TO BE PRINTED HLT 7 26E . - s Figure 6-10 All of the Program to Type One Stored Digit routines presented so far have been designed to handle single-digit octal numbers. However, PDP-S/E core memory locations may contain octal numbers with up to four digits. The- program shown in Figure 6-1 prints out a four-digit octal number'which is stored in core memory. The program shown in Figure 6—13 accepts four octal digits from the Teletype keyboard, converts them to an octal number, stores that number, and then loops back to accept another four digits. Figure 6—11 is a flowchart illustrating the procedure employed in these‘routines. V ACCEPT A DIGIT PROM KEYBOARD ? CLEAR A STORAGE LOCATION - GET CONTENT OF EXECUTE TLS TO CLEAR BUFFER AND SET FLAG STORE DIGIT TEMPORARILY STORE": LOCAT’O" IN AC RECEIVED BSIETTS 21:82:20 FOUR DlGITS 7 BRING STORED RESULT INTO AC A . . YES ADD 260 GET THE NUMBER IN Ac , To THE Ac — ' BRING FIRST DlGlT INTO AC I , ROTATE THE NUMBER 1 PLACE LEFT TTZEEDgf; ' i ADD THE CONTENTS OF STORAGE LOCATfoN ROTATE LEFT THREE PLACES i 4 SUBTRACT ADD NEXT DIGIT 2603 ALL DIGITS TYPED _ I . _ STORE THE RESULT ? TEMPORARILY . YES . ROTATE Ac THREE PLACES LEFT RETURN CARRIAGE PACKED 4 DlGlTS ? STORE AC IN STORAGE LOCATION YES STORE NUMBER IN BUFFER Figure 6-11 Flowchart for Figures 6-12 and ' 6-13 6-13 *ZOO START,V CLA CLL UNPACK, TYPE, CRLF, DCA STORE TLS JMS CRLF TAD M4 DCA DIGCTR TAD NUMBER RAL TAD STORE RAL RTL DCA STORE TAD STORE AND MASK7 TAD K269 JMS TYPE ISZ DIGCTR JMP UNPACK JMS CRLF HLT O TSF JMP .‘1 TLS CLA JMP I TYPE B TAD K215 JMS TYPE I TAD K212 JMS TYPE JMP I CRLF NUMBER, 1254 MASK7, .7 M4, DIGCTR, STORE, K212, K215, K252, -4 z 0 212 215 26G /CLEAR ACCUMULATOR AND LINK /CLEAR STORAGE LOCATION /RAISE PRINTER FLAG /RETURN CARRIAGE /SET LOCATION TO COUNT /NUMBER OF DIGITS /GET NUMBER TO BE TYPED /ROTATE ONE PLACE LEFT /ADD STORED LOCATION /ROTATE THREE /PLACES LEFT /STORE ROTATED NUMBER /MASK OUT /FIRST 9 BITS /ADD IN 26% /AND TYPE A DIGIT /TYPED FOUR DIGITS YET? /NO: GO TYPE ANOTHER IYES: RETURN CARRIAGE /AND HALT /TYPE SUBROUTINE /PRINTER FLAG RAISED YET? /NO: CHECK AGAIN /YES: PRINT A CHARACTER /CLEAR ACCUMULATOR /AND RETURN /CRLF SUBROUTINE /GET ASCII CARRIAGE RETURN /PRINT IT /GET ASCII LINE FEED /PRINT IT /AND RETURN /NUMBER TO BE PRINTED /AND MASK /DIGIT COUNT /DIGIT COUNTER /STORAGE LOCATION /ASCII LINE FEED /ASCII CARRIAGE RETURN $ Figure 6-12 Program to Type a Four-Digit Number 6-14 *ZOO' CLA START, /CLEAR ACCUMULATOR AND LINK IRAISE PRINTER FLAG /SET INDEX REGISTER TO /STORE PACKED NUMBERS /RETURN CARRIAGE A/SET COUNTER FOR /4 DIGITS 5/SET UP TEMPORARY JEOR ASCII INPUT A CHARACTER /STORE IT TEMPORARILY CLL 'TLS‘ - TAD K1777 DCA IRl JMS CRLF NXTNUM, IAD M4 DCA1 :COUNTR TAD KSSO' DCA t"TEMP NXIDIG, JMS LISN‘ DCA I TEMP ISZ TEMP' ISZ COUNTR‘= JMP .NXTDIG JMS CRLF JMS PACK DCA I IRI -JMP NXTNUM a PACK, DCA STORE TAD M4 DCA COUNTR TAD K556 .DCA TEMP PAKDIG,'TAD STORE "CLL RAL RTL» TAD 1 TAD MZSO ADCA STORE ISZ TEMP ISZ' COUNTR’ .JMP PAKDIG ‘TAD STORE JMPV I PACK STORAGE - . ‘ IEME CRLF, a .TAD K215 ers TYPE ‘TAD 1K212 JMS TYPE JMP I CRLF Figure 6-13 V's/GET T“/INCREMENI-STPOINTER ‘/RECE1VED 4 DIGITS YET?_ I T/NO: GET ANOTHER /YES: RETURN.CARRIAGE /PACK THE 4 DIGITS ,/5I0RE PACKED NUMBER /GET A NEW NUMBER /PACK SUBROUTINE .ICLEAR STORAGE LOCATION ISET COUNTER FOR /4 DIGITS ‘ISET POINTER TO IASCII INPUT CHARAC-TERS /LOAD PARTIAL NUMBER /ROTATE LEFT "“/IHREE TIMES /ADD NEXT STORED DIGIT --/STRIP OFF THE 260 /STORE PARTIAL NUMBER - 7/INCREMENT POINTER _ ‘ /PACKED 4 DIGITS'YET? /NO: PACK NEXT DIGIT /YES: TAKE PACKED NUMBER /BACK TO MAINLINE /CRLF SUBROUTINE IGET ASCII CARRIAGE RETURN /PRINT IT /GET ASCII LINE FEED IPRINT IT /AND RETURN - A . Program to Pack and Store Four-Digit Numbers 6-15 LISN, a KSF ‘1”? 0'1 KRB 1' TLS TYPE, , JMP I LISN a TSF J”? 0"] TLS Ki777, M4, couurn, xsse, TEMP, STORE, “250, K215, x212, CLA JMP I 1777 7774 TYPE a 550 a G 7520 215 212 IRI=13 $ /LISN SUBROUTINE /KEYBOARD FLAG RAISED YET? INO: CHECK AGAIN IYES: READ A CHARACTER /ECHO ON PRINTER IAND RETURN ‘ITYRE SUBROUTINE /PRINTER FLAG RAISED YET? ~/NO: CHECK AGAIN /YES: PRINT A CHARACTER /CLEAR ACCUMULATOR /AND RETURN /LAST LOC BEFORE BUFFER IDIGIT COUNT /DIGIT COUNTER IBEGIN TEMP STORAGE /TEMP STORAGE POINTER IPACK ROUTINE STORAGE IASCII CONVERSION CONSTANT /ASCII CARRIAGE RETURN IASCII LINE FEED fAUTO-INDEX REGISTER Figure 6-13 (cont) Program to Pack and Store Four-Digit Numbers ' The text and numeric translation routines described earlier are combined in the following sample program, which accepts four- digit octal numbers delimited by carriage returns and then sorts the numbers into ascending numerical order and prints them, on the teleprinter. Any number of elements may be supplied. The end of input is signalled by typing a. dollar sign ($). This program includes routines which ignore any non-octal digits of input; and echo a question mark. Onlyspositive octal digits are~accepted. The program is presented in four illustrations. 6-16 ACCEPT ASCII CODE FOR ONE DIGIT TYPE '?" AND IGNORE THAT ENTRY COUNT THE NUMBERS [5 NUMBER NEGA?TIVE IS i1 A NONOCTAL CHARACTER ? PUT THE NUMBERS lN ' INCREASING ORDER HAVE FOUR DIGITS ? l TYPE ONE PACK AM) STORE AS ONE NUMBER TYPED 4 mens . ? RETURN CARRTAGE "Figure 6-14 Flowchart for Sample Program 6-17 *200 . START,. ACCEPT, ‘ CLA TLS CLL TAD BUFF DCA BUFFPT DCA AMOUNT JMS CRLF TAD M4 DCA DIGCTR TAD TEMP! DCA_TEMP 'NEWDIG, CHECK, ‘ PACK, DIGPAK, , JMS DCA TAD ~TAD SNA JMP LISN I TEMP I TEMP MDOLAR CLA ORDER TA 1 TEMP TAD M268 SPA JMP ERROR TAD M10 SMA CLA JMP ERROR 182 TEMP ISZ DIGCTR JMP NEWDIG TAD TEMP! DCA TEMP DCA HOLD TAD M4 DCA DIGCTR TAD HOLD‘ CLL RAL RTL TAD I TEMP TAD7M266 DCA_HOLD ISZ TEMP ISZ’DIGCTR JMP DIGPAK TAD HOLD DCA I BUFFPT TAD I BUFFPT TAD K4000 SMA CLA JMP ERROR 152 AMOUNT ISZ BUFFPT JMP ACCEPT Figure 6-15 ICLEAR ACCUMULATOR AND LINK /RAISE PRINTER FLAG /INITIALIZE STORAGE /BUFFER POINTER /AND ELEMENT COUNTER /RETURN CARRIAGE /INITIALIZE COUNTER /FOR 4 DIGIT INPUT /SET A POINTER T0 /TEMPORARY INPUT STORAGE /GET A CHARACTER /STORE IT /CHECK FOR A /TERMINAL $ /IS CHARACTER A $? /YES: ORDER INPUT. /NO: CHECK FOR /OCTAL INPUT /IS INPUT <'266? /YES: ENTER ERROR ROUTINE /NO: SUBTRACT 10 /IS INPUT > 26%? /YES: ENTER ERROR ROUTINE /NO: INCREMENT POINTER /RECEIVED 4 DIGITS YET? /NO: GET ANOTHER /YES: SET POINTER TO /STORAGE LOCATION /CLEAR LOCATION HOLD /SET COUNTER FOR /4 DIGITS /LOAD HOLD INTO AC IROTATE INTO CLEARED LINK /ROTATE TWICE MORE IADD ONE ASCII CHARACTER /SUBTRACT OUT THE 263 ISTORE IN LOCATION HOLD /INCREMENT STORAGE POINTER /PACKED 4 DIGITS YET? /NO: PACK ANOTHER /YES: STORE /PACKED NUMBER lCHECK FOR /NEGATIVE INPUT lIS ENTRY NEGATIVE? /YES: TAKE ERROR BRANCH /NO: COUNT THE ENTRIES /INITIALIZE FOR A NEW ENTRY /GET A NEW ENTRY " Initialization and Input Coding for Sample Program 6-181 ORDER, TEST, TAD AMOUNT CIA IAC DCA TALLY DCA FLAG TAD BUFF DCA X1 TAD BUFF IAC DCA X2 TAD I X2 CIA TAD I X1 SMA SZA CLA JMS REVERSE ISZ X1 ISZ X2 ISZ TALLY JMP TEST TAD FLAG SZA CLA JMP ORDER JMP PRINT ‘ REVERSE,Z' TAD DCA TAD DCA TAD DCA CLA ‘DCA JMP I X1 HOLD I X21 X1 HOLD I X2 CLL CMA FLAG I REVERSE Figure 6-16 . /SET UP A TALLY /TO COUNT THE /NUMBER OF /COMPARISONS /CLEAR THE FLAG /SET XI POINTER TO /FIRST BUFFER LOCATION /SET X2 POINTER T0 /SECOND BUFFER /LOCATION »/GET X2 POINTER ENTRY /FORM TWO'S COMPLEMENT /ADD Xl POINTER ENTRY /IS X1 ENTRY LARGER? /YES: SWITCH X1 AND X2 /NO: INCREMENT X1 POINTER /INCREMENT X2 POINTER /COMPARED ALL ENTRIES? /NO:.LOOP BACK /YES: WAS SWITCH MADE /0N LAST PASS? /YES: MAKE ANOTHER PASS /NO: TYPE THE ORDERED DATA /SWITCH X1 AND X2 ‘/GET X1 ENTRY /STORE TEMPORARILY, /GET X2 ENTRY /STORE AT XI LOCATION /GET Xl ENTRY /STORE AT X2 LOCATION /SET FLAG WHENEVER "/A SWITCH IS MADE /RETURN ‘ ' _ ' _ Order Routine Coding for Sample Program 6—19 PRINT, JMS CRLF /RETURN ANOTHR, MORE, JMS TAD DCA DCA TAD CLL TAD CRLF M4 DIGCTR HOLD I BUFFPT RAL HOLD ' NRAL RTL /RETURN THE CARRIAGE, /GET DIGIT COUNT /INITIALIZE DIGIT COUNTER /CLEAR STORAGE LOCATION /GET A CHARACTER /ROTATE INTO CLEARED LINK /ADD STORED LOCATION /ROTATE LEFT ISZ JMP ISZ BUFFPT ISZ PRNTCT JMP ANOTHR JMS CRLF JMP START /THREE TIMES /STORE ROTATED NUMBER /GET STORED LOCATION /MASK OUT FIRST 9 BITS ICONVERT TO ASCII /TYPE ONE DIGIT /TYPED 4 DIGITS YET? /NO: TYPE ANOTHER /YES: INCREMENT POINTER /TYPED ALL ENTRIES? /NO: TYPE ANOTHER /YES: RETURN CARRIAGE AND /ACCEPT MORE INPUT CLA TAD QUEST JMS TYPE JMS ACCEPT /ERROR ROUTINE /GET ASCII FOR "7" /PRINT QUESTION MARK /DISREGARD ILLEGAL ENTRY DCA TAD AND TAD JMS ERROR, THE CARRIAGE /INITIALIZE THE /BUFFER POINTER /INITIALIZE A COUNTER /TO COUNT /0UTPUT ELEMENTS TAD BUFF DCA BUFFPT TAD AMOUNT CIA DCA PRNTCT HOLD HOLD MASK? K260 TYPE DIGCTR MORE . ' ENDZ. Figure 6-17 Output Coding for Sample Program 6-20 *166 V TYPE,‘ ‘8 IJMP TLS CLA JMP 0 CRLF, 0—1 I TYPE TAD K215 JMS TYPE TAD K212 JMS'TYPE ', JMP - I CRLF 9 LISN, I - ' KSF . - ‘JMP KRB .-l TLS JMP END Q I LISN- BUFF, BUFFPT, 7774 M4, DIGCTR, O TEMP1,.N.+2 TEMP, @;O;0;0;@ MDOLAR, 7334' -10 MIC, K40@@,r AOOO O HOLD, —zsa_ M260, AMOUNT, O O FLAG, O TALLY, O .x1, O x2, PRNTCT, O 7 MASK7, ‘ . K260, -K212, K215, .QUEST, $ /TYPE SUBROUTINE /PRINTER FLAG RAISED YET? /NO: CHECK AGAIN /YES: PRINT A CHARACTER /CLEAR ACCUMULATOR‘ /AND'RETURN ICARRIAGE RETURN/LINE FEED /GET ASCII CARRIAGE RETURN /PRINT IT ‘/GET ASCII LINE FEED /PRINT IT /AND RETURN /LISN SUBROUTINE /KEYBOARD FLAG RAISED YET? /N0: CHECK AGAIN /YES:.READ A CHARACTER /ECHO ON PRINTER /AND RETURN /FIRST BUFFER LOCATION IBUFFER POINTER /DIGII COUNT /DIGIT COUNTER. /TEMP STORAGE POINTER /TENP DIGIT STORAGE /TwO'S COMP OF 244 /OCTAL -1O /OCTAL AOOO /PACK ROUTINE STORAGE .‘ /ASCII CONVERSION FACTOR /DATA ENTRY COUNTER /SIGNALS DATA SWITCH /COUNTS DATA COMPARASONS /0RDER_ROUTINE /POINTERS /COUNT OUTPUT ELEMENTS /ASCII CONVERSION MASK' /ASCII DIGIT OFFSET /ASCII LINE FEED /ASCII CARRIAGE RETURN /ASCII QUESTION MARK . TSF 26G 212 215 ,277 _ ’ , ' ' _ , Figure' 6-18 Subroutines and Constants for Sample Program 6-21 ' PROGRAM INTERRUPT FACILITY The running time of programs using input and output routines is primarily made up of the time spent waiting for an I/O device to accept or transmit information. Specifically; this time is spent in loops such as: TSF / SKIP ON FLAG J MP .—1 Waiting loops waste a large amount of computer time. ~In those cases where the computer can be doing something else while wait— ing, these loops may be removed and useful routines included to use the waiting time. This sharing of a computer between two tasks is often accomplished through the program interrupt facility, which is standard on all PDP—8 series computers. Theprogram interrupt facility allows certain external conditions to interrupt the com: puter program. It is used to speed the processing of I/O devices or 'to allow certain alarms to halt program execution and initiate another routine. ’ Every device which is able to request a program interrupt contains a special one-bit register called the interrupt request flag. This register normally contains a 0, but it is set to 1 whenever the device requires servicing. When the interrupt facility is enabled and any device flags an interrupt request, the computer automatically disables its interrupt system and executes a hardware JMS 0. This causes the contents of the program counter to be stored in core memory location 0000 and the instruction in location 0001 to be executed. Location 0001 usually contains an effective 1 MP SERVE, where SERVE is the entry address of an interrupt service routine. The interrupt service . routine calls I/O device service routines to correct the condition which caused the interrupt, then re—enables the interrupt system - and executes a J MP I 0 instruction to resume program execution. Table 6-3 lists the eight IOT instructions used to program the ‘ PDP-8/E for program interrupt operation. . If an interrupt occurs while another interrupt is being serviced, the return address stored in location 0000 will be lost. This is pre- vented by leaving the interrupt system disabled while the interrupt 6-22 . ‘ Table 6-3 Program Interrupt-IOTVInstr-uctions I Mnemonic Octal- Operation SKON 6000 Skip 'the next instruction if the interrupt system is on and turn the interrupt system CE. I / p ‘ICHQ 6001 Execute the next instruction, and then turn the interrupt system on. IOF 6002 Turn the SRQ 6003 Skip GTF 6004 Get flags. The link is loaded into accumulator bit position 0. Accumulator bit 2 is set to a 1 if any device. is requesting an interrupt. Accumulator'bit 4 is set to a lifthe interrupt system off. ' the next instruction if one or devices are requesting an interrupt. more . ' interrupt system is enabled.3 ' RTF 6005 Restore verse flags. This instruction is the con- of the GTF instruction. Execution of RTE instruction is deferred until after the next JMP or JMS instruction is exean cuted. If accumulator bit 4 contains a 1, this instruction enables the interrupt sys-V tem.3 ‘ ‘ _ SGT 6006 CAF 60073‘ 3 The the next instruction if the Greater Than Flag is set. This instruction is implemented only if the KE8-E Extended Arthmetic Element is installed. Skip Clear all flags. This instruction is the logical equivalent of operating the CLEAR switch on the programmer’s console. It should not be used while any I/O device is active. ' ' GTF and RTF instructions perform other operations on the remain- ing accumulator bit positions if the KE8-E Extended Arithmetic Element and/or KM8-E Extended Memory Control Computer Handbook for further information. 6—23 are ' installed. See the Small ‘ service routine is servicing an I/O device. The interrupt system may then be re—enabled by an ION instruction immediately before the J MP I 0 which terminates the interrupt service routine, or by an J I RTF instruction anywhere in the service routine. Execution of the ION instruction will be deferred until the following instruction has been executed, and execution of the RTF instruction will be deferred until the next J MP or J MS instruction has been executed. In this manner, an interrupt service routine protects the contents of location 0000 by executing with the interrupt system disabled and using deferred ION or RTF instructions to re—enable the in' terrupt system as soon as mainline execution has resumed.Use of the interrupt system allows a mainline routine, referred to as the background program, to execute without wasting a large amount of time in waiting loops while I/O devices are assembling and transmitting information. The interrupt service routine, called foreground program, is entered automatically whenever an I/O device requires servicing under program control. a Programming an Interrupt The program presented in Figure 6-19 consists of a background routine which rotates one bit through the accumulator endlessly, and a foreground program, initiated by the interrupt service routine, which accepts and stores ASCII characters from the Teletype. Upon receipt of the ASCII code for a period, the foreground program prints out the characters which have been stored. The coding begins with an initialization routine which allocates buffer space to store the incoming characters and sets the mode for input. The program signals input mode by a value of MODE =0 and output mode by a value of MODE-=1. Once the initialization routine has enabled the interrupt facility, the background program is started. The background program is a routine to rotate one bit through , the accumulator and link. The first instruction clears all bits ex- cept bit 11. The program then counts through the two 152 loops, after which it-rotates the bit one place left and then returns to the count loops. With the console indicator select switch set to AC, displays will exhibit a rapidly rotating light while waiting for an interrupt to initiate the foreground the accumulator and link program. 6-24 ' An interrupt request will cause the following operations automatically: computer to perform the 1. The interrupt system is disabled. 2. The content of the program 3. ory location 0000 The JMP I 2 instruction in location 0001 is executed. Loca- _ counter is stored at core mem— tion 0002 contains the entry address of the interrupt service routine. The interrupt service routine then performs the following op— erations: 1. The contents of the accumulator and link are stored. 2. The source of the interrupt is determined. 3. A JMP to either the keyboard input routine or the printer output routine is executed. The keyboard input routine is entered from the interrupt service routine whenever the keyboard flag is set. The flag is cleared to prevent further interruptions when the interrupt system is reenabled. If the mode is set for output, program control returns to the background program. Otherwise,‘ the routine accepts a char— _ (KRB), acknowledges receipt by printing the character on the printer (TLS), and stores it in the buffer. No .KSF, J MP .-1 acter loop-is necessary. The routine then checks for the ASCII code for period, returning to the background program if the character was not a period. Upon receipt of a period, the routine resets the buffer and sets the mode for output. Program-control then returns to the background program. Since a TLS instruction was executed previously, another interrupt will be requested as soon as the printer becomes available, and the stored ASCII codes will be typed out by the printer output routine. a The printer output routine is entered from the interrupt service routine whenever the printer flag is set. This routine clears the device flag and checks for output mode, then prints one character from the buffer. No TSF, JMP .-1 loop is necessary. If the character is not ' ” period, control returns to the background program while the printer finishes typing the character. If the character is a period, the routine resets the bulfer, sets the mode for input, and then returns to the background program. a 6-25 ' The keyboard and printer service routines return control to the background program Via the exit routin‘e. This routine restores the content of the accumulator, which was previously saved by the interrupt‘service routine, then re-enables the interrupt system by means of an RTF instruction, which also restores the link. The RIF instruction does not take effect until after the IMP I 0 instruction, which terminates the exit routine, has been executed. This allows background program execution to resume before another interrupt can occur. The constants used by the various ' routines conclude the listing. cg: SET MODE FDR mpur :3.“ + e RESTORE A: AND L CLEAR LPRINTER RESERVE BUFFER SPACE FOR CHARACTERS l TURN mTERRUFT ON WTERRUPT 0" i RETURN TO BACKGROU'D AN l READ THE CHARACTER TYPE ONE CHARACTER & FROM BUFFER ROTATE an ENDLESSLY “mum AcchLAToR TYPE THE CHARACTER i STORE ASCII CODE EN INTERRUPT BUFFER SAVE Ac RESET BUFFER AND L POINTER e 15 IT A PERIOD ENTER KEYWORD SERVICE ROUTINE CHANGE HOW ? ' (KB) TO INPUT YES RESET BUFFER POINTE R Figure 6-19A- Interrupt Facility Program Flowchart 6—26 *2 IFIRST INSTRUCTION /AFTER AN INTERRUPT: EISTORE RETURN ADDRESS flJUMP TO SERVICE ROUTINE IPOINTER TO SERVICE ROUTINE /INITIALIZATION ROUTINE: . 0‘ \ JMP I 2 SERVE *EOE START, ICLEAR ACCUMULATOR AND LINK, ISET MODE FOR INPUT /INITIALIZE DATA IBUFFER POINTER ITURN INTERRUPT 0N /BACKGROUND PROGRAM: ISET ACCUMULATOR BIT ll CLL MODE TAD K1777 DCA BUFFER CLA DCA ION ROTATE,'CLA' CLL IAC ISZ COUNT JMP ISZ JMP RAL JMP ROTATE+1 /COUNT /TWICE L SERVE, DCA AC GTF DCA FLAGS KSF SKP JMP KB TSF SKPJMP TP CAP JMP . Ex1T_ KB, KCC TAD SZA JMP ISZ KRB TLS MODE CLA ' EXIT BUFFER DCA I BUFFERTAD I BUFFER TAD MPER' SZA CLA 'JMP EXIT TAD K1777 DCA BUFFER CLA‘ CMA DCA MODE JMP EXIT Figure 6-19B /THROUGH IDELAY LOOP /ROTATE BIT LEFT /RETURN TO DELAY LOOP ISERVICE ROUTINE: /SAVE ACCUMULATOR /SAVE INTERRUPT‘ /FLAGS AND LINK IKEYBOARD FLAG RAISED? '/N0: CHECK PRINTER lYES; SERVICE KEYBOARD /PRINTER INTERRUPT? INO: SKIP FOR EXIT /YES: SERVICE PRINTER /CLEAR ALL FLAGS /AND RETURN /KEYBOARD INPUT ROUTINE: /CLEAR KEYBOARD FLAG /CURRENTLY IN IINPUT MODE? /NO: RETURN TO BACKGROUND /YES: INCREMENT POINTER /READ THE CHARACTER /ECHO 0N PRINTER /STORE THE CHARACTER /WAS THE /CHARACTER A /PERIOD? /NO: RETURN TO BACKGROUND /YES: RESET BUFFER >/POINTER T0 TYPE ITHE CHARACTERS /SET MODE FOR OUTPUT AND /RETURN TO BACKGROUND - Interrupt Facility Program Coding 6—27 TCF TAD MODE SNA CLA JNP Exrr IP, _ ISZ BUFFER IAD I BUFFER TLS TAD MPER SZA OLA JMPvEXIT DOA MODE TAD K1777 DOA BUFFER JNP EXIT EXIT, , TAD FLAGS RIF OLA TAD Ac /PRINTER OUTPUT ROUTINE: ICLEAR PRINTER FLAG /CURRENTLY IN /0UTPUT MODE? JNOA RETURN TO BACKGROUND /YES: INCREMENT POINTER /GET CHARACTER FROM BUFFER /PRINT IT /WAS THE CHARACTER /A PERIOD? /NO: RETURN TO BACKGROUND /YES: SET MODE FOR INPUT /RESET BUFFER '/POINTER AND /RETURN TO-BACKGROUND /EXIT ROUTINE: /GET FLAGS AND LINK /RESTORE FLAGS AND LINK /CLEAR ACCUMULATOR IRESTORE‘ACCUMULATOR I /RETURN TO BACKGROUND ./DELAY LOOP COUNTER [MODE szIOR ILAST LOO BEFORE BUFFER /DAIA BUFFER POINTER /SAVE ACCUMULATOR /SAVE FLAGS AND LINK INEGATIVE OF ASCII CODE Figure 6-19B (cont) Interrupt Facility Program Coding JMP O O COUNT, MODE, 1777 x1777, O BUFFER, G AC, O FLAGS, ~25s MPER, 5 , 'Multiple Device Intefrupt Programming Many programming applications use the interrupt system to service Several devices. For example, a PDP—S/E may use the interrupt facility to control the operation of DECtape and DEC— disk systems through a Teletype console. Systems of this type require a service routine that, determines the source of an interrupt request (i. e., which device flag is set). Thefollowing instruction sequence uses dummy skip instructions to determine which device requested an interrupt 6-28 _ /SKIP ON DEVICE A FLAG DASF SKP IMP SERVA DBSF SKP JMP SERVB , ' . / DEVICE A REQUESTED THE INTERRUPT / SKIP ON DEVICE B FLAG ' ' / DEVICE B DNSF' REQUESTED. THE INTERRUPT / SKIP ON DEVICE N FLAG ' ' SKP IMP SERVN - / DEVICE N REQUESTED THE INTERRUPT The dummy instructions (DASF, DBSF, etc.) are skip-on—flag' instructions for each of the devices in the interrupt system. Because of the predominance of SKP instructions, the instruction sequence which determines the sourceof an interrupt request is often called a skip chain. A skip chain may be enlarged to test for almost any number of device flags, provided that high-speed devices which retain information for a relatively short period of time are tested near the top of the skip chain, so that the chain may be traversed and the high—speed devices serviced before the information is lost. High— speed. devices should never be required to wait for service while a long skip chain is traversed. If several high—speed devices are tested at the topof the chain, it may still be necessary to check the timing constraints to ensure that the last high-speed device to ' be tested will be serviced before any loss of information can occur. If two interrupts occur simultaneously, the high-speed device will ‘be serviced first because it will be tested first in the skip chain. The low-speed device may be serviced later in either of I two ways: 1. By terminating the high-speed device service routine in the usual manner, in which case the low—speed device will request another interrupt as soon as the interrupt system has been re-enabled and resumed.“ 2. background program execution - By terminating the high-speed, device service routine with a jump back into the skip chain, without re—enabling the interrupt .system. In this case, the skip chain must terminate 6—29 ' .— ' with an ION, J MP I 0 instruction sequence to return con— trol to the background program if no further interrupt re— ‘ quests are pending. ~ A Software Priority Interrupt System The techniques described in the previous section may be used to guarantee that a high-speed device will be serviced before a interrupts occur simultaneously. How— ever, information will still be lost if the high-speed device requires slower device when two servicing and requests an interrupt while the low-speed device is being serviced, because the interrupt system is disabled during ‘ this time. An interrupt service routine may be written in such a way that priority of device interrupts is established through software. This may become necessary in a system that includes high—speed devices which retain information for a short time and require im~ mediate attention. For example, a PDP-S/E system employing Teletype and DECtape I/O may use a software priority interrupt system which permits the Teletype service routines to be inter— rupted whenever DECtape requests servicing. This is accom— plished by modifying the keyboard and printer service routines to permit the following sequence of operations: a o 1. Begin the keyboard and printer service routines by storing the contents of location 0000, the accumulator, the link and 2. any other important registers in temporary storage locations. Execute an ION instruction, 5-” Clear the low-speed device flag. The ION instruction will _ not take effect until this instruction has been executed. 4. 5. Service the device. At this point, the service routine may be interrupted without danger of the background program. return address being lost. Terminate the service routine by restoring the contents of the accumulator, the link and any other registers which were .. stored in step 1, then executing a J‘MP I TEMP, where TEMP is the location in which the return address from location 0000 was stored. A low—speed device service routine written in this manner operates with the interrupt system enabled most of the time. The 6—30 "routine may be interrupted by an interrupt request from a higher priority. device, and the second interrupt will not cause the con— tents of location 0000 (or any other important registers) to be lost. In the example cited above, the DECtape and DECdisk service routines would not ”re-enable the interrupt system until they are ready to return control to the background program. However, the “ I Teletype routines re-enable the interrupt system almost. immedi— ately. If DECtape or DECdisk interrupts one of the Teletype ser— vice routines, the Teletype service routine is treatedlike a back— ground program;.that is, execution of the Teletype service routine is suspended until the high—speed device has been serviced. Control then reverts back to the Teletype service routine, and finally back to the mainline program. -. ' . , _ Multiple Interrupt Demonstration Program Figure 6-20- presents a demonstration program designed to use the program interrupt facility. This program rotates a bit through the accumulator, with the speed and direction [of rotation determined by switch register settings.~ Simultaneously," the pregram accepts 4—digit, positive octal numbers from theTeletype, automatically terminating each .4-digit number with "a carriage return and line feed'.‘ Upon receipt of a typed dollar sign (iii), the program sorts the data into ascending numerical order and prints the or— dered numbers on the Teletype. This example illustrates the power of interrupt programming because the computer appears to be performing two tasks at the same time. The programmer knows that this is impossible, and that the two tasks are actually sharing computer time; however, the appearance indicates simultaneous action. When an interrupt request occurs, the current value of the PC is stored in location 0000 of page 0, while locations 000] and 0002 contain an indirect jump to the interrupt service routine. The program constants which are stored on, page 0 beginning at location 0050 include four software switches that record conditions within the program. The contents of location MODE indicates whether the program is currently performing input or output func- tions. Location SW1 indicates whether the next digit to be received ' 6—31 ‘ ' ' *3 /PAGE ZERO /INTERRUPT [HANDLER /PACE ZERO CONSTANTS: /INPUI=0 0UTPUT=-l “fl*52 MODE, "*‘sw1,1 Euswa, (sws, ' = ‘ Ac, ‘“FLAGS,' PRINTR, KEYBRD, ORDPTR, EXITPT, BUFF, BUFFPT, DICCTR, ,TEMPI, TEMP, _ O OLD # = l LFz-l DATAzl /MODE BYPASS szTCH /SAVE ACCUMULATOR ISAVE INTERRUPT FLAGS /POINTER To TP ROUTINE /POINTER TO KB ROUTINE /POINTER TO ORDER ROUTINE /POINTER T gEXIT ROUTINE IFIRST BUF ER LOCATION /BUFFER POINTER /-4 OCTAL /DIGIT COUNTER /TEMP STORAGE POINTER /TEMP DIGIT STORAGE INEU # /CR=@ MDOLAR, 'MIB, HOLD, LHOLDL, M266, AMOUNT, FLAG, TALLY, x1, ‘x2, PRNTCT, K7, 260 xzsg,, 212 x212, 215' Eats, 277 QUEST, 4360 K4096, . Figure 6-20A OCTAL OCTAL IPACX ROUTINE STORAGE ISAVE LINK /—26O OCTAL /DATA COUNTER /ORDER ROUTINE FLAG /ORDER ROUTINE COUNTER /ORDER ROUTINE POINTER /ORDER ROUTINE POINTER /OUTPUT ROUTINE COUNTER /Asc11 CONSTANTS: /ASCII CONVERSION FACTOR /ASCII LINE FEED /ASCII CARRIAGE RETURN JASCII'QUESTION MARK /4DOD OCTAL /-244 x-IO Multiple Interrupt Demonstratipn Program ,4 ($32 TAD x215 CR, - aTLS _ ACCUMULATOR CLA £MA DOA SW2 ;A»H; JMP I EXIIPI TAD K212i LF,-» swstT, . ‘TLS CLA TAD sws SNA CLA JMP swstT DCA sws DCA swz JMP I EXITPT CLA CLL IAc DCA swz JMP I EXITPT Figure 6-20B IGET ASCII CARRIAGE RETURN IPRINT IT /LOAD -1 INTO /SET swa FOR LINE FEED =/ENTER EXIT ROUTINE IGET ASCII LINE FEEO /PRINT IT /CLEAR ACCUMULATOR /UEI MODE BYPASS szTCR ISEI FOR BYPASS MODE? /No: SET swz AND RETURN /YES: TURN OFF MODE BYPASS ISEI swa FOR CARRIAGE RETURN /ENTER EXIT ROUTINE -/LOAD 1 INTO ACCUMULATOR. /SET swz FOR DATA lENTER EXI T ROUTINE . . ~ : Multiple Interrupt Demonstration Program is the first digit of a new namber, to be packed into a new storage location, or the neXt digit of a continuing number, to be packed and stored with previous digits. Location SW2 indicates whether a carriage return or line feed-should be printed to delimit input ele— ments, and location SW3 regulates the printing of carriage returns, line feeds and question marks while the program is in input mode. A question mark is printed whenever a non—octal digit or nonpositive octal numberis received. Other constants include location AC, in which the content of the. accumulator issaved, during an interrupt, and location FLAGS, in which the interrupt flags and the link are stored. Location BUFF "contains the address of the first data buffer location, ’which .is the core location " following the. last program instruction. Thus, the data buffer is all of memory following the end of the program. The 5-word-block beginning at location-TEMP is used to store 6—33 *ZOO START, 10F OLA DCA DCA DCA DOA TAD ROTATE, BECIN, GO, INSTR, CLL MODE SW1 SW2 SW5 BUFF — DCA BUFFPT DCA AMOUNT ION OLA CLL CML DCA SAVEAC RAL DOA SAUEL TAD K7006 OSR DCA COUNT OSR RAL SZL CLA JMS LEFT JMS RIGHT CLL TAD SAVEL RAR TAD SAVEAC HLT ISZ COUNTR INSTR+1 ISZ COUNT JMP INSTR+l JMP BEGIN JMP SA VEAC, SAVEL, KTOOO, COUNTR, /COUNTERS COUNT, LEFT, ISZ LEFT TAD KRAL DCA INSTR RIGHT, KRAR,‘ KRAL, /INTERRUPT SYSTEM OFF V/DURING INITIALIZATION /CLEAR ACCUMULATOR AND LINK /SET INPUT MODE /SET SW! FOR NEW ENTRY /SET SW2 FOR CARRIAGE RETURN /SET MODE BYPASS /GET FIRST BUFFER LOCATION r/INITIALIZE BUFFER POINTER /AND ELEMENT COUNTER IENABLE INTERRUPTS /SET THE LINK /CLEAR ACCUMULATOR STORAGE /ROIATE LINK BIT LEFT /SAVE LINK BIT IGET OR MASK /READ’SWITCH REGISTER /INITIALIzE DELAY COUNTER /READ SR BIT ZERO /ROTATE INTO LINK /wAS BIT ZERO SET? {YES: ROTATE LEFT INO: ROTATE RIGHT ICLEAR THE LINK /GET THE STORED LINK /AND RESTORE IT /GET STORED ACCUMULATOR /OVERwRITTEN BY RAL OR RAR /INCREMENT COUNTER /UNTIL IT OVERFLONS IINCREMENT COUNT /UNTIL IT OVERFLOWS /LOOP BACK AND REPEAT /STORAGE FOR ACCUMULATOR ISTORAGE FOR LINK /SETS BITS 1-5 /ROTATE ROUTINE JMP I LEFT fl TAD KRAR DCA INSTR JMP I RIGHT RAR RAL Figure 6-200 /INSERT RAL INSTRUCTION /INCRENENT RETURN ADDRESS /CET RAL INSTRUCTION /wRITE OVER RLT /AND RETURN /INSERT RAR INSTRUCTION /GET RAR INSTRUCTION waITE OVER RLT /AND RETURN [RAR INSTRUCTION /RAL INSTRUCTION Multiple Interrupt DemonsuafioniProgram 6-34 SERVE, , /SAME ACCUMULATOR _DCA AC 'GTF DCA FLAGS’ IGET'FLAGS ISAVE FLAGS AND LINK /PRINTER FLAG RAISED? /NO: CHECK KEYBOARD IYES: SERVICE PRINTER /KEYBOARD FLAG RAISED? /NO: CLEAR ALL FLAGS /YES: SERVICE KEYBOARD IAND RESUME /BACKGROUND EXECUTION /0RDER ROUTINE /GET NUMBER OF ENTRIES TSF SKP JMP KSF SKP 1 PRINTR I KEYBRD CAF JMP I EXITPT’ CLA CLL TAD AMOUNT CIA IAc DOA TALLY DOA FLAG TAD BUFF DCA XI TAD BUFF IAC JMP ORDER, IEST,"" REVERs, ‘ '/SET TALLY TO ITERATIONS /THRU ORDER LOOP /CLEAR FLAG ON EACH PASS IGET FIRST BUFFER ADDRESS /INITIALIZE X1 POINTER /FORM SECOND /COUNT [BUFFER CLA INCPTR, . CLL CMA DOA FLAG ISZ x1 152 182 JMP TAD SZA X2 TALLY TEST FLAG CLA JMP ORDER CLA CMA DCA’ MODE TAD BUFF DCA BUFFPT DCA SW1 TAD AMOUNT CIA DCA PRNTCT TLS JMP I EXITPT _ Figure 6-20D ADDRESS /INITIALIZE X2 POINTER /GET X2 POINTER ENTRY IFORM TNO'S COMPLEMENT /ADD X1 POINTER ENTRY /IS ACCUMULATOR POSITIVE? DCA X2 TAD 1 x2_ CIA TAD I x1 SPA SNA CLA JMP INCPTR TAD I x1_ DCA HOLD TAD I x2 DCA 1 x1 TAD HOLD DCA I-Xz ' /NO: INCREMENT,POINTERS /YES: SWITCH THE ENTRIES /HOLD X1 ENTRY /GET X2 ENTRY /STORE AT XI LOCATION IGET X1 ENTRY /STORE AT X2 LOCATION /LOAD *1 INTO FLAG TO /SHOW SWITCH WAS MADE ~/INCREMENT X1 POINTER /INCREMENT X2 POINTER /COMPARED ALL ENTRIES? /NO: LOOP BACK /YES: WAS SWITCH MADE /ON LAST PASS? /YES{ CONTINUE ORDERING /N0: FORM -1 AND /SET MODE FOR OUTPUT /GET FIRST'BUFFER ADDRESS /INITIALIZE BUFFER POINTER ISET SW1 FOR NEW NUMBER /GET NUMBER OF ENTRIES IFORM TWO'S COMPLEMENT /INITIALIZE COUNTER /RAISE PRINTER FLAG IRESUME BACKGROUND Multiple Interrupt Demonstration Program 6—35 . I successive digits of a 4-digit number. Location TEMP serves as a pointer to the following four locations, and the content of location TEMPl is used to reset location TEMP for the first digit of a new number. Page 0 also contains three Subroutines which print carriage returns and line feeds, when indicated by the value of SW2, and then reset SW2 to continue data I /0. The program coding begins with an initialiation routine at loca- tion 0200; This routine initializes the software switches and resets the data buffer pointer and counter, then enables the interrupt facility. At this point the background program is entered. The ROTATE routine sets accumulator bit 11, then checks *400 {KEYBOARD SERVICE ROUTINE KCC KB, TAD MODE CNTDIG, ’ CHECK, SZA CLA JMP EXIT TAD SW1 SZA CLA JMP CNTDIG TAD M4 DCA DIGCTR TAD TEMP! DCA TEMP KRS DCA I TEMP TAD I TEMP TLS TAD MDOLAR SNA CLA JMP I ORDPTR TAD I TEMP TAD M260 SPA JMP TAD SPA ERROR, ERROR MID JMP LEGAL CLA TAC DCA SW5 DCA SW1 TLS 'JMP EXIT Figure 6-20E /CLEAR KEYBOARD FLAG /CURRENTLY IN /INPUT MODE? /NO: RESUME BACKGROUND. /YES: EXPECTING CONTINUED INUMBER 0R NEW NUMBER? ICONTINUED NUMBER INEW ENTRY ' IINITIALIZE DIGIT COUNTER IAND TEMPORARY IDIGIT STORAGE /READ A CHARACTER /STORE IT /GET THE CHARACTER IECHO ON PRINTER ’ ITS CHARACTER A /DOLLAR SIGN (3)7 IYES: BEGIN ORDER ROUTINE INO: GET THE CHARACTER /SUBTRACT 260 /IS CHARACTER < 26%? /YES: TAKE ERROR BRANCH /NO: ADD TO /IS CHARACTER > 267? /N0: MUST BE LEGAL /YES: FORM 1 AND /SET SW3 FOR BYPASS /RESET SW1 /RAISE PRINTER FLAG /RESUME BACKGROUND‘ Multiple Interrupt Demonstration Program 6-36 switch register bit 0 and rotates the accumulator'right, if bit 0 is off, or left, is bit 0 is on. The appropriate instruction (RAL or RAR) is written into location INSTR, which is arbitrarily assigned an initial content" of 7402 (HLT). After determining the direction of rotation, the ROTATEroutine loads the value of switch register bits 1-11 into a counter and uses this value to‘control the speed - Increasing the value specified by switch register bits 1-11 decreases the speed of rotation. of rotation. LEGAL, . PACK, DIGPAK, CLA DCA ISZ ISZ amp TAD TEMP DIGCTR EXIT TEMPl DCA TEMP DCA HOLD TAD M4 DCA DIGCTR TAD HOLD RAL CLL. RTL NOTNEG, DISALO, /FORM -1 IN ACCUMULATOR /SET SWl /INCREMENT STORAGE POINTER /INCREMENT DIGIT COUNTER CMA SW1 . TAD I TEMP TAD 'MBSB DCA HOLD ISZ TEMP ISZ DIGCTR JMP DIGPAK' TAD HOLD DCA I BUFFPT TAD ‘I BUFFPT TAD KADDD SPA CLA JMP NOTNEG IAC JMP DISALO ISZ BUFFPT 132 AMOUNT CLA CMA DCA SW5 DCA SW1 TLS JMP EXIT_ Figure 6-20F "/RESUME BACKGROUND /INITIALIZE TEMP /STORAGE POINTER /CLEAR STORAGE LOCATION /INITIALIZE THE /DIGTT COUNTER /ADD STORED LOCATION /ROTATE LEFT /THREE TIMES /ADD IN A DIGIT /SUBTRACT THE 260 /STORE PARTIAL NUMBER /INCREMENT DIGIT POINTER /PACKED 4 DIGITS YET? /NO: PACK ANOTHER /YES: GET PACKED NUMBER /STORE IN BUFFER /GET STORED NUMBER /ADD 408% OCTAL IIS NUMBER NEGATIVE? /NO: KEEP ZERO ACCUMULATOR /YES: FORM 1 IN ACCUMULATOR /TAKE ERROR BRANCH /INCREMENT_POINTER /AND COUNTER /FORM '1 IN ACCUMULATOR /SET MODE BYPASS /RESET SW1 /RAISE PRINTER FLAG /RESUME BACKGROUND Multiple Interrupt Demonstration PrOgram 6-37 s The interrupt service routine, which begins in location SERVE, is simply a skip chain that directs control to the appropriate device service routine- If an interrupt occurs when none of the devices tested in the skip chain requested an interrupt, the routine clears all flags and resumes background execution. The ORDER routine is initiated whenever receipt of a dollar sign indicates that input is complete. This routine uses techniques introduced in Chapter 3 to sort the input data into ascending order. The device service routines and the interrupt system exit routine conclude the program listing. TC TP, . SNA JMP TAD SPA JMP TAD TLS CLA DCA MODCHK, RETLF, DATA, V TAD SW5 JMP TAD SNA JMP TAD SNA JMP TAD SPA JMP TAD SZA JMP TAD DCA CLA - MODCHK SW3 CLA RETLF QUEST CMA SW3 , EXIT MODE CLA EXIT SW2 CLA CR SWZCLA LF , , . . SW1 CLA DIGTYP ' M4 DIGCTR DCA HOLD DCA HOLDL TAD I BUFFPT Figure6-20G /CLEAR PRINTER FLAG /SW5 SET FOR /MODE BYPASS? INO: CHECK CURRENT MODE /IS SW3 SET FOR /A QUESTION MARK? /NO: RETURN CARRIAGE /YES: GET QUESTION MARK /PRINT IT /SET SW3 FOR ICR AND LF, THEN /RESUME BACKGROUND ICURRENTLY IN /INPUT OR OUTPUT MODE? /INPUT: IGNORE REQUEST /OUTPUT: BEGIN OUTPUT /PRINT A ICARRIAGE RETURN 0N /FIRST PASS, AND /LINE FEED /ON SECOND PASS /PRINT DATA ON THIRD PASS /NEU NUMBER? /NO: TYPE ANOTHER DIGIT IYES: GET DIGIT COUNT /RESET DIGIT COUNTER /CLEAR TEMPORARY /STORAGE LOCATIONS /GET NEXT NUMBER TO PRINT ' Multiple Interrupt Demonstration Program ’ 6—38 TAD HOLDL CLL RAL _DIGTYP5 ' V , -TAD' HOLD RAL RTL DCA HOLD RAR DCA HOLDL TAD HOLD AND TAD TLS CLA DCA ISZ .JMP CLA DCA DCA 152 152 amp CLA DCA DCA CMA DCA TAD DCA DCA JMP CLA TAD RIF RESTRI, EXIT, CLA TAD JMP K266 CMA SW1 DIGCTR EXIT SW1 SW2 BUFFPT PRNICT EXIT CLL MODE swz /GET‘LINK AND i/RESTORE IT /ROTATE /STORED VALUE /LEFT ‘ ITHREEZTIMES /SAVE BIT THAT WAS IROTATED INTO LINK /GET ROTATED NUMBER /MASK OFF FIRST 9 BITS /CONVERT TO ASCII /AND PRINT A DIGIT /FORM 11 IN ACCUMULATOR /SET SW1 TO CONTINUE NUMBER /PRINTED 4 DIGITS YET? /NO: RESUME BACKGROUND /YES: SET SW1 TO ISIGNAL A NEW NUMBER /SET SU2.FOR CARRIAGE RETURN /INCREMENT BUFFER POINTER /AND ELEMENT COUNTER /RESUME BACKGROUND ICLEAR ACCUMULATOR AND LINK /SET MODE FOR INPUT '/SET SW2 FOR CARRIAGE RETURN /SET SW3 FOR /INPUT MODE BYPAS IGET FIRST BUFFER LOCATION /RESET BUFFER POINTER 1 - sws BUFF BUFFPT AMOUNT EXIT CLL FLAGS IAND ELEMENT COUNTER /RESUME BACKGROUND /CLEAR ACCUMULATOR AND ‘/GET INTERRUPT FLAGS LINK IRESTORE FLAGS I O /CLEAR ACCUMULATOR /RESTORE ACCUMULATOR IRESUME BACKGROUND ENDz. . Figure '6-20H Multiple Interrupt Demonstration Program - 6-39 DATA BREAK transfers of data, including program interrupt transfers, pass through the accumulator. This requires that the content of the accumulator be saved before the transfer is per- Programmed formed, and later restored. This type of transfer is often too slow for uSe with extremely fast peripheral devices. Devices which op- high speed, or which require very rapid response from the computer, use the data break facility. The data break permits an external device to insert or extract core memory words directly, bypassing all program control. Because a computer proerate at very cognizance of transfers made in this manner, it is necessary to check for the presence of transferred data prior to using it. The data break is particularly well-suited to I/O devices gram has no ‘ that transfer large amounts of data in block form, such as random access disk files, high-speed magnetic tape systems, or high-speed ' drum memories. Accessing Data Before a peripheral storage device may accept data from the computer, it must find the off-line location at which the data is to be stored. In the same manner, a peripheral device cannot send input data into the computer until it has found the location at which the data is presently stored. The process of finding a stored data‘ word, or the location at which a data word is to be stored, is called accessing data. The time required for this process is the device access time. It is important to realize that even very fast peripheral storage devices have an access time of many machine cycles, so that many instructions could be executed in the time required for the peripheral device to access one data word. Single-Cycle Data Break . of two types: single-cycle and 3-cycle. In a data break, the I/O device contains two registers Data breaks , are single—cycle which specify the core memory location with which the next data word is to be transferred (current address, or CA, register) and the negative of the number of words that remain to be transferred (word count, or WC, register)pIOT instructions initiate the transfer by setting the WC and CA registers. Other IOT instructions indicate the direction of transfer and cause the device to perform 6—40 any “preliminary operations which may be necessary to accessthe desired data. At‘ this point, prOgram execution continues and the device assumes full control of the data transfer. Figure 6—21 provides a diagram of the single-cycle data break. After performing the necessary preliminary operations, the I/O device accesses the first data word and signals a data break request. This causes the central processor to suspend operation by disabling its major state generator and instruction register, while loading its memory address register with the contents of the de— vice CA register. The device then generates a-signal which either 'I . LOAD WC REGISTER ACCESS DATA LOAD CA REGISTER V [EXECUTE REQUEST DATA BREAK IOT'S TO AXCESS DATA I LOAD CA NTO CPMA ONE MACHINE CYCLE STOLEN H'TO PERFORM THESE ’ OPERATIONS LOAD DATA INTO MB REGISTER ACCEPT DATA FROM MB REGISTERS I” I NCREMENT WC BICA REGISTERS ,( CONTINUE ) RAISE DEVICE FLAG Figure 6-21 Single-Cycle Data Break 6-41 loads the memory buffer register with data or accepts data from this register, depending upon the direction of data transfer. When this operation is complete, the device increments its WC and CA registers and returns control to the central processor, which con- ' ‘ tinues mainline execution. Meanwhile, the I/O device begins to access the next data word to be transferred. This process continues until the device WC register overflows (contains 0000), indicating that no further data transfers are required. Cycle Stealing The process by which cycle is “stolen” from the central processor in order to transfer data directly to or from core mem— ory is called a cycle-steal operation. Each single-cycle data break causes the WC and CA registers to be incremented and transfers ’ one one word of data to or from core memory. The 1/0 device re- quests a data break whenever it is ready to transfer a word, and performs all transfers during cycles stolen from the central processor. Program execution continues between data breaks, while the I/O device is accessing the next data word. 3-Cycle Data Break Devices which operate by means of a 3-cycle data break do not contain a WC register or a CA register. Instead, the addresses of two core memory locations are hard-wired into the device, and these core locations are used in place of the WC and CA registers. When a 3-cyc1e data break is requested, the first cycle is used to fetch the content of the core location designated as the WC register into the device, increment it, test for WC overflow, and re- register is incremented in the same manner during the second cycle, and loaded into the memory address register. The actual data transfer occurs during the third cycle. In contrast to devices which use the single-cycle data break, 3-cyc1e devices increment the CA register before performing the actual data transfer. For this reason, the CA register of a 3—cycle device must always be loaded with one less than the address of the first data buffer location. The WC register of a 3-cyc1e device turn it to core memory. The CA I . is loaded with the two’s complement of the number of words to be transferred, just as with a single-cycle device. 6-42 the only other major difler— ence between single-cycle and 3-cycle data breaks is that a singlecycle device contains its own 'WC and CA registers, which are loaded by means of IOT instructions. A 3-cycle device uses two core memory locations as its WC and CA registers, so that the registers must be loaded by means of memory reference instrucFrom a programming viewpoint, , ' tions. EXERCISES 1. Write a subroutine ALARM which rings the teleprinter bell five times. 2. ' ~ Write a format subroutine for the teleprinter to tab space the teleprinter. carriage. The subroutine is entered with the number of spaces to be tabbed in the accumulator. 3. i 4. Write a program that'will type a heading at the top of the paper and then type the numbers 1 through 10 down the left hand side of the page with a- period after each number. Write a program which will accept a 2-digit octal number from the Teletype keyboard and type “SQUAREDz” and the value for the number squared, followed by “OCTAL” and a carriage return and line feed. .5. Extend the program written in [Exercise 4 by adding routines to disallow the input of an 8 or-9 and type out an appropriate message. 6. Combine the program of Exercise 5 with a bit—rotating pro- gram to use the program interrupt facility. 6-43 ' dectdpe * Pr091'ammlng INTRODUCTION The DECtape system is a standard option for PDP- 8 series computers that serves as an auxiliary magnetic tape data storage facility. DECtape provides a distinct advantage over conventional magnetic tape because it stores information at fixed positions which may be directly addressed, much like conventional magnetic disk or drum devices. Yet unlike magnetic disk or drum devices, DECtape is bidirectional and adaptable to a Wide variety of user data formats. In this manner, DECtape combines the versatility of magnetic disk and drum storage with the convenience and econ- omy of magnetic tape. DATA BLOCKS ‘ DECtape is organized into a series of addressable blocks. Each block consists of control words, used to identify the A reel of . block, and data words, used for data storage. The data words con— tain twelve bits each; however, every control word contains eighteen bits. Blocks are usually numbered in sequence, from O to N—l, where N is the (octal) number of blocks on the tape. The maximum number of addressable blocks per tape is 212, or 4096. Every block contains ten control words. A block may contain any number of data words, with the restriction that the number of data words contained in each block must be an even multiple of‘ three. If the number of b10cks on'a tape is known, the number of data words per block may be found by the following formula: where NW 2 Decimal number of words 212080 NB Z + 2 per block. . . . N“'+15 NR = Decimal number of blocks per tape. Disregard any fractional remainder. 7—1 , DATA CHANNELS DECtape is divided longitudinally into five pairs of identical channels which run the entire length of the tape. Duplicating each channel helps to minimize‘ any loss of information. The timing the tape. The mark—track channels establish the format of information contained channels are used to reference fixed locations on in the data channels. The three pairs of data channels are arranged way that no two identical channels are adjacent. The arrangement of channels on the tape is shown in Figure 7-1. in such a 3/4 INCH MAGNETIC TAPE \ \ 0 ”43‘ \ \ Figure 7-1 4r ). $404” "$2 I 2%‘3- DECtape Data Channels STANDARD DECTAPES Figure 7-2 indicates that a standard, 260 foot reel of DECtape contains 2702;; (or 147410) standard blocks and two end zones. The figure also shows an enlarged diagram of one standard block, which contains 2013 (or 129m) twelve-bit data words and 10 A; eighteen-bit control words. Note that only the top half of the tape is shown. The five redundant channels have been omitted for clarity. ' ' 7-2 , L ' A ' ONE COMPLETE REEL-260 FT. -I474 STANDARD aI.CCKs . ONE STANDARD BLOCK-129 DATA WORDS AND 10 CONTROL w0RDs TIMINGTRACK ‘E‘L .' IIT F’T'I I - . I I WIII-II'TIIIIIIIIIIII I I I II II I II I II I II. I. IIIIIIIII-III-I-IIII ‘ INFORMATION TRACKS . 2 3 ' ‘ 'IB-BIT .5 DATA . . cCNTROI. wDRDs wonos 12912 DATA _ Iv—DNE DATA WORD LOCATDNS WORD-4 LINES 0F Dan‘s _ EACH-.1 TIMING TRACK MARK TRACK 1 DATA CHANNEL I , 2 I l—ILINE—cl . Figure 7—2 StandIRTd DECtapC Format lB-BII' DATA ’ CONTROL w0RDs - woRDs A further enlargement shows the. structure of one data word. again, the redundant channels have been omitted. If one 12-bit binary number is written into this data word in the forward direction, the twelve bits will be stored sequentially in the numOnce ‘ bered locations shown. DECtapes having more or less than 1291" data words per block may be prepared to theuser’s specifications. As Nonstandard with standard blocks, the number of data words per block must ‘ be an even multiple of three. DECTAPE CONTROL UNIT A DECtape system consists of up to eight single DECtape Transport Units (TU55) or four dual DECtape Transport Units (TU56), all operated by one TC08 DECtape Control Unit. Data is transferred between the computer and the DECtape Control Unit by means of the 3-cyc1e data break facility, described in Chapter 6. Transfers occur at a rate of one 12-bit word every 133 microseconds (”i 30%). The DECtape Control Unit uses core memory location. 7754 in field zero as its word count register and core memory location 7755 in field zero as its current address ’ ‘ register. . TC08 DECtape comm! Unit Core Address Register 7754 7755 Word Count (WC) Current Address (CA) DECTAPE STATUS REGISTERS The DECtape Control Unit contains two 12-bit registers, des— ignated Status Register A and Staus Register B, which may be by IOT instructions. These registers consist of various switches and indicators, as shown in Figure 7-3 and Figure 7—4. loaded and read * 7-4 ‘ BITPOSITION_:,O DEOTAoE - I 2 3 LLJ 4'5 7 6 11 1__JL - TRANSPORTJ TO BE USED DIRECTION O =FORWARD I =REVERSE MOTION O=STOP I =60 MODE O =NORMAL 1 =cONTINuous ’FUNCTION . DOO=De =MOVE DOI=18 =SEARCH DIO=28 =READ DATA ‘ 011=38 =READ ALL I DO=43 =WRITE DATA 101:53 =WRITE ALL 1 IO=68 =WRITE TIMING AND MARK TRACKS 111:78 =UNUSED INTERRUPT CONTROL 0= DISABLE DECTAPE FROM CAUSING INTERRUPTS 1= ENABLE DECTAPE TO CAUSE INTERRUPTS- ERROR F'LAe CONTROL G= CLEAR ALL ERROR FLAGS 1 =LEAVE ERROR FLAGS UNDISTURBED . DEC TAPE FLAG CONTROL O = CLEAR DECTAPE FLAG =LEAVE DECTAPE FLAG UNDISTURBED Figure 7—3 Status Register A, 'IO D12345673 ERROR FLAG—f MARK TRACK ERROR END-OF-TAPE SELECT ERROR PARITY ERROR TIMING ERROR MEMORY FIELD UNUSED I DEC TAPE FLAG (DTF') Figure 7—4 Status Register B ‘75 I Status Register B Bits 0-5 of Status Register B provide six indicators which flag error conditions zeros, , that may occur. These indicators normally contain indicating the absence of an error condition. The possible errors, their abbreviations and causes are listed in Table 7-1. Note that parity and mark-track errors are hardware malfunctions, while timing and select errors are generally caused by the software. Bits 6-8 of Status Register B specify the memory field from or to which data should be transferred. Bits 9 and 10 are not used. Bit 11 is called the DECtape» Flag (D-TF). In general, a value of 0 in this bit at any given time indicates that a DECtape operation - is in progress. A value of 1 indicates that the current operation has been completed. Status Register A Status Register A designates which DECtape transport is to be (bits 0-2), in which direction it should operate (bit 3) and whether operation should be commenced or discontinued (bit 4). Bit 5 of Status Register A specifies the transfer mode, which may be either normal or continuous. In normal mode, data trans- used fer continues until the end of a block is reached or a predetermined number of words has been transferred, whichever occurs first. In continuous mode data transfer continues, across block boundaries if necessary, until WC overflow occurs, indicating that the required number of words has been transferred. Bits 6-8 of Status Register A designate the function to be per— formed. The seven possible functions are summarized in Table 7—2. The first four functions, MOVE, SEARCH, READ DATA and WRITE DATA, are used exclusively for most applications. The remaining three bits of Status Register A indicate whether or not the interrupt system is to be wusedjj(b,it 59,), whether error flags in States Register B are to be cleared (bit 10) and whether the DECtape Flag is to be cleared (bit 11). ' 7-6 ‘ Table 7-1 TC08 Error Codes Bit Posi- tion - Designation 0 A value of Tim this bit indicates: " Error Flag Detection of one or more of the follow- ing errors. 1 Mark-Track Error Erroneous information the mark track. 2 End-of—Tape Error The end zone on either end of the tape read from was is over the recording heads. ' Select Error 3 This error is 5 flagged microseconds after loading Status Register A to indicate one or more of the. following conditions: a. The unit select code is not assigned to any transport or is assigned to more than one transport. b. A write function was specified with _ the WRITE ENABLE/WRITE LOCK switch in the WRITE LOCK position. c. An unused function code was speci- fied (111 in bits 6—8 of Status Regis‘ ter A). ‘ d. A write timing and mark track func,. - tion was specified with the WRTM/ NORMAL switch in the NORMAL position. 4 Parity Error . Checksum Wasincorrect during a read data function, or else WC overflow did not occur at the end of the first block read in continuous mode. This flag is only set simultaneously with the DTF. ' 5 Timing Error A program fault caused one of the folI lowing conditions: a. _ A data break could not occur within 66 microseconds i30% of the data break request. b. The DTF was not cleared before the _ control unit attempted to set it. c. A read data write data function after the current block specified had been entered, preventing comor was plete data transfer. 7—7 Table 7-2 DECtape Functions Possible Function Errors Description mm MOVE Initiates motion of the (000) tape drive in the specified direc— tion. Errors are inhibited, except Select specified End—of-Tape for end of tape errors. Used only rewindltape. DTF, WC and CA are never changed. to SEARCH (001) As the tape is moving in either direction, the sensing of a block Select data transfer of the block number. The CA is not 'Timing mark causes End-of—Tape a Mark—Track incremented. Normal mode: Continuous DTF is set after mode: WC is each block number iS' incremented after each block number is transferred. DTF is set transferred. . when WC over- flow occurs. m READ DATA . (004) data Normal mode: DTF is set at the end of each Continuous block or when WC overflow overflow T‘— 4i 2% into memory. Only data words are transferred. Transfers (002) WRITE DATA 4: mode: DTF is = Select End—of-Tape Timing Parity Mark-Track set when WC occurs. occurs. Transfers data onto tape. When WC overflow occurs in the middie of a block, the block is filled out with zeros. Modes of opera- Select End-of-Tape Timing Mark-Track ' the same as for READ DATA function. tion are 7-8 the Table 7-2 [(Cont’gd) ' Possible Function Errors Description m r READ ALL Transfers data into memory. The Select ( 003) entire content of the information End-of—Tape Timing tracks is transferred. including Mark—Track control words.1 Normal mode: DTF is set after each data word is transferred. Continuous mode: DTF is set When WC overflow occurs, ==fi=i (005) r WRITE Select _ End-of-Tape Timing Mark—Track Used Select by DECtape formatting routines to write timing and _- establish of the blocks.1 length change AND MARK TRACKS : Transfers data onto tape regardless of the data- format. Only mark-track and end of tape errors are checked. Used to write block numbers on tape. Modes of operation are the same as for the READ ALL function}. WRITE ALL TIMING if A mark-tracks, and . to - Timing or ’ (0.06) DECTAPE IOT , INSTRUCTIONS The six basic IOT instructions used to program the PDP— 8 for DECtape operation are listedin Table 7- 3.. A11 instruction to load Status Register A is, in effect, an instruction to begin the operation specified by the bit configuration loaded. Once begun, the operation continues to execute until the DTF flags completion, andthe tape remains in motion until a 1 is loaded into bit 3 of Status Register A. 1 These functions are normally used only by DECtape formatting routines and diagnostics. 7—9 The memory field bits (positions 6-8) of Status Register B are loaded by means of a DTLB instruction. The remaining bits in Status Register B are loaded by specifying proper values for bits 10 and 11 of Status Register A. Note that Status Register A is loaded by exclusive ORing the contents of accumulator bits 0—9 into the register. Accumulator bits 10 and 11. are sampled directly, without the exclusive OR operation, and used to set the Status Register B flags. Table 7-3 DECtape IOT Instructions Octal ' Mnemonic Code Operation DTRA (Read Status 6761 The contents of Status Register A bits 0-9 Register A) are ORed with the contents of accumulator bits 0-9, and the resultris placed in accumulator bits 0-9. DTCA (Clear Status 6762 Register A) ; DTXA (Load Status ~ 6764 V Register A) ' Register A is cleared. Register B is undisturbed. Status Status Bits 0—9 in the accumulator are EX— CLUSIVE ORed with bits 0—9 of Status Register A and the result is loaded into bits 0-9 of Status Register A. Bits l0 and H in the accumulator the flags are cleared if bit l0 is a 0. The DECtape flag is cleared it bit H is a 0. The are sampled, and error accumulator is cleared. DTSF on 677i (Skip Flags) If either the error flag or the DECtape flag is set the program counter is in— cremented to skip the next sequential instruction. DTRB (Read Status 6772 Register B) " The content of Status Register B is ORed with the content of the accumu- " later and the result is placed in the accumulator. DTLB (Load Status ~Register B) 6774 Bits 6-8 of the accUmulator are loaded into bit positions 6-8 of Status Register B. The accumulator is cleared. Error flags and DECtape flag are un- disturbed. 7-l0 PROGRAMMED DECTAPE OPERATION , using the TC08 DECtape system for data storage, a reel of DECtape must be prerecorded to insert the timing track, mark-track and block numbers. This function is performed in two passes by a DECtape formatting program utilizing the WRTM control operation. SuCCe‘ssful execution requires that the manual switch on the DECtape Control Unit be placed in the WRTM position during the first-pass. After one prerecording, a reel of DEC— tape may be used indefinitely. Prior to Tape I/O operations are usually performed by a DECtape service routine, which uses the six DECtape IOTs to clear, read and load the status registers. Since the actual data transfer occurs, by means of the 3—cycle- data break, service routines often begin by using memory reference, instructions'to set the word count and current address registers. By loading an appropriate bit configuration into Status Register A, the SEARCH function is then initiated to locate the block number selected for transfer. While searching, the DECtape control reads only block num- bers. In normal mode the DTF is raised at every block number and the block number is transferred into the address specified by the CA register, which is not incremented during SEARCH. The contents of this location may be monitored until the desired block _ number is transferred, at which time a READ DATA operation must'be instituted promptly (within 400 microseconds i30%) by reloading Status Register A.', ‘ - During the READ DATA operation,- the DECtape service routine monitors Status Register B constantly by means of a DTSF (skip on flags) loop “to check for error conditions and determine when the DTFflags completion of data transfer. Meanwhile, data transfer continues without program control until the data block is exhausted or WC overflow occurs. Either of these eventswill raise the DTF (in normal mode), at which time the. service routine may . again lOad Status Register A, forcing a 0 into bit 4 to terminate the operation. With the interrupt facility enabled, the DECtape service routine described abOVe may be designed to execute as a foreground program, and mainline operations in the background program may be performed while the DECtape system is accessing data. 7—11 operations summarized above may be broken down as The follows: A with the negative 1. Use an MRI to .load the WC register (two’s complement) of the number of words to be trans‘ ferred. 2. Use an MRI to load the CA register with one less than the core address with which the first transfer is to be made. Successive transfers will be made with successive core lo‘ cations. 3. Use a DTLB instruction to load Status Register B bits 6-8 with the desired memory field designation. 4. Begin to search for the desired block number by using a DTXA instruction to ”load Status Register A with an ap— propriate bit configuration. This should also clear all flags. 5. Remain in as a skip-on—flag loop and test each block number it is transferred until the desired block number has been transferred. 6. Reload Status Register A to clear all flags and begin READ ' DATA function. 7. Remain in skip-on-flag loop until the DTF flags completion. 8. Load a 1 into bit position 4 of Status the tape. Register A to halt ‘ procedure summarized above is neither complete nor efficient, although it does illustrate the sequence of operations gen— erally employed. Step 5 is ineflicient because it may be necessary to search the entire length of a tape before the desired block number is transferred. Steps 5 and 7 are incomplete because they do The conditions, and any error condition will cause the program to skip out of the waiting loop before the current not test for error operation is finished. Finally, this procedure makes no provision for reversing the direction of tape motion, which may become necessary if either end zone is reached or if the desired block is initially accessed in the wrong direction. Techniques for dealing with all of these conditions will be developed in the following sections. 7—12 ‘ USE OF THE DECTAPE FLAG The DECtape flag may be tested to determine the status (in operation. progress, or finished) the flag is set when WC overflow occurs. If WC overflow has not of the current In normal mode, i occurred and the flag is set: During SEARCH function: 1. A block mark has just been read and transferred to the address contained in the CA register. The CA register was not incremented, and the tape is still moving.’ During READ DATA function: Afull block of data has 2. just been transferred to core memory Via data break. The control unit is still in READ DATA mode and the tape is moving. The CA register contains the address of the next sequential core location following the last one read into. The nextdata block will be read into core beginning at this location. 3.! During WRITE DATA function: A block of data has just been written on tape from core memory Via data break. The control unit is still in WRITE DATA mode, and the tape is moving. The CA register contains the address of the next sequential core location following the last one transferred. The contents of. core beginning at this location will be writ— ' - ten into the next block on the tape. In continuous mode, the . DECtape flag is set only when WC overflow Occurs, regardless of the functiOn being performed.2 This usually indicates that the current operation is complete and that execution should now be terminated under program COntrol. Note that the tape. does not stop moving automatically when the DTF flags completion of the current operation; however, any error con— dition except a parity error will cause the tape to stop. 2 If transfer has continued across one or more block boundaries, the Parity Error Flag is also set as soon as WC overflow occurs. 7—13 SELECTING DIRECTION Data is normally read in the direction in which it was written; If data is read in the wrong direction, the data buffer will be filled in reverse order, with what was originally the first data word being _ placed in the last buffer position, and so on._ Furthermore, since the DECtape system breaks every word into four 3-bit increments which it stores sequentially, each data word will be returned with its bit positions changed as shown below: 0| 1|2|3|4|5|6|7|8|9|10|11 RETURNEDBITPOSITIONS:9|10|n|6|7|813|4|5I0] 1|2 ORIGINALBITPOSITIONS: Finally, reading a data word in the wrong direction causes the word to be returned with every bit complemented. Thus, an octal 1234 written in the direction would be read reverse as 3456 in the forward direction. REVERSING DIRECTION _ The DECtape transport requires at least one full standard block to reverse direction and cycle back up to reading speed. Most programmers allow two full blocks .to assure successful turn around. If block number 105 is to be read when block 200 is positioned under the recording heads, for example, it is necessary. to search in the reverse direction for block 102. The tape may be turned around just inside block 102, and it will cycle up to read- ing speed before reaching block 105. In general, to read block N forward, search in reverse for block N-3‘. The standard DECtape format provides sufficient space be— tween the end data blocks and the end of the tape to perform a turn around in the end zone and successfully access either block 0 in the forward direction or block 2701 in reverse. Some bootstrap loaders take advantage of this by performing a MOVE reverse until the end zone is reached, and then a READ forward to load a routine stored in block 0. 7-14 ACCESSING DATA BLOCKS - The most e'flicient method 'for accessing data blocks is sum—_ marized. below: ' ' ' 1 I 1. SEARCH forward in normal mode until the first block number is transferred into core at the location the CA register. 2. specified by flags completion of this transfer, test the block number to determine how many blocks must be bypassed and in which direction. Allow two extra blocks if a turn around is. required. Load the WC register'with the number of blocks which must be bypassed, then SEARCH in continuous mode until the DTF flags WC overflow. Turnaround, if necessary. When the DTF . . 3. 4. The next block encountered will be the desired block. ALLOCATING STORAGE AREAS Any process. whichattempts to access single DECtape blocks sequentially will be ineflicient, because it? may be necessary to turn around twice to access each block. This problem develops whenever large amounts of code or slow I/O operations must be accessing adjacent blocks of DECtape. Under these circumstances, the block being accessed may overshoot the recording heads before the intermediate operation is Complete. Stopping the tape to allow full execution of the intermediate process; is‘not a solution, because the tape requires two blocks to cycle up to reading speed, so that it will still overshoot the block being accessed. An efficient way of solving this problem is to break up data files and programs into large segments spanning many blocks, executed between I I and then alternate a recorded segment with a blank segment on the tape. While a blank segment is passing under the recording heads, it is possible to perform an intermediate process and com- plete it in time to access the first block of the next recorded segBlank segments: may be recorded in a similar manner in the reverse direction. The DECtape Copy program uses this type ment. '14 block segments separated by 14 block intervalsflt is very eflicient at reading and copying DECtapes. of operation to access 7—15 - PROGRAMMING FOR ERROR CONDITIONS generally desirable for every DECtape service routine to provide an extensive method for handling error conditions. This might include: It is " Ni-i' 3. Requesting operator intervention after a select error. Counting changes in tape direction to guard against tape rocking loops, which can occur when the desired block is nonexistent or when the tape mechanism is malfunctioning. Attempting to wade block a second time following a parity error. 4. Informing the user when a nonrecoverable error condition exists. PROGRAMMING FOR INT ERRUPTS The ‘ DECtape control unit contains a 1—bit register called the DECtape Control Flag (DTCF, not to be confused with the DECtape fiag) which always contains the inclusive OR of the Error Flag and the DECtape flag. It is this register which is actually sampled by the DTSF skip-on-flag instruction. If the interrupt facility is enabled (ION instruction) a 1 in bit position 9 of Status Register A causes an interrupt to occur when— ever an error condition or an operation—complete condition (or both) is flagged by the DTCF. This makes it unnecessary for the DECtape service routine to monitor Status Register B during every operation bymeans of skip—on-flag waiting loops. The time spent in waiting loops may be used to execute mainline instructions, provided that these instructions do not attempt to use data before the DECtape service routine has had time to transfer it. Because the DECtape system is comparatively fast, an interrupt service routine will. normally test the DTCF~near the top of the skip chain. This creates a problem when the DECtape system is not in use. An interrupt from a lower priority device will eventually occur, in which case any bit configuration in Status Register A will be interpreted as a SCICCt error when the DTCF is tested, and the program may loop indefinitely. Such problems may be pre— test with a NOP when— vented by replacing the DTSF skip—onever DECtape15 not in use. flag 7—16 IDTAPE SUBROUTINE3 IDTAPE subroutine illustrates one method of programming for DECtape operation. IDTAPE operates with the interrupt facility disabled. It performs data transfers in continuous mode, so that multiple blocks of data may be transferred in a single operation. Searching may commence in either direction, to minimize The access ' time. One full block is allowed for turn around when search- ing in the reverse direction. IDTAPE reads and writes in the forward direction only . IDTAPE must be stored in field zero, but it will read or write data into any specified memory field. It will not automatically field boundaries. Errors flagged while searching cause cross I 1 IDTAPE remain in the SEARCH loop indefinitely. If the specified block number is nonexistent, it hangs up in a tape rocking loop. Errors flagged during data transfer cause the branch IDSERR to be taken with tape motion halted and Status Register 3 error flags set. to The IDTAPE sequence is: calling JMS to IDTAPE, ie., indirect 0000 JMS (IDTAPE) Effective JMS if IDTAPE is not page on same calling sequence Bits 0—2, unit number as 0001 WORD l, Bit 3, start search (0: forward l=reverse).Bits 6—8, memory field for transfer. Bit 10, error return (0: JMP WORD 5' l'zJMP I WORD 5). Bit 11, function .(OzREAD l:WRITE). 0002 0003 Block number for start of' transfer. WORD 2, WORD 3, Two’s complement of the number of words to transfer. _ 0004 0005 WORD 4, WORD 5, Memory address minus 1 of first transfer. ‘ Error return or address for error return (to correspond to Bit 10 of WORD l). 0006 RETURN, Transfer completed; cleared. return with AC On exit, the DECtape drive will halt. 3 This subroutine is not currently available from the DEC Software Distribution Center, and is included here for the user’s convenience. 7—17 ' . *ZOO /AN ORIGIN OF OZOO IS USED FOR TESTING /HOWEVER THIS SUBROUTINE MAY OCCUPY THE FIRST /113 (OCTAL) LOCATIONS OF ANY PAGE IN FIELD /LOCATIONS 7754 AND 7755 ARE ALSO USED /AND MASK MUST BE ID7400, ZERO F 74GB /FIRST CLA TAD DCA ISZ TAD IDD2OO, AND I IUIAP’E IDCODE IDTAPE IDCODE ID74OD TAD IDOOIO DTCA DTXA DTLB TAD IDWC DCA I IDCA IDSERR, RTL RAL CLA CML TAD IDOZDO . SNL TAD IDCONT, IDO4OO DTXA SPA JMP IDSERR DTRA RTL RTL SZL CLA TAD IDOOOZ TAD I IDNC CMA TAD I IDTAPE CMA SZA CLA JMP IDCONT SZL JMP IDCONT+I ISZ IDTAPE TAD I IDTAPE DCA I IDWC ISZ TAD IDTAPE I IDTAPE I IDCA DCA IN PAGE /CLEAR ACCUMULATOR /GET WORD 1 /STORE IT /ADVANCE POINTER TO WORD 2 /GET NORD ! /MASK OFF BITS 4-11 /PUT INTO SEARCH MODE /CLEAR AND LOAD STATUS A /LOAD STATUS B FOR FIELD O /GET-ADDR OF NO REGISTER /INITIALIzE CA FOR SEARCH /THEN FALL THRU ERROR /ROUTINE TO START TAPE /NORMALLY ENTERED NITH /STATUS B IN ACCUMULATOR /MOVE END ZONE FLAG /INTO LINK /COMPLEMENT LINK /MASK STOP/GO BIT ON AND /ENTER DECTAPE SEARCH LOOP /TAPE IN END ZONE? /YES: REVERSE DIRECTION /NO: BEGIN SEARCH /MONITOR FLAGS UNTIL /A FLAG IS RAISED /ERROR FLAG RAISED? /YES: TAKE ERROR BRANCH /NO: MUST BE DTF, SO GET /DIRECTION BIT AND IROTATE IT INTO THE LINK /MOVING FORWARD? /NO: GET "BLOCK TO FIND" '2 /YES: GET LAST BLOCK SEEN /FORM ONE'S COMPLEMENT /ADD IN BLOCK TO FIND /TWO'S COMP MIGHT SET LINK lBLOCK NUMBERS MATCH? 1N0: REENTER SEARCH LOOP /YES: MOVING FORWARD? /NO: TURN AROUND /ADVANCE POINTER TO wORD 5 /GET wORD s /LOAD wC REGISTER /ADVANCE POINTER /GET wORD 4 /LOAD CA REGISTER . DTSF DTRB JMP .-l ’ NORD /ENTER’SUBROUTINE D IDTAPE, ’ 7—18 TAD IDCODE /GET WORD l /LOAD STATUS B FIELD BITS ./SET BIT 11 FOR /READ 0R WRITE THEN - , DTLB IAC‘ AND IDCODE ~ RTL CLL ".RTL : /ROTATE INTO POSITION AND /BUILD XOR MASK TO /LOAD STATUS REGISTER A /BEGIN READ/WRITE ~/MONITOR STATUS B UNTIL /A FLAG IS RAISED /ADVANCE T0 WORD 5 ‘~/IS ERROR FLAG SET?. /NO: ADVANCE TO WORD 6 /YES: KEEP ERROR RETURN /GET INDIRECT RETURN BIT /ROTATE INTO LINK /INDIRECT RETURN? /NO: MAKE NORMAL-RETURN /YES: CHANGE INDIRECT RETURN /TO DIRECT RETURN /GET STATUS REGISTER A /MASK STOP/GO BIT OFF‘ /PRESERVE ERROR FLAGS ./LOAD STATUS A TO STOP TAPE /RETURN /POINTER TO WC REGISTER /POINTER TO CA REGISTER v/SETS BIT 8 FOR SEARCH /SETS BIT 4 TO-REVERSE TAPE /BUILDS XOR MASK ' TAD IDOISO DTXA DTSF DTRB .JMP 1-]. ISZ IDTAPE; SMA ISZ IDTAPE SPA CLA TAD IDCODE RTR SNL CLA JMP .‘+3 TAD '1 IDTAPE DCA IDTAPE DTRA AND IDOZOO TAD IDOODZ DTXA ‘IJMP I IDTAPE 7754 7755 Ich, IDCA, IDDZIO,1O 109400, 4am ID013B,150 IDOO02,_2 iDCODE, O _ - ~- ' A/HANDY CONSTANT /STORAGE FOR WORD l DECTAPE SYSTEM SOFTWARE DECtape Software, described in the following-sections, provides the programmer with fOur major operational materials: _ 1. Input/output subroutines which may be included in larger programs. 2. AROutines for copying and formatting DECtapes. These pro‘- grams will duplicate non-standard tapes, write timing and mark-track channels, insert block format information and perform similar chores for the programmer. _3.1 A 4. library system for storing and retrieving programs on DECtape. 08/8, which provides the most eflicient means of using both DECtape and disk storage. 7—119 ' DECTAPAE SUBROUTINES DECtape subroutines allow the programmer to read, write" and using prewritten and tested subroutines which execute with the interrtipt facility enabled, so that mainline instructions may be performed during tape operations. The DEC library supplies these subroutines on one ASCII symbolic tape which has no origin, and ends with the pseudo-op PAUSE. It must be assembled with a user program, and the resulting binary tape loaded with the Binary Loader. The following restrictions should search, DECtapes be observed: 1. The routines are designed to be used with standard tapes (129 words per block). The last data word in each block is not accessed, so that each block is effectively one core page long. The routines will read jor'write in the forward direction only. . Data may be transferred from or into any memory field, but these routines will not transfer data across field bound— ' aries. storage locations. They may be located on any page of core in field 0, except The routines page 0, and they must all reside on the same page, filling require 2003 consecutive that'page completely. An ION instruction will be executed by the routines upon entry; however, the user is responsible for storing the contents of the accumulator and link when an interrupt occurs. define a register called MCOM on page 0. This register is initialized by the tape.routines and is used The user must for communication with the interrupt system. If the DTF is set on the occurrence of an interrupt, the accumulator must be cleared and the instruction JMP I MCOM must be executed to return control to, the tape routines. 7—20 DWAIT Subroutine The DWAIT subroutine tests the motion bit (bit 4) of Status Register A. If the motion bit15 a 1, the routine cycles through this test process until the motion bit is cleared, indicating that the tape stopped and the previous operation is now complete. It then has ‘ location following the JMS which called it. DWAIT13 called automatically, whenever necessary, by of the all DECtape subroutines.- returns control to the following - ‘ DWAIT Calling Sequence _ JMS-I DWAITI GOSUB, Explanation Where DWAITI contains the address of ' ' subroutine DWAIT. RETURN, - ‘ . After tape motion has stopped, DWAIT returns control to the location - following the JMS which called it” SEARCH Subroutine The SEARCH subroutine should only be used to position the tape. It is called automatically by the READ and WRITE sub— routines. In the event that the tape is moving, the SEARCH subroutine will transfer control to the DWAIT subroutine, and con- tape stops moving. If the user wishes to continue mainline execution "immediately upOn completion of the search, the completion return address in the folloWing calling tinue to execute when the sequence should be the address of the interrupt exit routine. SEARCH Calling Sequence GOSUB,~ CLA CLL TAD'BLOCK ' Explanation Where BLOCK contains the number being sought. Any other method of getting the block number into the AC is'acceptable. of the block 7-2 1 SEARCH . Calling Sequence Explanation JMS I SERCHI . Where SERCHI contains the address of routine SEARCH. SERCHI may be on, page 0 or the same page as the call0 ing sequence. CMPADD Where CMPADD is the completion return address. When the correct block has been found, control transfers to the address contained on this line with the tape stopped and the interrupt system ofi. U000 Bits 0-2 contain the DECtape trans- port unit number. The rest of the word contains zeros. For example, using unit 3 this would be 3000. IRETRN Where IRETRN is an intermediate absolute return. When searching starts, control is transferred to this line with the interrupt on to allow multiprocessing while the tape is in motion. If multiprocessing is not _desired this line should read “3MP .—-l” which causes the program to idle in a closed loop consisting of one instruction until the requested block has been found and an interrupt occurs. READ and WRITE Subroutines The READ and WRITE subroutines will transfer any number of memory pages to or from standard'blocks of DECtape, how— ever only whole pages will be transferred onto whole data blocks, calling sequence specifies the starting location, the’memoryffield, the starting block number and the tape unit number. As with the SEARCH routine, the program waits until any previous tape operation has been completed. These rou— tines use the SEARCH subroutine to find a specified block num— ‘ber, however theydo nOt stop the tape until after execution is complete. and vice versa. The user’s 7—22 _ READ/WRITE ” " ’ Calling Sequence. JMS 1 READl Explanation . ' gWhere READI contains the address of R128 and WRITEI contains the address of W128 or ‘ JMS 1 WRITEl C ORADD ’ ~ 1 _ Where CORADD is the address of the first location on the page to be used for transfer. core UOFO Where bits 0-2 contain the DECtape transport unit number and bits 6-8 contain the memory field. The remainder of the word contains zeros. (E.g.. for unit 3 and memory field 1 this would be 3010.) —NUl\/l Where —NUM is the negative (2’s complement) of the number of successive blocks to be read or ; . written. BLCK Where BLCK is the number of the first block on tape to be read or written l-RETRN an intermediate absolute re— turn. When the routines start searching for the block specified, control is transferred to this line Where IRETRN is ' multiprocessing while the tape is in moIf multiprocessing is not desired, this line to allow tion. may contain a JMS to the DWAIT.routine. DECtape Copy Program The DECtape Copy program (DTCS) p1ovides a simple, ef— ficient method for copying from one DECtape to another on PDP—8 series coreruters. Features include the capability of handling nonstandard block lengths (up to 15501., 12- bit words per data. block) and the ability to reread and verify the routine is internal and monitor independent. copied The DTCS resides in memory between locations 0000 and 1547, with the remainder of core divided into two buffers. The starting address is 0200, and the routine may be restarted at this address normally distributed as a binary tape and loaded with the Binary Loader. Alternately, it may be stored on DECtape or disk and loaded with the monitor system. Two DEC— tapes must be mounted with WRITE LOCK enabled on the input at any time. DTC8 is tape. 7-23 Teletype input is required at the conclusion of each printed message generated by DTC8. The operator may type: I. ‘ ,CTRL/C, which causes a branch to location 7600. 2. A string of octal digits (0 to 7), which will be interpreted as an octal number. Only the rightmost four digits are preserved, so that 1234567 is interpreted as 4567. 3. RETURN, which terminates the input string If no digits were typed, the input value15 zero. 4. Any other characters which are ignored and not echoed. The operator is expected to respond to the following messages printed by the program: DECTAPE COPY FROM UNIT Type the input unit number (0-7). Only the last digit typed is accepted. Terminate with acarriage return. TO UNIT ’ the output unit number, which must be different from the input unit number. Terminate with a carriage Type ' return. FINAL BLOCK TO COPY (OCTAL) Type the octal block number of the last block to be copied. If no digits are typed, the program will copy to the end of the tape. If a number is typed, it must be greater than or equal to the number of the first block to be‘copied. Terminate with a carriage return. PDP-8 WORDS PER BLOCK nnn The program types the octal number of 12-bit words in each block. No‘ operator response is required. VERIFY OUTPUT? (OZYES, 1,:NO): If a l is typed, the program does not reread and verify the output copy. Terminate with a carriage return. DONE Program indicated completion. Type RETURN key restart the program or CRTL/C 7600. 7—24. to to branch to location Any illegal Teletype input causes the program to restart itself. CTRL/C may be typed any time after the start of the program to cause a branch to location 7600. A ' parity error while reading from the input unit causes the message: PARITY ERROR ‘ON BLOCK nnn Copying continues, but when execution is finished the operator “may attempt to‘copy the designated block separately. A validation error is flagged when the information written is not the same as the information read in. Three consecutive , validation errors cause the This message ' message: WRITE ERRORS ON UNIT #n can occur only if validation was requested. Typing the RETURN key causes the program to attempt to reread and validate the erroneous data. . A select error on either tape driVe causes the message: SELECT ERROR ON. UNIT #n After a select error, the operator should correct the error condition and then type the RETURN to continue program ‘ _ key execution. Mounting an output tape with more than 15501.) 12—bit words per block causes the message: BLOCK LENGTH ERROR After a block length error, the program automatically restarts. DECtape Formatting Program package is available to perform formatting and maintenance operations on DECtapes. It provides for recording 0ftiming and mark-track channels and permits block formats to be recorded for any block length. Patterns may be written in these blocks, and then read out and verified. Specified areas of tape "may also ,be “rocked” for specified periods of time. In this manner, a reel of tape may be thoroughly checked before it is used for data storage. For detailed information, refer to the TCOl—TUSS DECtape Formatter (DEC-08-EUFB) available from the DEC Software .A software Distribution Center. 7-25 - DECTAPE LIBRARY SYSTEM The DECtape Library System permits the user to build a com- plete file of his active programs and continuously update it. It is capable of calling programs by name from the keyboard and allowing for expansion of programs stored on tape. It conforms to existing system conventions, in that all of core except for the last memory'page is available to the programmer, and it permits the Binary Loader to reside in core at all times. The Library System fully restores the initial state of the computer when it exits. Library System may be illustrated as follows. A program that will be run repeatedly is written in PDP—8/E FORTRAN. At the keyboard, the operator may call the FORTRAN compiler from the library tape and compile his program, obtaining an object program on paper tape. He may then call the FORTRAN operating system from the library to load and run his object program. Finally, the library program UPDATE may be called. The operator defines a new program file, consisting of his object program and the FORTRAN operating system, then adds it to the library tape. The program is now available for easy access on the library tape. The minimum library system, called a skeleton library, occupies the first 408 blocks of a standard DECtape. It contains the following routines: One use for the INDEX ‘—— Causes the names of all routines on the library tape to be printed on the Teletype. UPDATE -——- Allows the user to add routines to the library tape. ' GETSYS ’DELETE — -—- Used to "generate a new library tape.‘ Causes a specified routine to be deleted from ‘ the library tape. ESCAPE — Causes the library system to exit. 7—26 A prerecorded skeleton library tape may be obtained from the DEC Software Distribution Center. This tape should be duplicated with DTC8 (or else GETSYS should be used to generate a second skeleton library tape) and the original should then be stored in a safe place. The Directory The directoryIS part of the library system. It contains the names of files on the library tape and all information thatIS required by the library system to load, delete, or add named files. The direc- tory contains 3481., usable locations, With each entry requiring a minimum of seven locations. entry is as follows: _ The structure of a single directory File name in trimmed ASCII with characters First 3 Words: packed 2 per word. For example, INDEX would appear as: 1 1 16 0405 3000 _ /IN /DE /X - Starting DECtape block number for the file. 5 Starting core address of the file. First in a list of core specifications for the file. The format of these specificationsIS shown1n Figure 7-5. Fourth Word: Fifth Word: Sixth Word: Last Word} 0000 to terminate list of core there is specifications. If only one specification, the directory entry is seven words long. This is the mini— mum length for an entry. 0 ‘l 23456'789'1011 1 W FLAG BlTS ——J PAGE. A ‘5- PAGE 3 Figure 7-5 Format of Core Specifications 7—27 . Bit 0: ' If set to 0, the two 5-bit page-number specifica-. tions (page A and page B) designate discrete single pages which belong to the file. If set to 1, page A signifies the first page in a series of contiguous pages and page B signifies the last page in the series. For example: 0247 or 00 00101 00111 means that page 5 and page 7 belong to this file. ObserVe that the user may not save the last page of core (7600-7777) with one of his files. Bit 1: This is always set to the same value as bit 0. Five bit page number specification (Page A Bits 2-6: above). Bits 7—11: Five bit page number specification (Page B ’ above). There are spaces for almost 50]“ names in the directory. UPDATE will determine whether or not the directory is full and if so, it will print a message to this effect. There are 26408 usable blocks on the library tape, which is more than adequate in view of this limitation on the directory size. ' Using the Library System All skeleton library routines are called from the Teletype by typing the name of the routine and then a carriage return. Some Of the ' routines generate messages which request operator input. Typing a RUBOUT causes any input on the current line to be ignored and the line to be retyped. Typing INDEX and RETURN causes a list of all routines stored on the library tape to be generated on the Teletype. The UPDATE routine assumes that a file to be added to the library tape was in core before the library system Was loaded. Typing UPDATE and RETURN generates the message: NAME OF PROGRAM: The operator must type. a name consisting of one to six charac— ters,_ and then a carriage return. All characters, are legal except: 7—28 - (@,T,TAB,FORNIFEED,amlLDflEFEED.UPDATENMH now type: . . SArocrAny The operator must type the Octal starting address of the file being loaded. If the file does not have a proper starting address (as. example, the floating point package), the starting address of the system loade1 (7600) or the HLT in the BIN (7700) for 1 may be _ Loader specified UPDATE will now type: PAGELOCATIONS: The operator must specify the page locations in core memory at which the file is presently stored. This infOrmation may be pro- vided to UPDATE in either of two forms: <XXXX> which means page On which the octal address XXXX falls, or <XXXX, XXXX> which means the page on which the first ad- the single through and including the page on. which the second dress falls UPDATE accepts information of this type until a semicolon (;) is received-Spaces, tabs, carriage returns, and line _' feeds are ignored between location elements. For example, if a program occupies locations 1—2354, 4600-7577, and 2400—2577, UPDATE might'be told: <0,22’00> <2400> <4600,~7577>. The numbers must be in ascending order, and any numbers lying within the same page are considered equivalent. UPDATE will now add the new file to the library, add an entry to the directo1y, and trans— fer control to the file- loading leaving the directory in address falls. _ core. g program . Typing DELETE and RETURN generates the following mes— sage: _ NAME OF FILE TO BE DELETED The operator must type a name (up to six characters) followed by a carriage return. DELETE searches the directory for the designated name and generates an error message‘if it is not found or if it is the nameof a system program. -If the name is found, DELETE removes it from the directory, removes the named program from the tape, and repacks the tape. DELETE then transfers control to the file—loading program, leaving the directory in core. 7—29 Typing GETSYS and RETURN generates the following'message: SKELETON TAPE WILL BE CREATED ON UNIT # The operator must type a single digit (1-7) and then a carriage return. GETSYS expects a preformatted, standard DECtape to be specified tape unit, with the WRITE ENABLE / WRITE LOCK switch in the WRITE ENABLE position. When the new library system has been created, GETSYS transfers control to the file—loading program, leaving the directory in core. Typing ESCAPE and RETURN causes the library system to mounted on the restore all of core and exit. The condition ,of the computer should . be identical to. its condition before the library system was loaded. example shown below, the operator used the Binary Loader, to load the FORTRAN compiler; He then loaded the library system, and the following interaction took place: In the ' ‘ Typed by user. INDEX ESCAPE UPDATE Presently gg‘fgg stored pro- grams listed by system. PALIII _ 1 UPDATE . £23m" Zfifi’éfiflmg 1" DEX User supplies data requested by system. :<0,74%>; PAGE LOCATIONS Typed by user. Second INDEX. ‘ . ’ ESCAPE gggg Stored programs listed by system- csrsrs ‘PALIII FRTRAN * DELETE ' - NAME OF FILE To BE DELETED: PALL NAME OF FILE To BE DELETED:PALIII Typed by'user. User typed and used mistake RUBOUT a 1‘65" INDEX 533252 Third INDEX. DELETE GETSYS FRTRAN ESCAPE 7—30 _ Theamountof time required to load a file from tape- into core memory depends upon the file location on the tape. If}the file is near the beginning, loading time will be about 8 seconds. UPDATE executes, in 30 to 45 seconds. DELETE time varies too much to ' make an estimate possible; it may take as long as several minutes. GETSYS requires approximately 30 seconds. The system has one DECtape error halt at location 7670. No recovery is possible at this point, and. any attempt to restart may result in'destruction of the library tape data. TC01 Bootstrap Loader _ The library system bootstrap loader resides in the last page of core with the RIM and BIN loaders; however,— with the bootstrap in core, only the RIM loader is operable. Since this bootstrap con- sists of only a few instructions, it may be loaded from the switch register, following the procedure for toggling in the RIM loader, TC01 Bootstrap Loader Location InstruCtion 7600 6224 - 7601 '6774 1221 7602 ‘ 4213 7603 7604 .1222 7605 , _ 1223 7606 7607 3355 4213 , 0000 7610 7611 * , 7612 0000 0000 - I 7613 0000 .7614 6766 7615 3354 7616 6771 7617 5216 7620 5613 . ' 7621 0600 7622 7577 _ 7623 3 7-31 0220 ' explained in Appendix E. Check carefully to ensure that the bootstrap is loaded correctly. If it is not, the system tape may be destroyed by an attempt to load the system. For checking procedures, See Figure 4—3.. To load the library system using the bootstrap loader, ensure that the library system tape is mounted on a DECtape transport. The tape may be wound to any point along its length, but at least four turns of tape should be on either reel. 1. Set the transport unit selector dial to O (or 8). 2. Set the LOCAL/ OFF/ REMOTE rocker switch to REMOTE. 3. Set the WRITE LOCK/WRITE ENABLE rocker switch to WRITE ENABLE. 4. Set the starting address of the bootstrap (7600) into the con— sole switch register and press ADDR LOAD and CLEAR then CONT. The library system will from the DECtape load into core. When the system is loaded, the Teletype keyboard will be enabled, awaiting operator commands. TDs-E DECTAPE SUBROUTINE A TD8—E DECtape system consists of up to four TU56 dual DECtape transport units with one TD8—E DECtape control unit for each dual transport unit. This system is similar to the TC08 DECtape system in that it uses the same hardware transport unit the TC08. However, the TD8—E system relies on programmed transfer for I/O operations, rather than the and tape data format 3- cycle data such as break, and requires that status monitoring operations as error sensing and checksum generation be performed by software under program control. A TD8— E DECtape system is best employed by or utilizing OS/ 8 the TD8— E DECtape Subroutine, which is a general data han- dling routine with a standardized calling sequence that facilitates tape l/O operations and provides full compatibility with OS/8 device handlers. This subroutine requires two adjacent pages of memory, in any memory field, for each TU56 dual transport to be serviced; Thus, operation of a maximum configuration system core requires that four copies of the subroutine ( with four different sets of assembly parameters) reside in core. 7-32 Assembly Parameters ' . Values for five parameters must be supplied when the TD8- E These parameters and the permissible, values which may be supplied are listed below. subroutine is assembled. DRIVE _ _~_ — 10 -20 3O DECtape units 0 and-1 DECtape units 2 and 3 DECtape units 4 and 5 DECtape. units 6 and 7 _ .40 ORIGIN = nnnn Specify an absolute origin, which will also be the entry point for the lowest-numbered, DECtape transport unit. The entry point for the other unit will be ORIGIN + 4. AFIELD = n' Designate a field (0< AFIELD< 7) into which the subroutine will be loaded. ' ' MFIELD =n_0 Specify 10 times AFIELD. WDSBLK 2 the value designated for Indicate the _octal number of data block. words per Assume, for example, that an assembly of the subroutine to handle DECtape units 0 and 1 is to be loaded into memory field 0, pages 24 and 25, and standard DECtape format is to be used. Input to the assembler would consist of: DRIVE 2 10 ORIGIN =— 5000 AFIELD : 0 MFIELD = O WDSBLK = 201 * This would be followed by a source copy of the subroutine. If’ DECtape units 2 and 3 are to be used simultaneously, a second assembly of the subroutine may be loaded into, say, memory field 1, pages 35 and 36. Assuming that standard format is also em— ployed onthese tape drives, the assembly parameterswill be: , DRIVE = 20 ORIGIN = 7200 AFIELD = 1 MFIELD = 10. WDSBLK = 201 7-33 .In this manner, as many assemblies of the TD8-E Subroutine as necessary may be loaded into any available core locations, provided that each assembly occupies two contiguous pages. The are subroutine may be relocated temporarily during program execution, if necessary, but it may not be called at any location except the one for which it was assembled. Calling Sequence A call to the TD8—E Subroutine should have the following gen, eral format: GOSUB, CDF DATA /DESIGNATE DATA FIELD: /CURRENT FIELD ’ CIF MFIELD /FIELD IN WHICH SUBROUTINE /WAS LOADED JMS ENTRY /EITHER “ORIGIN” OR / “ORIGIN + 4” ARGl ARGZ 'ARG3 JMP ERROR /ERROR RETURN /NORMAL RETURN JMP CONT The first argument which must be format: BIT POSITION: O t I 2 _ 3 4 1=WRITE 6 5 1x L BINARYNUMBER OF BLOCKS T0 TRANSFER supplied has l MEMORY FIELD OF DATA BUFFER UNUSED D = TRANSFER VLORDS PER DECTAPE BLOCK 1 =TRANSFER WDSBLK -| WORDS PER IICTAPE BLOCK 0=SEARCH REVERSE INITIALLY 1 =SEARCH FORWARD INITIALLY :WDSBLK" 7—34 7 8 J the 9 'following 10 11 The second argument (ARGZ) contains the core memory address of the data buffer. Data will be transferred to or from sequential locations, beginning at this address. The third argument (ARG3) specifies the DECtape block number core . at- which transfer should commence. Data will be transferred to or - from sequential blocks until the number of blocks designated by bits 1-5 of the first argument (ARGl) has been transferred. -_ If no errors . are encountered, the subroutine takes the normal return to the fifth location following the JMS which called it with all tape motion stopped, the accumulator cleared and the instructiOn and .data fields equal to the value of DATA specified in the rsubroutine calling sequence.» Any error condition sensed during a data transfer operation causes the subroutine to take the error return to the fourth location following the J MS which called it. An error _ . return with the acCumulator cleared indicates a select error. Parity, timing and checksum errors return a value of 4000 in the ”accumulator, as does any attempt to access a non-existent block number. 7—35 ‘ , Floating-point package's ' , INTRODUCTION , ‘ Floating-point packages provide an easy means 0f performing basic arithmetic operations, such as addition, subtraction, multi— plication and division, using floating-point numbers, They also provide extended function capabilities for the‘ cOmputation of natural logarithms, exponential functions, basic trigonometric functions and the like. The floating—point package maintains a high degree Of precision, and greatly facilitates I/O operations in floating—-point notation. This is particularly useful for computations involving numerous arithmetic operations on variables whose magnitudes may vary widely. The floating—point package, or FPP, stores very large orve‘ry small numbers by saving only the significant digits and assigning an exponent to account for leading‘and trailing zeros. ' There are’three floating-point packages designed for use with the PDP-S/E. The 23—bit Extended Arithmetic‘Element FloatingPoint Package (EAE FPP) may be employed on. any PDP—8/E equipped with a -KE8-E Extended Arithmetic Element and an LT33 Teletype. The'EAE FPP is described in detail in this chapter. The 23-bit Floating—Point Package (non-EAE FPP) may be any PDP—8 series computer with an LT33 Teletype. This FPP is functionally equivalent to the EAE FPP in re- used on many spects; in particular, the two are fully program compatible. Impor— tant differences between the EAE FPP and the non—EAE FPP are noted throughout this chapter. 8-1 » The 27-bit . Floating-Point Package (27-bit FPP) is also designed for use on any PEP—8 series computer equipped with an .LT33 Teletype. The 27-bit FPP provides extended precision for computations that require accuracy in excess of 6 or 7 significant digits. The 27—bit FPP is program compatible with both the EAE FPP and the non—EAE FPP, and similar to these packages in most respects. Differences are noted throughout the chapter. Each floating-point package is supplied as a binary paper tape and is loaded into memory via the Binary (BIN) Loader (see vAppendix E). Since a floating—point package is actually a collec— tion of subroutines, the user must also load a program of his own- which calls the floating-point package (or one of the individual subroutines) and tells it what operations to perform. The binary tape of the user—program is normally loaded after that of the package; this is particularly important if the user is not calling part of the package (for example, the extended functions) and his hunt-lave flu-2+ nrnnram flue” “J“ VVAA u u” narf full.- ASSEMBLY INSTRUCTIONS , -- available on three source paper tapes which the user may assemble with PAL III (or the equivalent) if he intends to alter the package. The source tapes should be assembled in ascending numerical order: tape 1 first, followed by tape 2 and tape 3. Tapes 1 and 2 end with the pseudo—op PAUSE, whiletape' 3 ends with a dollar sign; Each Floating-Point Package is also ‘ » ' If the FPP is assembled with PALS, the user must define several , floating-point and PDP- 8/ E instructions which are used by the in— terpreter but not containedin the PALS symbol table. The following paper tape should be prepared and used as the first tape of the ' assembly, before tape 1 of the FPP: 8-2 non-EAE FPP (DEC-OS—NFPPA—A—PAI PA2, PA3) 27-bit FPP (DEC-OS-NFPEA—A—PAI PA2, PA3) EAE ‘FPP (DEC-SE—NEAEA-A—PAI PA2, and PA3) , FADD , , : 1000 FIXMRI 2 2000 : 3000 FIXMRI FDIV : 4000 FIXMRI FGET : 5000 FIXMRI FDIV '_ : 4000 FIXMRI FGET‘ :. 5000 FIXMRI FPUT : 6000 FIXMRI FPUT ,FIXMRI FADD FIXMRI FSUB ‘ FIXMRI FMPY - :: 1000 FIXMRI FSUB : 2000 FIXMRI FMPY : 3000 0000 FEXT : FNOR .,:'7000 FNOR : PAUSE FEXT -: SWP : 7521' CAM : 7621 : 7501 : 7421 : 6006 MQA MQL SGT = 6000 0000 7000 PAUSE ‘ Following assembly of the FPP, a user program may be assembled. The user program should begin With the following pseudo-instruction sequence, or a tape containing the following sequence terminated with a PAUSE pseudo-op should be assembled before the user program: 8-3 Assembling with PAL III Assembling with PALS FIXMRI FJMP : 0000 FIXMRI FIXMRI FJMS : 7000 FJMP : 0000 FIXMRI FADD : 1000 FISZ :0000 FIXMRI FSUB : 2000 FEXT‘ : 0000 FIXM‘RI FMPY : 3000 = 0001 FIXMRI FDIV = 4000 : 0002 FIXMRI FGET -: 5000 FSIN : 0003 FIXMRI FPUT : 6000 FCOS : 0004 FIXMRI FJMS = 7000 FATN : 0005 FEXP : FLOG : FSQU FSQR F182 : 0000 0006 FEXT : 0000 0007 FSQU : 0001 : 0010 FSQR 2 0002 : 0011 FSIN : 0003 : 0012 FCOS‘ —_— 0004 FFIX : 0013 FATN : 0005 PLOT : 0014 FEXP : 0006 : 7000 FLOG : 0007 FCDF : 7001 FNEG : 0010 sto :7002 FIN :0011 FSWI : 7003 FOUT : 0012 FHLT 2 7004 FFIX : 0013 FSMA :7110 FLOT :0014 ESZA : 7050 FNOR : 7000 : 7100 FCDF : 7001 FSNA : 7040 sto : 7002 FNOP :7010 FSWl :7003 FSKP : 7020 FHLT : 7004 FSMA : 7110 FSZA : 7050 FSPA : 7100 FSNA : 7040 FNOP : 7010 FSKP : 7020 ' FNEG FIN FOUT FNOR FSPA FLOATING POINT NOTATION 'A floating-point number may be written as a mantissa, which consists of the floating-point number with its decimal point shifted a given number of places in either direction, and an exponent, 8—4 . which indicates the number of places that the decimal point was shifted and the direction of the'shift. A negative exponent corres- ponds to a shift to the right, while a positive exponent corresponds to a shift to the left. For example, the decimal number 12. 625 may be expressed1n the following ways: Mantissa Exponent. 12.625 0 12.625 2 12.625 X 100 ' : 1.2625 X 101 : 0.12625 X 102 : 1265.0 x 10‘3 ' 1.2625 0.12625 12625.0 1 . 2 -—3 A floating—point number which has been converted to a mantissaand an. exponent may be recovered by mutiplying the mantissa by the Eth power of the radix (base) in use, where E is the exponent. ' Normalization A floating-point number may be represented in an infinite variety of ways, since the decimal point may be shifted any number of places in either direction. If the decimal point is shifted until it appears immediately to the left of the most significant digit, the number is said to be normalized. The mantissa of a normalized floating-point number may be stored as an integer, since the dec— imal point is understood to appear to the left of the most signifi— cant digit. In the discussion which follows, all floating—point num— bers are assumed .to be expressed in normalized floating-point notation, as indicated below. Normalized Floating—Point Notation ‘Decimal Number ‘ 12.625 Mantissa Exponent .12625 2 - ' ' 0.0012 —15_30'.0 0.0 .12 —.153 -—2 ( 4 ' .0 0 ——89.9 ——.899 2 —0.0899 ——.899 —1 . 8-5 ' When a floating-point number is expressed in normalized notation, thP manticga ummllv falls in the range: We”, - “M”-.. -m R‘41 S [ mantissa | < 1 where R is the radix of the number system‘used. "Thus, the abso— lute value of the mantissa of a decimal floating-point number will be greater than or equal to 1/ 10.but less than 1 if the decimal point is positioned to the left of the most significant digit, in ac— cordance with the convention presented above. The only exception to this rule is the floating-point number zero, which is defined to have a mantissa and an exponent both equal to zero. In computer applications, all numbers are manipulated and stored in binary notation. The preceding discussion applies equally 'well to decimal or binary numbers, in that a binary number may be converted to normalized floating—point notation by shifting the decimal point to the left of the most significant digit and assigning an exponent equal to the (directed) number of places that the dec- imal point was shifted. Since the left-most significant digit will always be a binary 1, the mantissa conforms to the convention: 1/2 S l mantissa l < 1 except for the special case of zero. Number Representation PDP-8 floating-point numbers are stored in three consecutive 12—bit core memory locations as follows. EAE AND NON-EAE FPP The first location, which has the lowest core address, contains the exponent. The second word contains the twelve most significant bits of the mantissa, called the high-order mantissa. The third word, which has the highest core address, contains the last twelve (least significant) bits of the mantissa, or the low—order mantissa. As with one-word integers stored in the conventional manner, if the exponent or mantissa is negative, its two’s complement is used, thus the first bit of both the exponent and the high-order mantissa may be considered as sign bits. The low—order mantissa is unsigned, however, and should be considered an extension of the high-order mantissa. - storage location of a floating—point number may be tagged with a symbolic address, as shown in Figure 8~1. In this The core ’ 8-6 ' example, the floating-point number 12.625 is stored incore location “FPNUM.” The tag FPNUM is associated with the core lo- cation at which the exponent is stored, while the mantissa occupies locations FPNUM+1 and FPNUM+2. FPMM r—SIGN BIT 0 O 0 I O 0 I 0 '0 0 1 0 l I I O I 0 EXPONENT l ' HIGH-ORDER FPNUM+10110.0I101.0 °,°.°MA~TI$3A ' FPNUM+20 Figure. 8-1 olo olo'o o LOW-ORDER 010 °.°.°MANTIS$A Storage Allocation for a 23-bit Floating-Point Number 27-BIT FPP The first word (lowest core address) contains the sign of the mantissa, the exponent in bias 2008 notation, and the higher, order 3 mantissa bits. The second two words are the middle order and low order mantissa; respectively, in sign-magnitude notation; HIGH ORDER 3 MANTISSA ans EXP O NENT + 200 8 _ 0 l a 9 n MIDDLE ORDER MANTISSA 12 23 LOW ORDER MANTISSA - Figure 8—2’ Storage Allocation for a 27-bit Floating-Point Number The sign of the number is bit 0' of the first word. The value of ' the exponent is obtained by subtracting 2003 from bits 1 8 of the first word. USING through ' THE FLOATING-POINT PACKAGE The Floating—Point Package contains subroutines which perform floating-point operations using three core memory locations—44, 45 and 46, which are collectively designated as the floating accumulator, or FAC. Some of the subroutines require a floating-point 8-7 argument. The Floating Add Subroutine, for example, must be supplied with the address of a floating-point number which is to be added to the content of the» FAC. Other floating-point subroutines do not require an argument because they operate on the FAC directly. The Floating Square Root Subroutine, for example, operates directly on the FACuy replacing the current value of the FAC with the square root of this value. It does not require an argument. Most of the floating-point subroutines may be called by a user program at any time, in precisely the same manner that user subroutines are called, subject to the restriction that the subroutine call, the FPP itself and the argument (if required) must all reside in the same memory field. In general, all FPP subroutines should be entered with the hardware accumulator cleared. FIOating Subtract Subroutine, for example, may be called by an indirect JMS toits entry address. The location following the The . subroutine call must contain the address of the floating—point argument to be subtracted from the FAC. Once this Operation has been performed, the subroutine will return control to the core location following the address of the argument (i.e. the second location following the JMS). The Floating Square Subroutine may also be called by an indirect JMS to its entry address. Since this subroutine does not require an argument, it will square the contents of the FAC and return control to the location immediately following the 1 MS which called it. When used in this manner, the FPP is being employed in single- instruction mode. In this mode of operation, every call to an FPP subroutine causes one floating—point operation to be performed on the FAC. Table 8-1 lists the floating—point subroutines which may be called in single-instruction mode, specifying which subroutines reqUire'an argument-and which don’t, along With their'abs'Ol'ute' entry addresses and a description of the operations they perform. ‘ NOTE Subroutine addresses are constant for all three flbatingpoint packages. Thus, the user may easily upgrade from NON-EAE to an EAE system if greater speed is required and from either 23- bit FPP to the 27- bit FPP a if greater accuracy is required. 8—8 " Figure 8-3 is a program which calls the 23-bit floating-point. single—instruction mode. This program calls the Floating Input Subroutine to accept a floating-point number from the Teletype, then calls” the Floating Multiply Subroutine to multiply the input by 10.0; Finally, the program stores the result of these operations and halts. subroutines in * 260 . J xcc TLS ans JMS FINP FMPYP I I .TEN JMS I FPUTP STORE HLT 6290 FINP, ,FMPYP, FPUTP, TEN, 66am. 7522 a .V 4 ' 24mg NOOO D O STORE, IINITIALIZE KEYBOARD TELEPRINTER /CALL INPUT SUBROUTINE /CALL MULTIPLY SUBROUTINE /ADDRESS OF OPERAND ICALL PUT SUBROUTINE ISTORAGE ADDRESS /HALT UPON COMPLETION /POINTER To INPUT ROUTINE /POINTER TO MULTIPLY ROUTINE /POINTER-TO PUT ROUTINE /EXPONENT /HIGR-ORDER MANTISSA /LOU-ORDER MANTISSA /5-UORD FLOATING-POINT /STORAGE LOCATION ,/AND « a . s Figure 8-3 Using the FPP in Single-Instruction Mode The same program could‘be FPP by changing the constant TEN (necessary because of the different TEN; converted for use under the 27-bit- floating-point format) to look like: 2045 0000 0606 /EXPCNENT /r-lIGH-0RDER MANTI SSA /LOW- ORDER MANTI SSA The user should note that in single-instruction mode, the hardware AC must be zero when Calling a floating—point routine. The contents of the link are not important. 8—9 - ~ Table 8-1 Floating-Point Subroutines Subroutine and Entry Address Function FLOATING ADD 7000 FLOATING SUBTRACT Add the argument to the content of the FAC and store this result in the FAC. 7 1 17 Subtract the argument from the content of the PAC and store this result in the FAC. FLOATING ‘MULTIPLY 6600 Multiply the argument by the content of the PAC and store this result in the FAC. FLOATING gDIVIDE .Divide the content of the PAC by the argument and store this result in the FAC. 6722 An error results from any attempt to di- vide by zero. FLOATING 7306 GET ‘ Load the argument into the FAC. FLOATING PUT Replace the argument with the content 7322 of the FAC. FLOATING INVERSE SUBTRACT 6400 Subtract the content of the PAC from the argument and store this result in the FAC. “ FLOATING INVERSE DIVIDE Divide the content of the PAC into the 6412 argument and stOre this result in the FAC. FLOATING NORMALIZE 7265 Normalize the content of the PAC and store this result in the FAC. FLOATING “SQUARE 75 64 and FLOATING SQUARE ROOT 645 1 store this result in the PAC. Compute the positive square root of the absolute value of the content of the FAQ and store this result in the FAC. FLOATING SINE ' ‘ Multiply the content of the FAC by itself 5000 Compute the sine of the content of the PAC (in radians) and store this result in the FAC. FLOATING COSINE 5053 Compute the cosine of the content of the FAC and store this result in the FAC. FLOATING Compute the primary arctangent of the ARCTANGENT content of the PAC and store this result 5200 in the FAC. ‘ _ 8-10 _ _ Table 8-1 (Cont) Floating-Point Subroutines Subroutine and Entry Address Function ‘ Compute the exponential function of the FLOAHHNC; EXPIONENTIAL content of the PAC and store thisresult 5135 in the FAC. FLOATING LOGA‘RITHM Compute the natural of the logarithm content of the FAC and store this result in the FAC. An error results if the con- 5263 ' tent of the FAC is negative or zero. FLOATDKENEGATE Negate the" content of the PAC and store 7135 this result in the FAC. - FLQKHNGINPU 6200 ' - ‘ FLOArnu3OUTPUT Accept a floating-point decimal number from the Teletype keyboard, convert it to a floating—point binary number, normalize and truncate if necessary, and store result in the FAC. this 5600 Convert the content of the PAC to a decimal floating-point number and print this. result on, the Teletype printer. Fix 5500, Compute the largest integer that is not larger than the content of the PAC and this result in the exponent word (10c. 44). An error occurs if this result falls outside the range -—2047 S X < 2047. store of the PAC ' FLOAT 5533 Compute the floating-point number-that is equal to the content of the exponent word of the PAC (10c. 44) and store this result-in the FAC. ' The FPP also contains an interpreter, which is a subroutine that decodes and executes floating—point pseudo-instructions. The in- terpreter may be called in the same manner as any other subroutine, however the FPP loads a pointer to the interpreter into core location 0007 of the memory field in which it resides, so that the interpreter is most conveniently called by a J MS I 7 instruction. To call the FPP from which it memory field other than the one in effective JMS to location 7400 of the a resides, use an field in which the package has been loaded. The following is an 8-11 example of a call to the floating-point package where multiple {1an fiplflc nrp invnlvprl ”up“ A HAUL) “I. V J-ll V U}. V“. N=MEMORY FIELD M=MEMORY FIELD 59? CIF JMS NE ‘ I CONTAINIVG CALL CWTAIVING FPP {HAY SE CM! TTED IF BE MAY M0 0‘11 TTED P7499 ( PSEUDO P7 409: V IFr CUR. E31": DF=N CURRENT IF=M ‘ INSTRUCTIONS) 7 409 floating data field is originally set to the hardware data field upon entry to the interpreter. This may be changed via the The _FCDF instruction which has a format similar to the normal PDP-8 CDF instruction. The floating data field is interpreted like the normal data fieldin that it applies only to “1....1 me operanu of an indirectly addressed memory reference instruction (op codes 1- 6). The interpreter essentially accepts all of the pseudo—instructions following the JMS which called it as arguments. Beginning with the first pseudo—instruction following the interpreter call, the in— terpreter decodes each pseudo—instruction as an effective JMS to the appropriate floating-point subroutine and passes the subroutine an argument, if required. When used in this manner, the FPP is being employed in interpretive mode. In the interpretive mode the package can be called from any memory field, and the user can access data in any memory field. The pseudo-instructions which are interpreted as calls to those subroutines that require an argument are closely analogous to standard memory referenceinstructions. The first three bits of the ' pseudo-instruction specify which floating-point operation is to be performed (i.e. which subroutine to call) while the last nine bits specify the effective address of the argument according to the same conventions used for effective address generation by standard memory reference instructions. The pseudo-instructions which are interpreted as calls to those subroutines that do not require an ar- gument are. analogous to the operate microinstructions in that these pseudo-instructions do not reference a core memory location. 8—12 The basic arithmetic operatiOns (FADD, FSUB, FMPY, FDIV) require that both FAC and floating operand be normalized. All four yield a normalized result. NOTE Pseudo-Instructions are the ‘ . same for each of the. three FPP’s to facilitate. conversion of user programs from one package to another. No alteration of the user program is necessary to convert from the EAE FPP to the NONa user program EAE FPP and vice versa. To convert from either 23- bit package to the 27- bit FPP, floating-point constants need be changed. only the Table. 8-2 Floating-Point Pseudo-Instructions Mnemonic Octal FEXT 0000 Operation the interpreter and execute the next normal machine guential instruction Exit se- a as _ instruction. ' 0001 Call the Floating Square Subroutine. FSQR 0002 Call the Floating Square Root Subroutine. F SIN 0003 Call the Floating Sine FCOS 0004 Call the Floating Cosine Subroutine. FATN 0005 Call the Floating Arctangent Subroutine. FEXP 0006 Call the Floating Exponential Subroutine. FSQU ' Subroutine. FLOG 0007 FNEG 0010 Call the FIN 0011 Call the Floating Input Subroutine. 0012 Call the Floating Output Subroutine. Fle 0013 Call the Fix Subroutine. FLOT 0014 Call the Float FOUT , _ ‘ Call the Floating Logarithm Subroutine. Floating Negate Subroutine. 8-13 éubroutine. _ . Table 8-2 (Cent) Floating-Point Pseudo-Instructions Mnemonic Octalf FNOP 0015 No operation. Available to the user. FNOP 0016 No operation. Available to the user. FNOP 0017‘ No operation. Available to the user. 0020 Floating Increment and Skip if Zero: 0177 Increment the content of the core memory lo- FISZ - to Operation cation designated by bits 5-11 of the FISZ' pseudo-instruction and skip the next sequential pseudo—instruction if the content of this locaton becomes zero. An FISZ pseudo-instruction may only reference page zero locations between 0020 and 0177 inclusive. FJMP to 0200 Floating Jump: 0777 as a Performs the same function standard I MP memory reference instruc- tion except that it is not possible to FJMP to a _ location on page zero directly. FADD lnnn Call the Floating Add Subroutine. Use nnn to calculate the effective address of the operand. FSUB 2nnn Call the nnn to Floating Subtract Subroutine. Use calculate the effective address of the operand. FMPY 3nnn . FDIV 4mm Call the Floating Multiply Subroutine. Use nnn to calculate the effective address of the operand. Call the Floating Divide Subroutine. Use nnn to calculate the effective address of the operand. . FGET Snnn Call the Floating Get Subroutine. Use nnn to calculate the effective address of the operand. FPUT 6nnn Call the Floating Put Subroutine. Use nnn to calculate the effective address of the operand. FNOR 7000 Call the Floating Normalize Subroutine. FNOP 7010 No operation. FSKP 7020 Floating ‘ Skip pseudo-instruction. Skip: 8-14 the next sequential Table 8-2 (Cont) Floating-Point Pseudo-Instructions Mnemonic Octal FSNA 7040 Operation Floating Skip on Non-Zero Accumulator: Skip the. next sequential pseudo-instruction if the content of the PAC is not zero. _ Floating Skip on zero Accumulator: Skip the next sequential pseudo-instruction if the con-_ 7050 FSZA ' ‘ tent of the PAC is zero. 7100 FSPA ' pseudo-instruction ~ _ Floating Skip on MinLis Accumulator: Skip the next sequential pseudo-instruction if the 7110 . ~ Floating Skip on Positive Accumulator: Skip if the the next sequential content of the- FAC1s positive. ' - FSMA ' ' content of the PAC is less than zero. . ‘ ‘ Change Floating Data Field: Obtain the 0p_i e’rand" for all subsequent indirectly addressed, floating-point, memory reference pseudo-in- 7on1 FCDF 7 ‘ 1 struCtions from memory field 11. ' 7lnl Unused. 70n2 Restore the normal order of all FDIV and FSUB until the next FSWl instruction is executed. _ ‘ 'FSWO " or 71112“ = operations 1 - pseudo- , . ' FSWl ; -70n3 ‘ReVerse‘ the order of all FDIV and FSUB” operations until eitherthe next FSWO pseud0~ instruction ”is executed, the interpreter is re- ,- or=71n3 .' entered by the next effective J MS I 7 instruc- tion, -or the Floating Input Subroutine is entered; FHLT ' ' 70n4 5 .or 7.1‘n4 Floating Halt: Halt and display the content of the floating PC in the hardware accumu- ' lator. 70n5 Unused. to 70n7 71n5 to 7ln7 ~Unused. . _ - FJMS - 7200 to—7777 Floating Jump to Subroutine: Performs the function .. standard JMS memory reference instruction, except that it is not location on page zero' possible to FJMS to same directly. 8—15 as a a Table 8-2 lists all of the floating-point pseudo—instructions, their -mnemonics and the operations they perform. The memory refer- pseudo-instructions (octal codes lnnn to 6nnn inclusive) are interpreted as calls to floating—point subroutines which require arence guments. All of these functi as are also available to the user in single-instruction mode. The FJ MP and FJ MS pseudo—instructions perform operations which are not possible in single-instruction mode, but they «are essentially equivalent to the standard PDP—8 ‘JMP and JMS instructions. Note, however, that no directly addressed FJMP or FJMS pseudo-instruction may reference a loca— tion on page 0. This restriction allows octal codes 0000 to 0177 and 7000 to 7177 to be interpreted as extended pseudo-instructions. The ‘ pseudo-instructions corresponding to octal codes 0001 to 0017 generate‘calls to subroutines which are available to the user in single-instruction mode. 0000 is the FEXT (leave interpreter) operation, and 0020 to 0177 are FISZ operations (see Table 8-2). Aside from the FNOR operation, the pseudo-instructions corresponding to octal codes 7000 to 7177 are not available in singleinstruction mode. The octal codes for some of these pseudo-instructions may have either a 1 or a 0 in bit position 5; this is because, the interpreter does not decode bit 5 of the designated pseudo-instructions. Several» possible octal codes do not have as‘signed pseudo—instructions (e.g. 71n1). These codes are unused, and should not be supplied as input to the interpreter. #206 xcc TLs ans 1 7 FIN ~ - FMPY TEN FPUT STORE FEXT HLT 4 .2408 TEN, . STORE, ‘ - OOOO O IINITIALIZE KEYBOARD /AND.TELEPRINTER IENIER INIERPRETER IGET NUMBER FROM TELETYPE IMULTIPLY BY’lfigfl ISTORE RESULT /LEAVE INTERPRETER IAND HALT IEXPONENT IHIGH-ORDER MANIISSA lLow-ORDER MANIISSA l5-WORD_FLOATING-POINT ISIORAGE LOCATION O O s Figure 8-4 Using the 23-bit F_PP in Interpretive Mode ’ 8-16 - Using the 27- bit FPP, the constant TEN would appear as follows: rav.‘ ' 29145 0000 9600 )EXPoVENt ' MI 614- ORDER /LON- ORDER MANTI SSA MANTI SSA The program example of Figure 8—4 performs the same opera— :tions as the example of Figure 8-3, however this program has been coded to execute in interpretive mode: Note that this program rethan the equivalent single-instruction mode quires lesshoweverstorage the execution time version, interpretive mode required will be core 1n considerably longer. ' Floating Input and Output The FIN pseudo-instruction calls the Floating Input Subroutine 'to accept one decimal floating-point number from the Teletype keyboard, convert this input to a binary floating-point number, normalize and truncate the number if necessary, and-load the num~ The input routine is normally called in intérpretive mode using the FIN command.’The input routine may her into the PAC." also be“ called by an effective I MS to the start of the routine (see‘ Table 8—1 for exact memory location). Input is terminated when the routine recognizes any typed character which could not be' part of the input. For example, the conversion of “12.0.” would be ‘ “ ” .The characters + and terminated upon reCeipt of the second will not be recognized as input terminators and should not be —— used following numbers, all terminated by carriage returns, are examples of legal input. They are all equivalent. as such. The 726.7 .7267E+@5 +7267E-1 Floating Input Subroutine echoes each _character as itis typed, including the terminator. Upon completion of any floating input operation. core memory location 0052 of the memory field The 1 Programs using floating input should begin with a KCC instruction to keyboard and a TLS instruction to initialize the printer. initialize the Teletype 8-17 in which the FPP resides contains zero if the input was invalid, and a non—zero value if the input was valid. Core location 0053 in this field contains the ASCII code for the terminating character last received. Core location 0054 of this field may be set by the user. A value of zero loaded into this location causes the input routine to echo only a carriage return whenever a carriage return is typed as an input terminator. Any non-zero value loaded into location 0054' causes the input~ routine to echo a carriage return and a line feed whenever a carriage return is received. Location 0054 is originally loaded with 77778. . , ‘ Using the 23-bit FPP’s, if the example illustrated in Figure is started at location 0200 and the Teletype, the program will halt at locations A and B containing: A; 8-5 types “0X1.0Y” at the location 0210 with storage user 3399 3363 3303 . B: 63.1 2390 Gaga while’ location 0053 will contain 03313, the ASCII code for the second terminator. Using the 27—bit FPP, storage locations A and B containz‘ A; .3' IZERO GQMGQN Q .. b IONE and register 0053 will contain 0331 ——the second terminator. NOTE Since the input routine calls the floating—point interpreter, after input, FSWITCH is set to 0 (FSWO) even if it was set to 1 when input was called Switch). 8—18 (see the section, Floating input routine recognizes RUBOUT as a special character which is not echoed. If a RUBOUT is typed during input. all characters received since the last input terminator are ignored. For example; typing: The 276(RUBOUT) IT to the input routine has the same effect as typing: 1T Input will be terminated with the binary floating-point‘eguivalent if decimal 1 in the PAC. The current input element must be re' typed from the beginning. *200 - KCC TLS' JMS I 7 FIN FPUT A FIN FPUT B ' _ " FEXI HLI A, B, ‘/INITIALIZE KEYBOARD lAND TELEPRINTER /ENTER INTERPRETER /INPUT A NUMBER /STORE IN LOCATION A /ACCEPT ANOTHER NUMBER /STORE¢IN LOCATION B fEXIT INTERPRETER /AND HALT g B 0 a G G _ $ Figure 8-5 Floating Input Routine The FOUT pseudo—instruction calls the Floating Output Subroutine to print the contents of. the FAC on the Teletype.2 The 'FPP maintains four core memory locations on page 0 of the memory field in which it resides. These locations may be set by the user to determine-the format for all floating-point output. Loading any non-zero value into locatiOn 0056 causes all output to be printed in FORTRAN. Fa.b format, where a is the content 2 Programs using floating output initialize the Teletype printer. should begin 8—19 with a TLS instruction to of core location 0057 and b is the content'of location 0060. As with FORTRAN, field overflow causes the field to be filled with asterisks, while field underflow causes the output to be right justi— ’ fied. If location 0056 contains zero, the FF? loads 0016;; into location 005 7 and 00068 (0007 8 fOr the 27-bit FPP) into location 0060 , then prints all output in FORTRAN E14.6 format (E14.7 for 27-bit FPP) - . In either case, each element of output will be followed by a carriage return and line feed if the content of location 0055 is not Loading a zero into location 0055 suppresses the terminating carriage return and line feed. Upon loading, the FPP initializes these four core locations for E14.6 format (E14.7 in 27-bit FPP), with each element terminated by a carriage return and line feed. zero. NOTE .The output routine destroys the contents of the. FAC. If the number to be typed is: needed for further calculation, it should be saved prior to calling the output _ routine. OVERFLOW AND UNDERFLOW Under the 27-bit FPP only, overflow and underflow on are input treated like exponent overflow and underflow (see section on Error traps). Typing a number like: 109006E+ 61 willresult in exponent overflow, and the error trap will be taken if the user has set it. The capacity of the input routine is approx- imately 10'38 < X <1038. If more than 8 significant digits are input, the result will be truncated. Use of F ISZ and Auto-Indexing Core memory locations 0010 through 0017 may be used for auto-indexing in interpretive mode. If one of these locations is referenced indirectly in interpretive mode, the contents of the loca- tion will be incremented by three before it is used for effective ‘ address generation. 8-20 . The Floating ISZ pretive mode. (FISZ) operation is only availablevin inter- A FISZ pseudo-instruction-must be directly ad- dressed, and may only reference a page 0 location greater than 0017. A hardware 182 is performed on the referenced page 0 location, and the next pseudo—instruction is skipped if the content of the location becomes zero. If the content of the referencedloca— tion does not become zero, the next sequential pseudo-instruction is executed. The program example of Figure 8-61uses auto-indexing in inter- pretive mode to pickup 20 r(octal-) floating-point numbers from a » buffer in core and calculate the sine of each. The sines of the numbers are stored in a separate buffer area and are also printed on ~ the Teletype. After each' iteration, an FISZ is performed on a counter and the program loops back until the counter becomes zero, at which time the program exits the interpreter and halts. (Assume that the floating—point package and the user’s program are in the same data field.) ‘ /INPUT BURI=4$$ BUF2=600 BEGINS BUFFER [OUTPUT *16 BEGINS AT 0400 BUFFER AT 0600 ‘ R16: 0 /IN'PUT R17, 6 IOUTPUT BUFFER R29: 0 /DATA BUFFER ELEMENT POINTER POINTER COUNTER ' 1:200 KCC TLS JMS LOOP: IINI TIALIZE 7 I IENTER FGET FPUT R16 FGET I R16 I R~17_ INDXR lINI TIALIZE THE THREE lAUTO’INDEX REGISTERS lGET NUMBER FROM INPUT BUFFER /TAKE ITS SI-NE IPUT RESULT IN OUTPUT BUFFER /PRINT RESULT IDCNE ALL NUMBERS? FSIN FPUT FOUT FI SZ R23 FJMP LOOP _ FEXT' INDXR: IND: LOOP HES: BACK EXIT IAND HALT HLT BUF1'3 BUF2-3 -20 _ TELEPRINTER INTERPRETER INTERPRETER IINITIAL /INITIAL VALUE OF UPLUE OF R16 R17 xrmrm. VALUE or Rae 3 Figure 8-6 Use of FISZ and Auto-Indexing 8—21 User Subroutines ‘ Users who require special floating-point functions may code the functions as assembly language subroutines and call them through ‘the interpreter in the same manner as the extended functions are called. Up to three such subroutines may be inserted in place of the three FNOPs having octal codes 0015, 0016 and 0017. This is accomplished by assigning a mnemonic to the user function, equating the assigned mnemonic to the octal code of the FNOP to be deleted, and inserting the entry address of the user subroutines}; into location 7246 (for octal code 0015), 7247 (for octal code 0016) or 7250 (for octal code 0017) of the memory field core in which the FPP and user subroutine reside. User subroutines called through the interpreter can themselves call the interpreter and use all interpreter functions except calling another user function or extended function through op code 0. The extended functions could be called, however, using singleinstruction mode. All user subreutines must be in the same memory floating-point package. They may enter the interpreter and change the floating data field. They can even change field as the the hardware data field, but when one user subroutine returns to the interpreter, the floating data field, hardware data field, and floating instruction field are all restored to the value they had prior to calling the user subroutine. The program example of Figure 8-7 contains a user subroutine called through the interpreter. This subroutine has been assigned the mnemonic FUSR and octal code 0015. If the FPP is loaded into the same memory field, the program will accept floating-point Teletype, add all such input elements greater than 0.5 to a running sum, and print the sine of the cumulative total after-each input element is received. numbers from the 8-22 ' AND CODE FUSR=UUIS FIELD 8 /ASSIGN K60 /INITIALIZE KEYBOARD /AND TELEPRINTER IINSERT USER.SUBROUTINE ENTRY -/ADDRESS IN INTERPRETER TABLE /ENTER INTERPRETER /ACCEPT NUMBER FROM KEYBOARD /GALL USER SUBROUTINE /PRINT RESULT (SINE 0F SUM) IACCEPT NEW INPUT" NNENONIO *203. START, TLS_ TAD KUSR I DCA I JMS I INTABL 7 FIN FUSR FOUT FJMP .«3 ' a USUB- KUSR, INTABL, 7246‘ 0 JMS USUB, I 7 FPUT TEM FCDF 10 IENTRY ADDRESS FOR'USER ISUBROUIINE To BE ENTERED /IN INTERPRETER TABLE /POINTER TO INTERPRETER /TABLE ENTRY CORRESPONDING /TO OOTAL CODE Ozzs /ENTER USER.SUBROUIINE /ENTER THE INTERPRETER /STORE INPUT /cRANGE To FLOATING /DATA FIELD 1 /LOAD D.5 INTO FAC /SUBTRACT INPUT /IS INPUT GREATER TRAN D.5?. /NO: DON'T ADD TO sum lYES: GET CUMULATIVE sum /ADD IN LATEST INPUT /STORE HEW sum /LOAD sum INTO FAc AND /LEAVE INTERPRETER /TAKE SINE 0F sum /RETURN To NAINLINE /POINTER TO SINE ROUTINE /POINTER To FIELD l CONSTANT - FGET FSUB FsmA FJMP FGET FADD FPUT I COMPR TEN .+4 SUN TEN sum FGEI sum FEXT JMS PSIN, COMPR, JMP 5ODO PTs sum, O TEN, *23@ wasas ENG , I I PSIN USUB _ IFLOAIING-POINT'SIORAGE _ /FLOATING-POINT TEMPORARY IELD l IFIELD 1 CONSTANT = 2.5 980 Figure 8-7 Coding a User Subroutine (23—bit FPP) 8-23 _ If using the 27-bit FPP, the field 1 constant is stored as: FIELD l *EOO xcovsmm 2034 PTS; a = .s- . a Floating Skips The interpreter maintains a core memory location designated as the floating program counter (floating PC) which is originally set to the address of the location following the JMS I 7 which called the interpreter, and thereafter updated by the interpreter whenever a floating—point pseudo-instruction is executed. The floating PC may be incremented by the floating skip pseudo—instructions, which are functionally equivalent to normal PDP-S skip microinstructions except that floating skips reflect the status of the PAC rather than the hardware accumulator. Floating skip pseudoinstructions may be microprogrammed in the same manner as 7 minrnincfnlr’finnc All grcup Vt)»; flQating Skips aSSUIflC that the content of‘the FAC is normalized. There is no provision for clearing the FAC when skipping on condition. nnnrofp utw 1.4 - 111154 UAALU»; uvsAVAA-J- example of Figure 8-8 uses floating skip pseudo-instructions to accept floating—point numbers from the Teletype until it The receives ‘a number with an absolute value greater than 10.0. ‘ $290 INPUT, , ch TLs JMS 1 7 FIN , IINITIALIZE KEYBOARD IAND TELEPRINTER : FSNA FJMP .-2 '. FPUT TEN ~FSPA FNEG FSUB TEN FSPA FSNA FJMP INPUT FGET TEM FEXT HLT TEN, 4 . IENTER INTERPRETER IACCEPI INPUT FROM KEYBOARD /IS THE INPUT NUMBER 3.0? /YES: GET NEw INPUT /Na: STORE TEMPORARILY /Is INPUT POSITIVE? -/NO: TAKE ABSOLUTE VALUE /YES: SUBTRACT Ia.a /Is INPUT GREATER THAN 10.0? /NO: GET NEw INPUT /YES: U5E_TNTs INPUT /LEAVE INTERPRETER /HALT wITH INPUT IN FAC /CONSTANT = 13.0 24am OOOO TEN, 0;@;6 Figure 8-8 Use of Floating Skips (23-bit FPP) 8-24 Using the 27-bit FPP, the constant ten is stored as follows: TEN. /CONsTANT 2045 10.0 = 0006 “6020 Floating Data Field The floating CDF (FCDF) pseudo-instruction used 1s to Change the data field from which the operand of an indirectly addressed, floating-point, memory reference pseudo-instruction is obtained. The program example shownIn FCDF pseudo—instructiOn. T.FIELD D *EOD. ch TLs CDF FPP /U$ER PROGRAM ISET DO FCDF 10 FPUT I FGET TEN K56 > a FIELD IFIELD 0 THEN /SET DATA FIELD 1 AND O 1 FROM 1 = /SET OUTPUT REGISTER t/GET NUMBER FROM FIELD 1 PRINT IT /LEAVE INTERPRETER xmoamr'.. 740D /POINTER 42240030 TEN: 56 K56: PFSPTI..F3PTI = INTERPRETER /ENTER HU" #400 FIELD INTO FIELD PRINTER FIELD = O DATA IIVSTRUCTION /AND 'FEXT . INTO ILOAD _ FOUT F8PTI. - IINITIALIZE I CIF IO JMS I K7400 FGET I PF8PT1 KTAOO. Figure 8—9 illustrates the use of the ‘ TO INTERPRETER xcov5TANT 10.0 = /POINTER-To OUTPUTREGISTER IPOINTER FORMAT To SPEC _ , 1 xcovsrANTs IO ISET 1 TO OUTPUT To FORMAT /F8.1 s Figure 8—9 Use of the “FCDF Pseudo-Instruction (23—bit FPP) Using the 27—bit FPP, the constant ten is stored as: TEN: 2fl45 ICCNSTANT 3006 = lfl-Q 0066 If the FPP is loaded into memory field 1, this program will enter the interpreter from memory field 0, load the floating output regis8-25 ter with a format specification stored in field 0; and then print a floating-point number which is also stored in field 0. Floating Switch The floating switch instructions (FSWO and FSWI) regulate the operation of the FDIV and FSUB pseudo-instractions. Using floating switch 0, FSUB and FDIV are interpreted normally. Following any occurrence of an FSWI pseudo-instruCtion in interpretive mode, the order of all FDIV and FSUB operations is reversed. That is, every FDIV operation will divide the content of the PAC into the floating-point argument supplied (rather than vice versa) and every FSUB operation will subtract the content of the PAC from the floating-point operand. The result of these operations will be stored in the PAC in either case. After each occurrence of an FSWl pseudo-instruction, the order of FDIV and FSUB operations will continue to be reversed until either: 1 The. ‘ .l uv A. 2. tar-fun Inq‘xln navf oar-n “VAL ovsiuvntuu A u H u An thofnunfinn nae“ PM; uuu— ILIDLL uwuuu Io. Jo nvnnnfnr‘ unvvutuu The interpreter isrre-entered by the nexteffective JMS I 7 instruction. 3. A floating input operation is performed in either mode. The floating switch is normally set to 0. Certain mathematical calculations may be facilitated by using pseudo-instruction to reverse the order of FDIV and FSUB operations. For example, Figures 8-10 and 8-11 contain two the FSWl program segments, both of which calculate the value of the ex- pression: g—x A1 130+ V X2+B1+ 0 X“ + B2 + ‘7 A2 A3 x2 + Ba Both program segments execute in interpretive mode, however the uses the FSWl pseudo~instruction to reverse the order of certain FDIV and FSUB operations, while the second first program segment program-segment, does not. 8-26 #203 " 7 JMS I [ENTER INTERPRETER IGEI x ISQUARE IT ISTORE TEMPORARILY I rear x rseu ‘FPUI XSQR FADD 35 st1 FDIV A5 FADD 32 FADD FDIV FADD FADD FDIV .FADD FMPY FSUB FPUT FEXT HLI /USE INVERSE DIV AND lFORM A3/(X12+BS) /FORM BZ+A5/(Xt2+85) suB — /(x12+32+A3/(X¢2+Bs)) xson '“/A2/<Xt2+32+A3/(Xt2+33>) A2 Bl XSQR Al Be x PIOVZ. ANS ‘ -, . . /Xt2+Bl+A2/(X12+BZ+A5/(X12+B3)J _ _ A r - 1P1/2-XtBQ+Ai/<X12+31+A2/(...>>> » ‘ IEXII INTERPREIER - Figure 8—10 ‘ /FORM X12+B3 - Use of the FSWl Pseudo-Instruction Floating Halt The floating halt pseudo-instruction is used mainly for debug— ging floating-point code. When a floating halt is detected in‘ interpretive mode, the interpreter will halt with the address of the next floating-point instruction displayed in the hardware accUmulator. "The user can continue execution by pressing the CONT switch on the programmer’s console. Normally, the floating halt pseudoinstructions would be removed or replaced by FNOPs once the program has been debugged. ‘ . SINGLE INSTRUCTION MODE VERSUS INTERPRETIVE MODE * - The relative advantages and disadvantages of each of the two IfiOdes of FPP operation are Summarized in Table 8-3. For most applications, interpretive mode is more convenient than single— instruction mode and more economical in terms of core storage requirements. However, the user who is especially speed-conscious may employ single-instruction mode to eliminate interpreter overhead and reduce execution time. 8-27 ' #200 n Jfia I iENTER IGET X FGET FSOU ISOUARE INTERPRETER IT FPUT XSOR /STORE Xf2 FADD 83 /FORM X? 2+B'3 rsmna .TEMPORARI u FPUT 5TEM FGET A3 FDIV TEM ’ IGET A3 IDIVIDE BY Kt2+33 FADD 52 FADD XSQR /X'2+BZ+A3/(X?2+BS) FPUT TEM ISTORE FGET A2 FDIV FADD TEM Bl~ TEMPORARILY FADD KSQR IX?2+8l+A2/(Xf2+B2+A3/(X72+B3J> FPUT TEM ISTORE FGET A1 FDIV TEM FADD BB FMPY FNEG FADD FPUT TEMPORARILY /X(Bfl+Al/(X'2+Bl+A2/(..-)))w AND ADD RATHER /THAN INVERSE SUBTRACT 'AVEGATE PIOV2 ANS FEXT HLT TEM: 0 IEXTRA TEMPORARY INEEDED INOT Figure 8-11 IF LOCATION FLOATING SWITCH USED Program Segment of Figure 8-10 Without FSWl Pseudo-Instruction As an example of the'trade-offs to be considered when Choosing between interpretive mode and single—instruction mode, the inter- pretive modeprogram segment of Figures 8-10 and 8-1 1 is recoded in single—instruction mode and presented in Figure 8-12 (pointers to FPP routines are given in Table 8-1). The single instruction mode version requires 18 (decimal) additional storage locations, but it is approximately 800 microseconds faster than the interpretive mode version. ' 8-28 Table 8-3 Single-Instruction Mode Versus Interpretive Mode Single-Instruction Interpretive Mode - Full instruction set. FISZ, FJ MP, FJ MS and floating skips not Instruction Set: ~ available. ‘ Execution Time: . Generally shorter. (50 microseconds .or Generally longer. 20-25% shorter for the EAE FPP.) Core Requirements: Memory Field Limitations: Generally lower (re- Generally up to 33% higher (requires 2 or 3 words per operation). quires 1 or 2 words per Operation). Instructions must re- All of extended mem- side in the field which ory is available for program and data contains the FPP. storage. Other Advantages: User programs may overlay the unavailable floating-point. . functions and the interpreter. ”ERROR TRAPS The following error conditions are detected by the FPP: 1. Attempt to 'FIX a number whose greater than 2047. 2. 3. absolute value is - Attempt to divide by zero. Illegal function argument ( log( X) where XIS not a positive number). 4. 5. Exponent Overflow (27-bit FPP only). Exponent Underflow (27—bit FPP only). Exponent overflow and underflow errors are detected only by the 27-bit FPP. These conditions occur whenever a calculation results in a number whose exponent has an absolute value greater » than 12810. The result of such a calculation is meaningless. In the 23- bit FPP’s, underflow or overflow occurs when a calculation results1n a number whose exponent has an absolute value greater than 61510. 8-29 JMS I x JMS I JMS I XSQR JMS I 35 JMS I A3 JMS 1 32 JMS I XSQR JMS 1 FGETP IGET X FSQP FPUTP /SQUARE IT ISTORE X12 FADDP IFORM xv2+35 rnrvzp FADDP /INVERSE DIVIDE To GET /A3/(X12+B5) IFORM BZ+A3/(X12+BSJ FADDP /Xr2+32+A3/ch2+Bs> FDIVIP /A2/CX12+BZ+A5/(X12+BS)) FADDP /ADD Bl FADDP IADD FDIVlP /Al/(X12+BI+A2/(...J) FADDP lADD Be FMPYP /X(BB+A1((X12+BI+A2/(...))) FSUBIP. /CALL A2 ‘ JMS I 81 ans 1 xses Jms I At JMS I Be JMS I x Jms I PIOVZ JMS 1 ANS HLT 7526 7564 7322 vane 64:2 ssoa s4ea sz" ‘ FGETP, FSQP, FPUTP, FADDP, FDIVIP, FMPYP, FSUBIP, INVERSEvSUBIRACT To GET /PI/2-X(B@+Al/(...)) FPUTP Figure 8-12 lPOINTERS /FLOATING /FLOATING IFLOATING IFLOATING /FLOATING TO FPP ROUTINES: GET SQUARE PUT ADD INVERSE DIVIDE lFLOATING MULTIPLY ,IFLOATING INVERSE SUBTRACT Program Segment of Figure 8-10 in Single Instruction Mode Error 3 leaves the FAC unchanged, while errors 1 and 2 set the FAC to zero. Error 4 in the 27-bit FPP sets the FAC to a. very large number. Error 5 in the 27-bit FPP sets the FAC to 0. The contents of the hardware accumulator and multiplier quotient regis— unpredictable when any of these errors occurs. The user may set the interpreter to jump to a Specific location in his pro— gram upon detection of one of these errors. To do this using the ter are 8—30 ‘ " ~, “ 23-bit FPP, .coreKIOCations 75.74, 7575 and 7576 shcufld be, loaded with the address (in the same memory field) to which control should be transferred upon detection of error 1, 2, or 3, respectively. Using the 27-bit FPP, core locations 7574, 7575, 7576, 7573, and 7577 should be loaded .with the address for transfer of control upon detection of error 1, 2, 3, 4,, or 5 respectively. Normally, these locations would, be set to point to user error message routines, and the user program would abort upon detection of one of these ‘ errors. - EXTENDED FUNCTION ALGORITHMS = y The algorithms to approximate the extended functions use either .Chebyshev optimized Taylor series expansions or continued frac— tion polynomials to calculate the value of a— function over some small range. These algorithms provide fairly. uniform accuracy over the specified range and, as opposed to converging series, they ‘ t consist of definite number of computations. Various extended a function algorithms .are deseribed individually in the following paragraphs. - I ' SIN(X) , . --The argument" (the PAC in radian measure) is first reduced to the interval: - . I _ 3.". <X<71. 2 2 using 'the proper identities, and the quadrantjof theroriginal argu:ment is determined. SIN(X) is then calculated as a function of the modified argument Y ,_____ .G(F) as follows: ‘ - ‘ Quadrant Y_= . ‘Using the Identity: I ' ' 0‘ F 1 1—-F _2 '—F ‘ 3 ; F'——1 SIN(Y) « -: SIN(Y) SIN(Y)’ = SIN(qr—Y) SIN(Y) = SIN(-f(Y-1r) ) SIN(Y)-_=SIN(—-(2-n--—Y) ) where F is the fractional portion of (1r/2)X. Using either of the 23-bit FPP s, SIN(Y) is then calculated 8-.31 ‘ over the range (—7/2, 1/2) using the Chebychev optimized Tay- lor series expansion: SIN %Y = A1Y+A3Y3+A5Y5+A7Y7 where : A1: 1.570949 A3: ——.64592098 A5: .07948766 -.004362476 A7 = Using the 27-bit FPP, SIN(Y) is calculated: SIN ~725—Y = A1 Y+A3Y3+A5Y5+A7Y7+A9Y9 where 2 A1: 1.57079633 A3 2 —.6459637l1 A5: .079689679 A7 = -.00467376557 A9: .00015148419 COS(X) The function COS(X) is calculated using the SIN function on the basis of the following identity: COS(X) =SIN( (1r/2) +X) ' EXP(X) algorithm for the calculation of EXP(X) The fraction polynomial to calculate e‘ as: 1 ex 6":2°‘2 .If: n z: X108} -’ =2‘ Integer part of Xloggc part of Xlogze r = Fractional e1: 2an then: A where: ' ‘ lrl<l 862 uses a continued Under the 23-bit FPP, the algorithm calculates 2r as follows: . _2 l‘ : 1 + 2 2y —._._—————_ A0 ' Y + A1 B1 + Y2 r where: y = logze “‘22 Under the 27-bit FPP, 2r = 1n2 2 1442695 —_‘— .34657359 A0 = 12.015017. A1 : —601.80427 B] : 60.090191 is calculated using the values: r1112 __ _ 2 ‘ logze -= 1.442695 “2’2 = A0: 3465735903 1201501675 _ A1 = —601.804267 Bl: - 600901907 ARCTANGENT (X) The algorithm for the calculation of TAN—l (X) also Uses a continued fraction polynomial to ‘ calculate the TAN-1(X) for ' 0<X<1. L The argument is reduced to therange O<X<l using the identi- ' ties: ‘If: x<0, TAN—1px): ——TAN—1(X) 0<X<1, TAN—1(X)=TAN~1(X) 1<X, _ TAN-1(X) -== (ar/Z)—-TAN-1(1/X) 8-33 Once X has been reduced, TAN“(X) is calculated as: TAN“ (X): x A‘ 3., + A2 X2 + B1 + .. . . \ X1 4- B"., 4- - ‘ \ . where (under the 23-bit FPP): A,.1 ' X” +. B. B" _.17465544 3.7092563 A1 B1 = 6. 762139 ~—7. 10676 AB B2: 3.3163354 .26476862 A3 = B3 = 1.44863154 — ‘ = . . = ., — ,w while under the 27-bit FPP: ' ~ . . .174655439 B” = A, = 3.709256% 2:. 6.7621392 B1 -—7. 10676005 A; 3. 31633543 B2 = .26476862 A-i = 1.44863154 33 = - = LOG(X) *Log(X) is calculated by.using a Chebyshev optimized Taylor series to approximate the log-_.of the mantissa of X. F : Mantissa of X If I then = log, (X) Exponent of X .2 [I + log._,(F)] logp (2) The logg (F) .is approximated as follows : ’ log2 (F) =CIZ +c3z3 + (3525 Under -— the 23- bit FPP: Z =(F— V75)/(F+ W5) c1=28853913 c3 = .9614706 - = V75 '- .59897865 = .7071068‘ ‘logeZ :7 .6931472 7 8-34 1/2 while under the 27-bit FPP: Z', = C1 C3 = C5 V75 log(. 2 : = (F— 1/75)/(F+ V75) 2.88539129 .961470632 59897865 : .707106781 = .69314718 The ranges of the extended functions are as follows: SIN, COS —-2047<X<2046 EXP ——141.5<X<1415, ATAN all X LOG all X>O . FIX, and FLOAT routines The SQUARE, SQUARE ROOT, are 1n Table 8- 1. explained Execution Time for EAE Floating-Point Operations Instruction times are for single—instruction mode calls. Add 50 ”sec. for interpretive mode, or 71 pSCC. for interpretive mode with ' indirect addressing. ‘ ' Typical Time Operation F ADD 160 p.860. ' FSUB 180 psec. - 200 “sec. FMPY p FDIV 160 usec. or 190 psec. I FGET 55 usec. - , FPUT ’ FSUB (with FSWl) FDIV (with FSWl) 35 ,rsec. 215 ,usec. 210 ”sec. or 240 “sec. . 8-35 ' _ ' Execution Time for EAE Extended Functions Average Execution ' Function Range . ~10“ < X < 0 SIN 2.30 msec. 0 < X < 10615 COS 2.25 msec. —10“15 < X < 0 2.45 msec. 0 § X < 10615 ATAN Time 240 msec. —10615 < X < —1 2.78 msec. -1 S X < 0 2.33 msec. 0 g X <1 2.27 msec. 1 < X < 10615 2.73 msec. —1415 < X < 1415 2.33 msec. ' EXP I LOG SQROOT SQUARE O < X < 10615 2.43 msec. —10615 < X < 10615 1.43 msec. “10300 < X < 10300 200 ”sec. Execution Time for Non-EAE Floating-Point Operations Instruction times single-instruction mode calls on the PDP—S/E. All 55 psec. for interpretive mode, or 72.8 usec. for interpretive mode with indirect addressing. are for Instruction Typical Time FADD (Operands have same 180 ,tsec. plus normalization order of magnitude.) time. (Operands differ by 3 orders of magnitude.) 270 FADD FADD FADD time. (Operands difler by 6 orders of magnitude.) - 360 psec. plus normalization time. (Operands differ by 12 orders of magnitude.) 530 ,usec. plus normalization time. FADD time plus 25 “sec. FSUB FMPY “sec. plus normalization (Positive operands.) FMPY (At least one 990 ,usec. average. 1025 ”sec. average. negative operand.) 8-36 FDIV 1077 am. or 1113 #sec. (Both operands . positive.) (At least one FDIV 111,8 ,Lsec. or 1153 ”see. negative operand.) 21+41.6N ,usec. where N FNOR FG-ET - , shifts are required. 57.6 ,usec. ‘ FPUT 39.6 ,usec. FSUB- with st1 Same as FSUB. FDIV with. st1 Add 54.0 ,isec. t5 FDIV time. FSQU Same as FMPY. FSQR Accuracy of Extended Functions Function SIN 1965 ,usec. average. ' - Approximate Range . Accuracy (no. of significant digits) ‘1r/2<X< 7/2 _ —50<X<50 COS 23-Bit 27—Bit 6 digits 7 digits 6% digits ' . -—200<X<200 5 digits 6 digits -—7r/2<X< 111/2 6 digits 6 digits 61/2 digits —30<X<30 —100<X<100 ‘ 5 digits ‘ ‘ —125<X<125 6 digits ~89<X<88 61/2 digits ' EXP ‘ —-50<X<100 5 digits —25<X<35 7 digits —1<X<1 6 digits ' 7 digits I LOG TAN-1 0<X<1000 6 digits —1<x<1 6 digits all X 6 digits 8-37.. 7 digits 7 7 digits 7 digits Conditions determining function accuracy: 1. All functions digits (7 digits under 27-bit FPP) over their primary range. Primary ranges. are as are accurate to six follows: SIN, COS EXP 2. , “7r/’2<X<= 17/2 -1<X<‘=I LOG 0<X<=1 TAN—1 —1 <X<=1 The SIN and COS functions are accurate to six digits (7 digits under 27-bit FPP) for all X, but the answer loses significance as X diverges from zero. 3. Accuracy decreases as X becomes very large, or very close to critical points. CORE STORAGE MAPS User programs may overlay portions of the FPP which are not used, such as 1/0 routines and extended functions. The following storage maps list core' allocations for the Extended Arithmetic Element FPP, the non-EAE package, and the 27-bit FPP. Page 0 storage is the same for all packages. EXTENDED ARITHMETIC ELEMENT FLOATING—POINT PACKAGE Core location Contents 7400-7577 7000—7177 Interpretive dispatch routines. Argument fetch, FPUT, FGET, FNOR extended functions calling sequence. FADD, FSUB, FNEG and part of FDIV. 6600—6777 FMPY and FDIV. 6400-6577 Inverse 7200-7377 ‘ and Floating Subtract and Divide, FSQR and FHLT. 5600-6377 FIN and FOUT. 5400-5577 FIX, FLOT and constants for extended functions. FATN and FLOG. 5200—5377 5000-5177 , FSIN, FCOS, FEXP and utility routines. 8-38 NON—EAE Core location 7400-75 77 FLQATING—POINT PACKAGE Contents Interpretive dispatch routines, «FSQU, FJMP - and FJ MS 7200-7377 Argument fetch, FPUT, FGET, FNOR, ex.tended functions calling sequence and part of FDIV. FADD, FSUB, FNEG, part of FDIV; 7000—7177” 6600-6777 FMPY and part of FDIV. ~ 6400-65 77 Inverse Subtract Floating and Divide, and FSQR. 5600-6377 FIN and __ 5400—5577 FOUT. FIX, FLOT and constants for extended functions. 5200-5 377 FATN and FLOG. 5000-5177 FSIN, FCOS, FEXP and utility routines l-Part of FMPY and FDIV, and. 4600-4777 routines. interpreter 27-BIT FLOATING-POINT PACKAGE ‘ Core location . COntents _ Interpretive Dispatch Routines; Floating Square, 7400-7577 J MP, J MS. 7200-7377. FPUT, FGET; Normalize; Extended Functions Call Sequence; Floating Halt 7000-71 77 Floating Add, Subtract, Negate. Floating Multiply, Divide. Inverse Floating Subtract and Divide; Square 6600-6777 6400-6577 _ ' Root. 1 5600-6377 ' 5400—5577 Floating Input and output Routines. FIX; FLOAT; Constants for Extended Func' ' tions. 5200—5377 Arctangent; Log. 5000—5177 SIN; COS; Exponential; Utility Routines. 4600-4777 Parts of _ Floating Multiply, Divide; Interprew ter Routines; Argument Fetch. 8-39 PAGE ZERO STORAGE Core location Contents - .7. MAP (an FPPs) -- 0007 Pointed to interpreter. 0040—0042 0053 Floating-point temporary storage. Interpreter constant storage. Floating accumulator (FAC). Floating-point operand storage. Valid input switch. Last input terminator register. 0054 Line feed after carriage return switch. 0055 0056 CR/LF after output switch. E/ F output format Switch. 0057 F format output field width specification. nnan F format decimal digit specification 0043 0044—0046 0047—005 1 I 0052 uuvv 0061 Internal . 0062 SUMMARY OF . pointer for interpreter. Reserved for future expansion. FLOATING-POINT INSTRUCTIONS Memory Reference Instructions Code Instr FJMP ' 0000 FADD 1000 FSUB 2000 3000 FMPY 'FDIV ' 4000 FGET 5000 FPUT 6000 FJ MS 7000 8—40 ' , Expanded Instructions Instr Code FISZ= 0 FEXT= 0 ' _ FSQU= FSQR= '1 FSIN= 3 FCOS= 4 FATN= 5 FEXP: 6 FLOG= 7 FNEG= 10 F IN: 11 (Square) (Square Root) 2 FOUT= 1.2 FF IX: 13 PLOT: 14 FNOP= 15 FNOP= 16 FNOP= 17 'FNOR= 7000 FCDF: 7001 , ' _ (Available to User) (Available To User) - ' , ' FSWO= 7002- FSW1 : 7003 FHLT= (Available To User) . (Bits 6-8 New Fltg. Data Field) 7004 ' FNOP= 7005 FNOP: 7006 FNOP: 7007 FSMA= 71 10 FSZA= 7050 FSPA: 7100 FSNA: FNOP= FSKP= . 7040 70107020 3—41 , Chapter 1 . Answers to selected exercises on page 1-10 2. 10010 12. 10 4. 1100100 14. 111 110 6. 1 16. 8. 1110101 18. 101 1 110 001 011 110 110 000 000 10. 111 20. 11 110 5 10. 4. 94 _12- 6. 31 8. 55 3641 4087‘ 63 4095 & b.2. 111 111 010 14. ' 16. 111 011 101 110 111 Answers to selected exercises on page 1-14 2. & 4. 6. 8. ' 6 575 40 30 ~ 10. 12. 7777 14. 16. 255 2372 10. 110 100. 7664 ,. b.2. 111 011 110 4. 1 000 6. 101 8. 1 001 000 001 ' a 14. 111 110 101 100 101 011 010 16. 1 010 100 011 2500 6005 7777 _12. 100 010 100 111 ‘ 2. 40 8. 4. 1104 10. 12. 6.'3 _ d.2. 4. 6. 31 512 482 8. 10. 4095 12. 174 2431 Answers to selected exercises on page 1-26 2. a 4. 6. b. 110 10 111 000 1 100 8. 11 10. 10 001 12. 1 010 010 101 One’s Complement Two’s Complement 000 100 000 101 000 100 001 000 000 000 000 101 111 ‘ 1— 1—-\ P F” wwpwgew 111 111 111 111 011 011 011 011 111 111 111 011 110 011 001 000 000 000 000 100 ‘111 011 011 101 100 100 000 000 000 011 110 011 010 000 000 000 001 101 000 101 4. 11 001 110 110 010 4. 1 010 011 110 101 e. 2. 111 010 001 f. 2. 100 , g. 2. 4. 70 6. 1331 110 8. 3623 h. 2. 205 1105 42 6. 4. 7 8. 2. 6. 4. 667 2767 2. 204 4. 433,254 172,166 i. j. 6. 8. 25 112 Chapter 2 Answers to selected exercises 1. The locations listed in parts b,'f, g, h, and i must be addressed indirectly. All others may be addressed directly. 2. Group 2 (SZL) (AND) (CLA CMA) (NOP) (JMS) (SMA CLA) MRI b.099“? Group 1 Group 1 MRI Group 2 a. AND 0 c. 182 Y Parts at, c, and 8 contain digits which can not be represented with binary numbers. Part b has too many digits to be represented by lZ—bits. Part d is- a legal instruction if a leading zero is assumed. . The logical AND of the AC with the contents of location 0 replaces the accumulator. Increment the contents of location 100 on the current page and skip the next instruction if the contents become 0 after the incrementation. e. DCA I Y . Deposit and clear the accumulator indirectly into the location whose address is contained in location 100. g. TAD 30 Two’s complement add the contents of location 30 to the accumulator. 1. . - JMP Y Transfer program control current page of memory. CLA CMA CML can?!» SZA SPA SNA CLA SPA SNA SZL A—2 to location 73 on the 6. After Execution Location Content (octal) AC 0000 205 1537 206 2241 207 4000' Program: 7200 . 1205,, _ 1206 3207 ‘ 7402 p ’ 1537 > ' 2241 0000 7. a. 7360 c. 7710 e. illegal One instruction may not be used to rotate once and" rotate twice at the same time. On the PDP~8 and PDP-8/ S it is also illegal to combine an increment and a rotate microinstruction, thus part dis legal on the PDP-S/ I and PDP-8/ L but it is illegal on the PDP-S and PDP-S/S. ‘ v _ One instructibn may not include g.‘ illegal , ' ‘ . "i. illegal " groups One instruction may not Group 1 and Group 2. members of both skip , combine microinstructions from - - 8. SZA SKP SNL Instruction to, be skipped . 9.-— Any testing of the accumulator is .done before the OSR instruction is executed. 10. a.- , 1 Location 200 202 ' - 203' b. 405 406‘ 407 TAD 210 TAD 211. DCA 212 HLT 0002 0010 0000 1210 1211 .3212 7402 ' ,v ~ .- . ~ Content CLA TAD“ 550 DCA 552 TAD 551 DCA 550 TAD 552 DCA- 551 "HLT A-3 _ ' 0002. 0010 0000 A ' ' 402 403 404 .7200 . - Location 400 401 _ Octal Content CLA ' 201 204 .210 211 212 _ _ , , ' ~ Octal 7200 -_ 1350 3352 1351 . 3350 1352 3351 7402 ‘ Chapter 3 Answers to selected exercises / SUBROUTINE TO SUBTRACT TWO NUMBERS 1. *fim LUV CLA CLL TAD K1200 JMS SUB START; - 1500 HLT , ' *300 -. 0 CIA SUB, TAD I SUB ISZ SUB ‘ JMP I SUB 1200 K1200, $ ‘23}: / LOAD LOCATIONS 2000 TO 2777 *200 CLA CLL START, TAD K2000 DCA LOCPTR DCA COUNT TAD COUNT DEPOSIT, DCA I-LOCPT-R ISZ COUNT Tsz LOCPTR TAD LOCPTR TAD M3000 SZA CLA IMP DEPOSIT HLT 0 2000 0 —-3000 COUNT, K2000, LOCPTR, M3000, $ ‘ /TRIPLE PRECISION ADD ‘ . *2“) 1mm. ‘ . ‘ CLA CLL TAD AL TAD BL DCA ANSL RAL TAD AM TAD BM DCA ANSM A4 - TADAH’ ,' ' TAD: :BH DCA ANSH HLT 1211 0314 AH, AM, AL, BH, BM, BL, 7125 0114 4157 0176 0 ANSH, 0 ANSM, 0 ANSL, $ /DOUBLE PRECISION RESULT - , - *200 . CLA CLL TAD A CIA DCA MINUSA TAD"‘B START, " , _ , , SZL ISZ CH NOP CLL - , ISZ MINUSA IMP .—6 'DCA CL HLT 0 MINUSA, A, B, CL, , CH, $ 0011 1234 . ' 0 0 / DOUBLE PRECISION MULTIPLE OF 2 *200 CLA CLL START, DCA NH TAD EXP ' , . ‘ ROTATE, CIA DCA MINUSE TAD N DCA N TAD NH RAL DCA NH 'A—S CLL ISZ MINUSE IMP ROTATE HLT - N, NH, EXP, MINUSE, $ ' 1234 0 ‘ 3 0 /How MANY NEGATIVES? *200 CLA CLL START, DCA NEGS TAD K2777 DCA 10 TAD M1000 *DCA COUNT TAD I 10 TEST, SPA CLA ISZ NEGS ISZ- COUNT JMP TEST TAD NEGS HLT » .. ‘ - ' NEGS, K2777, M1000, 0 2777 —-1000 0 COUNT, $ /20 SECOND DELAY *200 TAD CONST START, ‘DCA COUNT ‘ A TAD. CONsrl - DCA COUNT1 ISZ COUNT1 JMP .-1 Isz COUNT JMP .-3_ HLT ' 6030 CONST, COUNT, CONSTl #41000 DECIMAL 0 , COUNT1, 64 / 52‘ DECIMAL 0 A-6 9. ' / 20 OR 40 *200 START, SECOND DELAY CLA CLL TAD M2 '- HLT . OSR . DCA TWICE TAD CONST DCA COUNT TAD CONSTl DCA COUNTl ISZ COUNTl’ J MP .-—1 ISZ COUNT JMP .—3 ISZ TWICE DELAY, J MP DELAY HLT 5703 CONST, COUNT, CONST1, COUNTl, M2, TWICE, $ 0 44 0 —2 0 Chapter 4 ' Answers to selected exercises 3. V / SET LOCATIONS TO SWITCH REGISTER / VALUE . LOC. *200 CONT. , 0200 7300 1214 0202 3215 0203 1213 0204 3216 0205 7404 0206 3615 0207 2215 0210 2216 0211 5205 0212 7402 0213 7770 0214 2000 0215 0000 0216 0000 CLA CLL TAD K2000 . 0201 - .. ' ' ‘ M10, K2000, POINT, COUNT,. $ DCA POINT TAD M10 DCA COUNT’ OSR DCA I POINT ISZ POINT ISZ COUNT JMP .—4 HLT 7770 2000 0 0 ' A-7 / ADD TWO NUMBERS AND DISPLAY SUM Loc. CONT. mm 71nn v—vv *200 (‘IA .avv V“; 0201 7402 ("11' 3211 HLT OSR DCA A 7402 HLT 7404 OSR' TAD A HLT JMP .—10 0 0202 7404 0203 0204 0205 0206 0207 0210 0211 1 1211 ' 7402 5.200 0000 A, . $ (flquflnr6 Answers to selected exercises 1. / SUBROUTINE ALARM AND CALLING FOR IT * 200 START, ALARM, CLA CLL TLS JMS ALARM HLT 0 TAD M5 DCA RINGS TAD KBELL JMS TYPE ISZ RINGS JMP .—3 JMP I ALARM _ _ _ 0 TYPE, TSF JMP .—1 TLS CLA CLL JMP I TYPE M5, —5 RINGS o , KBELL, 207 / ASCII FOR THE BELL A-8 /TAB SPACE THE TELEPRINTER *200 , . ' - CLA CLL START, TLS HLT OSR JMS TAB - . '/ ACCEPT NUMBER OF [SPACES FROM SR JMP .—3 '/READY. TO TAB MORE 0 TAB, CIA DCA NUMTAB TAD ‘KSPACE . , , JMS TYPE ISZ NUMTAB ’JMP .—3‘ JMP I TAB 0 TSF TYPE, _ _ JMP .—1 TLS CLA CLL -JMP 1 TYPE 0 NUMTAB, KSPACE, 240 _, $ . /TEST ANSWER SHEET *200 . . START, CLA CLL ' TLS HEADING, TAD HEAD1 DCA POINTR TAD AMOUNTDCA COUNT JMS CRLF .V TAD 1 POINTR JMS TYPE ISZ POINTR- ISZ COUNT JMP .—4 JMS CRLF NUMBRS, TAD K260 DCA INTS ISZ INTS TAD INTS JMS NUMTYP TAD INTS TAD M271 SZA CLA JMP .—6 A-9 , TEN. TAD- K260 IAC JMS TYPE TAD K260 JMS NUMTYP HLT HEADI HEAD , POINTR. HEAD. , 0 -' 324 /H /I /s /T 3: 31 1 323, 317 10 322 /R 331 /Y 240 /SPACE /T , 324 305 323 324 AMOUNT, COUNT, K260, INTS, M271, K215, K212, , K256, - TYPE, —14 0 /E /s /T /# OF HEADING CHARACTERS 260 0 ~271 215 212 256 /NEGATIVE OF ASCII FOR A 9 / ASCII FOR CR /ASCII FOR LF / ASCII FOR PERIOD 0 TSF J MP .—1 TLS CLA CLL J MP I TYPE CRLF, 0 TAD K215 J MS TYPE TAD K212 J MS TYPE IMP I CRLF NUMTYP, O J MS TYPE TAD K256 J MS TYPE J MS CRLF J MP I NUMTYP A-10 /TWO DIGIT OCTAL SQUARE CONVERSATIONAIA / PROGRAM *200 CLA CLL START, ' TLS J MS CRL'F' /GET FIRST DIGIT J MS LISN. .TAD M260 ~RAL RTL CLL ’ DCA NUMBER JMS LISN TAD M260 TAD NUMBER DCA NUMBER~ ' ' MULT, TAD NUMBER CIA DCA TALLY TAD NUMBER ISZ TALLY JMP .——2 DCA NUMSQR TAD MESAGl DCA POINTR TAD M10 DCA ENDCHK J MS MESAGE TAD M4 , TYPSQU, ‘ TYPANS, UNPACK, DCA DI'GCTR DCA STQRE TAD NUMSQR CLL RAL TAD STORE RAL RTL DCA STORE TAD STORE AND K7 TAD K260 JMS TYPE TYPOCT, ISZ DIGCTR JMP UNPACK TAD MESAGZ DCA POINTR TAD M7 DCA ENDCHK JMS MESAGE ‘JMS CRLF, JMP START+2 A—ll '/GET SECOND DIGIT '/NUMBER IS NOW IN AC TYPE, '0 ,TSF JMP .——1 TLS CLA CRLF. JMP I TYPE 0 LISN, TAD K215 M 1' Y P TAD K212 JMS TYPE JMP I CRLF 0 , » KSF JMP .— 1 KRB MESAGE, TLS JMP I LISN 0 . TAD I POINTR NUMBER, M260, TALLY, NUMSQR, MESAG] , POINTR, M10, ENDCHK, STORE, M4, DIGCTR, K7, M7, K260, K212, K215, MESAGZ, STARTI, JMS TYPE ISZ POINTR ISZ ENDCHK JMP .—4 JMP I MESAGE 0 , -—260 0 0 STARTl 0 -—10 0 0 —4 7 —7 260 212 215 STARTZ 323 /s 321 /Q 325 /U /A /R /E /D /= 301 322 305 304 275 A-12 ‘ STARTZ, 240 /SPACE ‘317 /O /C /T /A /L 303 324 301 314 256 ’ ' /PERIQD A-13 ASCIIl- Character Set Octal 6-Bit Octal 8-Bit Character , 6-Bit Octal 8—Bit A 301 01 ! 241 41 302 02 ” 242 42 C D 243 43 244 44 303 03 # 304 04 $ % ' ' E 305 05 F 306 G J 307 310 31 1 3 12 06 07' 10 K I 245 45‘ 246 46 247 47 250251 252 253 254 50 51 / ': 255 256' 257 272 55 56 57 273 73 ‘ & ’ 11 ( ) - 12 * 313 13 + L 3 1-4 14 " M 3 15 15 - N 16* . P 316 317 320 20 Q 321 21 ; R 322 22 < 274 74 s T U 323 23 = 75 3 24 24 325 25 V 326‘ 26 W 27. X, 327 330 @ [ 275 276 '277 300 30 \ Y 3 31 31 ] Z O 332 260 32 T(/\)2 60 61 62 63 64 65 <-(— 2 O 2, 3 4 , ' 17 , 261 ' 262 263 264 7 265 266 267 8 4270 9 27 1 5 6 ' . 1 - Octal B H _ Character - > ? 76 77 33 34 35 36 37 Leader/Trailer 335 336 337 200 LINE FEED 212' Carriage RETURN SPACE 215 240 377 000 . 66 RUBOUT 'Blank 67 BELL 70 TAB 21 l FORM 214 207 71 0 1 An 2 72 333 ' . 53 54 334 _ . 52 abbreviation forwArnerican Standard Code for Information Interchange. The character in parentheses is printed on some console terminals. B—l 40 ' .CHARACTEKCQDES C o 8-bit ASCII. Code "DEC 026 Card EEC 029 6-bit ‘ Code Card Code Code * » S 2 5, _ a 3‘, Remarks . a a .: c» o a: 240‘ 241 242 243 244 245 246 247 40 250 251 252 253 254 255 256 257 50 260 261 262 263 264 60 265 266 267 ~ 270 271 272 41 42 43 44 45 46 47 51 52 53 54 8—5 blank 12—8—7 0-8-5 0—8—6 11—8—3 0—8—7 11—8—7 8—6 12—8—5 11—8—5 11—8—4 0—8—4 12—8—4‘" 11—8—4 blank 11—8—2 8—7 8—3 11—8—3 0—8—4 12 ' # 5 ' % & ' opening parenthesis closing parenthesis ( ) asterisk * plus 12—6—6 0—8—3 55 11 11 56 57 128—3 12—8-3 0—1 0—1 / 0 1 0 o 1 1 62 63 64 65 66 2 3 2 67 7 5 6 7 2 3 4 5 70 8 9 8—2 11—8—6 8 9 11—8—2 0—8—2 8 9 12—8—4 8-6 0—8—6 0—8—7 1.2—8—6 <, 8—3 11-8—6 12—8—2 8—4 12—1 12—2 12—3 12—4 12-5 12—6 12—7 8—4 12-1 12—2 12—3 12—4 12-5 12—6 12—7 71 72 273 274 275 276 277 73 300 301 302 00 01 02 303 03 304 305 306 307 04 05 74- 75 76 77 06, 07 5 6 quotation marks number sign‘w’ dollarsign percent ampersand apostrophe or acute accent " 0—8—3 4 . exclamation point ! 12 61 . space (non-printing) + comma , minus sign or hyphen — ' period or decimal point . 3 4 slash 5 7 colon ; semicolon ; _ _ _ = 1 > '7 @ at sign A B .3 0 D E F G less than equals greater than question mark = CHARACTER CODES c 2 E - ._ . [8-bit ASCII Code 6-bit Code 2 5 DEC 026 Card Code. DEC 029 Card Code 8 3 o I; - 310 311 312 313 314 315 316 317 ' 12—8 12—9 1 1 —1 1 1~2 1_ 1 —3 11—4 10 1 1 - 12 13 14 . 15 16 17 . - 20 1 1 —7 323 324 325 326 327 23 24 25 26 27 11-8 11—9 0-2 0~3 0—4 0—5 0—6 330 331 332 333 334 335 336 337 - 30 31 32 33 34 35 36 37 . H l J 1 1-1 K L M N 1 1 -2 1 1 ~3 . 11~4 11-5 1 1—6 1 1—6 ‘21 22 12—8 1 2~9 ' 1 1—5 320 321 322 ' . ' 0—7 0~8 0—9 12—8—2‘5’ 11—84(6) 0—8—2 12—8—7”) 0—8—5‘31 Remarks E :3; ‘ 0 11—7 11—8 11—9 P Q 0—2 0—3 0-4 0-5 0—6 8 T R ‘ 0-7 0—8 0—9 11—8—5 8—7 12—8—5 8—5 8—2‘3) U V W X Y ‘ ' Z [ opening bracket, SHIFT/K \ backslash. SHIFT/List ] closing bracket, SHIET/ M ‘ __ circumflex”) underline‘W Footnotes: (1) On some DEC 026 Keyboards this characterIs graphically represented 330 (2) ‘ (3) (4) (5) On most DEC Teletypes circumflex is replaced by up—arrow (t). Acard containing this code in column 1 with all remaining columns blank is an end—of—file card. On most DEC Teletypes underline is replaced by backarrow (<~). On some 029 keyboards this character is graphically represented as a cent (6) (7) (8) (9) (10) sign (G). On some 029 keyboards this character is graphically represented as logical NOT (—). On some 029 keyboards this character is graphically represented as vertical bar ( I). On some LP8 line printers the Character diamond (0)is printed instead of backslash. On some LP8 line printers, the character heart (0)Is printed instead of underline The number sIgn on some terminalsIs replaced by pound sign(£ ). B-3- . apartial list of flowchart symbols which can be used The following is ~ to'diagram the logical flow of a program. The symbols, may be made sufficiently large to include the pertinent informatiOn. The direction of flow in a program is represented by lines drawn between symbols. These lines indicate the order in which the operations are to be performed. Normal direction REPRESENTATION OF FLOW LEFT TO RIGHT oa' ' RIGHT TO LEFT - ' of flow is from left to right and top to bottom". When the flow direction is not from left to‘ right or top to bottom, arrowheads are placed on the reverse direction flowlines. Arrowheads may also be used on normal flow lines for increased clarity. . TOP . ‘ T0 aorrou on - BOTTOM TO TOP ' TERMINAL The. oval symbol represents a terminal point in a program. It can be used to indicate a start, stop, or interrupt of program flow. "The appropriate word is. included within the symbol. PROCESSING The rectangular symbol represents a processing function. The process which the symbol is used to represent could be an instruction or a- grOup of instructions to carry out a given task. A brief description of the task to be performed is included within the symbol. . DECISION A diamond is used to indicate a point in a program where a choice must be made to determine the flow of the program from that point. A test condition is included within the <> symbol and the possibleresults of the test are .used to label the respective flows from the symbol. , ’ symbolis used to represent an operagroup of operations not detailed in the flowchart. It is usually detailed in another flowchart. A subroutine is often represented This PREDEFINED PROCESS tion or in this manner. CONNECTOR The circular symbol * . represents an entry from an exit to another part of the program flowchart. A number or a letter is enclosed to label the corresponding exits and entries. This symbol does not represent a or i . . program Operation ANNOTATION F“— An addition of descriptive comments or ex- planatory notes for clarification is included within this symbol. INPUT/ OUTPUT This symbol is used in a flowchart to repre- sent the input or output of information. This [:7 . symbol may be used for all input/ output functions, or symbols for specific types of input or output (such as those which follow) may be used. This symbol may be used to represent the W Cl line keyboards, switch settings, etc. PUNCHED The input Or outpUt of information in which TAPE MAGNETIC TAPE 53 Q manual input of information by means of on- the medium is punched tape may be repre- sented by this symbol. This symbol is used in a flowchart to repre» sent magnetic tape 02 input or output. Page «1 D-l D-2 D-3 PDP-S/ E Memory Reference Instructions Loading Constants into the Accumulator .................... I 2 Group Group Operate Microinstructions 3 Group Operate Microinstructions Programmed Data Transfer Instructions KM8—E Memory Extension ' 4 5 -6 7 8 -9 pucoedeucouovueo Operate MiCroinstructions D—4 ............................ D-5 D-S ...................... KES-E Extended Arithmetic Element Teletype Keyboard/ Reader D-S D—6 .......................... D-7 .......................................... O Teletype Teleprinter/Punch Readers 2 PPS-E Paper Tape Punch D-7 .......... ‘ I PR8-E Paper Tape ' .............................. ............ . ' 3 PC8- E Reader/Punch 4 TC08-P DECtape Control 5 TC58 DECmagtape System D-7 D-7 ............................................ D-8 .............. D—8 ............... D-8 .......................................... 6 RKOS- P Control and RKOl Disk Drive and Control 7 DF32—D Disk File and Control D -9 8 RF08 Disk File 9 ~TM8-E/F Control D- 10 D—9 .................................... ........................................................... ................... '._ D- 10 ..................... 0 LE-S Line Printer ..... _ D-ll 1 CRS-E Card Reader and Control or .............. . ......... ..................... VCS-E'CRT Display Control 4 VWOl ............... ................. Writing Tablet 5 DC02-F 8- Channel Multiple Teletype Control -26 BBOS- P General Purpose Interface Unit 27 Universal Digit Controller 8 DR8- BA 12- Channel Buffered Digital I/O 9 MP8- E Memory Parity O Synchronous Modern Interface 1 Multicycle Data Break Locations ..................................................... ' ...... ...... ....... ........... ~. .......... .................................................. .................................... .................................. 2 KM8—E Time-Share .............. 3 DKS-EP Programmable Real Time Clock 4 DK8- EA Line Frequency Clock ..~1 5 DK8- EC Crystal Clock .: .................. ............................... ................ ................................ . -36 KP8-E Power Fail Detect -37 DP8-EP Redundancy Check Option D-38 DRS-E Interprocessor Buffer D-39 ADOlA 12-Bit Analog-to-Digital Converter D-4O AASO Digital-to-Analog Converter D-4l ADS-EA A/ D Converter D-42 AAOSA/AA07 Digital- to-Analog Converter and Control D-43 AFC-8 Low-Level Analog Multiplexer D-44 AF04A Guarded Scanning Integrated Digital Voltmeter (IDVM') .............. ; .......... ............................ ........................................ ................ .............................. .............................................. ............................................................ ........................ » D-3 ............................ .......................................... -23 - “D21 ............................ Optical Mark Card Reader and Control -22 XYS-E Incremental Plotter Control uuuueuueuc D-2 .............. .............................................. D-l D-ll D-ll D—12 D-12 D-12 D-13 D-l3 D-l3 D-14 ‘D-l4. D-lS D-15 D-lS D-15 D-l6 D-l6 D-l6 D-l6 D-l'l D-l7 D-17 mm mm D-18 Table Dfl PDP-B/ E Memory Reference Instructions (Refer to Chapter 3) Execution Times Mnemonic Octal Code Indicators AND Y IR:0,F,E Symbol 0 . Direct Address Indirect Address Auto}ndexed 2.6 3.8 4.0 . 1 IR 2 LEE 'Logical _AND between Y and AC _ TAD Y Operation 2.6 3.8 4.0 Two’s comple- ' ment Add Y to AC ‘ rsz Y 2 IR: 2,F,E 2.6 3.3 DCA Y 3 IR=3,F,E 2.6 3.8 4.0 Increment Y and skip if zero 4.0 Y and clear AC ' Deposit at JMS Y 4 IR=4,F,E 2.6 3.8 4.0 subroutine at Y IMP Y 5 IR : 5,F 1.2 2.4 2.6 Jump to Y Jump to Table D-2 Loading Constants Into The Accumulator Mnemonic Decimal Constant Octal Code NLDOOO = NL-DOOI == NLOOOZ :: 0 2 7300 7301. 7305 NL0002 : NL0003 : NL0004 : NL0006 : NLOIOO: NLZOOO : 2 7326 3 7325 7307 7327 7203 1 Instructions Combined CLA CLL CLA CLL IAC CLA CLL IAC RAL (or) NL3777 : 141.4000: NLS777 : NL6000 : NL7775 : NL7776 : NL7777 : 4 6 64 1024 7330 7352 7333 ~1024 —~—3 ——-1 _ 7350 ~O ~1025 RTL CLA CLL CML IAC RAL CLA CLL IAC RTL CLA CLL CML IAC RTL CLA IAC BSW CLA CLL CML RTR CLA CLL CMA RAR CLA CLL CML RAR CLA CLL CMA RTR CLA CLL CML IAC RTL CLA CLL CMA RTL CLA CLL CMA RAL CLA CLL CMA ' 7332 2047 -—2 CLA CLL CML > 7346 7344 _ 7340 D~2 Table D-3 Octal Mnemonic Symbol NOP Group 1 OperateMicroinstructions * Code 7000 , Sequence Operation. No operation Causes program delay. —— _ IAC 7001 fig RAL 7004 4 a 1.2 Increment AC. The content of .the AC1s incremented by one in two’s complement arithmetic. Rotate AC and L left. The con- tent of the AC and the L rotated left one place. RTL ' 7006 7010 7012. the ”left. successive Rotate 4 Equivalent to two RAL operations. Rotate AC and L right. The con- two' places to tent of the AC and L are rotated - RTR are 4 , RAR its right one place. Rotate two places to the right. Equivalent to two successive 4 . RAR . BSW 7002‘ 4 CML 7020 2 CMA 7040 2 Byte swap. Complement L. Complement AC. The content of . CIA 7041 operations. - 2, 3 the AC is set to the one’s com— plement of its current content. Complement and increment acto form two’s cumulator. Used CLL 7100 1 CLL RAL 7104 1, 4 CLL RTL 7106 1, 4 CLL RAR 7110 CLL RTR 7112 STL 7120 1, 4 1, 4 1, 2 ' complement. Clear L. : Shift positive number one left. Clear link, rotate two left. Shift positive number one right. Clear link, rotate two right. Set link. The L is set to contain a CLA 7200 CLA IAC 7201 binary 1. Clear AC. To be used alone or in CPR 1 combinations. 1 Set AC 2 1. GLK 7204 1, 3 1, 4 CLA CLL 7300 1 Clear AC and L. STA 7240 2 Set AC =.—1 Each bit of the AC is set to contain a 1. Get link. Transfer L into AC11. D—3 ' Table D4 Group 2 Operate Microinstructions Mnemonic Symbol Octal Code Sequence Operation HLT 7402 3 Stops the program after completion of the cycle in proHalt. ~ If this instruction is combined with others in the CPR 2 group the other operations are completed before the end of the cess. cycle. OSR 7404 3 OR with switch register. The OR function is performed between the content of the SR and the content of the AC, with the result left in the AC. SKP 7410 1 SNL 7420 1 SZL 7430 1 7440 1 7450 1 7460 1 Skip, unconditional. The next instruction is skipped. Skip if L i 0. Skip if L 0. Skip if AC : 0. Skip if AC 75 0. 0, or L 9f 1, or Skip if AC . SZA SNA SZA . SNL = 2 both. V SNA SZL 7470 7500 SMA O. Skip if AC ;£ 0 and L Skip on minus AC. If the content of the AC is a negative number, 1 2: ‘ 1 the next instruction is skipped. SPA 7510» 1 SMA SNL 7520 1 Skip on positive AC. If the content of the AC is a positive number, including zero, the next instruction is skipped. 1, or Skip if AC < 0, or L = both. ' SZL 7530 1 SMA SZA 7540 1 SNA 7550 1 CLA 7600 2 LAS 7604 , SPA SPA CLA 7640 SNA CLA 7650 SMA CLA 7700 SPA 7710 SZA CLA HH‘H VNNW Skip if AC 2 0 and'if L Skip if AC < 0. Skip if AC > 0. = 0. Clear AC. To be used alone or in CPR 2 combinations. Load AC with SR. Skip if AC : 0, then clear AC. Skip if AC 75 0, then clear AC. Skip if AC < 0, then clear AC. Skip if AC 2 0, then clear AC. w v 'D—4 . \ TaHeD-SGroanOperateMicminstnctions Octal Code Mnemonic Symbol NOP Operation 7401 7421 7501 7521 ..MQL MQA SWP No Operation Load Multiplier Quotient Multiplier Quotient OR into Accumulator Swap Accumulator and Multiplier ' Quotient 7601 CLA Clear Accumulator - _ _ CAM 7621 Clear Accumulator and Multiplier 7701 Clear Accumulator, Load Multiplier Quotient into Accumulator (CLA Quotient (CLA MQL) ‘ ACL MQA) Load'Multiplier Quotient into Accumula; tor, Clear Multiplier Quotient ' , ‘ 7721 CLA SWP .. -... .Ta'ble D-6 Brogrammed Data Transfer Instructions Mnemonic Octal Code Symbol ~ ION IOF 6001 6002 6000 6003 SKON SRQ GTF RTF 'SGT CAF 6004 6005 6006 _ 6007 . Operation Interrupt Turn On Interrupt Turn Ofl Skip if Interrupt On, IOF Skip if Interrupt Request Get Flags Restore Flag, ION Skip if “Greater Than” Flag is Set Clear All Flags . . Table D-7 KM8~E Memory Extension Mnemonic SYmbol Octal Code - 6004 6005 62N1 62N2 GTF RTF CDF CIF CD1 62N3 Operation Get Flags Restore Flags, ION Change to Data Field N (N20 to 7) Change to Instruction Field N (N20 to 7) Change Data Field, Change Instruction Field - ' (CDF CIF) RDF RIF RIB RMF 6214 - 6224 6234 6244 Read Data Field Read Instruction Field Read Interrupt Buffer Restore Memory Field D-S Table D-8 KE8-E Extended Arithmetic Element . Mhnmnnun nnfn‘ Symbol Code ileJ lenvlllv VUG‘JL Operation MODE CHANGING INSTRUCTIONS SWAB SWBA SKB 7431 7447 7471 Switch from Mode A to B Switch from Mode B to A Skip if Mode B STANDARD INSTRUCTIONS 7621 7501 CAM MQA ACL MQL 7701 7421 SWP 7521 o—> VAC, 0» MQ MQ “OR”ed with AC~> AC MQ—>AC (MQA CLA) AC-> MQ, 0—> AC AC—> MQ, MQ—+ AC MODE A INSTRUCTIONS SCA SCA CLA SCL MUY DVI NMI SHL ASR LSR 7441 7641 7403 7405 7407 741 1 7413 7415 7417 Step Counter “OR” with AC Step Counter to AC Step Counter Load from Memory Multiply Divide Normalize Shift Left Arithmetic Shift Right Logical Shift Right MODE B INSTRUCTIONS 7403 7405 7407 741 1 7413 7415 7417 ACS MUY DVI NMI SHL ASR LSR AC to Step Count Multiply ’ Divide Normalize Shift Left Arithmetic Shift Right Logical Shift Right DOUBLE PRECISION INSTRUCTIONS ' DAD DST DPIC DCM DPSZ 7443 7445 7573 7575 7451 Double Precision Add Double Precision Store Double Precision Increment Double Precision Complement Double Precision, Skip if Zero D-6 Table D-9 Teletype Keyboard! Reader Mnemonic Octal Code ' Symbol - Operation ' _ KCF KSF KCC 6030 6031 6032 KRS KIE KRB 6034 6035 6036 Clear Keyboard Flag _. _ L Skip on Keyboard Flag Clear Keyboard Flag, and AC, Advance Reader ReadrKeyboard Bufier Static Set/ Clear Interrupt Enable Read Keyboard Buffer, Clear Flag \Table D-10 Teletype Teleprinter/ Punch Mnernonio Symbol Octal Code TFL TSF TCF TPC TSK TLS .. 6040 6041 6042 6044 6045 6046 , _ Operation Set Teleprinter Flag Skip on Teleprinter Flag Clear Teleprinter Flag Load Teleprinter and Print .Skip on Printer or Keyboard Flag Load Teleprinter Sequence Table D-ll PR8-E Paper Tape Readers ‘ Mnemonic Symbol RPE . RSF RRB RFC RCC Octal Code Operation 6010 6011 6012 6014 6016 Set Reader/ Punch Interrupt Enable Skip on Reader Flag Read Reader Buffer Reader Fetch Character Read Buffer and Fetch New Character . (RRB, RFC) \ ' PCE . 6020 Clear Reader/ Punch Interrupt Enable Table D-12 PP8-E Paper Tape Punch Mnemonic Symbol Octal Code Operation RPE 6010 Set Reader/ Punch Interrupt Enable PCE PSF RCF PPC PLS 6020 Clear Reader/ Punch Interrupt Enable 6021 6022 6024 Skip on Punch Flag Clear Punch Flag Load Punch Bufier and Punch Character 6026 Load Punch Buffer Sequence - D—7 Table D-13 PCS-E Reader/ Punch Octal Code Mnemonic Symbol RPE RSF RRB RFC 6010 6011 Operation Set Reader/ Punch Interrupt Enable Skip on Reader Flag Read Reader Buffer Reader Fetch Character Read Buffer and Fetch New Character Clear Reader/ Punch Interrupt Enable Skip on Punch Flag Clear Punch Flag Load Punch Buffer and Punch Character Load Punch Butter Sequence ‘ 6012 6014 ’ 6016 RFC, RRB PCE 6020 PSF PCF PPC' PLS 6021 6022 6024 6026 Table D-14 TC08-P DECtape Control Mnemonic Octal Symbol Code Operation (as) DTRA DTCA DTXA DTLA DTSF DTRB DTXB 6761 6762 6764 6766 6771 6772‘ 6774 Read Status Register A Clear Status Register A Load Status Register A 2.6 2.6 ‘ Time Clear and Load Status Register A Skip on Flag Read Status ' Register B Load Status Register B Address Locations: ' 2.6 3.6 2.6 2.6 2.6 7754 2 Word Count 7755 = Current Address Table D-15' TC58 DECmagtape System Mnemonic Symbol Octal Code MTSF MTCR MTTR MTAF 6701 6711 6721 6712 MTRC 6724 6714 6716 6704 MTCM MTLC none MTRS MTGO, none- 7 6706 6722 6702 Operation . Skip on Error Flag or Magnetic Tape Flag Skip on Tape Control Ready Skip on Tape Transport Ready Clear Registers, Error Flag and Magnetic Tape Flag Inclusive OR Contents of Command Register fInclusive OR Contents of AC Load Command Register Inclusive OR Contents of Status Register Read Status Register Mag Tape “GO” Clear AC 7 D48 Table D-16 RK08-P Control and RK01 Disk Drive and Control ' Mnemonic Symbol _ Octal Code DLDA 6731 DLDC 6732 6733 6734 6735 6736 6737 6741 6742 6743 6745 6747 6751 6752 6753 6755 6757- Time (as) Operation —“ Load Disk Address - 2.6 (Maintenance Only) - DLDR DRDA DLDW DRDC DCHPDRDS DCLS DMNT DSKD DSKE DCLA DRWC DLWC ' “ _DLCA - DRCA Load Command Register Load Disk Address and Read . 26 2.6 2.6 2.6 3.6 4.6 Read Disk Address Load Disk Address and Write Read Disk Command Register Load Disk Address and Check Parity Read Disk Status Register ' _ 2.6 . Clear Status Register Load Maintenance Register _ ' Skip on Disk 'Done Skip on Disk Error ‘ Clear All Read Word Count Register Load Word Count Register Load Current Address Register Read Current Address Register - ' Table D-17 DF32-D 2.6 3.6 3.6 4.6 2.6 3.6 3.6 3.6 4.6 Disk File and Control ‘ Mnemonic Octal Code Symbol DCMA DMAR DMAW DCEA DSAC DEAL DEAC DFSE DFSC DMAC . 6601 6603 6605 6611 6612: 6615 6616 6621 6622 6626 Time ' Operation — " (#3) Clear Disk Address Register Load Disk Address Register and Read Load Disk Address Register and Write Clear Disk Extended Address Skip on Address Confirmed Flag 'Load Disk Extended Address Read Disk Extended Address Skip on Zero Error Fla'g Skip on Data Completion Flag Read Disk Memory Address Register , ~ Address Locations: " ’ 7750 = Word Count 7751 2 Memory 2.6 3.6 3.6 2.6 2.6 3.6 3.6 2.6 2.6 3.6 _Address D-9 ' Table D-18 RFGS Disk File Symbol Octal Code DCIM 6611 DIML 6615 DIMA. 6616 DFSE 6621 6623 6641 6643 Mnemonic ‘ Operation _ Disk Interrupt Enable and Core Memory Address Extension Register Load Interrupt Enable and Memory Ad- ‘ Clear ‘ dress Extension Register DISK DCXA DXAL DXAC DMMT ’ 6645 6646 Load Interrupt and Extended Memory Address Skip on Disc Error Skip Error or Completion Flag Clear High Order Address Register Clear and Load High Order Address Reg\ ister AC & Load DAR into AC Clear ' Initiate Maintenance Register Table D-l9 TM8-E/ F Control Mnemonic Symbol Octal Code LWCR 6701 CWCR LCAR CCAR LCMR LFGR LDBR RWCR CLT RCAR RMSR RCMR 6702 6703 6704 6705 6706 6707 6711 6712 6713 6714 6715 .RFSR 6716 RDBR SKEF 6717 ‘6721 SKCB 6722 SKJD SKTR CLF 6723 , 6724 .6725 Operation Load Word Count Register Clear Word Count Register Load Current Address Register Clear Current Address Register Load Command Register Load Function Register Load Data Bufier Register Read Word Count Register Clear Transport Read Current Address Register Read Main Status Register Read Command Register Read Function Register & Status Read Data Bufier Skip if Error Flag Skip if Not Busing Skip if Job Done Skip if Tape Ready Clear Controller and Master D-10 Table»D'-20 LE-S Line Printer MnemOnic Octal Symbol Code PSKF PCLF PSKE 6661 PSTB Operation Skip on Character Flag Clear the Character Flag Skip on Error Load Printer Buffer, Print on Full Bufler or ’ 6662 ' - 6663 6664 Control Character Set Program Interrupt Flag Clear Line Printer Flag, Load and Print Clear Program Interrupt Flag . PSIE PCLF, PSTB PCIE 6665 6666 A 6667 ~ Character, . Table D-21 CRS-E Card Reader and Control or-CM8;E Optical Mark Card Reader and Control Mnemonic Octal Symbol Code RCSF RCRA RCRB RCNO 6631 6632 6634 6635 6636 ,. Operation ' RCRC RCNI RCSD RCSE RCRD RCSI RCTF Skip on Data Ready Read Alphanumeric Read Binary ' - Read Conditions Out to Card Reader Read Compressed Read Condition 'In .From Card Reader Skip on Card—Done Flag Select Card Reader and Skip if Ready Clear Card Done Flag 6637 6671 6672 . 6674 Skip If Interrupt Being Generated Clear Transition Flags 6675 6677 Table D-22 XY8-E Incremental Plotter Control Mnemonic Octal Symbol Code PLCE 6500 6501 ‘ ' ‘ PLSF PLCF PLPU PLLR PLPD . 6502 6503 6504 Clear Interrupt Enable Skip on Plotter Flag Clear Plotter Flag Pen Up Load Direction Register, Set Flag 6505 Pen Down PLCF, PLLR 6506 ’ PLSE Operation 6507 _ ' Clear Flag, Load Direction Register, Set Flag Set Interrupt Enable D—11 \4 Table 13-23 VC8-E CRT Mnemonic Octal Symbol Code DILC 6050 DICD DISD DILX DILY DIXY 6051 6052 6053 DILE 6056 6057 ‘ 6054 6055 DIRE Display'Contl-ol Operation Clears Enables, Flags and Delays Clears Done Flag Skip on Done Flag Load X Register Load Y Register Clear Done Flag; Intensify; Set Done Flag Transfers AC to Enable Register Transfers to AC Display Enable/ Status Register Table D-24 VW01 writing Tablet Mnemonic Octal Symbol Code WTSC WTRX 605 4 6052 6072 6074 6064 WTRS WTSE WTMN Operation Set Tablet Controls Read X Read Status Select Tablet Clear Set XY _ Table D-25 DC02-F Iii-Channel Multiple Teletype Control Mnemonic Symbol Octal Code Operation MTPF 61 13 Read Transmitter Flag MINT 6115 6117 6123 6125 6127 6111 6112 Set Interrupt Flip-Flop Select Specified Station Read Receiver Flag‘Status 61 14 Receive Operation Combined MKRS & MICCC Skip on Transmitter Flag Clear Transmitter Flag MTON MTKF MINS MTRS MKSF MKCC MKRS NONE _ MTSF 6116 6121 MTCF 6122 MTPC NONE 6124 6126 Skip on Interrupt Request ' ' Read Station Status Skip on Key Board Flag Clear Receive Flag Transmit Operation Combined MTCF & MTPC D—12 Table D~26 BB08-P General Purpose Interface Unit Mnemonic Octal Symbol Code GTSF 6361 6362 GCTF GRSF GCRF ' 3 - GRDB (#5) Operation 2.6 Skip on Transmit Flag Clear Transmit Flag (User-Assigned) Skip on Receive Flag Clear Receive Flag 6564 6371 6372 6374 Time 2.6 2.6 2.6 2.6 2.6 Read Device Buffer Table D-27 Universal Digit Controller (UDC) Mnemonic Symbol Octal Code UDSS UDSC UDRA ,UDLS ' UDSF UDLA UDEI ' Time Operation (,uS) 6351 Skip on Sean Not Busy 2.6 6353 6356 6357 6361 6363 Start Interrupt Scan Read Address and Generic Type 3.6 3.6 Load Previous Status 4.6 Skip own: UDC Flag and Clear Flag 2.6 3.6 2.6 3.6 3.6 4.6 _ Load Address 6364 UDDI 6365 6366 6367 UDRD UDLD - - Enable UDC Interrupt Flag Disable UDC Interrupt Flag Clear AC and Read Data Load Data and Clear AC. Table D-28 DR8-EA 12-Channel Buffered Digital 1/ O Mnemonic Octal Symbol Code _ DBDI » 65x0 Disable Interrupt 65x1 65x2 65x3 65x4 65x5 65x6 Enable Interrupt Skip on Done Flag ' DBEI a DBSK DBCI DBRI DBCO DBSO DBRO Operation 65x7 Clear Selective Input Register Transfer Input to AC Clear Selective Output Register Set Selective Output Register Transfer Output to AC D—13 . _ «Table D-29 MPBE-Memory Parity Mnemonic Symbol Octal Code ‘SMP, CMP 6100 6101 6103 6104 6105 CEP 6106 SPO 6107 DPI SMP EPI CMP Operation Disable Memory Parity Error Interrupt Skip on No Memory Parity Error Enable Memory Parity Error Interrupt Clear Memory Parity Error Flag Skip- on No Memory Parity Error, Memory Parity Error Flag Check for Even Parity Skip on Memory Parity Option Clear Table D-30 Synchronous Modem Interface Mnemonic Symbol SGTT SGRR ‘SSCD SCSD SSRO SCSI SRTA SLCC SSRG SSCA SRSZ Octal Code 6405 6404 6400 6406 6402 6401 6407 SLFL SSBE SRCD 6412 6410 6411 6414 6415 6413 6416 6417 SSTO 6403 SRSl Operation Transmit Go Receive Go Skip if Character Detected Clear Sync Detect Skip if Receive Word Count Overflow Clear Synchronous Interface Read Transfer Address Register Load Control Skip if Ring Flag Skip if Carrier/AGC Flag Read Status 2 Read Status 1 Load Field Skip on Bus Error Read Character Detected (if ACO:0) . _ Maintenance Instruction (if ACO=1) Skip if Transmit Word Count Overflows Break Address Locations: For additional interfaces: ' 7720 . 7721 Test Characters 7722 7723 7724 Receive Word Count 7725 Receive Current Address 7726 Not Used 7727 Transmit Word Count 7730 Transmit Current Address Device Codes 42,‘ 43 44, 45 46, 47 . D-l4 Break Locations _ 7700-7710 7660-7670 7640-7650 Table D-31 Multieycle Data Break Locations ,1 I Date Break Device Assigned Locations Channel ‘ ‘ DPS-EA/ BB DP8-EA/ EB 7640-7650 7660-7670 7700-7710 7720-7730 4 ‘ ' 3 . . DPS-EA/EB. 2 - ' ‘ 7750,7751 _ 7752,7753 7754,7755 - ‘ DP8- EA/EB DF32- D 1 (Reservedfor Industry Standard Magnetic ' TC08-P Table D,-32 KM8-E Time-Share Mnemonic Octal Symbol Code Operation ‘ 6204' CINT SINT CUF SUF Clear User Interrupt 6254 6264 6274 Skip on User Interrupt Clear User Flag Set User Flag - 1 Table D-33 DK8-EP Mnemonic Octal Programmable Real Time Clock -- _ ' ' Symbol Code, CLZE CLSK CLOE CLAB CLEN 6130 Operation , 6131 6132 6133 6134 ' - 1 6135 6136 6137 CLBA CLCA AC to Clock Buffer Load Clock Enable Register __ CLSA Clear Clock Enable Register per AC 'Skip on Clock Interrupt Set Clock Enable Register per AC - Clock Status to AC Clock Butler to AC Clock Counter to AC Table D-34 DK8-EA Line Frequency Clock A ‘Mnemonic Octal Symbol Code CLEI 6131 6132 6133 A CLDI CLSK ‘ Operation Enable Interrupt Disable Interrupt Skip on Clock Flag and Clear Flag D-15 __ Tape) . ' Table D-35 DK8-EC Crystal Clock Mnemonic ’ Symbol . CLEI CLDI Octal Code Operation 61 3 1 6132 6133 CLSK ' ‘ Enable Interrupt Disable Interrupt Skip on Clock Flag and Clear Flag Table D-36 KP8-E Power Fail Detect Octal Code Mnemonic Symbol ’ Operation ~ SPL 6102 Skip on Power Low Table D-37 DPS-EP Redundancy Check Option Mnemonic Octal Code Symbol .. Operation Test VRC and Skip 6110 6111 6112 RCTV RCRL RCRH RCCV RCGB 'RCLC RCCB Read BCC Low Read BCC High Compute VRC Generate BCC Load Control Clear BCC Accumulation 61 13 61 14 61 15 6116 Table D-38 DR8-E Interprocessor Bulfer Symbol Octal Code DBRF 65x1 DBRD 65x2 Mnemonic » ‘ Operation Skip if the receive set to a 1 ' incoming data into the AC, clear lie-ceive flag Read " DBTF 65x3 Skip if the transmit flag is set to a 1 ‘DBTD 65x4 Load the AC into the transmit buffer, transmit and set the transmit flag ‘ 65x5 Enable the Interrupt Request line DBDI 65x6 Disable the Interrupt Request Line DBCD 65x7 Clear done flag DBEI ' D—16 Table D-39 ADOIA, lZ-Bit Analog-to-Dig‘ital Conferter .Mnemonic . . Symbol Octal Code Time - Operation - ‘ (,us) - ‘ ADSF ADRB -- 6531 6532 Skip on A/ D Done ‘Flag‘ ‘ Read A/ D Buffer ConVert Analog Input Select Multiplexer Channel and Gain Read A/ D Buffer, Clear Flag, and Start Conversion Select Channel and— Gain and Read A/ D Bufier - ' 6534 ADCV ADSC ADRC , 6535 6536 ., 2.6 2.6 2.6 3.6 ' - 6537 ADSR Table D -40 AA50 Digital-to-Analog Converter "j' 3.6 4.6 ‘ ‘ Mnemonic Symbol Octal Code DAC 1 6551 6552 '6553 6554 6555 6556 DAC 2 DAC3 DAC4 DAC 5 DAC6 ‘ , Operation _ _ ' ' Select DAC 1 Select DAC 2 Select DAC 3 Select DAC 4 Select DAC 5 Select DAC 6 . - 3.6 ' _ . Symbol Code Operation ADCL ADLM 6530 Clear Flags Load Multiplexer Start Conversion Read A/ D Buffer Skip on A/ D Done Flag 6532 6533 6534 65 35 6536 6537 - ' ADRS . Skip on Timing Error Load Enable Register Read Status Register D17 ‘ 2.6 2.6 Octal ADRB ADSK ADSE ADLE (us) _ Mnemonic ADST Time 2,6 Table 13-41 ADS-EA A/D Converter 6531 _ _ . . ‘ 3.6 3.6 Table D-42 AA05A/AA07 Digital-to-Analog Converter (‘nnhnl and uuu v Vllll VI. 7‘ '2 Mnemonic Octal Symbol Code Time " Operation , DACL DALD 6551 6552 DALI ' , DAUP (us) Clear DAC Address Load DAC Address - 6562 6564 2. ' Load DAC Input Register Update All Channels 2.6 2.6 2.6 , Table D-43 AFC-8 Low-Level Analog Multiplexer ' Octal Code Mnemonic Symbol ADSG ADSA Time ADRB ADSG ADSA Table D-44 AF04A Guarded Scanning Voltmeter (IDVM) Mnemonic Symbol VCNV VSEL VINX VSDR VRD VBA VSCC ' ' 2.6 2.6 2.6 2.6 2.6 2.6 Integrated Digital Time Octal Code Operation 6541 6542 6544 6561 6562 6564' 6571 (as) Set Multiplexer Gain Set Multiplexer Address Skip on A/ D Flag Read A/ D Converter Buffer Set~Multiplexer Gain Set Multiplexer Address 6542 6544 6531 6534‘ 6542 6544 ADSF Operation _ ~ ' - (II-S) Select Channel and Convert Select Range and Gate Index Channel and Convert 2.6 Skip on Data Ready 2.6 2.6 2.6 2.6 Read Data and Clear Flag Byte Advance Sample Current Channel .D—18 2.6 2.6 READ-IN MODE (RIM) LOADER The RIM Loader is used to load programs punched on RIM format paper tape into core memory. -It is stored in core memory locations 7756-7776 (218 locations), and started at location 7756. There are two versions of the RIM Loader, permitting either the high- or the lowfspeed reader to be used as an input device. The locations and corresponding instructions for both versions are listed below. Figure E-1 provides instructions for loading the RIM Loader. M RIM Loader Programs Table E-l INSTRUCTION ’ Location _ . 7756 7757 7760 7761 7762 7763 7764 Low-Speed Reader 6032 _ 6036 7106 ’ 7006 7510 5357 7006 6031 5367 6034 I 7770 7771 7772 7420 7773 3776 7775 ._ ' 7767 7774 6014 6011 ‘5357 6016 7106 7006 . 6031 5357 7765 7766 " High-Speed Reader - 3376 5356 _ -' 7510 5374 7006 6011 5367 6016 - 7420 3776 3376 5357 Note: Location 7776 is used for temporary storage. lE—l - < I IN ITIALIZE ' SET ROTARY SELECTOR SWITCH TO MD I SET SWITCHES 6-8 To DESIRED FIELD* INSTRIXZTION - *EEETAPE USERS SHGJLD. LOAD RIM INTO FIELD 0 SET SWITCHES 9-11 T0 DESIRED DATA HELD I PRESS EXTD ADDR LOAD sE'T SR TO 7755 I PRESS ADOR LOAD SET SFI= FIRST INSTRUCTION LIFT DEF SET SR= NEXT INSTRUCTICN LIFT DEP RIM IS LOADED Figure E-l Loading the RIM Loader E-Z BINARY (BIN) LOADER ‘ The BIN Loader is used to load programs punched on BIN format paper tape into core memory. It is stored in core memory ' . locations 7625-7752 and 7777 (1278 locations), and started at used to load a RIM location 7777. The RIM Loader is usually format tape of the BIN Loader. When the BIN Loader is used to load a binary tape, must be ' caution. exercised to ensure that the tape is started with binary (code 200) under the read station. If the tape is started before this code, the contents of core memory may be lost. Figures E-2 and E—3 provide instructions for loading the BIN Loader by means of the RIM Loader and using the BIN Loader leader code to store a binary program. E-s 0 LOAD RIM SET ROTARY SELECTOR SWITCH TO MD RIM I SET SWITCHES 9-” TO FIELD IN WHICH BIN IS TO BE LDMED PRESS EXT 0 ADM LOAD SET SR¥7756 PRESS ADDR LOAD HIGH'SPEED LOW- SPEED READER wan HSR on ' PUT am m LOADEFI nsnit > mess CLEAR MD com PRESS HALT SET SWITO'ES 6~8 TO FIELD BIN WAS LOADED INTO SET SR-7TTT PRESS ADDR LOAD PRESS EXAM YES BIN LOADER IS LOADED Loading the BIN Loader Figure E—2 ' 13—4 o LOAD BIN SET ROTARY SELECTOR SWITCH TO AC l SET SWITCHES 6-8 To FIELD IN WHICH BIN IS LOADED SET SWITCHES 9-“ T0 FIELD IN WHICH PROGRAM IS TO BE LOADED PRESS EXTD m LOAD ISET SR TO .777?! [ PRESS ADDR LOAD HIGH-SPEED READER ? TURN HSR ON SET SR=3777 PUT TAPE IN HS PRESS CONT OBJECT TAPE IS LOADED Figure E-3 Using the BIN Loader to Load a Binary Tape E-5 app MP ”miscellaneoustable's ' Powers of Two 11 3 NH 16 32 ' 128 255 NHO ‘UY-hw O NJO‘ L0 05 025 0125, 0.062- 5 0031 25 0015 625 0007 812 5 0003 906 25 0001 953 512 125 p. .‘ 024 10 0000 976 562 2 048 11 0000 488 281 12 0000 244 192 13 0000 384 14 0000 061 035 156 578 140 625 122 070 312 32 768 15 0000 030 517 '65 536 16 0000 015 258 789 062 131 ‘072 17 0000 007 629 394 531 262 125 144 18 0000 003 814 697 265 524 288 19 0000 001 048 576 20 0000 000 953 674 316 406 097 625 907 348 632 812 000' 476 837 152 21 0000 194 304 22 0000 000 238 418 579 ,388 608 23 0000 000 158 203 101 125 562 5 119 209 289 ,550 781 25 16 777 .216 24 0000 000 059 604 644 775 390 625 33 554 432 25 0000 000 029 802 322 387 67 108 864 26 0000 000 014 901 695 '312 728 27 0000 000 007 450 580 596 923 828 268 435 456 28 0000 000 003 725 290 298 461 536 870 912 29 0000 000 001 862 645 134 217 El 5 161 193 847 656 25 125 914 062 5 149 230 957 031 25 . Octal-Decimal Conversion The following table gives the multiples of the powers of 8 To convert a number from octal to decimal using the table, add the decimal number opposite the digit value fOr each digit position. To convert 402773 to decimal, the following numbers are obtained from the table and added. Position Table entry Digit 16384 0 128 56 7 \iqmoel FNu-PUI 1657510 = 402778 ' ' This process is reversed to convert a number from decimal to octal. Subtract out the largest table entry which allows a positive remainder, then take the column number (position coefficient) of the table entry as the Nth digit of the result, where N is the (digit position) of the table entry. Continue this process, operating on the remainder from each step in the next step, until all digits of the result have been found. For example, to convert 2336510 to an equivalent octal number: row number *20480 : ~256O = —320 = 5X84 5x83 5x 82 . Ox 81 5 —5 0 2 /5X80 555053/ _ F—2 2336510 ‘ ' ’ Octal-Decimal Conversion Table Position Coefficients (Multipliers) , ' ' Octal . Digit ’ Position/ 811 0 1 2 3 4 5 6 7 >2 3 4 '5 6 7 32 40 48 56 (80) 0 2nd'(81) 0 8 '16 24 3rd (82) 0- 64 128 ‘192 256 320 ~384 448 4th (83) 0 512 1,024 1,536 2,048 2,560 3,072 3,584 5th (84) 0 4,096 8,192 12,288 16,384 20,480 24,576 28,672 6th (85) 0 lst V 32,768 65,536 98,304 131,072 163,840 196,608 229,376 Octal-Decimal Fraction Conversion Table Octal .000 .001 Decimal . Octal 000000 . .001953 100 Decimal Octal Oclal Decimal 125000 .200 250000 .300 .126053 .201 .251333 .301 .370053 .3760m . .101 Decimal . . 375000 . .002 .003006 .102 124000 .202 .‘253006 .302 .003 .005650 .103 .130050 .203 .255550 .303 .360659 .004 .007612- .104 .132612 .204 .2571112 .3304 .362612 .304765 . ‘ . “ ,.005 .000705 .105 .134765 .205 .250765 -305 .006 .011713 .106 .136716 .206 .261716 .306 ..007 1013671 -107 «5338611 .207 .263671 .3072. .010 .015025 .110 .140625 .210 .205625 .310 .300025 .011 .017573 ,111 .142576 .211’ .207573 .311 .302576 .012 .010531 .112 .144531 .212 .209531 .312 .301531 .013 .021404 .113 .146434 .213 .271464 .313 .306464 .‘114 .146437 :214 .273437 .314 .300437 .115 .150390 215 .275300 .315 .400330 ’ .014 .023437 .015 .025390- ,531’37i3 r ...3101671 ‘ .016 .027343'“ .116‘ .152343 216 .277343 .‘316 .402343 .017 .020296 v.117 .154296 217 .270206 .317 .404236 .020 .031250 .120 .156250 .2207 3231250 121 . 1511203 .221 . 263203 .321 .035156 .122 .-160156 .222 .265156 .322 .410156 .037109 .123 .237109 .323 .412100 . 021 .022 . 033203 . . . .400250 .320 . 406203 ' .023 . 024 .025 ‘ . 030062 .041015 . 124 .125 .026 .042960 .027 . .030 .046675 .130 .031 .046626 .131 :032 .050731 .033 .052734 .034 .054607 .035 . 036 .037 . 044321 056640 .056593 . 060546 .040 .002500 .041 .004453 .042 .006406 .043 .003359 .044 .070312 .045 .072265 .046 . 126 .127 . 1:12 : .162109 . .223 164062 . .160015' . 224 225' 167066 226 230 .296875 .330 .421675 .231 .235623 .331 .423620 . 175761 .232 .300731 .332 . 177734 .233 .302734 . .155546 .237 . 234 .425761 333 427734 . 304637 .334 .429667 .235 .306640 .335 .431640 .236 .300593 .336 310546 .337 .435546 .437500 . . . . 433593 187500 .240 .312500‘ .340 .160453 .241 .314453 .341 .439453 . 191406 .242 .316406 .342 .441406 . . 103359 .243 .316359 343 .443359 .144 .153312 .244 .320312 .344 .445312 145 .107205 .245 1322265 .345 .447265 .074210 .146 .109213 .246 .324216 .346 .449210 .047 .0761“ .147 .201171 .247, .326171 .347 .451171 .050 .075125 .150 .203125 .250 . 3211125 .350 .453125 0600711 .151 . 205078 .251 .330076 .351 .455018 . 207031 .252 .332031 .352 206964 .253 333904 .353 .354 .457031 .4509“ .460937 .051 .052 .053 . .062031 . 0639114 . . . . 143 4173611 171675 . 163553 .142 . .173625 .181640 141 .416015‘ .419021 .135 140 414002 .325 . .1796” . . 5291015 .327 134 . 324 .326 . .137 . 202966 133 1:16 200062 .294021 . . . .227 . .103021 .7 152 15:1 . . .054 .065037 .154 .210937 .254 .335937 .055 .087650 .155 .212390 .255 . .056 .035643 .057 . 001756 .060 .093750 .061 .095703 . 062 .097656 . 063 .003609 .064 .005 .060 .007 .070 .071 .072 . 07:1 .074 101562 156 . 214643 .157 .216796 160 .218150 . . . . 3371190 . 355 . 3391143 .356 . 257 .341796 .357 .466706 . 260 . 343750 .360 .460750 . 220703 . 261 . 345703 . 361 . 162 .222656 . 262 . 347656 . 362 . 472656 163 . 224609 . 263 .345609 . 363 . 474609 164 . 226562 . 264 .351562 .364 .265 .353515 .365 . 105466 .166 .230463 .266 107421 .167 . 232421 .267 .355466 .357421 .366 . . 109375 . . 234375 . 270 .350375 . . 111326 .171 .236326 .361326 .371 .172 .235261 .271 .272 .303251 27:1 365234 367167 :369140 .113201 . 115234 .117107 . 119140 . 121003 .077 . 123046 . 17o 173 .174 . . . 470703 161 .226515 . .462690 .464043 256 .165 . . . 103515 .. .076 .075 . . . 240734 . .242107 .274 175 . 244140 .275 176 . 246093 . 177 .246046 . F—4 276 277 .367 .476562 .476515 .400466 .462421 . 372 .454375 .466326 .4662111 . . 373 . . . 374 .4921" .375 .434140 . . 370 371053 . 376 373046 , 311 490234 456053 .4930“ . Scales of Notation 2K in Deéimal 2' x 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 x 2' x 2' 0.01 0.02 0.03 1.00695 55500 56719 29 1.01395 94797 1.02101 21257 07193 6067 1.02811 38266 1.03526 49238 41377 1.04246 57608 41121 1.04971 66836 23067 1.05701 80405 61380 1.06437 01824 53360 0.1 1.07177 34625 36293 1.14869 83549 97035 1.23114 44133 44916 1 31950 79107 72894 1 41421 35623 73095 . 3874 62581 72557 11335 16050 79633 64359 01078 17485‘ 09503 75432 38973 38204‘ 23785 05803 98468 78234 97782 1.00069 1.00138 1.00208 1.00277 1.00347 1.00416 1.00486 1.00556 1.00625 0.04 0.05 0.06 0.07 0.08 0.09 - 10 10- O 1 12 144 1 750 23 420 2 3 4 1.000 000 000 000 000 0.063 146 314 631 463 0.005 075 341 217 270 0.000 406 111 564 570 0.000 032 155 613 530 5 303 240 0.000 002 476 0.000 0 3 64.1 100 6 206 46 11 200 7 0.000 000 015 575 360 400 8 0.000 000 001 7346545000900000000 0.9 . 000 00 146 31 1 243 66 16 651 77 221 704 15 2 657 132 610 706 157 364 055 327 745 152 257 143 561 104560276 64 37 75 06 151571 65665 10398 162450 47927 12471 174110 11265 92248 186606 59830 73615 m Octal. 10-1 n 1 :tl‘l 0.2 0.3 0.4 0.5 0.6 0.7 0.8 101 n 10-~ 112 402 762 000 351 035 564 000 432 451 210 000 411 634 520 000 142 0.36 440 000 10 11 12 13 0.000 000 000 006 676 337 66 14_ 0.000 0.000 0.000 0.000 500 000 15 16 17 18 0.000 000 000 000 0.000 000 000 000 0.000 000 000 000 0.000 000 000 000 34 327 724 461 434 157 115 760 5 432 127 413 542 67 405 553 164 731 200 000 400 000 000 000 1 , . . nlogz 10. n nlong nlogz 10 n nlong 1 2 0.30102 99957 0.60205 99913 0.90308 99870 1.20411 99827 1.50514 99783 3.32192 80949 6.64385 61898 9.96578 42847 13.28771 23795 16.60964 04744 6 1.80617 99740 2 10720 99696 4 5 000 022 01 000 001 63 000 000 14 000 000 01. log10 2, n log2 10 1n Deumal n 3 000 000 000 537 657 77 000 000 000 043 136 32 000 000 000 003 411 35 000 000 000 000 264 11 I 7 8 240823 99653 2.70926 99610 3.01029 99566 9 10 O I 19.93156 23 25349 26 57542 29.89735 33.21928 85693 66642 47591 28540 09489 I I Addltlon and Multlpllcatlon Tables Addition Multiplication Binary Scale 0 + 0 0 0+1=1+0=1 1 + 1 = 10 0 X 0 = = O 0X1=1x0=0 1 x 1 = 1 Octal Scale 0 01 102 04 05 06 07 1 030405 06 07 10 2040610121416 02 03 02 03 05 04 06 O7 203040506071011 3061114172225 3‘ 04 05 06 07 1o 11 12 4 10 14 20 24 30 34 4 05 06 07 10 11 12 13 5 12 17 24 31 36 43 5 06 07 10 11 12 13 14 6 14 22 30 36 44 52 6 07 10 11 12 13 14 15 7 16 25 34 43 52 61 7 ~10 11 12 13 14 15 16 Mathematlcal Constants in Octal Scale 3.11037 552421. e = 0.24276 301556. e-' v11: 1.61337 611067. v‘; In 1r 1.11205 loam = V10 = 1r = 1r" = 2.55750 521305. 7 = 027425 530551. ln7 = = 1.51411 230704.‘ 10327 = 404435. '0810 e = 0.33626 754251. 151544 163223. logze = 1.34252 3-12305 407267. log: 10 = 3.24464 _ F—5 0.44742 147707. = — — 0.43127 233602. 0.62573 030645. v2 = 1.32404 746320. 166245. ln2 = 0.54271 027760. 741136. In 10 _= 2.23273 067355. . W9“ digital equipment ‘ . users computer society OBJECTIVES . ' - Society (DECUS) was Digital Equipment Computer Users established in March of 1961 to advance the effective use of Digital Equipment Corporation’s computers and peripheral equip-‘ ment. It is a voluntary, non—profit users group supported by whose to: are DIGITAL, objectives 0 advance the art of computation through mutual education and interchange of ideas and information,- establish standards and provide channels to facilitate the free exchange of computer programs among members, and 0 provide feedback to the manufacturer on equipment and programming needs. A The Society sponsors technical symposia; twice a year (Spring and Fall) in the U. 5., once a year in Europe, Canada; and Australia. It maintains a Program Library, publishes a library catalog, proceedings of symposia, and a periodic newsletter: DECUSCOPE. A DECUS—Europe organization was. formed in 1970 to assist in the servicing of European members. , . G-l ' DECUS PROGRAM LIBRARY . . The DECUS Program Library is one of the major activities of the group. It is maintained and operated separately from the DIGITAL library andcontains programs contributed by users. Prousers grams are available for all DIGITAL computer lines. The Library contains many types of programs, such as executive routines, editors, debuggers, special functions, games, maintenance and various other classes of programs. Library Catalogs are issued which list all programs available from DECUS. There are submission standards which programs must meet be— fore they are accepted into the Library. Review procedures deter- mine whether the program remains in the or is removed. Library, is changed, Forms and information for submitting programs to the Library may be obtained from a DECUS office. Programs are available to all memberson a request basis. Requests for programs should be made on DECUS Library Request forms and directed to the DECUS cases, a Program Library. In most nominal service charge will be associated with a program. Information on program charges is published in the Library Cata— log. European members may forward requests through the European DECUS oflice in Geneva. As of December 1972, the Library contained approximately 1,600 programs. DECUSCOPE DECUSCOPE is the Society’s technical nersletter, published since April, 1962. The aim of this informal news “scope” is to facilitate the interchange of information. Society members are ideas, programming notes, letters, and appli« cation notes for publication. DECUSCOPE is mailed as issued to all members. Circulation reached 16,500 in 1972. invited to submit All submissions'to DECUSCOPE should be sent to‘the Editor, DECUSCOPE, at the DECUS Ofice in Maynard orGeneva. G—2 7' ACTIVITIES » . Two nation-wide symposia are held each ‘ -. . year—one in the spring and the otherin the fall. Seminars are also held annuallyin Europe, Canada, and Australia. The proceedings and papers presented at the symposia and seminars are published shortly after each meeting and are sent automatically to meeting attendees and, for a nominal charge, upon request to mothers DECUS sponsored the first workshop meeting of the Joint Users Group of the Association for Computing Machinery in April, 1966, and has actively participated in workshops held each year since. The purpose of the Joint Users Groupmeetings is to establish means for intercommunication among user groups. DECUS is also a _ member of- the Joint User JUG. This Group Library catalog; contains lists Catalog Project sponsored by of programs available from several major user groups. Members of the participating user groups will be eligible to requestprogram documentation from other groups through their Program Inter— change Chairman, i.ve., for DECUS members, the DECUS Executive Director. Specific details on this interchange program are available from the DECUS office. DECUS encourages subgrouping of users with common interests. Local User, Groups. (LUG’s) have formed in many areas for _ , the purpose of providing closer communication between users in specific field or area. Special Interest Groups (SIG’s) have formed for the purpose of providing closer communication between USers of a specific product or application area. They provide valuable grOup feedback to the manufacturer on specific program— ‘ming and hardWare needs. Current Special, Interest" Groups are: PDP—6/ 10 Mainframe Group, Education SIG, Physics» SIG, Graphics SIG, PS/ 8 SIG, PDP-8 Newspapers Users Group, LUDEC—Laboratory Users of Digital Equipment Computers, and a I Users SIG BATCH MEMBERSHIP Membership in DECUS is voluntary and does not require the payment of dues. Members are invited to take an active interest Society by contributing to the program library, to DE— CUSCOPE, and by participating in its meetings and symposia. There are two types of membership in DECUS: Installation Mem— bership and Individual Membership. in the . G-3 ' , MEMBERSHIP—DECEMBER 1972 Installation Delegates—~—7,0SZ Individual Members—8,243 Installation Membership An -... D!" nroanivation Vflnir‘l'l lane hut-plan: mg t”Minus.“ ....... m... m... 11nd n!- w 119.3 A” n.- uu U1. gr («I n nnm a UUIII‘ pater manufactured by Digital Equipment Corporation is auto— matically eligible for installation membership in DECUS. Mem— bership status is acquired by submitting a written application'to the Executive Director or European Secretary for approval by the DECUS Board. An organization may appoint one delegate for each DEC com- puter owned. The delegate should be one who is immediately emerned with the operation of the computer he represents and who is willing to take an active part in DECUS activities. He is . entitled to vote on all DECUS policies and during the election of officers. ‘ ’ " Mal“ Membership ' There are two classes for individual membership: 1. desiring membership in DECUS who are em— ployed at an installation but are not appointed delegates. 2. Individuals who have a direct interest in DECUS 01‘ DEC ‘ Individuals computers but are not‘employees of a DECUS installation member. An individual member is not entitled to vote on DECUS policies during elections. Written application indicating desire to join must be submitted to the DECUS oflice for approval by the DECUS Board. There is no limit to the number of individual members that may join from either an installation or a non-installation. or '- EXECUTIVE BOARD, POLICIES AND ADMINISTRATION Society’s policies are formulated by an Executive Board elected by vote of Installation Member delegates. The Administrative office is located at Digital Equipment Corporation, Maynard, 'Massachusetts, 01754, and all correspondence should be directed to: the attention of the DECUS Executive .»= Director. ”The EuropeanRegio‘nal Administrative office is located at- Digital Equipment ‘S.A.,r 8‘13? Route'de l’Aire,_CH-1-211- Geneva 26, The _ A ‘ > . ' ' Switzerland. ' ‘ . ~ . G—4 DECUS PROGRAM LIBRARY CATALOG ., The DECUS Program Library, Catalog . contains detailed infor— mation on programs available from the DECUS Library. Catalogs are divided according to computer line. A member must request the catalog of. his interest. PeriOdic updatesare sent automatically. necessary to find an item in a.‘ table or array (i.e. the index). Absolute address: A binary number that is permanently assigned as Arithmetic Binary and octal operations, 3-11 Division, 3-13 Double precision, 3-14 Multiplication, 3-13 Overflow, 3-11 the address of a core storage location. Absolute value, 8-6 Access time: The time required to locate an off-line storage location. Powers of two, 3-16 Accessing data: The process of locating the oif- line storage location Programming operations, 3-10 Subtraction, 3-13 with which data is to be trans”ferred. Accessing data Arithmetic unit: The component of a computer where arithmetic and? blocks, 7- 15 logical operations are performed, 1-32, 2-5. Array: A. set or list of elements, usually variables or data. ASCII: An abbreviation for Ameri- Accumulator. A 12-bit register in which the result of an operation is formed; abbreviation: AC, 2-6 - Accuracy of extended functions, 8-37 Address: A label, name, or number which designates a locat1on where can Standard Code for Information Interchange, 4-16 ~ information is stored._ Assemble. Address modification, 3-19 symbolic * program Address load switch, 4-3 Addressing, Algorithm: A prescribed set of welldefined rules or processes for the solution of a problem in a finite number of steps. Alphabetic data, 1-34 Alphanumeric: Pertaining to a char-' acter set that contains both letters and numerals, and usually other characters. AND group microinstructions, 2—25 AND instruction, '2-9 AND logical operation, 1-29 Answers to exercises, A-l Appending symbols symbol table, 5—46 to extended 2. A variable or constant which is given in the call of a subroutine as information to it. A variable upon whose value the value of a function de- pends. 3. The knOWn translate from a binary by substituting binary program to a reference factor . eration codes and; absolute or relocatable addresses for symbolic addresses. Assembler. A program which translates symbolic op—codes into machine language and assigns mem— ory locations for variables and constants. of the 0010' from through 0017 is addressed indirectly, the content of that location is incremented by one rewritten in that same location, and used as the effective address of the current instruction. When indexing. Aato— absolute 10cations one Auto—indexing, 8-20 Automatic processes, 1-3 Argument: 1. To operation codes for symbolic op- 2-13 Direct, 2:16 Indirect, 2-16' ‘ _ Auxillary storage: Storage that sup plements core memory such as disk or DECtape. B Background program, 6-24 Base address: A given address from Index—1 ’ which an absolute address is derived by combination with a relative address, synonymous with address constant. BIN Format, 4—17 instructions and data necessary to set up and call a given routine. Careers in programming, 1-2 Central processing unit: The unit of a computing system.that includes the circuits controlling the interpretation and execution of instructions—the computer proper, excluding I/O and other peripheral devices. BIN Loader, 4—18, 5—8 Self-Starting BIN, 5-9 to the number a radix with of two. system Binary: Pertaining Binary Addition, 1-18 Counting, 1-7 Division, 1~25 Format, see Binary format. Loader, see BIN Loader. Multiplication, 1-23 Notation, 8—6 Channels, DECtape, 7-2 Mark-track, 7 -2 Timing, 7—2 Character: A single letter, numeral, or symbol used to represent 1nformation. Number system, 1—6 Subtraction, 1-20 (complement and increment AC), 2-27 CLA (clear the AC), 2-19, 2-20 to CIA I. Binary code: A code that makes use of exactly two distinct characters, 0 and 1. Same as object code, 2-22 Clear: To erase the contents of a storage location by replacing the contents, normally with zeros or 2-2 Biz: A binary digit. In the PDP-8 each of 12 bits. posed computers, word is com— spaces; to set to zero. Clear switch, 4-3 Block: A set of consecutive machine words, characters or digits handled as a unit, particularly with reference to I/O. CLL (clear the link), 2—19, 2—20 Chilewomplement -2 CML (complement the 2-20 Bootstrap: A technique or device designed to bring a program into the computer from an input de— ful to the computer, or to an assembler, compiler or other lan- Bootstrap loaders, see BIN Loader, Hardware bootstrap, etc. Branch: A point in a routine where guage processor. Coding a program, 3-6 one of two or more choices is made under control of the rou- Combined CA register, see Current address register. Call: To transfer control to a specified routine. Calling sequence: “A specified set of microinstruction mne- monics, 2-27 Combining Microinstructions, 2-23 Skip microinstructions, 2-25 tine. C link), 2-19, Coding: To write instructions for a computer using symbols meaning- Vice. Branching program, 3-30 Breakpoint, 5-56, 5—68, 5-73 Buffer: A storage area. Bug: A mistake in the design or implementation of a program resulting in erroneous results. Byte: A group of binary digits usu— ally operated upon as a unit. the AC), 2-19, " Command: A user order to a computer system, usually given through a Teletype keyboard. Command summaries; Editor, 5-40 DDT, 5-65 ODT, 5—83 Comments, inserting, 3-22 Compatibility: The ability of an instruction or source language to be used on more than one computer. Compile: To produce. a binary-coded program. from a program written Index—2 Count: The successive increase or decrease of a cumulative total: of the number of times an event oc- (insource (symbolic) language, by selecting appropriate subroutines ’ from a subroutine library, as di— rected by the instructions or other symbols of the source program. The linkage is supplied for com— bining the subroutines into a workable program, and the subroutine and linkage are translated into binary code. curs. operation (see Loop). Counting, in binary, 1-7 Current address register, 7—4 Compiler: A program which trans- Current Location Counter: A counter kept by an assembler to determine the address assigned to an and formulas lates statements written in a source language into a machine language program, e.g. a FORTRAN Compiler. Usually generates more than one machine instruction for each statement. Current page or page zero bit, 2 1'5 Complement: (One’s) To replace all Cycle time. The length of time it ~ instruction constant being Cycle stealing, 6-41 D Data: A general term used to denote any or all facts, numbers, letters and symbols. It co'nnotes'basic el— ements of information which can be processed or produced by a- .have been met. Conditional skip: Depending upon whether a condition within the program is met, control may transfer to another point in the program. See Operate group tions. computer. Data blocks, DECtape, 7-1 Data break: A facility which. permits I/O transfers to occur on. a. cycle-stealing basis Without dis— turbing program execution, 6-‘1 Single cycle, 6-41 3—cycle, 642 instruc- » Data channels, DECtape, 7-2 Data field, 4-5, 4-20 Data formats, 1‘-34 .DCA (deposit and clear AC), 2410 , Continue switch, 4-4 Control unit, 1-32, 2-5, 2—6 Conversion Decimal to binary, 1-‘9 Decimal to octal, 1-12 Of fractions, 1-12, 1-17, F1-4 Octal to decimal, 1-12 DDT, see Dynamic Debugging Technique Debag: To detect, locate and correct m1stakes in a program. - vConvert: 1. To change numerical data from one radix to another. 2. To transfer 'data from one recorded format to another. _ - Core memory: The main high-speed storage of a computer in which binary data is represented by the switching polarity of magnetic cores, 2-7 , as- takes the computer to reference one word of memory. 0 bits with 1 bits and vice Versa. (Two’s) To form the one’s coma plement andadd 1. Console: Usually the external front side of a device where controls and indicators are available for manual operation of the device. See Computer console or Teletype console. or sembled. Computer console, 4-1 to 4-6 Computer fundamentals, 1-1 Conditional assembly: Assembly of certain parts of a symbolic program only if certain conditions ’ _ Counter: A register or storage location (variable) used to represent the number of occurrences of an . Debugging programs, 5-42 DECdisk systems, 4-23 DECtape Bookstrap, TCOl, 7-31 Control flag, 7-16 Control words, 7-11 Controls, 4-22 C7OP3Y program (DTC—8), 7-15, -2 Current address register, 7-4 Data blocks, 7-1 Data channels, 7-2 Index—3 - Data word format, 74 ifiesthe location of an instruction operand, 2-16 Directory device: A device (such as a disk) which is partitioned by software into several distinct files. A directory of these files is mainon the device to locate the DELETE program, '7-29 DEWAIT program, 7-21 Error codes, 7-7 Error conditions, 7-16 Error flag, 7-6 ESCAPE program, ‘7-30 Flag, use of, 7-13 Format, 7-1 ‘ngrmatting program }.iai ned es. (TOG-8), 7- Division in binary and octal, 1-23 Division, programming, 3-14 - Functions, 7-8 Double precision: Pertaining to the use of two computer words to represent one number. In the GETSYS program, 7-30 IDTAPE subroutine, 7-17 INDEX program, 7-28 Interrupt handling, 7-16 IOT instructions, 7-10 Library directory, 7-27 Library system, 7-26 Mark-track channels, 7-2Programming, 7-11 PDP-8, a double precision result is stored in 24 bits. 1-35, 3-14 Downtime: The time interval during which DTC-8, READ program, 7-22 SEARCH program, 7-21 Skeleton library, 7-27 Software, 7-20 Standard format, 7-3 a device is inoperative. see DECtape COPY Pro~ gram DTP, see DECtape flag Dummy: Used, as an adjective to indicate an artificial address, instruction, or record of information inserted solely to fulfill prescribed conditions, as in a “dummy” vari~ Subroutine, TD8~E, 7-32 Status registers, 7-6 Subroutines, TC08, 7-20 System, 4-21 Timing channels, 7-2 Transport unit, 4-22 able. Dump: To copy the contents of all or UPDATE program, 7-29 part of core memory, usually storage medium. onto an external DECUS, G—l DWAIT subroutine, 7-21 Defer state, 2-7 Dynamic Debugging Technique (DDT), 5—43 Delays, programming, 3-29 DELETE program, 7-26 Delimiter: A character that separates, terminates and organizes elements of a statement or program. Deposit switch, 4-4 Device flags: One-bit registers which record the current status, of ade: vice. Device selection code. 6-2 Command summary, 5-65 Defining symbols, 5-46 Errors, 5-49 Example program debugged, 5-63 Execution commands, 5-55 Internal symbol table, 5-67 Loading, 5-43 Output, 5-50_ Program modification, 5-50 Storage requirements, 5-48 DF32D DECdisk, 4-23 Digit: A character used to represent ‘one of the non-negative integers smaller than the radix, e.g., in binary notation, either 0 or 1. Digits, significant, 1-8 Digital Computer: A device that operates on discrete data, performing sequences of arithmetic and logical operations on this data. Direct address: An address that spec- B Editor, see Symbolic Editor Effective address: The address actually used in the execution of a computer instruction. Eight’s complement arithmetic, 1-22 Elementary programming techniques, 3-1 Address modification, 3-19 Arithmetic overflow, 3-11 Index—4 . Fetch state, 2- 7‘ Auto indexing, 3-27 Coding 3-6 a > Field: 1. One or more characters treated as a unit. program, Double precision arithmetic, 3-14 Flowcharting, 3-3 Inserting comments and headings, 3-22 Location assignment, 3-6 Looping a program, 3-24 Multiplication and division, 3-13 Powers of two, 3-16 Program branching, 3- 30 Program delays, 3-29 2. A specified area of a record used for a single type of data. 3. A division of memory on a PDP- 8 computer referring to a 4K section of core. 1 File: A collection of related records treated as a unit. File structured device: A device such .as disk or DECtape which contains records organized into files and accessible through file names found in a directory file. See directory device. operations, Programming arithmetic 3- 10 Programming phases, 3-2 - Subtraction, 3-13 Symbolic addresses, 3-7 Symbolic programming tions, 3-8 Writing subroutines, 3—16 End—zone, 7-2 ' conven- Alphanumeric characters used to identify ‘a particular.file. F ilename extension: A short appendage to the filename used to iden— F ilename: Error traps, 8—29. Equivalents, decimal-octal-binary, ,1‘ ~ 11 ESCAPE . program, Fixed point: The position of the radix point of a number system is instruction Execute: To carry out an program according to a predetermined convention. Flag: A variable or register used to constant Exclusive 0R, 1- 30 a on puter. the com- record the status of a program or device. In the latter case, also Execute state, 2-7 called a device flag. Flip-flop: A device with two stable Exercises, Answers to, A—1- operations, 1 Ariitzlémetic ' states. 1-26,1-27, Floating point: A number system in which the position of the radix point is indicated by one part of the number (the exponent) and another part represents the significant digits (the mantissa). Floating-point packages, 8-1 tech“ Elementary programming niques, 3-1 Input/Output programming, 6-1 Number systems, 1—5 ' Programming fundamentals, 2- 28 System operation, 4-24 Exponent, in floating-point numbers, 1- 35, 8- 4_ Overflow, 8-29 Underflow, 8-29 Extended address load switch, 4-4 Extended arithmetic element, 4-23 Extended function algorithms, 8—31 . External storage: A separate facility or device on which data usable by the computer is stored (such paper tape, DECtape or disk). F FAC, 8-7 Core storage maps, 8-38 Floating data field, 8- 12, 8-22, 8- 25 Floating halt, 8—27 Input and output, 8- 17 Instruction field, 8-22 Instruction summary, 8-40 Notation, 8—4 Operand, 8- 26 Pseudo-instructions, 8- 13—8- 15 Subroutines, 8- 8, 8- 10, 8- 11 Using, 8-7 / Extended memory, 4-20 as « " _ run tify the type of data in the file; e.g. BIN signifying a binary program. 7-26 Examine switch, 4— 4 or ' ' Flowchart: A graphical tion of the operations representa- required to carry out a data processing opera— tion Flowcharting, 3-3 Index—5 Foreground program, 6-24 Format: The arrangement of data. Also a FORTRAN statement. Half duplex: Describes a communications channel capable nf transmission and/or reception, but not both simultaneously. Hardware: Physical equipment, e.g., mechanical, electrical or electronic , Format routines, 6-8 Fractions, Binary and octal, 1-15 Converting binary and octal to dec‘ imal, 1-17 Full duplex: Describes a communications channel capable of simultaneous and independent transmission and reception. Function subprogram: A subprogram which returns a single value result, usually in the accumulator. devices. ‘ , Hardware bootstrap loader, 5-10 Head: A component that reads, records or erases data on storage device. Headings, inserting, 3-22 High-speed reader/punch, 4-18 HLT (halt), 2-22 I G IAC (increment the AC), 2-20 GETSYS program, 7-26 IDTAPE Subroutine, 7-17 Greater Than Flag (GTF), 4-24 Group I (operate) microinstructions, 2-18 CLA (clear AC), 2-19 to 2-22 CLL (clear link), 2-19, 2-20 (complement AC), 2-19, 2- Inclusive OR, 1-30 Incrementing a tally, 2-11 INDEX program, 7-26 ‘ Format, 2-19 Indirect address: An address in a computer instruction which indicates a location where the address of the referenced operand is to be found, 2-15, 2-16 IAC Initialize: To set counters, switches, Czth CML (complement link), 2-19, 2-20 (increment AC), 2-10 Legal combinations, E-2 NOP (no operation), 2-20 RAL (rotate AC, and L left), 2-20 RAR (rotate AC and L right), 219, 2—20 RTL (rotate AC and L twice left), (rotate AC and L twice right), 2-19, 2-20 2 (skip) microinstructions, 2- RTR Grgup 1 and addresses to zero or other starting values at the beginning of, or at prescribed Input and output units, 2-5 Input unit, general organization of PDP-8, 1-32, 1-33 Input/output transfer instructions, see IOT instructions. . Ins3e5‘ting Format 2-21 HLT (halt), 2-22 Illegal combinations, 2—23 OSR (inclusive OR of AC with switch register), 2-22 SKP (unconditional Skip), 2-22 SMA (skip on minus AC), 2-21, 2-22 SNA (skip on non-zero AC), 2-21, 2-22 SNL (skip on non-zero link), 2-22 SPA (skip on positive AC), 2-21; 2-22 SZA (skip on zero AC), 2-21, 2-22 SZL (skip on zero link), 2-22 H Halt switch, 4-4 points in, a com- puter routine. , comments and headings, 3- Instruction: A command which causes the computer or system to ' perform an operation. Usually one line of a source program. Instruction field, ,4-5, 4-20 Instructiou register (IR), 2-7 Internal storage: The storage facilities forming an integral physical part of the computer and directly controlled by the computer. Also called main memory and core memory, 1-32 Interpreter: A program that trans- lates and executes source language statements at run-time, 8-11 Interpretive mode, 8-12, 8-20, 8-27 Index—6 “ ‘ Least significant digit: The right-most digit of a number. Interrupt program debugging, 5-81 Interrupt programming, 6-22 Interrupt request flag, 6422 / Library routines: A collection of standard routines which can be Interrupt service routine, 6-25 I/0: Abbreviation for IOT instructions, Format of, 6- 2 incorporated into larger programs. Library syStem, DECtape, 7-26 LING-8 Computer system, 1-3. Line feed: The Teletype operation which advances the paper by one input/output DECtape, 7-10' Usage, 6-3 IR (instruction register), 2—7 Iteration: Repetition of a group of ‘ line. Line’ number: In source languages such as FOCAL, BASIC, and FORTRAN, a number which begins a line of the source program for purposes of identification. A instructions. I Job: A unit of. code which solves a numeric label. problem, i.e. a program and all its Link. related subroutines and data. IMP (jump), 2-10 1. _ JMS (jump to subroutine) 2-12 Jump: A departure from the normal sequence of executing instructlons in a computer. -2. symbol. K K: An 3. abbreviation for the prefix kilo, i.e. 1000 in decimal notation. Keyboard/printer devices, 49 . pointer to the next An address element of a list, or the next block number of a file. , Linkage: The code that connects two separately coded routines. L ' List: Label: One or more characters used 1. . to identify a source language statement or line. Language, assembly: The machineoriented programming language used by an assembly system, e.g. PAL III, MACRO-S/and SABR. Language, computer: A systematic meahs of communicating instruc- 2. 3. .. ' in which programs are written and Leader: The blank section of tape at the beginning of the tape. Load. To place data into internal Location assignment, 3-6 guage such as PAL III or FOCAL computer. symbol which defines it- Location: A place in storage or memory where a .unit of data or an instructlon may be stored, 3-6 Language, Source: A computer lan- LAS (load AC from switch register), 2-27 Literal. A self Loaders, 5— 1 tation. which require extensive translatlon in order to be executed by the the termi- on Pushd'own storage. tions and information to the com- Language, machine: Information. that can be directly processed by the computer, expressed in binary no~ A set of items, To print out a listing line printer or nal. See list. console ' -pu.ter Least significant binary digit, 148 A one- bit register in the PDP- 8, 2-6 An address pointer generated automatically by the PALS or MACRO-8 Assembler to indirectly address an~ off-page I Logic operations, 1-29 Loop: A sequence of instructions that is' executed repeatedly until a terminal condition prevails. Looping a program, 3-24 M (memory address register), 2—8 Machine language programming: In MA this text, synonymous with assembly language programming. This Index—7 term is also usedto mean the ac- JMS (Jump to subroutine), 2- 12 TAD (two’s complement add), 2-9 Macro instruction: An instruction .in a source language that is equ1valent to a specified sequence of machine instructions. Memory unit, 1-33, 2- 5, 2- 7 Microinstructions, see also Programming fundamentals. Combined mnemonics, 2-23, 2-27 Skip, 2—25 Mnemonic coding, 2'3 Mode, Interpretive, 8-27 Single instruction, 8-27 Modes of operation, Command, 5-12 tual binary machme instructions. Major state generator, 2-7 Mantissa of 1-35 floating-point number, High-order, 8-6 Low-order, 86 Manual Input: The entry of data by hand into a device at the time of . pI’OCCSSng. Manual operation: The processing of data'1n a system by direct manual techniques Text, 5-12 Monitor: The master control program that observes, supervises, controls or verifies the operation of a system. Manual program loading, 4-6, 4-7 significant digit: the left-most digit, 1—8, 8-5 Multiplication in binary and octal, Mask: A bit pattern which selects those bits from a word of data which are to be used in some subsequent operation, 1-29 Most Mass storage. Pertaining to a device Multiplier quotient register, 4-5, 4-24 Multiprocessing: Utilization of sev- such as disk nr DECtape which stores large amounts of data readily accessible to the central pro- cessing unit. rectangular array of elements. Any table can be consid~ Matrix: A ered a matrix. non-zero 1-23 eral or processors to execution of two or more pro— grams in core at the same time. Execution cycles between pro— Memory: 1. computers logically or functionally divide jobs or processes, and to execute them simultaneously. Multiprogramming: Pertains to the MB' (memory buffer register), 2-7 ’ , The alterable storage in a com- grams. puter. 2. Pertaining to a device in which data can be stored and from which it can be retrieved. Memory address register (MA), 2-8, Memory bufier register (MB), 2-7 Memory, extended, 4-20 Memory field, 420 Memory protection: A method of preventing the contents of some part of main memory from being destroyed or altered. Memory reference instructions, see also Programming fundamentals. AND (Boolean AND), 2- 9 DCA (deposit and clear AC), 2-10 Format, 2— l4 ISZ (increment and skip if zero), 2-10 List of, Dl-2 JMP (jump), 2-10 N Negative numbers and subtraction, 1-20 Nesting: 1. Including a program loop in— Side loop 2. Algebraic nesting, such as (A+B*(C+D)), where exer cution proceeds from the innermost to the outermost level. N0P: An instruction that specifically does nothing (control proceeds to the next instruction 1n sequence), 2-20 _ Normal mode, 7-2,7—13 Normalize: To adiust the exponent and mantissa of a floating-point number so that the mantissa ap— pears in a. prescribed format, 8—5 Numeric translation routines, 6—11 Index——8 OR: (Inclusive) A logical operation such that the result is true if either or both operands are true, and false if both operands are false. (Exclusive) A logical operation such that the result is true if either operand is true, and false if both Operands are either true or false. When" neither case is specifically indicated, Inclusive OR is assumed. See also Inclusive OR and Exclusive OR. Group of microinstructions (SMA, SZA, SNL), 2-25 Logical operation, 1-30 Numbers, Double precision, 1-35 Floating-point, 1-35 Representation in the PDP-8, 1-34, Number systems, Definition of basic concepts, 1-5 Primer, 1—5 0 Object Program: The binary coded program which is the output after translation of a source language program. Octal: Pertaining to the numbersys— tem with a radix of eight. of execution for combined microinstructions, 2—26 Origin: The absolute address of the beginning of a section of code, 3-6 OSR (inclusive OR switch register and AC), 2-22 Output: Information transferred from Order Octal coding, 2-2 'Octal Debugging Technique (ODT), 5-68‘ Commands, 5-71 Errors, 5—81 Features, 5-68 Loading and starting, 5-70 Operation, 5-69 Programming notes, 5-82 Punching binary tapes, 5-77 Storage requirements, 5-69 Using, 5-69 - - , the internal storage of a computer to output devices or external storage. - - Overflow: A condition that occurs when a mathematical operation yields a result whose magnitude is larger than‘the program is capable of handling, 8-20 Octal numbers, 1-11 Addition, 1-19 Division, 1-26 Multiplication, 1-24 P Page: A 128nword section of PDP-8 Multiplication table, 1-25 Subtraction, 1-22 Octal to decimal conversion, 1-12 Off-line: Pertaining to equipment or devices not under direct control of the computer, or processes per— formed on such devices. Orr-line: Pertaining to equipment or devices under direct control of the computer and to programs which respond directly and immediately to user commands, e.g., DDT. Opera-rid: 1. A quantity which is alfected, manipulated or operated upon. 2. The address, or symbolic name, portion of an assembly language instruction. Operate microinstructions, 2-18 Operation code, 6-2 Operation specification bits, 6-3 Operator: The symbol or code which indicates an action (or operation) to be performed, e.g. + or TAD. core memory dress which is Panel lock, 4-3 » beginning at an ada multiple of 200. - Paper tape formats, 4-14 to 4—17 Paper tape loaders, 4-18 Parity error, 7-6, 7-7 Pass: One complete cycle during which a body of data is processed. An assembler usually requires two passes during which a source prois translated into binary gram , code. Patch: To modify a routine in a rough or expedient way. Peripheral equipment: In a data pro- cessing system, any unit of equipment distinct from the central processing unit which may provide the system with outside storage or communication, 4-18. Phases of programming, 3-2 Pointer address: .Address of a core memory Index—9 location containing the - actual (effective) address of de- sired data, 2-15 Position coefficient, as used in number systems, 1-6 Powers of two, 3-16 Priority interrupt: An interrupt which is given preference over other in- terrupts withm the system, 6-30 Procedure. The course of action taken for the solution of a problem. See also Algorithm. Program: _The complete sequence 'of Instructions and routines necessary to solve a problem. Program counter (PC), 2-6 Program interrupt, 6-1, 6—22 to 6-30 Programmed transfer, 6-1 to 6-4 Programmer’s console, 4-1 to 4-6 Programming fundamentals, 2-1 (AC), 2-6 Accumulator AND group microinstructions (SPA, SNA, SZL), 2-25 AND instruction, 2-9 Arithmetic unit, 2-5 Binary coding, 2-2 CLA (clear the AC), 2—19, 2-22 CLL (clear the link), 2—19, 2—20 (complement the AC), 2-19, CZIVIig (pomplement the link), 2-19, CM216 2 Combining microinstructions, 2-23 skip microinstructions, ngtsbining Control unit, 2-5, 2-6 Core memory, 2-5, 2-7 Current page or page zero bit, 2-15 DCA (deposit and clear AC), 2-10 Exercises, 2-28 Group. 1 microinstructions, 2-18 Group 2 microinstructions, 2-21 HLT (halt), 2-22 IAC (increment the AC), 2—20 Incrementing a tally, 2 11 Illegal combinations of microinstructions, 2-23 Indirect addressing, 2- 15 Input and output units, 2- 5 Instruction register (IR), 2-7 Interrupts, 6- 22 to 6 30 182 (increment and skip if zero), 2- 10 IMP (Jump), 2 10 --12 JMS (Jump to subroutine),2 Link, 2-6 Major state generator, 2-7 address register (MA), 2- Ngengosry Memory buffer register (MB), 2- 7 Memory page, 2—13 Memory reference lflStI‘UCthfl Memory unit, 2-5, 2-7 Microprogramming, 2-23 Mnemonic coding, 2—3 NOP (no operation), 2-20 Octal coding, 2—2 OR group microinstructions (SMA, SZA, SNL), 2-25 Order of execution of combined microinstructions, 2-26 OSR (exclusive OR switch register_ with AC), 2-22 PDP-8 organization and structure, 2-4, 2-5 Pointer addresses, 2-16 Program counter (PC), 2-6 RAL (rotate AC and link left), 2-20 RAR (rotate AC and link right), 2-19, 2-20 (rotate AC and link twice RTL left), 2-20 (rotate AC and link twice right), 2-19, 2—20 Rules for combining microinstructions, 2~28 RTR SKP (unconditional skip), 2—22 SMA (skip on minus 2-22 AC), 2-21, SNA (skip on, non-zero AC), 2-21, 2- 22 SNL (skip on non-zero link), 2- 22 SPA (skip on positive AC), 2- 21, 2- 22 SZA (skip on zero AC), 2-21, 2 22 SZL (skip on zero link), 2- 22 TAD (two’s complement add),2 Pseudo-operation: An instruction to "the assembler; an operatiOn code that is not part of the computer’s hardware command repertoire. Pusha'own list: A list that is constructed and maintained so that the next item to be retrieved is the item most recently stored in the list. Q Queue: A waiting list. In time-sharing, the monitor maintains a queue of user programs waiting for processing time. Index—10 ,- RK8 DECdisk, 4-23 R 7 Routine: A set of instructions arranged in proper sequence to cause the computer to perform a desired task. A program or sub- Radix.‘ The base of a; number system; the number of digit symbols required by a number system. RAL (rotate AC and link left), 240 - program. Random access: A storage device in which the .paddressability Of data is eifectively independent of the location of the data. Synonymous with direct access. ‘ RAR (rotate AC and link right), 2- 19, 2- 20 from Read: To transfer R808 DECdisk, 4-23 RTL AC (rotate and link twice left), 2-20 (rotate AC and link twice right), 2-19, 2—20 .RTR Rules for combining microinstructions, 2- 28 - . information an . Run: A single, continuous execution of a program. input device to core memOry. Read-in mode, see RIM. Run light, 4- 5 READ subroutine, 7-22 Ready status, 6-3 Real-time: Pertaining to computation performed while the. related physical process is ..tak1ng place so S‘ | Search mask, 5- 75 ' SEARCH Segment: results of the can be used in that cal process. _ computation guiding the physi~ That part of a long program which may be resident in core at any one time. 2.' To divide a program into two segments or to store routine on an external storage device to be brought into core as needed. or more Recursive subroutine: A subroutine capable of calling itself. part of Register: A device capable of storing a specified amount of usually one word. Register, auto—index, 3- 27 access: Pertaining to the sequential or consecutive transmis- , sion of data to or from core, as with paper tape: contrast with random access. Relative address: The number that specifies the difference between the actual address and a base address. 1 - tme whose instructions are written ' that they can be located and executed in different parts of core memory. Response time: Time between initiating an operation from a-remote terminal and obtaining the result. Includes transmission time to and from the computer, processing time and access time for files em- ployed. R.estart To resume execution of a program. Restrictions using breakpoints, 5-5 8 ‘ Reversing DECtapes, 7'- 14 RIM format, 4-17 RIM LOADER, 4—18, 5-2- _ Sign-magnitude notation, 8-7 Simulate: To represent the function of a device, system or program with another device, system or ' ‘ program. _ Single-cycle data break, 6-40 Single instruction mode, 8-8, 8—27 Single-step: Operation of a computer m, such a manner that only one instruction is executed. each time the computer is started. Single step switch, 4-4 .. - RF08 DECdisk controller, bits to the movement of left or right frequently performed in the accumulator. Shift. A Reiocatable: Used to describe a rouso a Serial data, . ‘ I. Record: A collection of related items of data treated as a unit. “ subroutine, 7- 21 4. Skip chain, 6- 29 Skip microinstructions, see Group. 2 microinstructions. 23 ‘ SKP (unconditional Skip), 2— 22 SMA (skip 2— 22 Index—1 1 on minus AC), 2-,21 SNA (skip 2-22 on non-zero ment, the action of either AC), 2-21, SNL into core or storing it tem device. (skip on non-zero link), 2-22 Software: collection of proroutines associated grams The and With computer. a Switch: 6—30 See Symbolic address: A set of characters used to specify a memory location within a program, 3-7 Symbolic Editor: A PDP-8 system library program which helps users in the preparation and modification of source language programs by adding, changing or deleting positive AC), 2-21, Starting address of a program, 3-6 display indicators, 4-6 Statement: An expression or instruction in source language. Status display indicators, 4-5 Status registers, 7-6 STL (set the link), 2~27 Storage allocation: The assignment 'State lines of text, 5-11 Commands, 5-24 Example of use, 5-35 Generating a tape, 5-30 Loading a tape, 5-31 Loading and operation, 5-28 Switch register options, 5-18 Summaries, 5-38, 5-40 Symbolic language, Conventions, 3-8 Special characters, 3-9 System: A combination of software and hardware which performs specific processing operations. SZA (skip on Zero AC), 2-21, 2-22 SZL (skip on Zero link), 2-22 of blocks of data and instructions to specified blocks of storage. Storage capacity: The of amount data that can be contained in storage device. a Storage device: A device in which data can be entered, retained and retrieved. Store:_To enter data into a storage devrce. T String: A connected sequence of entities such as characters in a com- Table: A collection of data stored for ease of reference, generally mand string. as Subroutine, closed: A subroutine not stored in the main part of a program, such subroutine is norentered with a JMS instruction and provision is made to return control to the main routine at the end of the Subroutine, open: A subroutine that must used. a be relocated and inserted routine at each place it is matting ‘ Text routines, 6-8 TCOl Bootstrap Loader, 7-31 TCOS DECtape Control Unit, 7-4 TDS-E DECtape System, 7-32 TDS-E DECtape Subroutine, 7—32 TU56 DECtape Transport, 7-4 Teletype , Subroutines, programming, 3-16 Subscript: A number or set of numhcrs used to specify a particular item in array. complement add), 2-9 Tape formatting, see DECtape 'for- or subroutine. an TAD (two’s a mally called into — ues are recorded. Language, Source program: A computer program written in a-source language. on _A device or programming Symbol table: A table in which symbols and their corresponding val- ”source. SPA (skip 2-22 the sys- technique for making selections. Sorting program, 3-31 language: on Switch register, 4-3' Software priority interrupt system, So'urce tem- porarily bringing a user program _ ‘ an array. Console, 4-11 Controls, 4-1}, 4-12 IOT instructions, 6-4 to 6-6 Keyboard, 4—12 Subtraction, pregammg, 343 Punter, 4-13 Punch, 4~14 Swapping: In a time-sharing environ— Reader, 4~13 Induce-12. / yields a result whose magnitude is storage: Storage locations reserved for immediate results. Terminal: A peripheral device in a system through which data can enter or leave the computer. Temporary Timesharing: A method of allocating central processor time and other computer resources to multiple users so that the computer, in effect, processes a number of pro- , smaller than the program is capable of expressing. UPDATE program, 7-26 Updating current line counter, 5—15 User: Programmer or operator of a computer. . V 4, A symbol whose value of a prochanges during Variable. grams s1multaneously. Time quantum: In time-sharing, a unit of time allotted to each user by the monitor. execution gram. W switches to enterfToggle. data into the computer memory. WC Translate: To convert .fromone language to another: Weighting tables, 1-6, 1-8 To use Word count register, 74 Underflow: when a occurs floating point operation , (DDT), 5-58 .WRITE subroutine, 7-22 Word searches V A condition that word count reg- of data which may be stored in one addressable location. complement arithmetic, 1-20 U see “ Word: In the PDP-S, a 12-bit unit Truncation: The reduction of precision by' dropping one or more of the least significant digits; e. g. 3.141592 truncated to four decimal digits1s 3 141. Two’s register, ister. Write: To transfer information from memory .to a peripheral de- core v1ce or Index— 1 3 to-aux1liary storage.“ ‘ NOTES DIGITAL EQUIPMENT CORPORATION, Corporate Headquarters: Maynard, Massachusetts 01754, Telephone: (617) 897-5111 SALES AND SERVICE OFFICES DOMESTIC ARIZONA, Phoenix and Tucson 0 CALIFORNIA, Los Angeles, Monrovia, Oakland, Ridgecrest, San Diego, San Francisco (Mountain View), Santa Ana, Sunnyvale and Woodland Hills 0 COLORADO, Englewood o CONNECTICUT, Fairfield and Meriden . DISTRICT OF COLUMBIA, Washington (Latham, Md.) 0 FLORIDA, Orlando 0 GEORGIA, 0 Atlanta ILLINOIS, Chicago (Rolling Meadows) . INDIANA, Indianapolis 0 IOWA, Bettendorf o KENTUCKY, Louisville - LOUISIANA, Metairie (New Orleans) MASSACHUSETTS, Marlborough and Waltham - MICHIGAN, Detroit (Farmington Hills) - MINNESOTA, Minneapolis - MISSOURI, Kansas City and St. Louis 0 NEW HAMPSHIRE, Manchester 0 NEW JERSEY, Fairtield, Metuchen and Princeton - NEW MEXICO, Albuquerque 0 NEW YORK, Albany, Huntington Station, Manhattan, Rochester and Syracuse 0 NORTH CAROLINA, Durham/Chapel Hill o'OHIO, Cleveland, Columbus and Dayton 0 OKLAHOMA, Tulsa - OREGON, Portland o PENNSYLVANIA, Philadelphia (Bluebell) and Pittsburgh - TENNESSEE, Knoxville o TEXAS, Austin, Dallas and Houston 0 UTAH, Salt Lake City 0 WASHINGTON, Bellevue - WISCONSIN, Milwaukee (Brooktield) INTERNATIONAL ARGENTINA, Buenos Aires - AUSTRALIA, Adelaide, Brisbane, Canberra, Melbourne, Perth and Sydney - AUSTRIA, Vienna . BELGIUM, Brussels . BOLIVIA, La Paz o BRAZIL, Puerto Alegre, Rio de Janeiro and Séo Paulo o CANADA, Calgary, Halifax, Montreal, Ottawa, Toronto and Vancouver 0 CHILE, Santiago . DENMARK, Copenhagen 0 FINLAND, Helsinki 0 FRANCE, Grenoble and Paris 0 GERMANY, Berlin, Cologne, Hannover, Hamburg, Frankfurt, Munich and Stuttgart o HONG KONG o INDIA, Bombay . INDONESIA, Djakarta - ISRAEL, Tel Aviv 0 ITALY, Milan and Turin o JAPAN, Osaka and Tokyo 0 MALAYSIA, Kuala Lumpur o MEXICO, Mexico City . NETHERLANDS, Utrecht . NEW ZEALAND, Auckland . NORWAY, Oslo 0 PHILIPPINES, ManiIIa - PUERTO RICO, Santurce - SINGAPORE o SPAIN, Barcelona and Madrid - SWEDEN, Gothenburg and Stockholm . SWITZERLAND, Geneva and Zurich 0 TAIWAN, Taipei and Taoyuan 0 UNITED KINGDOM, Birmingham, Bristol, Dublin, Edinburgh, Leeds, London, Manchester and Reading 0 VENEZUELA, Caracas . YUGOSLAVIA, Ljubljana —— —
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies