Digital PDFs
Documents
Guest
Register
Log In
AA-5281C-TC
March 1983
264 pages
Original
15MB
view
download
OCR Version
11MB
view
download
Document:
Introduction to RT-11
Order Number:
AA-5281C-TC
Revision:
0
Pages:
264
Original Filename:
OCR Text
Introduction to RT-11 AA-5281C-TC March 1983 This document is an introductory manual for the RT—-11 operating system. Its purpose is to acquaint new users with the RT—11 commands that perform common system operations. This manual presents the background material necessary to understand the system operations. It also contains a series of command examples and demonstration exercises that complement the text. This manual supersedes the Introduction to RT-11, Order No. AA-5281B-TC. Operating System: RT-11 Version 5.0 To order additional documents from within DIGITAL, contact the Software Distribution Center, Northboro, Massachusetts 01532. To order additional documents from outside DIGITAL, refer to the instructions at the back of this document. digital equipment corporation - maynard, massachusetts First Printing, March 1980 Revised, March 1983 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipmen t Corporation assumes no responsibility for any errors that may appear in this docu- ment. The software described in this document is furnished under a license and may be or copied only in accordance with the terms of such license. used No responsibility is assumed for the use or reliability of software on equipmen t that is not supplied by DIGITAL or its affiliated companies. © Digital Equipment Corporation 1980, 1983. All Rights Reserved. Printed in U.S.A. A postage-paid READER’S COMMENTS form is included on the last page of this document. Your comments will assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DEC DECmate DECsystem-10 DECSYSTEM-20 DECUS DECwriter DIBOL clifgliltlallg MASSBUS PDP P/OS Professional Rainbow RSTS RSX M12700 UNIBUS VAX VMS VT Work Processor CONTENTS Page ix PREFACE INTRODUCING THE RT-11 COMPUTER SYSTEM . . . . SYSTEM HARDWARE . . . . . . . . .. The Computer. . . . . . . . . . . .« The Terminal . . . . . . . . . . . . . The Storage Medium . . . . . . . .. CHAPTER 1 . .. . . ... ... 1-1 . . ... ... .. 1-1 o o oo 1-1 .. 1-3 . . ... .. ... ... 14 . 1-6 Optional Devices . . . . . . . . . . . .. . SYSTEM SOFTWARE . . . . . . . . . . ... . ... ... 1-7 The RT-11 Operating System . . . . . . . . . . . ... .. 1-8 Language Processors . . . . . . . . . . . . .. ... .. 1-10 Application Packages . . . . . . . . ... ... 1-10 SYSTEM DOCUMENTATION. . . . . . . . . ... .. ... 1-10 Hardware Manuals . . . . . . . . .. ... .. .. ... 1-10 Software Manuals. . . . . . . . . ... . ... ... 1-11 Source Listings . . . . . . . . . . ..o 1-11 CHAPTER 2 STARTING THE RT-11 COMPUTER SYSTEM. . . . . . . . i i it it e 2-1 oo v v 2-1 COMPUTERMEMORY . . . . . . . . . . . ... ... .. 2-1 .. . . . . . N HARDWARE CONFIGURATIO Terminal . . . . . . . .« . o 2-3 e 2-3 e Computer . . . . . . . o . System Volume . . . . . . . . . . . .. ... 2-3 Storage Volume . . . . . . . . . . . ... 24 Optional Devices and Supported Languages . . . . . . . . . 24 BOOTSTRAPPROCEDURE . . . . . . .. . . ... ... ... 2-4 CHAPTER 3 INTERACTING WITH THE RT-11 COMPUTER SYSTEM . . . . . .. .. ... ... 3-1 USING THE CONSOLE TERMINAL TO ... 3-1 EXCHANGE INFORMATION . . . . . . . . . . .. USING MASS STORAGE VOLUMES . . . . . .. ... .. .. 34 FileStorage. . . . . . « o o ¢ o v v oo oo 3-7 File Protection . . . . . . . . . « .« .« o oo 3-7 CHAPTER 4 USING THE MONITOR COMMAND LANGUAGE. . . . . . . . . . ENTERING COMMAND INFORMATION . General Command Format . . . . . . Control Commands . . . . . . . . . . Re-Creating the Examples. . . . . . . iii . v 4-1 . . . . . .. .. .. 4-1 . ... ... .. .. 4-2 . . ... 4-3 . . . . ... . ... 43 CORRECTING TYPING MISTAKES. . . . . . ... INITIAL MONITOR COMMAND OPERATIONS. . . Using VT11 Display Hardware . . . . . Entering the Date and Time-of-Day . . Assigning Logical Names to Devices. . Listing Volume Directories . . . . . . Initializing the Storage Volume . . . . CHAPTER 5 . . . .. . .. . . ... . . . . CREATINGATEXTFILE. . EDITINGATEXTFILE. . . . . . .. ... . . .. . . .. ... .. 4-5 .. 4-5 . . . . . . . . .. . . ... ... . . . . . ... . .. 4-8 ... .. 4-9 .. 4-12 . . . 4-15 . CREATING AND EDITING TEXT FILES . THE RT-11 EDITOR . .. . . ... .. 44 . . . ... ... ... ..... 5-1 ...... 5-2 ... ... .. .... 54 USING UPPERCASE AND LOWERCASE CHARACTERS. . USING A GRAPHICS DISPLAY TERMINAL DURING EDITING . . . . . . . . . ... Normal Use of the Graphics Display. . Immediate Mode . . . . . . .. ... COMPARING TEXTFILES PERFORMING A COMPARISON . CHAPTER 7 . . . . 5-12 ... ... .... 5-15 . . . . . ... . .. CREATING THE DEMONSTRATION PROGRAMS . CHAPTER 6 . 5-1 . .. . . ... ... . . .. 5-16 ..... 5-16 . . . ... . . 5-19 ... 6-1 ... .... 6-1 PERFORMING FILE MAINTENANCE OPERATIONS . . . . . . ... ... ... .... 7-1 FILE DIRECTORY OPERATIONS. . . . . . . .. ... .. . . . FILE COPYING OPERATIONS . . FILE RENAMING OPERATIONS . FILE DELETION OPERATIONS . . . . ... ... .... 7-2 . . . . . . .. .. .. ... 7-3 . . . . . ... . ... ... 7-4 . . . . . .. .. . . . . . . . . . . .. MULTIPLE FILE OPERATIONS FILE PROTECTION OPERATIONS . FILE LISTING OPERATIONS . . . . CHAPTER 8 .. . ... ... 7-5 .. ... 77 . ... .... 7-8 ... ... 8-1 CHOOSING A PROGRAMMING LANGUAGE. . . . . . . . . ... HIGH-LEVEL VS MACHINE-LEVEL LANGUAGES RT-11 PROGRAMMING LANGUAGES . . . CHOOSING A LANGUAGE FOR THE DEMONSTRATION . . . . . . . . . . ... CHAPTER 9 .. 7-1 . . . .. 8-1 ... 8-3 ... .... 84 ... ... RUNNING A FORTRAN IV PROGRAM. . . ... . . . . . 9-1 DEVELOPING AN EXECUTABLE FORTRAN IV PROGRAM . . . . . . . .. 9-1 iv USING LIBRARYMODULES . . . . . . . .. ... .. .... 9-2 COMPILING THE FORTRAN IV PROGRAM . . . . . .. ... 9-3 LINKING OBJECT MODULES TOGETHER. . . RUNNING THE FORTRAN IV PROGRAM . . . COMBINING OPERATIONS. . . . . . . .. .. ALTERNATE FUNCTIONS . . . . . . . . . .. FILE MAINTENANCE . . . . .. . ... ... CHAPTER 10 . . . . . . .. 9-8 . . . . . .. 9-11 ... .... 9-12 ... .... 9-13 .. ..... 9-14 RUNNING A BASIC-11 PROGRAM . . . . . . 10-1 DEVELOPING A BASIC-11 PROGRAM. . . . . . . . . ... 10-1 USING THE BASIC-11 LANGUAGE PROCESSOR . . . . . . 10-1 USING THE BASIC INTERPRETER. . . . . . ... ... .. 10-2 Immediate Mode . . . . . . ... .. ... ... .... 10-3 Creating and Editing a BASIC-11 Program . . . . . . . . 104 RUNNING A BASIC-11 PROGRAM. . . . . . . ... . ... 10-8 FILE MAINTENANCE . . . . . . . . . . ... .. ..... 10-12 CHAPTER 11 RUNNING A MACRO-11 ASSEMBLY LANGUAGE PROGRAM . . . . . . ... . .. 11-1 DEVELOPING A MACRO-11 ASSEMBLY LANGUAGE PROGRAM . . . . . . e s i d e e e e 11-1 USING THE MACRO-11 LANGUAGE PROCESSOR . . . . . 11-2 The Program Counter . . . . . . . The Symbol Table. . . . . . . . . Machine Language Code . . . . . . . . . . . . .. ... .. 11-3 ... ... ..... 114 . . ... ... ... 11-4 ASSEMBLING THE MACRO-11 PROGRAM . . . . . .. .. 11-6 LINKING OBJECT MODULES TOGETHER. . . . . . . . .. 11-13 RUNNING THE MACRO-11 PROGRAM . . . . . ... ... 11-15 COMBINING OPERATIONS. . . . . . . . . ... . ..... 11-16 FILE MAINTENANCE . . . . . . . . .. ... .. ..... 11-18 CHAPTER 12 LINKING OBJECT PROGRAMS . . . . . . .. 12-1 RESOLVING SYMBOLIC AND LIBRARY REFERENCES. . . . . . . . . . . . . i 12-2 PROGRAM RELOCATION AND ADDRESS ALIGNMENT . . . . . . . o o e 12-3 Absolute and Relocatable Program Sections . . . . . . . . 124 The Overlay Feature . . . . . . . . . . ... ... ... 12-6 PRODUCING A LOAD MODULE AND ALOADMAP . CHAPTER 13 . . . . . . e 127 CONSTRUCTING LIBRARY FILES KINDS OF LIBRARY FILES. Macro Libraries . . . . . . . . . . . . . 13-1 . . . . . .. .. ... .... 13-1 . . . . . .. .. oo 13-1 ..... 13-1 CREATING AND MAINTAINING A LIBRARY FILE . . . . . Creating Object Library Input Files . . . . . . . . . . .. Building the Object Library . . . . . . . . .. ... ... Updating the Object Library. . . . . . . . . .. ... .. FILE MAINTENANCE . . . . . .. .. ... .. ...... Object Libraries. 13-2 CHAPTER 14 . . . . . . . . . . . . .. .. DEBUGGING A USER PROGRAM . AVOIDING PROGRAMMING ERRORS . . . . . . . 13-2 13-5 13-6 13-7 . 14-1 . . .. ... ... WHEN PROGRAMMING ERRORSOCCUR . . . . ... 14-2 . USING THE ON-LINE DEBUGGING TECHNIQUE . FILE MAINTENANCE CHAPTER 15 . . . . . .. ... ... .. . . . . 14-1 . 14-3 ....... 14-13 USING THE FOREGROUND/BACKGROUND MONITOR . . . . . . . . ... ... ...... 15-1 THE FOREGROUND/BACKGROUND ENVIRONMENT . . . . . .. ... ... Running the Foreground/Background Programs . .. ........ 15-1 . . . . . .. .. ... Creating the BackgrounddJdob . . . . L 15-1 . . . . . ... ... 15-2 Editing the Background Job. . Running the BackgrounddJob . USING THE FBMONITOR . . . . . . . . . . . . . . . . . . . . ... . . . .. .. .. 15-2 .. .. ... 15-2 ... .... 15-3 Communication in a Two-Job Environment . . . . . . . . Creating the Foregrounddob . . . . . . . . .. ... .. Executing the Foreground and Background Jobs. . . . . . FILE MAINTENANCE . . . . ... .. ... ... ..... CHAPTER 16 USING INDIRECTFILES. CREATING AN INDIRECTFILE . . . . . . ... . . ... FILE MAINTENANCE CHAPTER 17 . . . . . ... .. . . . . ... .. . . 16-1 ... ... 16-1 . . . . . . 16-2 ... ... ... . . .. ... .. .. MANUAL BOOTSTRAPPING OPERATIONS. . . . . . . .. BOOTSTRAPPING THE SYSTEM.. 15-5 15-8 ..... 164 .. .... 16-8 ADVICE TONEWUSERS. USINGTHEHELPFILE APPENDIX A . . .. 154 ... ..... 16-1 Entering Monitor Commands . . . . . . ... Using the Editor to Create an Indirect File . . EXECUTING AN INDIRECTFILE .. 15-3 . . . . ... 17-1 ........ 17-2 ... ...... A-1 .. ... ... A-1 ....... A-3 . TYPING THE BOOTSTRAP ON THE TERMINALKEYBOARD . . . . . . ... USING A PUSHBUTTON CONSOLE TO BOOTSTRAP . . . . . . . vi .. ... ... ... ... ..... A4 USING A SWITCH REGISTER CONSOLE TO BOOTSTRAP. . . . . . . . . . . .. . .. A-5 APPENDIX B SELECTED SYSTEMTOPICS . . . . . . . .. B-1 STOPPING AND STARTING THE SYSTEM . . . . . o i e e e et et e e e e e e e e s B-1 Stopping the System. . . . . . . . .. ..o B-1 Starting the System. . . . . . . . .. ... B-1 THE SYSTEM STOPS UNEXPECTEDLY . . . . . ... .. .. B-2 SUGGESTIONS FOR BOOTSTRAPPING THE SYSTEM . . . . . o o o o e et e i e e e e e e e e B-2 BACKING UP THE SYSTEM VOLUME. . . . . ... ... .. B-3 DIRECTORY- VS NONDIRECTORY- STRUCTURED VOLUMES . . . . . . . ... ... ... ... B4 ALTERNATE RENAME OPERATION FORMAGTAPE USERS. . . . . . . . . .« USING THE FORTRAN/BASIC oo v oo B4 LANGUAGE VOLUME . . . . . . . . . .. v B-5 SUBSTITUTING VOLUMES DURING OPERATIONS. . . . o o et e e e e e e e e e e e B-6 USING THELINK VOLUME . . . . . .. .. ... ... ... B-8 FORTRAN/LINK FILE MAINTENANCE . . . . .. .. . ... B-9 e GLOSSARY . . . . & o o e e e INDEX. . . . o o e e e e e e e e e e e Glossary-1 e e e e e e e e e Index-1 FIGURES FIGURE 1 1-1 1-2 1-3 1-4 1-5 1-6 1-7 2-1 3-1 3-2 3-3 4-1 5-1 5-2 9-1 9-2 Flowchart for Selective Reading. . . . . . . . . .. xii RT-11 Computer System . . . . . . . . . . .. .. 1-2 PDP-11Computers . . . . . . . . . . . « . . .. 1-3 TerminalDevices . . . . . . . . . . . . ... ... 14 Randon-Access Storage Media and Their Devices . .1-5 Peripheral Devices . . . . . . . . .. .. ... .. 1-6 RT-11 System Software. . . . . . . . . . .. ... 1-8 RT-11 Operating System . . . . . . . . . . . ... 1-9 Bootstrap/Computer Relationship . . . . . . . . .. 2-2 LA120/VT100 Terminals . . . . . . . . . . . . .. 3-2 LA120/VT100 Keyboard Layouts . . . . . . . . .. 3-3 Mass Storage Volumes . . . . . . . . . ... ... 3-6 VT11 Display Hardware. . . . . . . . . . . . . .. 46 EditingwithRT-11. . . . . . ... ... ..... 5-2 Text WindowFormat . . . . . .. ... ... .. 5-16 Evolution of a FORTRAN IV Program. . . . . . . . 9-1 Function of a FORTRAN IV Compiler. . . . . . . . 9-2 vii 9-3 9-5 10-1 11-1 11-2 11-3 114 11-5 11-6 12-1 12-2 A-1 A-2 Dimensions of FUN(X,Y) . . . .. . ... ... . . 9-7 The Link Operation. . . . .. . ... . .. .. . 9-9 The Result of GRAPH.SAV . . . . . . . . .. . . 9-12 Functions of the BASIC-11 Language Processor. . 10—2 PDP-11 Programming Card. . . . . . . . . . . . 11-1 Evolution of a MACRO-11 Program. . . . . . . . 11-2 Function of a MACRO-11 Assembler . . . . . . . 11-2 PDP-11 Computer Memory . . . . . . . .. . . . 11-3 PDP-11Word. . . . . ... ... .. ... .. . 11-5 The Link Operation. . . . . .. ... . .. . . . 11-14 Link Functions . . . . ... ... ... ... . 12-1 Object Module Relocation . . . . . . .. . .. .. 124 Pushbutton Console. . . . . . .. .. . ... . A4 Switch Register Consoles . . . . . . .. .. . .. A-5 TABLES TABLE 2-1 22 4-1 4-2 4-3 5-1 5-2 8-1 11-1 A-1 Representative System Volumes. . Bootstrap Prompts and Responses . . . . . . . . . . 24 . . . . . . . . . 2-6 Keyboard Characters . . . . .. ... . .. .. . . 3-5 Keyboard Symbols . . . . .. ... . ... . . .. 44 Physical Device Names . . . . . . . . .. .. .. . 4-9 Special Logical Device Nmaes. . . . . . . .. . . 4-10 FileTypes. . . . . . ... ... ... ..., . . 4-13 Command Arguments. . . . .. ... . .. .. . 5-5 Immediate Mode Commands. . . . . . .. . . . . 5-17 Language Comparisons . . . . . . . . .. .. ... 8-2 Decimal/Octal/Binary Conversion . . . . . . . . . 11-6 Binary Conversion . . . . ... ... ... . . . A-6 viii PREFACE The RT-11 (Real Time-11) computer system is a single-user computer/operating system that serves the programming needs of both the beginning and the advanced programmer. RT-11 supports a number of programming languages, including industry-standard FORTRAN and BASIC: and — for more advanced users — the PDP-11 assembly language, MACRO-11. RT-11 also provides a comprehensive set of operating commands for controlling system operations. The purpose of this introductory manual is to acquaint you with a number of RT-11 operating commands that are used to perform common system operations. The manual first presents information that you need to understand a particular system operation; then it shows you how to apply the system operation in a series of operating commands and exercises that you recreate; finally, it provides a list of reference materials that contain more information about the operation. This approach makes it possible for you to learn quickly the major features of the system; at the same time, it eliminates many of the learning problems encountered by new users. MANUAL INTENT This manual describes system usage fundamentals. It is not the intent of this manual to teach you to program the PDP-11 computer. You may already be proficient in one or more of the available programming languages. Likewise, no attempt has been made in this manual to cover all the possible applications for which the RT-11 computer system is suited. You will discover many applications yourself as you continue to use the system. This manual is designed for three categories of RT-11 users: e Inexperienced users: Those having little or no previous “hands-on” computer experience (including those whose experience has been limited to batch environments) e Experienced users: Those who are experienced users of a computer system other than the RT-11 computer system e Experienced RT-11 users: Those who have used previous versions of the RT-11 computer system but wish a quick introduction to the newest features of the current system (Version 5) The manual contains 17 chapters and 2 appendixes. The descriptions that follow and the chart at the end of this section will help you determine your own reading path. ix MANUAL DESIGN Preface Chapter 1, Introducing the RT-11 Computer System, discusses general system concepts. It introduces the roles of hardware and software in a computer system and describes the specific hardware and software components of the RT—11 computer system. Chapter 1 is intended for users in the first two categories. Chapter 2, Starting the RT-11 Computer System, shows all users how to start the system. Chapter 3, Interacting with the RT-11 Computer System, demonstrates how you use the console terminal to control system operations. Again, this chapter is most helpful to users in the first two categories. Chapters 4 through 7 describe system operations that are useful to all categories of users. Each chapter begins with a textual explanation of a particular system operation and expands into computer demonstrations showing the operation in use. Topics covered are: Using the Monitor Command Language; Creating and Editing Text Files; Comparing Text Files; and Performing File Maintenance Operations. Experienced RT-11 users may prefer to skip the textual explanations and review only the computer exercises. Chapter 8, Choosing a Programming Language, helps you which language to use. Choose BASIC-11, FORTRAN 1V, MACRO-11, or a combination of these three languages to continue the exercises in this manual (BASIC-11 and FORTRAN IV are optional products). determine Chapters 9, 10, and 11 describe the process of running programs written in the FORTRAN IV, BASIC-11, and MACRO-11 languages, respectively. You should read any chapters that apply to your choice of language. MACRO-11 and FORTRAN IV users should continue to Chapter 12, Linking Object Programs, and Chapter 13, Constructing Library Files. Chapter 14, Debugging a User Program, provides some suggestions for finding and fixing errors in user programs; all users should read this chapter. Chapter 15, Using the Foreground/Background Monitor, is intended for users who plan to exercise the foreground/background capability of the RT-11 system. All users should continue to Chapter 16, Using Indirect Files. Indirect files allow the system to perform operations unat- tended. Preface Chapter 17 gives some advice to new users and includes a description of the RT-11 HELP file. Two appendixes are provided for reference. Appendix A discusses manual bootstrapping procedures and Appendix B provides some additional information on selected system usage. A glossary of technical terms appears at the end of the manual for reference purposes. The following flowchart will help you plan your reading path through the manual. Read the chart from top to bottom; answer the questions and follow the direction of the arrows to see which chapters you should read. NOTE The demonstration portions of this manual are for use with Version 5 and later releases of RT-11. The exercises are quite lengthy, and you may prefer not to complete them in one sitting. You may pause at the end of any individual chapter. It is recommended that you stop only at the end of a chapter since you will otherwise not complete an exercise and thus may introduce errors that will affect later exercises. Instructions for pausing and beginning again are given in Appendix B. xi Preface WHAT IS Past Versions of RT-11 YOUR COMPUTER EXPERIENCE No Experience, or other systems READ CHAPTER 2 READ CHAPTERS 1,2AND 3 READ CHAPTERS 4 THROUGH 8 BASIC MACRO LANGUAGE WiLL YOU USE FORTRAN READ READ CHAPTER 10 READ CHAPTER 11 CHAPTER 9 READ READ CHAPTERS 12 CHAPTERS 12 AND 13 READ AND 13 READ CHAPTER 14 READ CHAPTER 14 CHAPTER 14 READ CHAPTER 15 DO YOU WANT TO USE ANOTHER PROGRAMMING READ CHAPTERS LANGUAGE 16 and 17 ? DONE Figure 1 Flowchart for Selective Reading CHAPTER 1 INTRODUCING THE RT-11 COMPUTER SYSTEM A computer system is a collection of components that work together to process data. The purpose of a computer system is to make it as easy as possible for you to use a computer to solve problems. A functioning computer system combines hardware elements with software elements. The hardware elements are the mechanical devices in the system, the machinery and the electronics that perform physical functions. The software elements are the programs written for the system; these programs perform logical and mathematical operations and provide a means for you to control the system. Documentation includes the manuals and listings that tell you how to use the hardware and software. Collectively, these components provide a complete computer system that allows both layman and expert alike to use a computer.’ SYSTEM HARDWARE SYSTEM SOFTWARE +SYSTEM DOCUMENTATION COMPUTER SYSTEM The RT-11 computer system requires three basic hardware items: the computer, which performs all data processing; a terminal device, used like a typewriter for two-way communication between the user and the system; and a storage medium, for storing programs and data. Figure 1-1 illustrates the hardware components of a typical RT-11 computer system. The computer performs all instruction decoding and data processing. The RT—-11 computer system is constructed around a DIGITAL PDP-11 computer, several of which are shown in Figure 1-2. Any model of PDP-11 can be used in an RT-11 system. Notice in Figure 1-2 that the front panel, or operator’s console, of each PDP-11 computer is slightly different. The switches, buttons, and lights that are on the operator’s console are used for various kinds of computer operations and applications. In the RT-11 computer system they are used only to start the system. Once the system has been started, your interaction with the computer system occurs through the terminal. UThis chapter attempts to build a working vocabulary that is both meaningful to the new user and consistent with standard DIGITAL terminology. Some definitions may appear inconsistent with those you have previously learned or used. 1-1 SYSTEM HARDWARE The Computer Introducing the RT-11 Computer System Figure 1-1 1-2 RT-11 Computer System Introducing the RT-11 Computer System PDP11/23 PLUS PDP11/23 PDP 11/44 Figure 1-2 PDP-11 Computers The terminal allows two-way communication between you (the user) and the computer system. You enter information — operating commands, for example — from the terminal keyboard, which is operated much like a typewriter keyboard. The computer, in turn, prints information and messages on the terminal’s printer or screen. Figure 1-3 shows two terminal devices — the VT100 video terminal and the LLA120 hardcopy terminal — that can be used in an RT-11 computer system. 1-3 The Terminal Introducing the RT—-11 Computer System Figure 1-3 Terminal Devices Generally, an RT-11 computer system has only one terminal through which all system/user interaction takes place. This is called the console terminal. If the system has more than one terminal, one of them is still designated the console terminal; others simply provide auxiliary message-printing capabilities. The Storage Medium The third important hardware device in an RT-11 computer system is the storage medium (usually a disk). It stores programs — those that make up the computer system software and those that you create. It serves as a distribution medium; system software is often packaged and distributed on a disk by the system supplier. Finally, it stores other data, information that is eventually needed for a computer operation (called input), the results of a computer operation (called output), or 14 Introducing the RT-11 Computer System textual information such as a report. Figure 1-4 shows the . : random-access storage media (and their specific drive units) that can be used in an RT-11 computer system. (Random access means that access time for data is independent of the location of data. Contrast this concept with sequential access.) & Figure 1-4 Random-Access Storage Media and Their Devices Introducing the RT-11 Computer System These three devices — the computer, the terminal, and the storage medium — are the required hardware components of an RT-11 computer system. With the exception of the computer, all hardware devices are called peripheral devices. Peripheral devices supplement the computer by providing external resources for operations that the computer cannot handle alone. In addition to the terminal and storage medium (which are required peripheral devices), other peripheral devices can be used in an RT-11 computer system. Optional Devices Optional peripheral devices are added to a computer system according to the specific needs of the system users. For example, computer systems that are used primarily for program development may have extra storage devices and a high-speed printing device. Computer systems used in a laboratory environment may have graphics display hardware, an oscilloscope device, and an analog-to-digital converter. Computer systems that provide (or use) information in conjunction with another kind of computer system usually have a magtape device, because magtape is an industry-standard storage device. Peripheral devices are categorized as input/output (I/0) devices since the functions they perform provide information (input) to the computer, accept information (output) from the computer, or do both. Line printers are output devices because they perform only output operations. Terminals and storage devices are input/output devices because they perform both input and output operations. Figure 1-5 shows several of the optional peripheral devices that are often added to an RT-11 computer system. VT11 Display Figure 1-5 1-6 Peripheral Devices Introducing the RT-11 Computer System Magtape Line Printer Figure 1-5 Peripheral Devices (Cont.) The hardware configuration of your own RT-11 computer system includes the computer, the terminal, the storage medium, and any other peripheral devices you choose to add. System software is an organized set of supplied programs that effectively transform the system hardware components into usable tools. These programs include operations, functions, and routines that make it easier for vou to use the hardware to solve problems and produce results. For example, some system programs store and retrieve data among the various peripheral devices. Others perform difficult or lengthy mathematical calculations. Some programs allow you to create, edit, and process application programs of your own. Still others handle entire applications for you. As illustrated in Figure 1-6, system software always includes an operating system, which is the “intelligence” of the computer system. Usually the system software includes one or several language processors; it sometimes also includes specific applications. SYSTEM SOFTWARE Introducing the RT-11 Computer System OPERATING SYSTEM LANGUAGE APPLICATION PROCESSORS PROGRAMS Figure 1-6 The RT-11 Operating System System Software An operating system is a collection of programs that provide s an environment in which you can create and run program your own. The operating system organizes all the hardwa s of re and software resources of the computer system into a workin g unit and gives you control. The RT-11 operating system comprises four types of program s: a monitor/executive program for system control and supervision; several device handlers (programs), one for each of the supported hardware devices; a variety of utility programs for program/data creation and manipulation; and finally, the inter- faces that are necessary to support several programming lan- guage processors. The operating system is illustra 1-7. ted in Figure The monitor (executive) program is the link between the system hardware, the system software, and you. Part of the monitor function is to accept, process, and execute your instructions for controlling the system. A comprehensive set of monitor operating commands allows you to direct, from the console terminal keyboard, those system operations that you want to occur. Device handlers are routines that provide the interface various hardware devices that are part of the computer to the system. A handler exists for every peripheral device that the system supports. Utility programs cover a wide range of resources; such programs allow you to create and edit text, maintain other pro- Introducing the RT-11 Computer System DEVICE HANDLERS UTILITIES ¢ EDITOR ® FILE o DEBUGGING MAINTENANCE SUPPORT FOR LANGUAGE PROCESSORS Figure 1-7 & FILE COMPARE ® LIBRARIAN The RT-11 Operating System grams, and locate user-programming errors. Some utility pro- grams in the RT-11 operating system are the following: e An editor, which allows you to create and modify textual material; this material could be the statements that make up a computer program, a memo, or any text you wish to create ¢ File maintenance utility programs, which allow you to manipulate and maintain your programs and data — to transfer them between devices, to update them, and to delete them when you are done with them e A debugging program, which helps you uncover and correct errors in your programs e A librarian, which makes it easy for you to store and retrieve often-used programming routines e A linking program, which converts object modules into a format suitable for loading and execution e A source comparison program, which is used to compare two ASCII files and to output any differences to a specified output device ® A dump program, which outputs to the console or line printer all or any part of a file in octal words, octal bytes, ASCII characters, or Radix—50 characters The RT-11 operating system also provides support for several programming languages and their respective language processOrs. Introducing the RT-11 Computer System Language A language processor is a translating program that you use to Processors process a source program you have created. A language processor exists for every programming language supported by the system, whether it is a high-level language or a machine-level language.' High-level languages, such as BASIC-11 and FORTRAN 1V, are relatively easy languages to learn and use. Since a single language statement often performs a series of intricate computer operations, high-level languages let you direct your at- tention to solving the problem at hand. They do not require that you understand how the computer interprets the problem. In addition to FORTRAN IV and BASIC-11, the RT-11 operating system supports the high-level language DIBOL, DIGITAL’s interactive commercial language. Machine-level or assembly languages are available for users who prefer to work at the instruction level of the computer. At this level, you have control over such factors as program size and speed of execution. Machine-level languages do require that you be familiar with the computer and the hardware devices of the system. RT-11 provides the MACRO-11 assembly language processor for those who would rather work at this more intricate level. Applications The RT-11 Packages packages. These include a laboratory applications package for operating system supports several applications the standard functions found in most laboratory environments. A scientific subroutine package (for FORTRAN 1V users) provides a large selection of mathematical and statistical routines commonly required in scientific programming. And a graphics support package for BASIC-11 and FORTRAN IV users provides display features such as multiple intensity and blinking vectors (lines), alphanumerics, and points. Because of the spe- cialized nature of these applications packages, they are not described further in this manual. SYSTEM The third component of a computer system is documentation, DOCUMENTATION which includes manuals that tell you how to use the software and hardware of the computer system. Documentation also includes any source listings of programs that make up the operating system. Hardware Manuals Hardware manuals describe the devices in the computer system. RT-11 hardware documentation includes a Processor !Language selection is discussed in Chapter 8 of this manual. 1-10 Introducing the RT—11 Computer System Handbook that describes the PDP-11 computer you are using, and a User’s Guide or Maintenance Manual for each peripheral device in your computer system. These manuals tell you how to operate the devices and give you special programming information that you may need if you intend to write device drivers or special system software involving the devices. Software manuals' describe the operating system and the language processors. RT-11 software documentation falls into three major categories: introductory or once-only manuals (intended to be used once and then stored away); console manuals (intended to be used at the computer); and desk/console manuals (intended to be used at your desk for reference purposes). Software Manuals Once-only manuals include this manual and others that are needed only when your system is initially installed. You may have little or no occasion to use these manuals once your computer system is in operation and you are familiar with its use. Console manuals are those manuals that tell you how to use the computer system. They describe in detail command usage and syntax, list summaries of system operations, and give the meanings of system messages. The RT—11 System User’s Guide is an example of a console manual. Desk/console manuals are those manuals that you continually use for reference as you write your own application programs. These manuals include the general language reference manuals and the advanced programming manuals that contain programming information specific to the RT-11 computer system. The RT-11 Software Support Manual is an example of a desk/console manual. Source listings are actual listings of the assembly language code that makes up the RT-11 operating system. These listings are very detailed and are generally needed only if you intend to modify the system software. They can be ordered on microfiche from the DIGITAL Software Distribution Center. This completes a general introduction to the RT-11 computer system. Subsequent chapters of this manual describe how you use the various system components mentioned here to perform a series of related computer operations. You begin in Chapter 2 by learning how to start the RT-11 computer system. 1a1l RT-11-related software manuals are listed and described in the Guide to RT-11 Documentation. Many of these manuals are provided with your system; others can be ordered from the DIGITAL Software Distribution Center. 1-11 Source Listings Introducing the RT-11 Computer System REFERENCES Digital Equipment Corporation Reference Service, Volume 2: Products and Services. Maynard, Mass.: Digital Equipment Corporation, 1982. An overview of the PDP-11 family products and services; includes capsule descriptions of the various PDP-11 computers, periphera ls, and operating systems, and describes the supportive services provided by DIGITAL. Eckhouse, Richard H. and Morris, L. Robert, M inicomputer Systems: Organi- zation, Programming, and Applications (PDP-11). Englewoo d Cliffs, N.J.: Prentice-Hall, 1979. A guide to programming fundamentals, PDP~11 organizat ion and structure, and programming techniques. See Chapters 1, 2, and 3. Guide to RT-11 Documentation (AA-5285G-TC ). Maynard, Mass.: Digital Equipment Corporation, 1983. A listing and brief summary of current RT-11-r elated software docu- mentation. Katzan, Harry Jr., Information Technology, The Human Use of Computers. New York: Mason & Lipscomb, Petrocelli Books, 1974. An introductory textbook covering basic computing concepts, programming languages, and topics in computers and society. See Chapters 1, 2, 4, 5, and 10. PDP-11 Peripherals Handbook. Maynard, Mass.: Digital tion, 1981-82. Equipment Corpora- A technical summary of the PDP-11 peripheral devices; includes descriptions, specifications, programming, and interfacing information for PDP-11 peripheral devices. PDP-11 Processor Handbook. Maynard, Mass.: Digital Equipme nt Corporation, 1981. A hardware manual for the owners and users of the PDP-11 computers and for those who will be using the PDP-11 guage instruction set. family of assembly lan- PDP-11 Software Handbook (EB-21759-20). Maynard , Mass.: Digital Equipment Corporation, 1982-83. A general overview and introduction to available PDP-11 software, operating systems, and language processors. Spencer, Donald D., Fundamentals of Digital Computer s. Indianapolis, Kansas City, New York: Howard W. Sams, Bobbs-Merrill, 1969. A discussion of the history and evolution of computers, computer applications, and fundamentals of computer use. See Chapters 1 through 12 and Chapter 20. 1-12 CHAPTER 2 STARTING THE RT-11 COMPUTER SYSTEM Before you can use the RT-11 computer system to perform any operations, you must start it. Starting the system involves turning on the computer and the various hardware devices and loading the appropriate software components into computer memory. Within every PDP-11 computer is a physical, designated storage area called memory. Computer memory is where system information and data are temporarily loaded and stored for use during the various system operations. COMPUTER MEMORY Each time you use the computer system, there may already be information in computer memory, left by the person who used the system last. For example, there may be the results or data of another user’s program; there may be the results of a particular system operation; there may even be an entirely different operating system in memory. For your purposes, computer memory must contain the RT-11 operating system, and specifically the RT-11 monitor program. Thus, your first operation as a system user is to transfer the monitor program from the disk device, where it was stored during system installation, to computer memory, where you can use it. The process of transferring the RT-11 monitor to memory is called bootstrapping the system,; it is the only system operation that requires you to use the operator’s console on the front panel of the computer (see Figure 2-1). Starting the RT-11 computer system requires that you know how to operate your system’s hardware devices. Since you may not have had the opportunity to use any of the devices yet, ask an experienced user to help you the first time. Follow the instructions in the section in this chapter entitled “Bootstrap Procedure.” If necessary, refer to the RT—11 Automatic Installation Booklet, the RT—11 Installation Guide, or the various hardware manuals provided with your system. First read through the following material and fill in the appropriate information where requested. You should be able to determine all responses by checking the RT-11 Automatic Installation Booklet or the RT-11 Installation Guide. 2-1 HARDWARE CONFIGURATION Starting the RT-11 Computer System RT-11 RESIDENT ; 3 8 o [ o E[b Figure 2-1 BOOTSTRAP Bootstrap/Computer Relationship NOTE If your system device is a diskette, you need to build four volumes and, when running some of the demonstration programs, limit the volumes to the components needed to execute the programs. Also, you need to preserve the distribution volume you received from DIGITAL by making backup copies. The RT-11 automatic installation procedure performs these functions for you. If you did not use the automatic installation procedure to install your RT-11 system, the RT-11 Installation Guide will provide you with the commands you need to copy and preserve the distribution volume and create the volumes for use with this manual. You must have the following materials to start the system and to perform the exercises in this manual: ¢ The volume containing the RT-11 operating system (called the system volume); refer to Section 2.3.6 of the RT—11 Instal- lation Guide for the list of components you will need on your system volume to perform the exercises ¢ The volume containing the FORTRAN IV and/or BASIC-11 language processors if these languages are not stored on the system volume BASIC-11 users) (available only to FORTRAN IV and Starting the RT-11 Computer System e A volume for program storage (for example, magtape or another disk or diskette); this volume should contain no important information since all information on it will be erased during a later computer exercise e A copy of the RT—11 Automatic Installation Booklet or the RT-11 Installation Guide NOTE You can find hardware configuration information in the various hardware manuals provided with your system. Instructions for starting (bootstrapping) your RT-11 system appear in the RT-11 Automatic Installation Booklet and the RT—11 Installation Guide. This information should be adequate for you to answer all the questions asked here. If you have trouble, see Appendix B, Suggestions for Bootstrapping the System. Do not continue to any other chapter in this manual until you understand the following configuration information and can bootstrap the system yourself. 1. What kind of terminal device are you using (for example, Terminal 2. Is your computer a PDP-11/23-PLUS, PDP-11/24, or Computer LA120 DECwriter III, VT100 video terminal)? PDP-11/447 3. Does your computer operator’s console have pushbuttons or switches? 4. How much memory does your computer have? 5. What kind of system volume are you using (for example, RLO02 disk, RX02 diskette)? 6. What is the two-letter mnemonic for this volume (typical mnemonics are given in Table 2-1; respond with the mnemonic for your own volume)? System Volume Starting the RT-11 Computer System Table 2-1 Representative System Volumes Volume Mnemonic RX01 Diskette DX RXO02 Diskette DY RKO05 Disk RK* RKO06/07 Disk DM RC25/RD51 Disk, RX50 Diskette DU RL01/02 Disk DL * Use DK to bootstrap from an RK05 disk. Storage Volume 7. What volume are you using for program storage (for example, TS11 magtape, RLO2 disk)? 8. In which device unit will you use this volume (choose any available device unit — for example, 0, 1)? Optional Devices 9. and Supported What peripheral devices are part of your system (for example, line printer, magtape, VT11 display hardware; list all devices other than the terminal and the computer)? Languages 10. What programming languages does your system support (MACRO-11 or BASIC-11, for example)? BOOTSTRAP PROCEDURE Once you have determined your hardware configuration, you are ready to bootstrap the system. The purpose of the bootstrap procedure is to load and start the RT-11 monitor in computer memory, thus activating the RT-11 computer system for your use. NOTE If your answer to question 2 in the Hardware Configuration section is YES, continue to the next paragraph. Otherwise, read the section entitted Bootstrapping System, in Appendix A, for bootstrap instructions. the The bootstrapping procedure for the RT-11 computer system on a PDP-11/23-PLUS, PDP-11/24, or PDP-11/44 processor consists of the following steps. For more detailed instructions on 24 Starting the RT-11 Computer System the bootstrap operation, refer to the RT—11 Automatic Installa- tion Booklet. 1. 2. Turn the terminal to an on-line condition. Make sure that the computer power is on and that the com- puter is not already in use. e If your computer is a PDP-11/23-PLUS, power up the system by lifting the AUX toggle switch to the ON posi- tion. The red PWR OK indicator on the front panel will light up if the system was successfully turned on. e If your computer is a PDP-11/24 or a PDP-11/44, power up the system by turning the status selector key to the LOCAL position. The red DC ON indicator on the front panel will light up if the system was successfully turned on. 3. Stop the computer. e If your computer is a PDP-11/23-PLUS, lift the HALT toggle switch to the up position. The AUX toggle switch that you lifted in the previous step and the HALT toggle switch can be lifted simultaneously. e If your computer is a PDP-11/24 or a PDP-11/44, push the HALT/CONT/BOOT horizontal toggle switch to the HALT position. 4. Load the system volume in its corresponding device unit 0. Make sure that the system volume is write-protected (for all except RX01 or RX02 diskettes, which are always writeenabled). 5. Load the storage volume in the device unit noted in question 8 in the Hardware Configuration section. Make sure that this volume is write-enabled. 6. Boot the system. e If your computer is a PDP-11/23-PLUS, lift the RE- START toggle switch on the front control panel. This switch will not remain in the up position; it will spring back to the center position. e If your computer is a PDP-11/24 or a PDP-11/44, push the HALT/CONT/BOOT horizontal toggle switch to the BOOT position. This switch will not remain in the rightmost position; it will spring back to the center position. The red RUN indicator on the front control panel should now be illuminated. 2-5 Starting the RT-11 Computer System A series of self-diagnostic routines to check out the system are then executed. The execution of these routines may take up to a minute, depending upon how much memory is installed in your system. A prompt appears on your console terminal when execution of the routines is completed. The prompt that appears is dependent upon the type of processor you are using. Table 22 provides the prompts that appear and the corresponding responses which must be supplied if you are using the PDP-11/23-PLUS, PDP-11/24, or PDP-11/44 processor. Table 2-2 Bootstrap Prompts and Responses Processor Prompt PDP-11/23-PLUS TESTING MEMORY Response dd[n]GED wwww. KW START? PDP-11/24 bbbbbbbb <none> PDP-11/44 >>> B dd[n]GED WWWW, = bbbbbbbb. = amount of memory in K-bytes (octal) dd[n] = device mnemonic (dd) and unit number (n) 7. amount of memory in K-words (decimal) Respond to the prompt that appears on your console terminal by typing the appropriate response (refer to Table 2-2) followed by a carriage return. NOTE Refer to question 6 in the Hardware Configuration section for the two-letter device mnemonic (dd) and refer to question 8 for the device unit number (n). You should now direct your attention to the console terminal, since system interaction continues on this device, REFERENCES PDP-11 Processor Handbook, Maynard, Mass.: Digital Equipment Corporation, 1981. A hardware manual for the owners and users of the PDP-11 family of computers and for those who will be using the PDP-11 assembly language instruction set. 2-6 Starting the RT-11 Computer System RT-11 Automatic Installation Booklet: RX02 Diskettes (AA~-M235A-TC), RT-11 Automatic Installation Booklet: RLO2 Disk (AA-M236A-TC), RT-11 Automatic Installation Booklet: RC25 Disk (AA-M237A-TC), and RT-11 Automatic Installation Booklet: MICRO/PDP-11 (AA-M238A-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. RT-11-specific software booklets which provide basic instructions for using the automatic installation process to install and test the RT-11 monitors, system programs, and certain languages. RT-11 Installation Guide (AA-H376B-TC) and RT-11 System Release Notes (AA-5286E-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. Two RT-11-specific software manuals that contain instructions for installing, customizing, and starting the RT~11 computer system. Manual Maintenance System Disk Floppy RX8/RX11 (EK—ORX01-MM-PRE2). Maynard, Mass.: Digital Equipment Corporation, 1975. A hardware manual for the owners and operators of RX01 diskettes and for those who will be programming computers to interact with these devices. VT100 User Guide (EK-VT100-UG-002). Maynard, Mass.: Digital Equip- ment Corporation, 1978. A manual for the owners and operators of the VT'100 video terminal and for those who will be programming computers to interact with these devices. 2-7 CHAPTER 3 INTERACTING WITH THE RT-11 COMPUTER SYSTEM Interaction with the RT-11 computer system involves an exchange of information between you (the user) and the software operating system. The exchange may be active, with you dictating command information from the terminal keyboard and the system responding immediately; or it may involve the storing of information on mass storage volumes for later use. During the bootstrap procedure you activated the RT-11 computer system by loading and starting the monitor program in computer memory. One of the functions of the monitor program is to provide you with the capability to use the console terminal. Since the console terminal can perform both input and output operations, it is used to interface between the system and the user. With it, you can: ¢ Type the commands that control system operation ¢ Receive messages and responses from the system All console terminals have a keyboard — used to enter information — and a paper output device or video screen — used to echo characters typed at the keyboard and to print system messages and responses. Figure 3—1 shows two commonly used terminals, the LA120 and the VT100. These two terminals differ in their output mechanism. While the LA120 terminal has a paper printer, the VI'100 has a video screen. The paper printer and the screen serve the same purpose — they show user input and system responses; however, paper output can be saved for later use.while screen output is temporary. The keyboards of both terminals are shown in Figure 3-2. 3-1 USING THE CONSOLE TERMINAL TO EXCHANGE INFORMATION Interacting with the RT-11 Computer System LA120 VTi00 Figure 3-1 3-2 LA120/VT100 Terminals Interacting with the @-llflllll@m w LA120 %e@@lllflt w VT100 Figure 3-2 LA120/VT100 Keyboard Layouts Using Figure 3-2 as a guide, study your own terminal keyboard. First, notice that the keys for the alphabetic characters are positioned in the same way as on most standard typewriters. The SHIFT key allows you to select between numeric and special characters and between uppercase and lowercase characters.! The position of the numeric and special characters varies somewhat among the different terminals, so you may need to hunt for a particular key until you become familiar with your own terminal. Locate the DELETE key. This key is used to correct a typing mistake. Pressing the key once cancels the last character typed. Pressing it twice cancels the last two characters, and so on, back to the beginning of the line. 1With the exception of system messages and one other exception explainedin Chapter 5, the RT-11 computer system uses uppercase characters exclusively. 3-3 RT-11 Computer System Interacting with the RT—11 Computer System Locate the TAB key. Tab stops on a computer terminal are positioned every eight spaces across the line, beginning at column 1. Pressing the TAB key moves the character pointer (that is, the position on the line where the next character will be typed) to the beginning of the next tab stop. The key marked RETURN performs a carriage return; it both returns the character pointer to the beginning of the line and advances it to the next line. This key is used to terminate the line currently being typed and to terminate certain RT-11 system commands. Locate the ESC key and the LINE FEED key. These are special command terminators that are described in Chapters 5 and 14. An important key is the CTRL key. It is always used with another character key to perform one of several system opera- tions. CTRL commands are explained in detail when you begin to use them later in the manual. Table 3-1 reviews the console terminal keyboard characters. Keys not mentioned are not used by the RT-11 computer system and can be ignored. You will have an opportunity to become familiar with your terminal keyboard as you perform the demonstrations in this manual. The console terminal also displays messages and responses from the system. These messages and responses provide or request information. Error messages are an example of informa- tional output; they help you detect typing errors, programming errors, and system malfunctions. If an error message appears on your console terminal while you are performing the demonstrations in this manual, refer to the RT-11 System Message Manual for an explanation of the cause of the message and a description of the corrective action that should be taken. USING MASS STORAGE VOLUMES Mass storage volumes provide an area (apart from computer memory) to keep information for later use. The information may be user application programs, data needed by a program, the results of a program run, textual information, batch-type programs, and so on. As an example, the RT-11 operating system is stored on a mass storage volume called the system volume. When information is needed, as it was during bootstrapping, information from the storage volume is transferred into computer memory. Interacting with the RT—11 Computer System Before you can access the information stored on a storage volume, however, you must first insert the volume (the medium) into its corresponding device unit (drive), the hardware device connected to the computer. Once a volume has been in- serted into a device unit, the device unit’s symbol identifies the volume. There may be more than one device unit for a volume, each individual device unit is numbered 0, 1, 2, and so on. As you learned in the bootstrap procedure, the system volume is inserted in device unit 0 and remains in it as long as you are using the system. Other storage volumes can be inserted in any available device units. Figure 3-3 illustrates several mass storage volumes. Table 3-1 Keyboard Characters Function Key BACK SPACE Ignored during normal system use BREAK Ignored during normal system use CTRL Control; part of several two-key command combinations that perform specific system functions DELETE ESC LINE FEED Erase; cancels the last character typed Command terminator; terminates an editing command string; transmits the command to the computer and performs a carriage return Command terminator; terminates certain system commands; transmits the command to the computer and performs a carriage return REPEAT Ignored during normal system use RETURN Line terminator, command terminator; termi- SHIFT TAB any other key nates the current line; terminates certain system commands; transmits the command to the computer and performs a carriage return Selects the uppermost of two characters ap- pearing on a key Moves the character pointer ahead to the be- ginning of the next tab stop Transmits the alphanumeric or special character to the computer Interacting with the RT-11 Computer System Diskette Figure 3-3 3-6 Mass Storage Volumes Interacting with the RT-11 Computer System Mass storage volumes hold large amounts of information. Most volumes, however, are physically small enough so that you can transport them from the system, to your desk perhaps, or to another computer system. In addition to disks (shown earlier in Figure 1-4), magtapes are also mass storage volumes. You store information on a mass storage volume in the form of files. Each file is a logical collection of data. Files may be parts of programs or entire programs, program input data, or text, such as a letter or report. Whatever its content, each file is treated as a unit and occupies a fixed area of the volume. File Storage Every file on a mass storage volume has a unique name that is composed of a file name and a file type. The file name and file type identify the file and distinguish it from other files on the volume. You can instruct the system to print on your terminal the names of all files on a volume. The resulting list is called the volume directory listing. By referring to the volume directory, you can find the name, size, and creation date of each file on that volume and delete old files that you no longer need. Whenever you perform an operation that affects the contents of the volume, a new volume directory reflects the change. Occasionally, after many files are added to a storage volume, the volume has no room for new information. A storage volume may also become damaged, lost, stolen, or worn through use. For these reasons it is a good idea to have several extra storage volumes on hand and to protect your more important files against accidental erasure or loss. One way to protect a file is to make a copy of it on a second storage volume. The copy, called a backup file, insures you against the loss or damage of your original file (or its respective storage volume). Some storage volumes provide a mechanism that protects files against accidental erasure. This mechanism is generally a switch on the volume itself, or on the device unit, that you can set to a write-protect or write-enable condition (as you did during bootstrapping). When the volume is write-protected, information can be copied only from the volume to computer memory or to another volume that is write-enabled. A volume that is write-enabled, on the other hand, also allows information to be copied from memory back to the volume. 3-7 File Protection Interacting with the RT-11 Computer System The RT-11 operating system itself provides a protection feature. This optional feature requires that you confirm certain system commands that might otherwise erase important information. The system also issues prompting messages so that you provide the proper file information when it is needed by a com- mand. Chapter 4 and succeeding chapters require you to use the terminal to enter command information and perform file copy and other system operations. Before you continue, make sure that there is a backup copy of your system volume. If you cannot locate one, read Appendix B, Backing Up the System Volume, before going on. REFERENCES RT-11 System Message Manual (AA-5284D-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. An explanation of system messages that may occur during normal system use; includes required user actions. VT100 User Guide (EK-VT100-UG-002). Maynard, Mass.: Digital Equipment Corporation, 1978, A manual for the owners and operators of the VT100 video terminal and for these who will be programming computers to interact with these devices. CHAPTER 4 USING THE MONITOR COMMAND LANGUAGE During the bootstrap operation, the RT-11 monitor was copied into computer memory and started. The RT-11 monitor is actually many different components working together to supply basic system functions. For example, the part of the monitor called the resident monitor (RMON) provides the console terminal service and central program code necessary for a working environment for both system and user programs. The resident monitor is so named because it always remains in computer memory, regardless of other system operations that may be occurring. Other parts of the monitor are brought into memory from the system volume as needed. These include the user service routine (USR), which provides support for the RT-11 file system, and the keyboard monitor (KMON), which controls terminal keyboard interaction. From your standpoint, the keyboard monitor is the most visible part of the system software. Among other services, it supplies the monitor command language that you use to control system operations. The monitor command language is a set of English-like command words that you type on the terminal keyboard to initiate and control system operations. You can type a command in one of two general formats: a long format or a short format. The long format causes the system to print prompting messages. These messages ask you to supply specific information, such as file names and device names. The long format is helpful until you become familiar with the commands. You will then probably prefer to use the short format, which allows you to enter all required information on a single command line and provides prompts only if you do not supply necessary information. Both formats are demonstrated throughout this manual. You terminate all monitor commands with a carriage return. That is, after you type the required command information, you press the carriage return key (represented in this manual by ®D). This instructs the monitor to initiate the command and to perform the operation. A prompt character — a period at the left margin of the terminal printer or screen — appears whenever the RT-11 monitor is waiting for you to type a command. The period is your cue that the system is in the monitor command mode and ready to accept a monitor command. Check the output on your terminal printer or screen. You should see the following at the left margin: RT-11FB . xx VOS5 4-1 ENTERING COMMAND INFORMATION Using the Monitor Command Language RT-11FB identifies the RT-11 monitor called the foreground/background (FB) monitor. Following this is the version (and update) number of the system in use, in this case, Version 5. The period on the next line indicates that the system is in the monitor command mode and is waiting for you to type a monitor command. General Command Format Whenever you issue a monitor command, you must supply certain information to guide command processing. This informa- tion includes the following (square brackets indicate optional qualifiers and characters): COMMAND//option] First you indicate, by command, which system operation you want initiated. Command options are available to allow you to alter the normal (default) operation. INPUT[/option] You next indicate, by device and file name, input information that is to be used during the operation. The system volume serves as the default input device. You must explicitly indicate other volumes that you want used for input, and you must usually indicate the file names and file types of the input files. Input file options are avail- able to allow you to alter assumed (default) input operations. OUTPUT{/option]* Finally you indicate, by device and file name, output information that is to be created as a result of the operation. The system volume serves as the de- fault output device. You must explicitly indicate other volumes that you want used for output, and you must usually indicate the file names and file types of the output files to be cre- ated. Output file options are available to allow you to alter assumed (default) output operations. As mentioned earlier, you can type this command information on the terminal keyboard in one of two formats; illustrations of both follow: 'OUTPUT(/option] is not always used; sometimes output must be specified as COMMAND/[/option] INPUT/QUTPUT:filespec. 4-2 Using the Monitor Command Language Long Command Format (system prompts for specific information) +COMMANDL /0P tionl@ED INPUT PROMPT? INPUTL/oPtionl@D DUTPUT PROMPT? OUTPUTL/optionl@D Short Command Format (no prompts) +COMMANDL/optiond INPUTI/orptionl DUTPUTL/crtion ]G Notice that a slash character (/) separates an option from the portion of the command that it qualifies, and a carriage return @ED terminates each individual command line. When you have supplied all the necessary information, the carriage return signals the monitor to execute the command. You can use either format; both are demonstrated throughout this manual. In addition to monitor commands, RT-11 has several special function commands, called control commands, that you type by first pressing and holding down the CTRL key on the terminal keyboard and then typing the letter key of the command. To execute the CTRL/C command, for example, type the letter C while holding down the CTRL key. These control commands require no terminator; the system performs the function as soon as you type the command. Control Commands Control commands are used to interrupt program execution, to inhibit terminal output, and to perform other similar special system operations. They are described in the manual as you need to use them. During the course of this chapter, and throughout the remainder of the manual, you will use a number of monitor commands to perform some common system operations. For example, you will list the directories of device volumes, copy files between devices, create files, and execute system and user programs. You perform these operations by re-creating on the terminal keyboard the examples already provided for you. You should first read the entire explanation of a command to be aware of its format, the operation it performs, and the options that are available. Then type the command on the terminal keyboard exactly as you see it used. Characters that you type appear in the demonstrations in red print. Characters that are system responses are shown in black print. Table 4—1 lists symbols that you will see used throughout the demonstrations. These symbols represent various keys on the 4-3 Re-Creating the Examples Using the Monitor Command Language terminal keyboard. When you see one of these symbols in a command line, type the appropriate key on the keyboard. Table 4-1 Keyboard Symbols Type Symbol ®ED carriage return key line feed key space bar (once for each time the symbol is shown). Assume that you should type a single space unless you are otherwise instructed; the space symbol is used only if there is doubt about the number of spaces to type. TAB key (once for each time the symbol is shown) DELETE key (once for each time the symbol is shown) ESCAPE key (once for each time the symbol is shown) CTRL CORRECTING TYPING MISTAKES CTRL key (hold down CTRL key while typing the letter character [x]) All commands that you give the system are typed on the terminal keyboard. If you make a mistake while typing a command, you can correct it in one of two ways. One way to correct a typing error is to use the DELETE key on the keyboard. Pressing the DELETE key once cancels the character just typed; pressing it a second time cancels the next to last character typed, and so on, from right to left, until the beginning of the line is reached. Then additional DELETEs are ignored. CTRL/U The second way to correct a typing error is to use CTRL/U, a special control command. Typing this command once is equivalent to typing as many DELETESs as are needed to cancel every character in the current line. Type on the keyboard the letters DABE, followed by two DELETEs, followed by the letters TE, and notice the system’s response: +DABE @B TE The monitor echoes each deleted character and encloses them within backslashes. As far as the monitor is concerned, the only characters you have typed are DATE. Using the Monitor Command Language +DABENEBA\TE Thus, your current line is DATE. Continue by typing a CTRL/U. Remember to first press and hold down the CTRL key and then type the U key; no carriage return is necessary. €D Notice that CTRL/U echoes on the terminal printer or screen as “U. +DABENEBA\TE"U All characters on the line are canceled, and the character pointer is moved to the beginning of a new line so that you can enter another command. You are still in the monitor command mode even though no prompting period appears at the left margin. Once the carriage return or line feed key is pressed, the previous line cannot be corrected with DELETE or CTRL/U. These two methods are commonly used to correct typing errors made at the keyboard. You can choose whichever method seems most convenient. The kinds of command operations that you usually perform immediately after the monitor is bootstrapped are those that set up initial conditions, such as the current date and time of day, and those that initialize and prepare the system for future operations such as file transfers. If your system has VT11 display hardware that you want to use, you should also enable (turn on) INITIAL MONITOR COMMAND Display hardware on an RT-11 computer system consists of a cathode ray tube that allows programs to use graphics displays. Using VT11 Display OPERATIONS the graphics display screen. If your system has display hardware' (Figure 4-1), you can use the graphics screen in place of the terminal printer or screen. NOTE Check question 9 in the Hardware Configuration section of Chapter 2 to determine if your system has display hardware. If you do not have display hardware, go on to the next section, Entering the Date and Time-of-Day. 1yideo terminal screens are not considered graphics display hardware. 4-5 Hardware Using the Monitor Command Language GT The monitor command that enables the graphics screen is GT command. The GT command is used to change the of the graphics display. In this case, you will use the condition it to activate the graphics display hardware so that the VT11 display screen replaces the console terminal printer or screen as the termina l output device. Figure 4-1 VT11 Display Hardware Type the following on your terminal keyboard (if necessary, refer to Table 4-1 to review the special symbols): Long and Short Command Format JGT OMGEED If your system does not have display hardware, the monitor prints a message' on the terminal printer or screen informing you that the command is invalid for your system configuration: PRKMON-F-Invalid command Otherwise, the command is accepted. You should notice that all character-echoing and system responses are now directed to the graphics screen instead of to the terminal printer or screen. After the command has been accepted, a period appears on the graphics screen, indicating that the system is waiting for an- other command. The character pointer is visible as a blinking rectangular cursor situated after the period. (In the edit mode, the cursor is L-shaped.) 'The meanings of all system messages are listed in the RT-11 System Mes- sage Manual. 46 Using the Monitor Command Language Like output on the terminal screen, output that appears on the graphics screen is temporary. Once the screen is filled, lines are rolled off the top and are lost to view. However, if your terminal has a printer, a special control command allows you to control console terminal output so that it appears on both the graphics screen and the terminal printer simultaneously. In this manner, you can direct selected portions of terminal output — directory listings, for example — to be both displayed and printed at the same time. The advantage of this is that although the display copy is eventually lost, you have a printed copy for later use. The control command that provides this function is CTRL/E, which is initiated by holding the CTRL key down while typing the E key. No carriage return is necessary. When you type this command, no characters echo on the graphics screen, but you should notice that all subsequent characters (both input and output) appear on both the graphics screen and the terminal printer. Thus, if your terminal has a printer and you wish to use the printer in addition to your VT11 graphics screen, type once: (Remember, this command does not echo.) Now type the following and notice where the characters echo: ,WRONG COMMAND To disable the printer at any time so that character echoing occurs only on the graphics screen, type another CTRL/E command: Finally, to return terminal output control to the terminal, disabling the graphics screen, use the GT OFF command; this changes the terminal device handler back to its original output setting: Long and Short Command Format JGT OFFG@D Decide now whether to use the graphics screen for the remaining demonstrations. If so, use the GT ON command to enable the graphics screen, and remember that the CTRL/E command is available when you wish to produce simultaneous output. 4-7 CTRL/E Using the Monitor Command Language Entering the Date and Time-of-Day Entering the current date and time-of-day helps in record- keeping for system operations. Later, you can identify when system operations were performed. For example, by entering the current date you instruct the system to assign this date to all files you create. The date will also appear in volume directories and listings produced by the various language processors and utility programs. If your system has a clock, by specifying the current time-of-day you instruct the system to keep track of time based on the time you set. The current time is printed on listings when they are produced, and may also be used to control certain program operations. DATE Enter the date by typing the monitor DATE command with the day, month, and year as follows (there is only one format): Long and Short Command Format .DATE 8-JAN-B3ED This sets the date to January 8, 1983. Since this date is not current, reenter the correct date using the same command format: JDATE dd-mmm-vyy @D Typing the new date overrides the previous date. The date that is set is temporary. You must reenter it whenever you bootstrap the system. TIME The monitor TIME command is used to set the time-of-day, specified in 24-hour notation. The system keeps track of time in hours, minutes, and seconds, based on the initial time that you enter in the command. Enter the time as follows (there is only one format): Long and Short Command Format TIME 15:01: 0060 If your system does not have a clock, the monitor prints a message on the terminal; this message informs you that the command is not valid for your system configuration: PKMON-W-~-No clocK Otherwise, the time is set to 3:01 p.m. If your system has a clock, reenter the correct time, using the same command format: +TIME hhimm:ss@D 4-8 Using the Monitor Command Language Typing the new time overrides the previous time. The system’s clock stops when the system stops running. If you want the time to be kept current, you must reenter it whenever you bootstrap the system. If your system has a clock and you do not set the time, the TIME command will return the time elapsed since the last hardware boot. To check the time or date at any time while you are using the system, simply type either the DATE command or the TIME command, followed by a carriage return only: Long and Short Command Format DATEGD 8-.JAN-83 , TIMEGED 15:06:18 The system responds by printing the date or the time, based on the information you previously entered. If the system responds to the DATE command with the message 2KMON-W-No date, the date has not been set since the system was last bootstrapped. Each hardware device in the RT-11 system is identified by a two-letter mnemonic. The mnemonics, listed in Table 4-2, are defined in the system software and are recognized and used by the operating system. These are the device names that you generally use in command input and output lines. However, you may want to change any of these device names temporarily, for a variety of reasons. The following paragraphs describe both using the physical device names shown in Table 4-2 and assigning logical (temporary) device names to devices. Table 4-2 Physical Device Names Mnemonic Device DUn: RC25/RD51 Disk, RX50 Diskette RKn: TT: RKO05/RK11 Disk Console Terminal DLn: DMn: DXn: DYn: LP: LS: MMn: MSn: MTn: RL01/02 Disk RKO06/07 Disk RXO01 Diskette RX02 Diskette Line Printer Serial Line Printer TJU16 Magtape TS11 Magtape TM11 Magtape 4-9 Assigning Logical Names to Devices Using the Monitor Command Language Two additional logical device names are used. These special names are described in Table 4-3. Table 4-3 Special Logical Device Names Mnemonic Device SY: The volume from which the monitor bootstrapped; that is, the system volume. was DK: The default storage volume (initially the same as SY:; that is, the system volume). You use device names in the input and output portions of a command line to identify where input information can be found and where output information will be sent. If a file is involved, you also include its file name and file type, in the following format: devicename:filename.filetvre The device name is followed by a colon and is always separated from any file name and file type by a colon. The device name is generally one of the mnemonics listed in Tables 4-2 and 4-3. When you use a device name in any command, you must also include the device unit number (represented by the letter n in Table 4-2) unless the number is 0. The system assumes unit 0 of the device if no unit number is given. Thus, diskette unit 0 is DY: or DYO:; diskette unit 1 is DY1:; RK: disk unit 2 is RK2;; and so on. Note that, according to Table 4-3, you can use the device mnemonic SY: or DK: for your system volume in addition to its standard device name. However, since the system volume is initially the default storage volume for all operations, you do not need to use a device name for your system volume. The names listed in Tables 4-2 and 4-3 are the device names defined within the system software. However, you can change any of these name assignments temporarily, either by reassigning existing names to different devices or by assigning new logical names of your own choosing to devices. You might want, for many reasons, to change a device name temporarily and assign it a logical name. You may, for example, have a program written for a device that is not available on your system. If you assign the program name to a device that is available, the program then uses that device instead.! Since not all RT-11 users have access to the same kind of storage volume, you are instructed to assign the logical name VOL: to whatever volume you are using for storage. After you IThis is called device independence. 4-10 Using the Monitor Command Language make this assignment, subsequent command lines can be the same for everyone using this manual. Similarly, the special logical device name DK:, presently assigned to your system volume, could be assigned to any kind of storage volume. Not only would DK: signify your storage volume, regardless of its physical device name, but you could also avoid typing DK: since it is the default storage volume for most commands. (Only the R command requires that the file specified be on the system volume SY:) To assign a logical name to your storage volume, first determine its physical device name. Check questions 7 and 8 in the Hardware Configuration section of Chapter 2 to see which de- vice and which device unit you are using for your storage volume. Translate this into the appropriate name and number using Table 4-2 as a guide. Use the monitor ASSIGN command to change this physical name to a logical name. Substitute for physical-device-name in the following command lines the physical name and device unit number for your storage volume (for example, for RKO05 disk ASSIGN unit 1, substitute RK1:). Long Command Format +ASSIGNED Physical device name? physical-device-name@D Logical device name? WOL:@®ED Short Command Format ,ASSION physical-device-name YOL @D Once the assignment is made, the system recognizes the logical name VOL: as the device name for your storage volume. This is the only logical assignment you need to make. Since you are not changing the DK: assignment, the system volume remains the default device for all I/O operations. As you continue to use the system, you may well make many device assignments and deassignments. To check the status of all assignments made during a computer session, you can use the monitor SHOW command to print on your terminal a list of all the logical assignments currently in effect. Use the SHOW command now to check the status of the assignment just made: Long and Short Command Format + SHOWEED 4-11 SHOW Using the Monitor Command Language Check the list printed on your terminal to make sure that the code VOL: has been assigned to your storage volume. The let- ters VOL: should follow the appropriate device name in the list, as in the following response, in which VOL: represents disk unit 1: TT RK (Resident) RKO = GY RK1 = VOL + DK NL 13 free slots Logical device assignments are temporary. Thus, if you want a logical device assignment to remain in effect, you must reassign it each time the system is bootstrapped. Listing Volume Directories Both your system volume and your storage volume have directories, which are compiled lists of all the files stored on the volume. You can print a volume directory on your terminal, using the monitor DIRECTORY command.' To list the direc- DIRECTORY tory of your system volume, type: Long and Short Command Format \DIRECTORY® CTRL/O (The system volume is the default device.) Since the directory of the system volume may be quite long, after approximately 10 lines have printed on the terminal, type: This special control command, echoed as "O, inhibits the re- mainder of the listing output from printing on the terminal, although the information on the total number of files and blocks is still given. When control returns to monitor command mode, look at the directory listing. At the top of the listing is today’s date, as you entered it earlier in the DATE command. Following the date is a list of the files on the volume. Notice the two-column format of each line in the directory. 'Users of VT11 display hardware may wish to use the CTRL/E command to enable both the graphics screen and the terminal printer for the following exercises. 4-12 Using the Monitor Command Language 08-Jan-83 .SYS SWAP RT11FB.SYS RT11XM.SYS +5YS DT . 8Y5 DX «8YS RF «8YS DL +8YS DM 26 86 94 3 3 3 4 5 2B6-Auyg-B2 26-Aug-82 26-Aug-82 26-Aug-8B2 26-Aug-B2 26-Aug-BZ 268-Aug-B82 2B-Aud-82 RT1154.8Y8 RT11BL.SYS «8YS T7 +SY8 Dp +8YS Dy +SYS RK +SYS bu +5YS DS +8YS 5 ZB-Aug-82 0 DD 73 73 2 3 4 3 4 3 26-Aud-B2 26-Ausg-B2 26-Aug-B2 26-Aug-82 26-Aug-B2 26-Aud-82 2B-Aus-82 2B6-Aug-82 170 Files s 4264 Blocks 498 Free blocks First the file name appears, followed by a dot and a file type that is frequently used to identify the file’s format. For exam- ple, .SYS represents a system file; other RT-11 file types used to represent different kinds of files are listed in Table 44. After the file type is a number that indicates the size of the file. The size is given in blocks, a term used to designate a standard amount of information. A file that is 1 to 10 blocks long is fairly small, while a file over 100 blocks in length is quite large. The date on which the file was created is shown at the right. This space is empty if a date was not specified (with the DATE comTable 44 File Types Meaning File Type .BAC .BAK .BAS BAT BUP .COM .CTL .DAT .DBL .DIF .DIR .DSK JFOR .LOG .LST .MAC .MAP MLB .OBJ BASIC compiled file Editor backup file BASIC source file BATCH source file Backup/restore file .REL .SAV Executable foreground program file or system job Executable background program file SML SYS Indirect command file or IND indirect control file BATCH control file BASIC-11 or FORTRAN 1V data file DIBOL source file SRCCOM output file Directory listing file Logical disk file FORTRAN IV source file Batch log file Listing file MACRO-11 source file Linker map file MACRO library file MACRO-11, FORTRAN 1V, or DIBOL object out- put file or library file System MACRO library System files and handlers 4-13 Using the Monitor Command Language mand) on the day the file was created. At the end, you are told how many files are on the volume, their total length, and the number of free blocks available for your use. NOTE Files furnished on the distribution medium have a pro- tected status, which means they cannot be deleted. This is indicated by the letter P after the file size shown when you print a directory listing. You cannot perform any operation on a protected file if the result is to delete it. You can change the protected status of a file by using the RENAME keyboard monitor command with the /PROTECTION or /NOPROTECTION option; you can give a protected status to a file by using the PROTECT keyboard monitor command; and you can remove a protected status from a file by using the UNPROTECT keyboard monitor command (see the RT-11 System User’s Guide). DIRECTORY /BRIEF You can also obtain an abbreviated directory, which omits file lengths and dates and lists only file names and file types in five-column format. To do this, you use the DIRECTORY command with its /BRIEF option. Type the following, and after several lines have listed, interrupt the directory by typing two CTRL/C command characters. This double control command echoes two "Cs and requests the running program to abort immediately, regardless of what the program is doing (one CTRL/C CTRL/C CTRL/C aborts an executing program waiting for input from the console terminal). Control returns to monitor command mode. Long and Short Command Formats WDIRECTORY/BRIEF®RED 08-Jan-83 SWAP ,5YS RT11S8J.5YS5 RTILIFB.SYS RT11BL,SBYS RTIL1XM.8YS T +8¥85 DT +S¥Y8 DP «SYE DX +8Y8 DY +8Y8 RF DS +8Y8 «8YS RK DD «8¥S +5¥8 DL LP +8YS +SY¥S8 DU LS «8¥S5 «5¥YS DM CR +SYS8 +8Y¥8 L CIETLC ) DIRECTORY /PRINTER Volume directories can be printed on a line printer if one is available on your system. Check the answer to question 9 in the Hardware Configuration section of Chapter 2 to determine if your system has a line printer. Since listings print faster on a line printer than on the console terminal, it is to your advantage to use the line printer for large amounts of output. The /PRINTER option is used with the DIRECTORY command to cause a directory to be printed on the line printer instead of on the terminal. Make sure your line printer is turned on, and then type the DIRECTORY command as shown: 4-14 Using the Monitor Command Language Long and Short Command Format JDIRECTORY/PRINTERGED The listing may be quite long. When the line printer has finished printing, retrieve the listing. Initializing a storage volume clears its directory. A new (unused) volume should always be initialized before it is first used. In addition, any storage volume that contains files that are no longer needed can be initialized to recover the storage space. Note, however, that an initialize operation is used to remove all file names from the directory. So before you initialize a volume, make sure that it contains no files that you Initializing the Storage Volume might want later. Since you will use your storage volume to store several new files (created as a result of the various exercises in this manual), clear its directory using the monitor INITIALIZE command. This operation ensures that the volume has room for new files. Long Command Format VINITIALIZE®D : @D Device? UOL (VOL: is the assigned logical device name for your storage volume.) Short Command Format VINITIALIZE VoL 6D RKi:/Initialize$ Are vou sure?YEJ) The system prompt physical-device-name/Initialize; Are you sure? gives you an opportunity to verify the command. Typing a Y initiates the operation, while N stops the operation and returns control to the monitor command mode. Check your command line, make sure you are initializing your storage volume, and then type a Y. Again, list the directory of the storage volume. It should be empty. Long and Short Command Formats JDIRECTORY VOL : GED B-Jan-83 0 Filessy 4762 Free O Blocks blocks The number of blocks available for use on the volume is printed at the end of the directory and varies depending on the type of device you use as your storage volume. 4-15 INITIALIZE Using the Monitor Command Language The commands you have performed in this chapter have pre- pared the system for major operations that will follow. In Chapter 5 you begin by using the RT-11 editor to create text files that you will store on your initialized storage volume. SUMMARY: INITIAL MONITOR COMMANDS ASSIGN physical-device-name logical-device-name Assign a logical device name to a physical device name. DATE Print the current date, if previously set. DATE dd-mmm-yy Set the current date (day-month-year). DIRECTORY ddn: List the volume directory on the terminal (ddn: is the mnemonic for the device name; the default storage volume, DK:, is assumed if ddn: is not specified). DIRECTORY/BRIEF ddn: List a brief volume directory on the terminal, showing only file names. DIRECTORY/PRINTER ddn: List the volume directory on the line printer. DIRECTORY/PRINTER/BRIEF ddn: List a brief volume directory on the line printer. GT OFF Disable the VT11 display hardware. GT ON Enable the VT11 display hardware so that the graphics screen replaces the terminal printer/screen as the terminal output device. INITIALIZE ddn: Clear the directory of the indicated volume (ddn: is the mnemonic for the device name and must be specified). SHOW Print the status of all current logical device name assignments. TIME Print the current time, if previously set. TIME hh:mm:ss Set the current time-of-day (hour:minute:second). 4-16 Using the Monitor Command Language CTRL/C CTRL/C Interrupt the current operation or program and return control to monitor command mode. SUMMARY: SPECIAL CONTROL COMMANDS CTRL/E Direct terminal output to both the graphics screen and the terminal printer simultaneously. Type a second CTRL/E to return output control to the graphics screen only. (Valid only when VT11 display hardware is enabled.) CTRL/O Inhibit the remainder of output from printing on the terminal. CTRL/U Cancel every character in the current line. DELETE Cancel the last character typed on the current line. LP11/LS11 Line Printer Manual (EK-LP11-TM-005). Maynard, Mass.: Digital Equipment Corporation, 1975. A hardware manual for the owners and operators of LP11/LS11 line printers and for those who will be programming computers to interact with these devices. RT-11 Mini-Reference Manual (AA-M241A-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A summary of all RT-11 monitor commands, command options, system utility program operating commands, and programmed requests. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. 4-17 REFERENCES CHAPTER 5 CREATING AND EDITING TEXT FILES The ability to create and edit text files is one of the most useful features of the RT-11 operating system. Not only can you create computer programs, data files, memos, and reports on line (that is, under the control of the system), but you can alter what you create without retyping the entire file. You create and edit text files more often than you perform any other system operation. Therefore it is essential that you become familiar with the editing process as quickly as possible. Editing should become second nature to you as you learn to use the RT-11 computer system. Two RT-11 editor system utility programs, EDIT.SAV and KED.SAV, are stored as part of the RT-11 operating system on your system volume. The demonstrations in this manual illustrate EDIT, which can be used on a video terminal or a hardcopy terminal. The use of KED is restricted to video terminals. For more information about KED, refer to the PDP-11 Keypad Editor User’s Guide. Text files that you create with the editor are stored in the computer in ASCII format. ASCII, which stands for the American Standard Code for Information Interchange, is an industrystandard code that consists of a numeric representation for each of the alphabetic characters (A to Z), the numeric characters (0 to 9), the punctuation characters, and some special communication control characters. When you type text on the terminal keyboard, the system automatically converts the text to ASCII codes; when you request listings on the terminal or line printer, the system converts the ASCII code back to the text characters. The RT-11 editor uses a specially reserved area of computer memory to hold the text you are creating or editing. This area of memory is called the text buffer. When you create text, the characters that you type on the terminal keyboard are transmitted directly into the text buffer. When you edit text, the characters are copied from the input file into the text buffer, where you can modify them. When you have edited the text in the buffer to your satisfaction, the characters are moved out of the text buffer to the output file (Figure 5-1). 5-1 THE RT-11 EDITOR Creating and Editing Text Files COMPUTER OUTPUT . Figure 5-1 Editing with RT-11 Since the text buffer is a limited area of computer memory, you may at times try to input more text than the buffer can accommodate. If this condition becomes apparent to the editor, it prints a warning message on the terminal telling you that, before you can input any more text, you must make room in the buffer, either by transferring text to the output file or by erasing text already in the buffer. You can avoid this inconvenience during editing if you make use of a concept called paging. When you create a large text file, instead of typing the file as one long stream of text, divide it into individual pages of approximately 50-60 lines in length; this corresponds roughly to the size of a line printer or terminal listing page. You can copy the text into and out of the buffer one page at a time. A single page of text is never too large for the text buffer and also fits on the line printer or terminal perforated paper when you obtain a listing. CREATING A TEXT FILE EDIT/CREATE You activate the editing capability by using the monitor EDIT command. When creating a file, you must use the /CREATE option followed by the file name and file type you want assigned to the new file. The default storage volume (DK:) serves as the default device, so unless you specify a device using one of the mnemonics in Table 4-2, the editor creates the new file on the device DK: (which is the system volume, unless changed via ASSIGN). First, if you are using display hardware, disable it with the monitor GT OFF command; the editor has a special display capability that is not described until later in this chapter. Long and Short Command Format +GT OFFGED Creating and Editing Text Files Next, use the editor to create a text file of five lines. Call the file DECIND.USA, and use the default storage volume — currently the same as the system volume — for the file. Long Command Format JEDIT/CREATERD File? DECIND.USAER * Short Command Format JEDIT/CREATE DECIND.USAGD #* Once the output file is open (that is, when the appropriate file has been established for output operations), the editor prints a prompting asterisk at the left margin. The asterisk indicates that the editing command mode is in control. This prompt is your cue to enter an editing command. The editing command used to create text is the I (Insert) com- mand. Type: INSERT #] All subsequent characters that you type on the terminal key- board will now be entered into the text buffer just as you type them. Enter the following text exactly as shown, including all spaces and errors. Before you type the RETURN key, check the line to make sure that it matches what is shown here. Remember, if you make a typing mistake that is not intentional, ESCAPE ESCAPE you can use the DELETE key on the terminal keyboard to erase individual characters and the CTRL/U command to erase all characters on the current line. When you have finished typing the five lines, type the ESCAPE key twice. The ESCAPE key echoes on the terminal as a $; it is used to execute an editing command and to return control to editing command mode. #IWE HOLD THESE TRUTS TO BEE SELF-EVIDENT .G THAT ALL MEN ARE CREATED EQUAL, THAT THEYGED HAVE UNRELIABLE TENDENCIES OF WHICH THEYGED AR ENDOMWED BY THEIR CREATOR: THAT AMONGED THESE ARE LIFEs LIBERTY AND HAPLENESS.EED E0E0 * Forget for the moment that this text contains several misspell- ings and other errors, and assume instead that you are satisfied with it and ready to transfer it from the text buffer to the output file. The EX (Exit) editing command performs this function. This command terminates editing, transfers all text in the text buffer to the output file, closes the currently open output 5-3 EXIT Creating and Editing Text Files file (making it unavailable for further output operations), and returns control to monitor command mode, indicated by a dot at the left margin. DECIND.USA: Use the EX command to close the file wwwwww *EX EDED You now have a file on your system volume -called DECIND.USA, consisting of the five lines of text you just created. EDITING A TEXT FILE EDIT The file DECIND.USA needs editing. To edit a file, you again use the EDIT command to activate the editor. Next indicate in the command line the two-letter device mnemonic for the volume on which the file resides (the default storage volume, DK:, is assumed). Following this, you indicate the file name and file type of the file. The editor then opens the file, making it available for input operations. Thus, to open the file DECIND.USA for editing, type: Long Command Format +EDITED File? DECIND.USAGD * Short Command Format +EDIT DECIND,USAGEED * READ The EDIT command opens the input (and output) files. Use the R (Read) editing command to read the first page of text from the input file into the text buffer. No output occurs to the output file, but the file is available for output at a later time. The input file itself is not altered in any way. R EOED * BEGINNING Whenever text is read into the text buffer, a pointer is automatically positioned at the beginning of the text. This pointer is an invisible indicator that serves as a target for editing commands. The pointer pinpoints the exact location in the file where the next character will be inserted. For example, when you finished inserting text earlier (just before using the EX command), the pointer was positioned at the end of the file. Now that the EDIT command has been used to read text into the text buffer, the pointer is positioned at the beginning of the text in the text buffer. If the pointer is not at the beginning and you want to J M Creating and Editing Text Files move it there, you can use the B (Beginning) command; this command moves the pointer to the beginning of the text in the text buffer, no matter where the pointer is currently positioned: #* With the pointer positioned at the beginning of the text buffer, you can use the L (List) editing command to list the text cur- rently in the text buffer on your terminal printer. The List command lists text, starting at the pointer and continuing to whatever place you indicate by the command argument. A command argument is simply a prefix to an editing command that sets limits on the command’s actions. Command arguments are used frequently and are summarized in Table 5-1. Study this table for a moment before continuing. Table 5-1 Meaning Argument n Command Arguments Represents any integer in the range -16383 to +16383; it may be preceded by a + or —. If no sign precedes n, it is assumed to be positive. Whenever an argument is acceptable in a command, its absence implies an argument of 1 (or —1 if only the — is present). 0 Refers to the beginning of the current line. / Refers to the end of text currently in the text buffer. Thus, with the pointer positioned at the beginning of the text, use the / argument and the L command to list on the terminal all text in the buffer. The position of the pointer does not change. List the text and compare your output with the five lines shown in the following example — they should match exactly. # /1. E0E0 WE HOLD THESE TRUTS TO BEE SELF-EVIDENT, THAT ALL MEN ARE CREATED EQUAL., THAT THEY HAVE UNRELIABLE TENDENCIES OF WHICH THEY AR ENNDOMWED BY THEIR CREATOR, THAT AMONG THESE ARE LIFE. LIBERTY AND HAPLENESS. #* If your output and the five lines above do not match exactly, then you probably typed some unintentional errors into DECIND.USA. 5-5 LIST Creating and Editing Text Files The remaining EDIT commands in this exercise depend upon an exact reproduction of DECIND.USA to function properly. Therefore, since you are not yet familiar with the EDIT com- mands necessary to correct your file, an existing copy of DECIND.USA with intentional errors must be substituted. Prepare the text buffer by erasing it with CTRL/CESOESD. This unusual command combination is required by the EDIT pro- gram when you want to exit without creating an output file. The structure of the command prevents you from accidentally eliminating a file with a single CTRL/C. The monitor command mode period appears, signaling your departure from the editing command mode. Your system volume still contains the file DECIND.USA that you created earlier. However, it also contains the copy provided with the system, DEMOED.TXT, which you will use for the remainder of the exercise. Before going any further, you must rename DEMOED.TXT to DECIND.USA to avoid confusion. A RENAME operation, ex- plained fully in the File Copying Operations section of Chapter 7, is the method of choice. Type the following command: +RENAME DEMOED.TXT DECIND.USAGED The contents of DEMOED.TXT are now labeled DECIND.USA. Note, however, that if a file labeled DECIND.USA already ex- ists and you rename another file to DECIND.USA, the system deletes the first file named DECIND.USA and renames the current one. Type EDIT DECIND.USA to open the file for input, and type the R command to read it into the text buffer. JEDIT DECIND.USAGD *REDED Since the pointer automatically returns to the beginning of the text with an R command, you can type /L to list the entire file. */|. BOED WE HOLD THESE ALL HAVE UNRELIABLE AR MEN TRUTS THAT ENDOWED THESE ARE BY ARE * 5-6 BEE SELF-EVIDENT. EQUALs+ THAT TENDENCIES THEIR LIFE: TO CREATED OF CREATOR» LIBERTY AND WHICH THAT THEY THEY AMONG HAPLENESS., Creating and Editing Text Files The text contains errors and misspellings deliberately introduced for the purposes of the exercises in this chapter. To cor- JUMP rect the errors, reposition the pointer so that it is near the text you want to change. The J (Jump) command, for instance, in conjunction with a command argument, moves the pointer either backward or forward by the specified number of characters, including spaces. Type the J command now, using an argument of 18, to reposition the pointer 18 places ahead": * 18 JE0ED # Although you cannot see it, the pointer has moved from the beginning of the text buffer to the right of the 18th character. You can verify this by using the List command again. The List command with no argument prints from the pointer to the end of the current line and thus exposes the location of the pointer: *#L GO0 8 TO BEE SELF-EVIDENT. # The characters in the example should match the current line on your terminal, showing the pointer positioned at the first error in the text where an H is missing in the word TRUTS. Since the pointer is positioned between the second T and the S, use the Insert command to insert an H in the proper place: * T HEDED * Now use the V (Verify) command to verify the line. The V command, which does not require arguments, prints the entire line VERIFY containing the pointer (the current line) on the terminal. It allows you to verify that a correction was properly made. The pointer is not moved as a result of the V command,; its position « remains just to the right of the last inserted character (shown here by the arrow): #1) ESDESD WE * HOLD THESE TRUTHS TO BEE SELF-EVIDENT, T ! Anytime you use the Jump command to move the pointer forward (or back- ward) by enough characters so that it moves to a new line, you must account for two extra characters in the command argument. This is because the editor treats the carriage return at the end of each line as two characters — a return and a line feed. Creating and Editing Text Files So far you have entered and executed editing commands one at a time. You can enter multiple commands by separating each individual command with a single ESCAPE. Typing two ESCAPEs then executes all the commands in the entire command string in consecutive order. For example, combine the J and L commands as shown in the following command string: * 7 JEDL ESDED £ SELF-EVIDENT, * The 7J moves the pointer seven positions to the right, and L then lists the text from the pointer to the end of the line so that you can see the pointer’s new position. A special CTRL command is available to erase multiple editing CTRU/X commands. The CTRL/X command (hold the CTRL key down and type the X key) causes the editor to ignore an entire command string that might extend over several lines if the I command is involved. The editor echoes with "X, issues a carriage return, and prints an asterisk indicating that you are still in editing command mode and can enter a new command. For example, type: *70JE0ISTART NEW AGED LINE * In addition to the CTRL/X command, you may still use the DELETE key to erase individual characters in the command line one at a time, and the CTRL/U command to erase all char- acters entered on the current command line. Since you used the CTRL/X to ignore this last command string, DELETE the pointer is still positioned at the next error in the file — just before the extra E in the word BEE. You can erase this extra character by using the D (Delete) command.! The D command removes one character (or space) to the right of the pointer for every +1 in its argument and one character to the left for every —1. Use the D command to erase the extra E and then verify the line (+1 is assumed if no argument is used): * DESDVESDED WE HOLD THESE TRUTHS * TO BE SELF-EVIDENT, 1 'The Delete command should not be confused with the DELETE key on the terminal keyboard. While both perform the delete function, the D command is used to erase characters already within a text file; the DELETE key is used to erase typed characters in a command string or during text creation. 5-8 Creating and Editing Text Files in the example As you can see from the position of the pointer not actually move (shown by the arrow), the D command doesaround the pointer. the pointer, but simply erases characters is now positioned Since the extra E was erased, the pointer between the E and the space. by Just as you can use the Jump command to move the pointerthe command to move characters, you can use the A (Advance)the command an argupointer by entire lines. Again you give ment that indicates the number of lines, either forward or backward. The pointer is positioned at the beginning of the new ADVANCE line. Use the A command to move the pointer forward two lines, and then list the current line: * 2 A0 BOED HAVE UNRELIABLE TENDENCIES OF WHICH THEY * This entire line does not belong in the text. To erase it, you could count the number of characters in the line and use this is number as an argument to the D command; however, there KILL an easier way. The K (Kill) command erases the entire line following the pointer and positions the pointer at the beginning of the next line in the text. Type: * K E501L ES0ED AR ENDOWED BY THEIR CREATOR: THAT AMONG * The pointer is now at the beginning of the next line in the text. As you can see, this line also contains an error, the word ARE is incorrectly spelled as AR. Use the J command to jump over two characters, and insert the E. Then verify the line: * 2 JEE0 1 EEOVEDED ARE ENDOKWED BY THEIR CREATOR» THAT AMONG * 1 The arrow shows where the pointer is now positioned. This line still contains an error — it is missing the words WITH CER- TAIN INALIENABLE RIGHTS, which should follow the word CREATOR. You can count the number of characters from the pointer to the second R in CREATOR and then jump the pointer by this number, or you can use the G (Get) command. The G command searches, from the pointer, for the first occurrence of a specified character string and leaves the pointer at the end of that string. Use the G command to search for the string OR (in CREATOR); then insert the missing words and list the lines that have changed. Notice how you use the carriage return to 5-9 GET Creating and Editing Text Files break the line into two parts (the @ symbol is used to show where you should insert spaces): *CORESOIGPWI THERCERTA T NEED INALIENABLEGRIGH - A0 TSED 2L EDED ARE ENDOMWED INALTENABLE BY THEIR RICHTS, CREATOR THAT WITH CERTAIN AMONG * To list both lines, it was necessary to move the pointer back to the beginning of the first line you changed; this was done by the —A command. The 2L command then listed both lines. Notice where the pointer is; it was moved by the ~A command and was not repositioned by the L. command. You must be careful when you use the Get command, becaus e the character string you specify must be unique if you want the pointer to move to the correct spot. For example, if the characters OR had occurred anywhere after the pointer and before the word CREATOR, the pointer would have stopped there instead, and you would have inserted text in the wrong place. The final errors in this text occur in the last line. The words THE PURSUIT OF are missing, and the word HAPL ENESS is a misspelling. Use the Get command to move the pointer to the word AND and insert the missing text. Move the pointer again with the Get command to the PLE of HAPLENESS; erase the LE, and insert PI. Then verify the line: *GANDED IGPTHEBPP TEPOF URS ESOED UI *GPLEED-2 1P ] EOVED DED ED THESE ARE LIFE,» * } CTRLL LIBERTY AND THE PURSUIT OF HAPPINESS, Large text files — 50 lines or more — should be delimited into pages. To do this, insert a form feed into the text at the place where you want the page to end. A form feed is typed as a CTRL/L (hold the CTRL key down and type the L key), which the editor recognizes as a page break. Since this text file is only five lines long, there is really no need to delimit it as a page. However, for the sake of practice, insert a form feed at the end of this file. Then move the pointer to the beginning of the text buffer and list the entire text. Compare your text with the following example. If errors remain in your file, fix them by using the commands described %G, 016D (CTRL/L echoes as eight line feeds.) 5-10 so far. Creating and Editing Text Files D /L EDED E0BE TO BE SELF-EVIDENT ., WE HOLD THESE TRUTHS TED EQUAL» THAT THEY THAT ALL MEN ARE CREA WITH CERTAIN ARE ENDOWED BY THEIR CREATOR AMONG INALIENABLE RIGHTS, THAT INESS. THESE ARE LIFEs LIBERTY AND THE PURSUIT OF HAPP * last two This text is correct in spelling and content, but totheread. The r lines should be justified to make them easie G the pointer is currently at the beginning of the text. Usethen incommand to search for the character string AMONG,; sert and delete text to justify the lines. Finally, list the text again: EOED *GAMONGED IEPTHESESD AREEDAED!L ODEDBED /L NT + WE HOLD THESE TRUTHS TO BE SELF-EVIDE THAT ALL MEN ARE CREATED EQUAL» THAT THEY ARE ENDOWED BY THEIR CREATOR WITH CERTAIN INALIENABLE RIGHTS, THAT AMONG THESE ARE LIFEs LIBERTY AND THE PURSUIT OF HAPPINESS. * Once you are satisfied with your text, you are ready to transfer r it to the output file. You could use the EX command to transfe File. Text a ing Creat n sectio the the text, as you did earlier in However, suppose your input file has additional pages of text that require editing. If you use the EX command, all remaining text in the input file will be read through the text buffer into the output file, and the files will be closed although you may want to do more editing. To avoid this, you can use the N (Next) command. This command transfers the text currently in the text buffer to the output file, clears the text buffer, and reads in the next page from the input file. The pointer is positioned at the beginning of the text buffer. * NEOED 2EDIT-F-End of * input file (No text remains in the input file.) If you use the N command when no text remains in the input file (as just happened), the editor prints a message on the terminal telling you so. At this point, you can type the EX command to close the file. *E X ES0ED 5-11 NEXT Creating and Editing Text Files When you close a file after editing, the editor creates a file on the default storage volume (or system volume). It gives this new file the file name and file type that you indicated for input. It then renames the input file so that the file retains its file name but is assigned a file type of .BAK. This file type identi- fies a backup file, here an original input file retained in case of editing mistakes or accidental deletion of the new file. Thus you now have two versions of the DECIND file on your system volume: DECIND.USA, which is the edited version, and DECIND.BAK, which is the unedited (original) input file. Verify this by using the monitor DIRECTORY command: Long and Short Command Format +DIRECTORY DECIND.*@EED 08-Jan-83 DECIND.BAK 2 Filesy 496 Free i 2 08-Jan-83 DECIND.USA 1 08-Jan-83 BlocKs blocKs The asterisk (*) following DECIND. is a type of shorthand notation called wildcard construction. Here it means to list all files named DECIND, regardless of their file type. Wildcard construction is explained in detail in the Multiple File Operations section of Chapter 7. Whenever you edit the same file a number of times, new ver- sions overwrite old versions. Thus only two versions of the edited file (filnam.BAK and filnam.typ) ever reside on a volume at one time. USING UPPERCASE AND LOWERCASE CHARACTERS Later model terminals (for example, LA120 DECwriters and VT100 video terminals) have the capability to print in upper- case and lowercase. Certain line printers also have this capa- bility. You can use the uppercase/lowercase capability of these devices if you type the EL (Edit Lower) editing command before entering the text you want to insert in lowercase. The EL command instructs the system to accept all characters typed as they appear on the keyboard. The monitor facility, which converts all alphabetic characters to uppercase, is disabled. In ad- dition, the characters are echoed on the terminal printer or screen as uppercase and lowercase characters. Open the file DECIND.USA again, and type the EL command: Edit Lower Long and Short Command Format +EDIT DECIND.USAGD *EL E0E0 * 5-12 Creating and Editing Text Files Once you have typed the EL command, you can use the SHIFT key on the terminal to designate uppercase, just as you do on a typewriter. Editing commands may be entered as either upper- case or lowercase characters. For example, type the following commands, which change the characters in the first line of the file DECIND.USA to uppercase and lowercase: # rE50 b €0 1 ES0E0 WE HOLD *KEDiWe THESE hold TRUTHS these T0O BE truths SELF-EVIDENT, to be self-evident @0 €0 - 2 €50 v EOED We hold these truths to be self-evident * The uppercase and lowercase capability is useful for reports, memos, and other textual material that you list on Edit Upper uppercase/lowercase devices. However, all characters are printed as uppercase if you list the file on a line printer or terminal that does not have the uppercase/lowercase capability. If at any time you want to revert to strictly uppercase editing, type the EU (Edit Upper) command: #¢ uEBDED * Uppercase editing is a default mode. Whenever you open a file for editing or create a new file, you must enter the EL command if you want to use the uppercase/lowercase capability. Close the file DECIND.USA by typing: *EXEOE0 + EDIT filespec Activate the editor and open the file for editing. SUMMARY: EDITING COMMANDS EDIT/CREATE filespec Activate the editor and create a new file. Control Commands CTRL/L Insert a form feed. The form feed character is used to delimit pages of text in a file (introduced as part of text by the Insert command). CTRL/X Ignore all commands in the current editing command string. 5-13 Creating and Editing Text Files Command Arguments n(+ or —) An integer value between —16383 and + 16383 that sets the range of a command’s actions based on the pointer’s current position. 0 Beginning of the current line (the line pointer). containing the / End of the text in the text buffer. Input/Outpuf Commands (pointer is not repositioned) (x indicates that an argument can be used) EX Exit; terminate editing, transfer the contents of the text buffer and the remainder of input file to the output file; close input and output files; return to monitor command mode. xL, List; list, from the pointer, x lines of text. xN Next; write the contents of the text buffer to the output file, clear the text buffer, and read into it the next page from the input file; perform this write/read sequence x times. \Y% Verify; list the current line (the line containing the pointer) on the terminal. Pointer Location Commands (pointer is repositioned) (x indicates that an argument can be used) xA Advance; move the pointer to the beginning of the xth line from the current pointer position. B Beginning; move the pointer to the beginning of the text buffer. xJ Jump; move the pointer forward or backward by x characters. 5-14 Creating and Editing Text Files Text Modification Commands (pointer is repositioned) (x indicates that an argument can be used) xD Delete; erase x characters to the right (or left) of the pointer. I text Insert; insert text into the text buffer at the present pointer position. xK Kill; erase x lines of text, beginning at the pointer. Search Command (pointer is repositioned) (x indicates that an argument can be used) xG text Get; search the text buffer, beginning at the pointer, for the xth occurrence of the indicated text string and leave the pointer at the end of the text string. Uppercase/Lowercase Commands (pointer is not affected) EL Edit Lower; accept characters typed at the keyboard as uppercase/lowercase. EU Edit Upper; revert to uppercase editing (after EL). If your system configuration includes VT11 display hardware, there are several advantages to your using it during editing.’ First, the graphics screen becomes a window into the text buffer, exposing twenty lines of text at a time: the current line, the ten lines preceding it, and the nine lines following it. Figure 5-2 illustrates this format. As you edit, the lines in view shift to conform to the current line. In addition, the pointer is visible and appears as a blinking, L-shaped cursor. Its position is automatically adjusted as you execute editing commands. Finally, the four lines at the bottom of the screen display the last three command lines plus the current command line. Horizontal dashes separate the text of the file from your commands. 1If your system does not have VT11 display hardware, skip to the next section, entitled Creating the Demonstration Programs. 5-15 USING A GRAPHICS DISPLAY TERMINAL DURING EDITING Creating and Editing Text Files 10 PRECEDING LINES OF TEXT CURSOR WINDOW (CURRENT LINE) INTO THE TEXT BUFFER AND 9 FOLLOWING LINES OF TEXT SEPARATION LINE 3 PRECEDING COMMAND LINES CURRENT COMMAND LINE Figure 52 Normal Use of the Graphics Display Text Window Format All editing commands and functions described so far can be used when the graphics screen is enabled. The only difference is that terminal I/O is rearranged on the screen as shown in Figure 5-2. Note that the L and V editing comma nds become superfluous since the pointer is always displayed on the screen. Also, since twenty lines of text are always displayed, any List command within that range is unnecessary. Currently, your graphics screen is not enabled. To enable it, use the monitor GT ON command as you did in Chapte r 4: Long and Short Command Format JGT ONGED Now when you use the EDIT command to activate the editor, the graphics screen will be rearranged as shown in Figure 5-2. You can use the CTRL/E command, described in Chapte r 4, to request simultaneous I/O on the terminal printer screen. Immediate Mode and graphics In addition to the regular editing capability, a quick and easy method of graphics editing, called immediate mode, is available. Immediate mode uses a simplified set of editing commands that are limited to pointer relocation and character deletion and insertion. Most of these commands are similar to the special CTRL commands because to type them you use the CTRL key in combination with another character key. How- 5-16 Creating and Editing Text Files ever, the use of these particular control comma nds is mean- ingful only in the editor immediate mode. Table 5-2 commands. Table 5-2 Immediate Mode Commands Command CTRL/N lists the Meaning Advance the cursor to beginning of next line (equivalent to A). CTRL/G CTRL/D Move the cursor to the beginning of the previous line (equivalent to —A). Move the cursor forward by one character (equiv- alent to J). CTRL/V Move the cursor back by one character (equivalent to —J). DELETE Delete the character immediately preceding the cursor (equivalent to -D). ESCAPE Return control to the editing command mode. double ESCAPE Summon immediate mode. Use the editor to open a new file called IMMODE.TXT: Long and Short Command Format +EDIT/CREATE IMMODE, TXTEE * Now activate immediate mode. You do this by typing the ESCAPE key twice in response to the editing command mode asterisk. Since there are no other commands in the command line, the editor recognizes the double ESCAPE as an immediate mode command. ESCAPE ESCAPE *EDED i The editor responds by printing an exclamation point in the command portion of the screen; the exclamation point signifies that you are using immediate mode. Character insertion is the default operation and occurs when- ever you type a character other than one of the immediate mode commands listed in Table 5-2. 5-17 Character Insertion Creating and Editing Text Files The next several paragraphs demonstrate the use of the immediate mode commands on a selected portion of text. Remember that all characters you type that are not immediate mode com- mands are treated as input. Commands do not echo on the graphics screen, so all you ever see is the current text file. Type the following: TO BEs+ OR NOT TO BE - THAT IS5 THE QUESTION:GD WHETHER ‘TIS5 NOBLER IN THE MIND AND HEART TO SUFFERED THE SLINGS OF OUTRAGEOUS FORTUNEGED OR TO TAKE ARMS AGAINST A SEA OF TROUBLES BB AND BY OPPOSING END THEM?PED CTRL/G As you can see on the graphics screen, the cursor (pointer) is positioned at the beginning of a new line. CTRL/G, equivalent to —A in standard editing, moves the cursor to the beginning of the previous line; the cursor is repositioned immediately. Type: The cursor has moved backward three lines, one line for each CTRL/G command, and is positioned before the line: THE CTRLV SLINGS OF DUTRAGECUS FORTUNEs CTRL/V, equivalent to —J, moves the cursor back one character. Move the cursor back over the carriage return and line feed at the end of the previous line by typing the CTRL/V command eleven times (remember, the carriage return and line feed count as two characters): (eleven [11] times) WHETHER ‘TIS5 NOBLER IN THE MIND AND HEART TO SUFFER This positions the cursor before the word TO. The command DELETE DELETE, equivalent to —D, deletes the character immediately preceding the cursor. Type the DELETE key ten times: (ten [10] times) WHETHER ‘TIS NOBLER IN THE MIND TO SUFFER CTRI/N, equivalent to A, advances the cursor to the beginning CTRUN of the next line: CRND THE SLINGS OF DUTRAGEOUS 5-18 FORTUNEs Creating and Editing Text Files CTRL/D, equivalent to J, moves the cursor forward one character; type CTRL/D ten times: CTRL/D (ten [10] times) THE SLINGS OF OUTRAGEOUS FORTUNE Next type this text (it will be inserted immediately to the left of the cursor): EPANDEPARROWSE The text on the screen should now look as follows: TO BE OR WHETHER THE NOT TO ‘TIS NOBLER SLINGS OR TAKE AND BY AND ARMS BE - ARROWS AGAINST OPPOSING THAT IN END OF A IS5 THE THE MIND QUESTION] TO OUTRAGEQUS SEA OF SUFFER FORTUNE, TROUBLES, THEM? Check your results and correct any other mistakes you may notice. To return to the standard editing command mode, type a single ESCAPE. ESCAPE * This ESCAPE command does not echo on the screen. Notice that the exclamation point immediately disappears and the text window format returns; an asterisk appears immediately below the exclamation point on the screen. You use immediate mode only to create and edit text. Operations that move text in and out of the text buffer must be done with standard editing commands. You do not need to save the text you have just created, so use the CTRL/C command and two ESCAPESs to return control directly to monitor command mode. As mentioned before, EDIT CTRL/C ESCAPE ESCAPE requires this unusual command combination to prevent an accidental CTRL/C from killing your text. Following are two demonstration programs. One is written in CREATING THE the FORTRAN IV programming language and one is written in DEMONSTRATION the MACRO-11 assembly language. Both programs are used in PROGRAMS later chapters of this manual, and both contain intentional misspellings and errors. 5-19 Creating and Editing Text Files Use the editor to create these programs. Type them exactly ast they are shown, including errors. Use tabs and spaces to forma each line as shown (remember that tab stops are positioned every eight spaces across the terminal page). Make sure that the FORTRAN IV program is formatted properly so that a source comparison described in the next chapter will operate properly. Except for the comment lines (those beginning with a C) and the lines that begin with a number, begin all lines with a tab. Use any of the editing commands described in this chapter. Activate the display editor and immediate mode if you wish. When you have finished, check each file carefully. The two files should match those shown here exactly, including tabs and spaces. Correct any errors that you find that are not intentional. Obtain a listing of each file by using B €O/L before closing the file. Create the FORTRAN 1V file first. Call it GRAPH.FOR and use the system volume for storage. Then create the MACRO-11 program. Call it SUM.MAC and again use the system volume for storage. NOTE Knowledge of the FORTRAN IV and MACRO-11 languages is not necessary to create these demonstration programs. The following program, GRAPH.FOR, is the FORTRAN 1V demonstration program. VERSION 1 C GRAPH,FOR C THIS PROGRAM PRODUCES A PLOT ON THE TERMINAL C OF AN EXTERNAL FUNCTION., FUN(X.Y) C THE LIMITS OF THE PLOT ARE DETERMINED BY THE DATA STATEMENTS ¢ "STAB" IS FILLED WITH A TABLE OF WEIGHT FLAGS C "STRING" 18 USED TO BUILD A LINE OF GRAPH FDR PRINTING (MAXZ-1) AX-ZMIN) /FLOAT SCAL (ZMIN s ZMAX sMAXZ 1K) =ZMIN+FLOAT(K-1)#(ZM LOGICAL*#: STRING(13:3),8TAB(100) DATA XMIN XMAX 1MAXX/-5:5:45/ DATA YMIN YMAX I MAXY/-5:5472/ DATA FMIN,FMAX/0.0+1.,0/ CALL SCOPY(‘~- 1 2 3 456 7 8 9 +',5TAB) MAXFLEN(STAB) IX=1.MAXX X=BCAL (XMIN s XMAX sMAXX + IX) MAXY) CALL REPEAT(’#’,STRING IF(IX.EQ.1 .OR, IX.EQ.MAXX) GOTO 20 DO 20 DO 10 IY=Z,MAXY-1 Y=SCAL (YMIN YMAX /MAXY , 1Y) IFUN=2+INT (FLOAT (MAXF-3) # (FUN(X Y)-FMIN) / (FMAX-FMIN)) 1) MAXO (1, IFUNI F STRING(IY)=STAB(MINO(MAX 10 CALL PUTSTRING(7,STRING,' ") 30 CALL EXIT END FUNCTION FUN(X,Y) R=GORT(X##2+Y#%2) FUNsX#Y#R#EXP(-R))##2 RETURN END 5-20 Creating and Editing Text Files The following program, SUM.MAC, is the MACRO-11 demonstration program. +TITLE SUM.MAC VERSION +MCALL LTTYOUT JEXIT, JPRINT iND. DIGITS N = ‘E‘ 70, EXP: FIRST: SECOND: THIRD: FOURTH: THE = 1700 + OF SUM 1/18 + THE 1721 1 OF TO OF THE 1730 + 1/50 + 1740 «PRINT #MEGSAG SPRINT MQV #NR3 iNO. OF CHARS MOV *#N+1 4RO iNO. OF DIGITS MOovV *#A,R1 $ADDRESS ASL BR1 500 MOV - (SP) BRI iSAVE CALCULATE FACTORIALS + INTRODUCTORY OF OF OF TYEXT VECTOR 10 (DECIMAL) POINT TO NEXY #2 eRrt i*d 8rt %8 ADD (SPI++(R1)+ INOW DEC RO SAT END OF DIGITS? BNE 2ZND SBRANCH IF NOT MOV %N RO GO THRU ALL MOV -(R1)R3 iBY THE PLACES MOV «-1,R2 SINIT QUOTIENT INC R2 iBUMP QUOTIENT suB RO R3 SSUBTRACT LOOP ISN'T BCC FOURTH INUMERATOR IS ALWAYS ADD ROR3 FFIX MOV R3:8R1 ISAVE #10, PLACES: BAD < 10#N REMAINDER REMAINDER NEXT AS FGREATER INTEGER iTO GIVE DIGIT CARRIES $AT END OF DIGIT THIRD $BRANCH IF NOT Moy -{R1) sRO FCET DIGIT SUB #10.,RO IFIX THE 2.7 TO .7 STHAT IT IS ONLY 1 scc FIFTH S(REALLY ADD ®10+'0,R0O iMAKE TO VECTOR? OUTPUT DIVIDE DIGIY ASC 50 DIGIT BY 10) Il ;OUTPUT THE DIGITY CLR B8Rt SCLEAR NEXT DIGIYT DEC RS iMORE DIGITS 7O BNE FIRST iBRANCH IF $WE DONE ARE BASIS DIGIT RO +REPT DIVIDING REGISTER BNE JEXIT DIGIT INDEX DEC +TTYON PRINT BY ASL R2-2(R1) TO ACCURACY DIGIT MULTIPLY ., 'E’ ASL ADD EXP: ‘E’ RECIPROCALS $FOR FIFTH: OF LOCATION PRINT? YES N+1 +WORD FINIT VECTOR TO ALL ONES +ENDR MESSAG: .ASCII /THE VALUE OF € IS:/ <183x<12> /2.7 <2002 +EVEN +ENDEXP When you have created and checked these two programs, obtained listings, and stored them as files on your system volume, go on to Chapter 6, Comparing Text Files. Chapter 6 demonstrates a proofreading aid that helps you evaluate your editing ability. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital thipment Corporation, 1983. A guide to the use of the RT-11 operating system. 5-21 REFERENCE CHAPTER 6 COMPARING TEXT FILES The RT-11 operating system provides a proofreading aid, called a source comparison, to help you quickly establish the differ- ences between two ASCII text files. During a source comparison, the system compares the two files, character for character, and prints on the terminal (or line printer) any lines that contain differences. Usually, you perform a source comparison against two files that you expect to be the same, or at least similar. For example, if an individual has copied one of your files to make changes to it, you can quickly scan the changes by performing a source comparison between the new version and your original. Another use of a source comparison is to check edits you have made to a file yourself. By comparing the backup file against the edited version, you can proofread the changes since only the portions of text that are different are printed. In this chapter, you will use source comparisons to find editing errors that may exist in the demonstration programs (GRAPH.FOR and SUM.MAC) that you created in Chapter 5. These demonstration programs contain intentional misspellings and misplaced text that you must correct before the programs can be used in later demonstrations. On your system volume is a counterpart of each file. These counterparts are provided as part of the RT-11 operating system so that you can use them to perform a source comparison against your own versions. Essentially, the counterpart programs have been carried one step further in the editing process than your own; they contain no editing errors. Therefore, when you compare them against your versions, the printed list of differences will reflect the typing errors that still exist in your versions — some of these errors are intentional; others you may have inadvertently introduced during editing. All must be corrected before you can use the programs. The monitor command used to compare two text files is the DIFFERENCES command. When you type this command on the terminal, it activates the RT-11 utility program called SRCCOM.SAV, which is part of the RT-11 operating system stored on the system volume. The system prompts you for the input file names. Respond to the input prompts with the names of the files you want to compare; the default storage volume is the system volume. The output will be sent to the terminal, which is the default device for output. 6-1 PERFORMING A COMPARISON Comparing Text Files The programs that you created in Chapter 5, SUM.MAC and DIFFERENCES GRAPH.FOR, have their respective counterparts, DEMOX1.MAC and DEMOF1.FOR, on the system volume. Use the DIFFERENCES command to compare the MACRO-11 (.MAQ) files first. The /MATCH option indicates the number of lines that determine a “match”, explained in a moment.’ Long Command Format [DIFFERENCES/MATCH: 1 @D File 17 DEMOX1.MACEED File 27 SUM,MACED Short Command Format DIFFERENCES/MATCH:1 DEMOX1.MAC SUM,MACGED The list of differences printed on your console terminal should be similar to the following example. It will show all the differences listed here, plus any others that you may have introduced yourself during editing. Notice the format of the list. Individual sections are marked with the letters A, B, C, and D to help you become acquainted with the format. A description follows the list, and you should refer to it as you study the list. A 1) A 2) DK:DEMOX1.MAC DK:BUM.MAC EERXERRRER C N1 +TITLE EXAMP.MAC (VERSION +MCALL JTTYOUT,» JEXITs +TITLE SUM.,MAC VERSION JMCALL TTYOUT, (EXIT, PROVIDED) 1) D B C PRINT #%xx 2)1 1 2) D 2» PRINT ERREEEKERS C 11t D BNE SECOND iBRANCH IF MOy #N RO iGO ALL THRU NOT PLACES. iDIVIDING B x#xx C 2z D 2 BNE 2ND $BRANCH MOV #N RO iGO IF THRU NOT ALL PLACES, iDIVIDING R C 1)1 D1 B ADD %10+ 04RO +TTYON iMAKE DIGIT F0UTPUT THE ASCII DIGIT #%%% C 21 ADD D 2) +TTYON #10+'0,R0O IMAKE DIGIT ASC iOUTPUT THE 11 DIGIT ERERERRERS C 1 B #xxx C 21 EXP +END +ENDEXP EEERERRRNER ?SRCCOM-W-Files are different 1Users of display hardware may wish to enable both the graphics screen and the terminal printer by first typing the CTRL/E command. 6-2 Comparing Text Files comThe first two lines identify the two files that are being s reside file pared. The file name and the device on which the are printed. Also, the numbers 1) and 2) are assigned to the files (see lines labeled A in the example list above). The first difference that is listed occurs in the title line of the program. Usually differences that occur in these two lines are intentional and reflect information that is unique to each file, such as name and file type, version or edit number, and perhaps date of creation. The numbers that appear at the left margin of the list further identify the files. For example, 1)1 indicates the first page of the first file and 2)1 indicates the first page of the second file. The lines of both files are compared character for character. Blank lines are ignored, but all other characters, including tabs and spaces, are compared. When two lines are found to be different, the system prepares a difference section, which it subsequently prints (see lines labeled B). The system prepares the difference section as follows. When it finds two lines that are different, it notes the page number and records the lines (see lines labeled C). Next it searches for a match. A match is a certain number of lines in each file that are exactly the same. Since you specified a match of 1 in the /MATCH:n option (MATCH:1), the system in this case searches for a single line in each file that is exactly the same. When the system finds a match, it records the last line of the match for identification purposes (see lines labeled D). Then it prints the difference section and repeats the process, preparing a subsequent difference section if more differences exist. Individual difference sections are separated from each other by a long row of asterisks, while the short rows of asterisks separate the lines of the first file from those of the second. A message is printed following the comparison. Files are different is printed if differences exist; No differences found is printed if the files are the same. Check the list printed on your terminal to find the errors the system detected. Mark each error on the listing of SUM.MAC that you obtained in Chapter 5. Now perform a source comparison between the FORTRAN IV files, DEMOF1.FOR and GRAPH.FOR. Long Command Format WDIFFERENCES/MATCH: 1EED File 1? DEMOF!.FORGD File 27 GRAPH,FORGE 6-3 DIFFERENCES/ MATCH:n Comparing Text Files Short Command Format 'DIFFERENCES/MATCH:1 1) DK:DEMOF1.FOR 2) DK:GRAPH.FOR DEMOF1.FOR GRAPH,FORGED HRERARRRHA 1)1 C EXAMP,FOR 1) L THIS 2)1 C GRAPH.FOR 2} € THIS (VERGION PROGRAM PRODUCES PROVIDED) A PLOT ON THE TERMINAL ON THE TERMINAL EREH PROGRAM VERSION ¢ PRODUCES A PLOT A TABLE HREREEERRH 11 € "STAB" n C "STRING" 2)1 C "STAB" 2) C "STRING" IS FILLED IS USED WITH TO BUILD A OF LINE HEIGHT OF FLAGS GRAPH FOR PRINTING (222 IS5 FILLED IS USED WITH TD A TABLE BUILD A OF LINE WEIGHT OF FLAGS GRAPH FOR PRINTING HEREREERES 11 MAXF=LEN(STAB) | ) DO 20 IX=1:MAXX *EEE 21 MAXFLEN(STAB) 2) DO 20 IX=1,MAXX HREH KRN KN 11 30 CALL | CALL PUTSTR(7,STRING,’ /) EXIT XK 231 30 CALL 2) CALL PUTSTRING(7.:STRING,’ ) EXIT HEERREEARN ?BRCCOM-W-Files are different Similarly, mark the errors on the listing of GRAPH.FOR that you obtained in Chapter 5. Now return to the section entitled Editing a Text File in Chapter 5. Review the editing commands described there and the summary at the end of the section. Use the appropriate commands to correct the files SUM.MAC and GRAPH.FOR. When you have finished editing, perform the source comparisons again against DEMOX1.MAC and DEMOF1.FOR. If you have edited the files correctly, the comparison finds differences only between the first lines of each program. The following messages should print on your console: +DIFFERENCES/MATCH 1B : File 17?7 DEMOF1.FORED File 27 GRAPH.FORGD 1) DK:DEMOF1.FOR 2) DK:GRAPH,FOR LRI TR ¥ 1 C EXAMP.FOR | C THIS (VERSION PROGRAM PRODUCES * KR 21 C GRAPH.FOR 2) C THIS PROGRAM PROVIDED) A VERSION 1 PRODUCES A HEEEEEEERSE PBRCCOM-W-Files are different and PLOT ON THE TERMINAL PLOT ON THE TERMINAL Comparing Text Files .DIFFERENCES/MATCH:l@@ File 17 DEMOX1.MACED File 27 SUM,MACED 1) 2} DK:DEMOX1.MAC DK:5UM,MAC (VERSION PROVIDED) KK FEEEHHEK 1)1 LTITLE EXAMP.MAC 1 ] JMCALL TTYOUT,» (EXIT, .PRINT * % %% 231 ,TITLE SUM.MAC VERSION 1 2) 2) JMCALL JTTYOUT» JEXIT. LPRINT EEERREERER PGRECOM-W-Files are different These messages indicate that a difference exists in the first line of each program. However, no other differences were found in the programs during the comparison. Thus, your programs are ready for use in later demonstrations, and you know how to create and edit programs. If differences still exist in your files and you cannot resolve them by editing, you may continue to the next chapter if you wish. However, you need practice editing, and it is to your advantage to rework the examples in both Chapter 5 and this chapter. DIFFERENCES List the differences between two ASCII text files. SUMMARY: COMPARISON COMMAND DIFFERENCES/MATCH:n Indicate the number of lines (n) to determine a match; the default number is 3. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. RT-11 System Utilities Manual (AA-M239A-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 system utilities. 6-5 REFERENCES CHAPTER 7 PERFORMING FILE MAINTENANCE OPERATIONS The system volume, as it is initially supplied, contains only the files of the RT-11 operating system -— the monitor files, the system device handlers, the system utility programs, and perhaps the language processors. Since the system volume serves as the default storage volume for all system operations (unless DK: was assigned to another volume), you will discover that it acquires many additional files during normal use. For example, files that you create with the editor are written on the system volume; edited files automatically create backup versions on the system volume; many utility programs create output and listing files on the system volume as part of their normal processing operations. By the time you finish an average session of computer operations, several new file names have been added to the directory of your system volume. Eventually your system volume may become full and its directory cluttered with the names of files for which you have no use. To avoid this you should perform regular housekeeping, or file maintenance, operations as you use the system. You should update and transfer copies of your important files to other storage volumes for safekeeping and later use, and you should delete from your system and storage volume directories the names of files you no longer need. The RT-11 operating system provides a number of monitor commands for this purpose. These commands activate the RT-11 utility programs called PIP.SAV, DUP.SAV, and DIR.SAV, which are part of the RT-11 operating system stored on your system volume. These utility programs allow you to transfer and erase files. The commands used in this chapter show one way to maintain your system and storage volume. When you become more familiar with system operations and learn some of the commands not described here, you may prefer other methods. Before you perform operations that might move or erase files on a volume, list a directory of the volume involved. The directory tells you the full names of files, their sizes, and whether backup copies exist. A directory of your system volume shows the files that have been added to it through normal use. First obtain a directory of your system volume (as you learned in Chapter 4), using the appropriate command to list it on either the terminal or the line printer. The directory is relatively long; let it list to completion. FILE DIRECTORY OPERATIONS Performing File Maintenance Operations Long and Short Command Format (Line printer) ,DIRECTORY/PRINTERGED (Terminal) ,DIRECTORYGE At the end of the system volume directory you should see several additional entries. These files are the result of the system operations you have performed so far: DECIND.USA DECIND.BAK GRAPH .FOR GRAPH .BAK +MAC SUM +BAK SUM 1 1 2 2 3 3 8-JAN-B3 B8-JAN-B3 B8-JAN-83 B-JAN-83 B-JAN-B83 B8-JAN-83 Next list a brief directory of your storage volume. This directory should be empty (void of any file names or file types) because you initialized it in Chapter 4. Long and Short Command Format (Line printer) L,DIRECTORY/BRIEF/PRINTER VOL:@D (Terminal) ,DIRECTORY/BRIEF VOL: G These directories give you the information you need for erasing and copying files. For example, you know the additional files that are now on your system volume, and you know that since the directory of the storage volume is empty, there is ample room on it for new files. MULTIPLE FILE OPERATIONS You often have occasion to perform the same utility operation on several files. For example, you may copy from one volume to another all files with the file type .MAC, or you may erase from a volume all files with the name TEST. Rather than perform the required operation on the files one at a time, it is easier to use the wildcard construction, a shorthand method provided by the RT-11 operating system. Wildcard construction allows you to substitute an asterisk (*) or percent sign (%) for a portion of the file name that is variable among all the files you want used Performing File Maintenance Operations a comin the operation. For example, specifying DECIND.* in name file the mand causes the operation to act on all files with em syst es the DECIND, regardless of their file type; * BAK caus their file to act on files with the file type BAK, regardless of act on all to tion name. Specifying TEST%.FOR causes the opera files having a type of FOR, starting with the four characters TEST, and having any fifth character (for example, TESTA.FOR, TEST1.FOR, etc.). A special use of the wildcard construction involves substitution of an asterisk for both file name and file type. *.* implies that all files, regardless of the file name or file type, are to be used in the operation. Exercises in this chapter and throughout the remainder of the manual demonstrate various uses of the wildcard construction. Storage volumes provide an area where you can store important files. Since most files are originally created on the default system volume, you must copy them from the system volume to the storage volume. The following exercises show you how to make backup copies on your storage volume of the two provided demonstration programs (DEMOF1.FOR and DEMOX1.MAC), and FILE COPYING OPERATIONS how to copy to the storage volume the two programs you created (GRAPH.FOR and SUM.MAC). The monitor command that copies files between volumes is the COPY command. This command instructs the system to duplicate the file that you indicate as input, and then gives the new file the name and file type that you specify as output. The original version of the file is unaffected; that is, a copy of the original version is made and moved to the new volume. To copy GRAPH.FOR to your storage volume under the new name GRAPH.TWO, type: Long Command Format ,COPYED From? GRAPH.FORGD To 7 WOL:GRAPH,TWOGED (System volume is for input.) assumed Short Command Format ,COPY GRAPH.FOR VOL:GRAPH.,TWOEED The system makes a copy of the file GRAPH.FOR on the storage volume and gives the copy the name GRAPH.TWO. When the operation is complete, the monitor prints a period at the left margin and waits for you to enter the next command. This time, copy SUM.MAC to the storage volume. 7-3 COPY Performing File Maintenance Operations Long Command Format , COPY@ED From? SUM.MADEET To WOL:SUM.MACER 7 Short Command Format ¢ COPY SUM.MAC vOL:SUM. MACED The system copies the file SUM.MAC to your storage volume and gives the copy the name SUM.MAC. Now, copy the two provided demonstration programs, DEMOF1.FOR and DEMOX1.MAC, to the storage volume. Long Command Format + COPYEED From? DEMOFL.FORGD To UOL:DEMOF1.,FOREED 7 , COPY @D From? DEMOX1.MACED To VOL:DEMOXI,MACED 7 Short Command Format COPY DEMOFL.FOR VOL:DE . MOF .FORGD »COPY DEMOXI . MAL VOL:DEMOXD . MACED A directory of your storage volume should verify that it now contains these four files.' Long and Short Command Format «DIRECTORY YOL @D 0B-Jan-83 GRAPH THD <2 08-Jan-83 DEMOFL.FOR 5UM +MAC 2 3 Z26-Aug-8BZ 0B-Jan-83 DEMOXI MAC 3 2B-Aug-87 4 Filess 4732 FILE RENAMING OPERATIONS Free 10 Blocks blocks The directory you just listed shows that you copied the GRAPH demonstration file to your storage volume under a new file type, TWO. Assume you did not intend to copy it using a new file type and now wish that it were assigned its original file 'If you are using magtape as your storage volume, read the section entitled Directory vs Nondirectory-Structured Volumes in Appendix B. T4 Performing File Maintenance Operations type, .FOR. Use the monitor RENAME command to rename the file already on the storage volume.’ RENAME Long Command Format E . RENAMRED From? YOL:GRAPH.TWOGD To 7 VOL:GRAPH.FORGD Short Command Format , RENAME UOL:GRAPH,TWO VOL:GRAPH.FORGD The RENAME command simply changes the file name or file type of a file in the volume directory without altering or moving the file itself. When you perform a rename operation, the volume indicated in the input and output portions of the command must be the same; otherwise a system message is printed. Rename the file copies DEMOX1.MAC and DEMOF1.FOR presently on your storage volume to EXAMP.MAC and EXAMP.FOR respectively. , RENAME UOL:DEMOX1.,MAC VOL:EXAMP,MACEED , RENAME UOL:DEMOF1.,FOR VOL:EXAMP,FORGED Again list a directory of your storage volume to verify that the renaming operation occurred. Long and Short Command Format ., DIRECTORY VOL:@D 08-Jan-83 GRAPH.FOR EXAMP.FOR 2 2 08-Jan-B3 26-Aug-BZ 4 Filess» 10 Blocks 4752 Free blocks JMAC SUM EXAMP . MAC 3 3 08-Jan-83 26-Aug-B2 Once copies of your important files are stored on a storage volume, you can delete from the system volume — or any other volume — those files that you no longer need. The file deletion operation removes information about the file from the volume’s directory; the space that the file occupies on the volume becomes available for reuse. Files that you want to delete generally include .BAK files created during editing, temporary files created by utility programs, or any other unnecessary files. 1Magtape users cannot use the RENAME command and should read the section entitled Alternate Rename Operation for Magtape Users in Appendix B. 7-5 FILE DELETION OPERATIONS Performing File Maintenance Operations Now that you have copies of your important files, you can de- lete several files from your system volume. For example, you can delete all files with a .BAK file type created as a result of editing. You can delete the file DECIND.USA, since this was created only for editing practice. Finally, you can delete the files GRAPH.FOR and SUUM.MAC, since copies of these arc now on VOL.. Do not delete DEMOF1.FOR and DEMOX1.MAC from your system volume, even though copies of these are also on VOL:. You should consider these two files as part of the RT-11 opera- ting system, and therefore should not erase them from the Sys- tem volume. These copies can serve as additional backups for the files on the storage volume. DELETE The monitor DELETE command is used to delete file names from a volume. You can specify as many as six input files for deletion. Long Command Format Files? DECIND . UBAGRAPH,FOR,SUM, MOCED Short Command Format JDELETE DECIND,USAGRAPH,FORSUM. MACED If wildcard construction is used or if the /QUERY option is specified, the DELETE command requests confirmation from you by printing each file name on the terminal before it deletes it. If you type a Y response, the system deletes the file, while an N response instructs the system to ignore that file and go on to the next. Notice how you use the wildcard construction in the input file to delete all files with a .BAK file type. Long Command Format Files? #.,BAnRD Files? Files deleted: Files DEK:DECIND.BAK 7 v DK:8UM,BAK v b DK:GRAPH . BAK 7 Y& GRAPH . BAK SUM, BAK DECING , BAKHET deletved: DK:DECIND,BAK 7 DK :SUM (BOK R vin DK:GRAPH.BAK 7 YED Short Command Format VOELETE Files #.BoKGED JOELETE/GUERY deleted: Files GRAPH, BAK BUM, BAK ,DECIN . BAK D 6T deleted: DK:DECIND,.BAK 7 YD DK:DECIND.BAK 7 DK :SUM, BAK v OVED DK :8UM. BAK 2 DE:GRAPH.BAK 7 Y& DEK:GRAPH,.BAK 7 7—6 YD V& Performing File Maintenance Operations You can give a file a protected status to prevent it from being deleted from the volume it resides on. A file that has a protected status cannot be deleted until that status is removed. The files DEMOF1.FOR and DEMOX1.MAC should still be on your system volume. These files must not be deleted because FILE PROTECTION OPERATIONS they are part of your RT-11 operating system. You can give these two files a protected status to ensure that they are not accidentally deleted. The monitor PROTECT command is used to give files a protected status. You can specify up to six input files (separated with commas) with this command. As with the DELETE command, if you use the wildcard construction or specify the /QUERY option, the RT-11 system requests confirmation be- PROTECT fore protecting each file. Use the PROTECT command to give the files DEMOF1.FOR and DEMOX1.MAC a protected status. Long Command Format + PROTECTGEED Files? DEMOF1.FOR,DEMOX1.MACGD Short Command Format .PROTECT DEMOF1.FORDEMOX1.MACGRED List a directory of these two files and notice the “P” next to the number of blocks in the second column. Long and Short Command Format +DIRECTORY DEMOF1.FOR,DEMOX1.MACGE 08-Jan-83 DEMOX1 .MAC 2 Filesy 921 Free 3P 2B-Aug-82 D DEMOF1.FOR 2P 26-Aug-82 BlocKks blocks The UNPROTECT command removes a file’s protected status so that the file can be deleted. You can determine whether a file is protected or not by listing the directory. If a file is protected, a “P” will appear next to the block size number of the file’s directory entry. You can specify up to six input files (separated with commas) with this command. As with the DELETE command, if wildcard construction is used or if the /QUERY option is specified the UNPROTECT command requests confirmation for each file. Remove the protected status from the files DEMOF1.FOR and DEMOX1.MAC. 7-7 UNPROTECT Performing File Maintenance Operations Long Command Format JINPROTECTED Files? DEMOF1.FORVDEMONL MACHED Short Command Format JINPROTEDT DEMOFILLFORDEMONT . MACHED Again list a directory of the two files DEMOF1.FOR and DEMOX1.MAC. The “P”’s are removed from the listing, signifying that the files are no longer protected. Long and Short Command Formats OIRECTORY DEMOFLL.FORDEMOXL, MACHED 0g-Jan-83 DEMOX1 .MAC 3 Z2B-Aug-82 Z Filess 5 Blocks 821 Free blockKs FILE LISTING OPERATIONS DEMOF1,FOR 2 26-Aug-B82 You sometimes need a listing of a file before you can decide whether or not to delete it. In Chapter 5, you used the RT-11 editor to get listings of the files you created. You can also use monitor commands to obtain listings of files. One command lists a file on the conseole terminal; another lists a file on the line printer.' The system volume is the assumed storage volume for the input file. Type one of the following sets of commands to obtain listings of EXAMP.MAC and EXAMP.FOR. Long Command Format PRINT TYPE {Line Printer) (Terminal) PRINTED T Files? UOL:EXAMP. MACKD Files? PE Files? VOL:EXAMP.FORGED Files? UDLsEXaMP, FOREE wOL:ExAMP, MADET Short Command Format {Line Printer) {Terminal) PRINT UOL tEXAMP . MACEDD fTYFE UOL s EXAMP, MADET sPRINT UOLsEXAMP ., FORGED STYPE VDL rEXA 1f a line printer is available on your system, you should always use it for listings because of its high speed of printing. Performing File Maintenance Operations You should perform file maintenance operations periodically as you use the system. File maintenance keeps your system and storage volumes up-to-date and provides maximum free space on volumes for new files. COPY Copy the specified file from one volume to another. DELETE Delete the specified file(s) from the volume’s directory. Confirmation is required before deleting the file if wildcard construction or the /QUERY option is used. SUMMARY: FILE MAINTENANCE COMMANDS DIRECTORY List the volume directory on the terminal. DIRECTORY/PRINTER List the volume directory on the line printer. PRINT List the contents of the specified file on the line printer. PROTECT Give the specified file protected status so it cannot be deleted until that status is removed. Confirmation is required before protecting the file if wildcard construction or the /QUERY option is used. RENAME Give a new name to the specified file. TYPE List the contents of the specified file on the terminal. UNPROTECT Remove the protected status of the specified file so that the file can be deleted. Confirmation is required before removing each file’s protection if wildcard construction or the / QUERY option is used. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. 7-9 REFERENCE CHAPTER 8 CHOOSING A PROGRAMMING LANGUAGE Programming languages and language processors are aids provided by the operating system to help you develop programs of your own. Whenever you plan to write a program, you must first decide on the programming language that you will use, since most computer systems support several. After you have chosen the language, you must design and code your program using appropriate language statements and being careful to follow formatting rules and restrictions. Finally, you must use the corresponding language processor, which is stored on the system volume or on a volume of its own, to convert your program statements into a format suitable for execution. Hundreds of programming languages have been developed for computer systems. Some languages can be used only for specific applications or with a particular computer system. Other languages are general purpose; they are suitable for a variety of problem-solving situations and, in addition, are easy to learn and use. The languages demonstrated in this manual include two well-known and widely used high-level programming languages (BASIC-11 and FORTRAN IV) and one RT-11 systemspecific machine-level programming language (MACRO-11). High-level languages, like BASIC-11 and FORTRAN 1V, are usually easy to learn and use. You write programs using language statements that need not deal with the specifics of the computer system. The language processor — and perhaps other utility programs as well — handles all conversions that are necessary for program execution. Since a single high-level language statement may perform several computer operations, and since you need not be concerned or familiar with the structure of the computer and peripheral devices, you can concen- trate solely on solving the problem at hand. The language processor takes care of translating the statements into computer information. Thus, high-level languages are considered machine-inde- pendent languages because language statements are such that any program written in the language can usually be executed on an entirely different computer system (that supports the language) with few, if any, modifications. Machine-level languages, on the other hand, such as the assembly language MACRO-11, require that you know about the computer and the peripheral devices and how they work together. You write programs in formats that are closer to those 8-1 HIGH-LEVEL VS MACHINE-LEVEL LANGUAGES Choosing a Programming Language required for execution. Since a single machine-level language statement usually performs only one computer operation, you must account in your program for each computer operation that will be required. For this reason, machine-level languages are machinedependent languages. The program is coded in a format that is not usually interchangeable among systems. Machine-level language programs can be efficient because the knowledgeable programmer will choose the fastest and most precise instructions for getting a job done. Table 8-1 lists a comparison of high-level vs machine-level languages. Table 8-1 Language Comparisons High-Level Easy to learn and use; no experience required Machine-Level More difficult to learn and use; familiarity with the computer system required Machine-independent Machine-dependent Many hidden conversions necessary for program exe- Only direct translation is necessary for program execution; less computer memory is used cution; more computer memory is used Slower execution time Faster execution time Less the system More efficient; the program- makes decisions concerning computer operations mer makes decisions concern- Easier to debug (find and fix Harder to debug (find and fix errors) efficient; errors) ing computer operations Easier to understand programs; functions added with grams; functions added with less difficulty greater difficulty Harder to wunderstand pro- Beginning programmers, students, commercial applications programmers, and the casual computer user prefer high-level languages because they are less difficult to learn and to use, and they produce fast results. System programmers, on the other hand, may prefer machine-level languages for writing programs (those that make up an operating system, for example) that must often be as fast, efficient, and concise as possible. 8-2 Choosing a Programming Language The designers of a computer system generally select programming languages that will satisfy and suit the current (or perhaps potential) system user environment. The RT-11 computer system is designed for use in many environments: education, business, laboratory, etc. Some of its applications include data acquisition and analysis, record keeping, control systems, and learning through computer simulation. RT-11 programmers and users include both the very knowledgeable and the student/beginner. To satisfy the varied requirements of these environments, RT-11 supports several programming languages: High-Level Machine-Level BASIC-11 FORTRAN IV MACRO-11 DIBOL Whenever you choose one or more of these programming languages for your own use, consider the following criteria: e What is your programming experience? What languages do you already know? ¢ How much time do you have to learn a new language? ¢ For what applications will you use the language? How important are program speed and efficiency? ¢ Will you use your program on any other computer systems? If you are already familiar with a language supported by the system, you may prefer to continue using that language rather than spend time learning a new one. However, if you want to learn a language, consider your application. High-level languages handle most programming jobs. Unless you plan to write extremely detailed or time-critical programs, you should select a high-level language. If you are a beginning programmer, you may prefer to start with a language like BASIC-11, which is a conversational, interactive language. Language statements use simple, Englishlike words and common mathematical expressions. You can request immediate answers to problems by using the immediate modes of the language, or you can create detailed programs by combining single language statements into larger segments. BASIC-11 is a superset of the industry-standard BASIC developed at Dartmouth College. Chapter 10 of this manual describes BASIC—-11 in more detail. 8-3 RT-11 PROGRAMMING LANGUAGES Choosing a Programming Language RT-11 FORTRAN 1V is a superset of the industry-standard FORTRAN 1V. This language has long been recognized for its use in the scientific field; in addition, it is one of the most commonly supported languages across systems. You may decide to choose FORTRAN IV because it is a more powerful language than BASIC-11 or because you plan to use your programs on more than one system. Chapter 9 of this manual describes FORTRAN IV in more detail. Finally, if you are an experienced user, you may select the machine-level programming language MACRO-11. This is a powerful language that allows user programs to access and utilize every possible feature available on the RT—-11 computer system. The language requires a considerable amount of computer experience and knowledge to be used effectively, however. The MACRO-11 language is best for you if you are a system programmer or an experienced high-level language programmer. It is described in more detail in Chapter 11 of this manual. CHOOSING A LANGUAGE FOR THE DEMONSTRATION Three RT-11 programming languages are demonstrated in the next several chapters of this manual;, FORTRAN 1V, BASIC-11, and MACRO-11. Consider your ability as a pro- grammer. If you are a beginner, BASIC-11 is probably the best language for you to start with; FORTRAN 1V is also a good choice. However, you need not be proficient in any of these programming languages to perform the exercises provided in this manual. Your particular RT-11 computer system may not provide all three languages. First check question 10 in the Hardware Configuration section of Chapter 2 to find out which languages are available on your system. Then select a language to continue the demonstration. If you choose FORTRAN 1V, continue to Chapter 9. If you choose BASIC-11, go on to Chapter 10. If you choose MACRO-11, go to Chapter 11. REFERENCES Digital Equipment Corporation Reference Service, Volume 2: Software and Services. Maynard, Mass.: Digital Equipment Corporation, 1982. An overview of the available PDP-11 family products and services. Katzan, Harry Jr., Information Technology, The Human Use of Computers. New York: Mason & Lipscomb Publishers Petrocelli Books, 1974. A textbook covering basic computing concepts, programming languages, and topics in computers and society. See Part II, Chapters, 7, 8, and 9. PDP-11 Software Handbook (EB—-21759-20). Maynard, Mass.: Digital Equipment Corporation, 1982-83. A general overview and introduction to available PDP-11 software, operating systems, and language processors. 84 CHAPTER 9 RUNNING A FORTRAN IV PROGRAM The FORTRAN IV programming language' is a machine-independent programming language that was originally designed as a quick and easy aid for solving mathematical equations and formulas. However, FORTRAN 1V is a powerful language and not difficult to learn or use, and is also well suited to many other kinds of applications. FORTRAN (FORmula TRANSslation) IV is an algebraically oriented language. You write a FORTRAN IV program as a sequence of language statements that combine common English words with quasi-algebraic formulas. You then arrange groups of the language statements into logical units called program units. One or more program units make up an entire executable DEVELOPING AN EXECUTABLE FORTRAN IV PROGRAM FORTRAN 1V source program. When you are satisfied with the logic of your FORTRAN IV source program, you use the RT-11 editor to create it as a file (see Chapter 5). You use tabs and spaces to format each line properly, and you may choose to insert comment statements throughout the source code to explain what various parts of the program are doing. When you have finished creating the program as a complete, edited file, you next enter it as input to the FORTRAN IV language processor, which is stored on your system volume or on a separate volume of its own. The FORTRAN IV language processor processes (compiles) the language statements, converting them into internal machine-language code called object code. This code is next processed by the system linker, which combines your program units and necessary system-supplied routines to make your program suitable for execution. The development of an executable FORTRAN IV program is represented in Figure 9-1. CREATE Figure 9-1 EDIT COMPILE LINK RUN Evolution of a FORTRAN IV Program The FORTRAN IV language processor is a compiler that translates your source program into a machine language program. IThe PDP-11 FORTRAN IV programming language conforms to the specifi- cations for American National Standard FORTRAN X3.9-1966. 9-1 USING THE FORTRAN IV LANGUAGE PROCESSOR Running a FORTRAN IV Program Since you create a FORTRAN IV source program in ASCII for- mat, you must next translate the program into a machine for- mat that the computer can use. The FORTRAN IV compiler performs the translation, producing as output a new version of the program, called an object module. You may instruct the FORTRAN IV compiler to produce a listing of the source pro- gram at the same time. Figure 9-2 is a diagram of the compiler’s function. SOURCE COMPILE PROGRAM > OBJECT MODULE LISTING {OPTIONAL) Figure 9-2 USING LIBRARY MODULES Function of a FORTRAN IV Compiler Typical FORTRAN IV programs often require similar operations. Most programs, for example, use routines and instruc- tions that calculate square roots, exponentials, and other arithmetic functions; handle input and output operations; detect cer- tain kinds of error conditions; test values; calculate subscripts; and perform conversions. These commonly used operations have been gathered into a special file called SYSLIB.OBJ (de- fault System Library), which is provided with the RT-11 operating system and is stored on your system volume. During the processing of your source program, the FORTRAN IV compiler examines each language statement in the program. If you use operations that are provided in SYSLIB, the compiler notes them and makes references to SYSLIB. The compiler translates all the information gathered during processing (your converted language statements and the references to SYSLIB) into numerical data called object code that the system linker can use. The result of the compilation, therefore, is an object format file, called an object module, which is automatically joined with SYSLIB (containing many object modules) and with any other required object modules at link time. Linking all the necessary object modules together produces a complete, workable FORTRAN IV program. The FORTRAN IV object time system (OTS) is also needed to successfully compile a FORTRAN IV program,; this system is in 9-2 Running a FORTRAN IV Program file is included in SYSLIB the file FORLIB.OBJ. Whether this em was built. or not depends on how your syst program, you must either To link the example FORTRAN IV or fy SYSLIB before include FORLIB.OBJ in SYSLIB, speci ructions on how to inFORLIB in the link command. For inst clude FORLIB in SYSLIB, refer to Section 3.4 in the RT-11 FORTRAN IV Installation Guide. TRAN In Chapter 5 you used the RT-11 editor to create a FORge volstora your on IV source program, which you then stored step next ume. Since a source program is in ASCII format, the is to use the FORTRAN IV compiler to convert it to object code. Some RT-11 systems store the FORTRAN IV compiler on a volume apart from the system volume.! You can quickly deter-m mine whether the FORTRAN IV compiler is on your syste volume by using the DIRECTORY command. ,DIRECTORY SY:FORTRA.SAVED In the directory listing that results, if the directory entry for FORTRA.SAV is included, then the required FORTRAN 1V files are on your system volume. If, however, FORTRA.SAV did not appear in the directory listing, then the required files are not part of your system volume. Before you can use the compiler, you must make a volume substitution. Read the section in Appendix B entitled Using the FORTRAN/BASIC Language Volume. The next step involves using the monitor COPY command to copy the FORTRAN IV source program from the storage volume (where you stored it in Chapter 7) back to the system volume, which serves as the default volume for input/output operations. Remember that on your storage volume are two FORTRAN v source programs, the one you created (GRAPH.FOR) and the one provided as part of the system (EXAMP.FOR). Which of these you should use depends on the results of the source com- parison you performed in Chapter 6. If the comparison resulted in no differences except for the title lines, copy your own program (GRAPH.FOR) as follows: Long Command Format JLCOPYED From? VOL:GRAPH,FORGED To 7 GRAPH.FORED not have enough free 1This is true for any RT-11 system volume that does RX01 diskette is an files. system IV AN blocks to accommodate the FORTR example. COMPILING THE FORTRAN IV PROGRAM Running a FORTRAN IV Program Short Command Format LOPY UOL:GRAPH.FOR GRAPH.FORGD However, if differences were printed in addition to the title lines, use the provided program (EXAMP.FOR) instead, copying it under the new name GRAPH.FOR: Long Command Format LOPY R From? UOL::EXAMP . FORED To GRAPH,FORED 7 Short Command Format LCOPY VOL:EXAMPL.FOR GRAPH.FORGD The FORTRAN IV source file now resides on your system volume under the name GRAPH.FOR and is the file that you will process with the FORTRAN IV compiler. The command used to compile a FORTRAN IV source program is the monitor FOR- TRAN command. FORTRAN Use the FORTRAN command with its /LIST option to compile your program and produce a listing. The system prompt asks you to supply the input file name. You can omit typing the FOR file type since the FORTRAN command assumes this file type unless you indicate otherwise. The system will assign the name GRAPH.OBJ to the object module and GRAPH.LST to the listing file and store both newly created files on your system volume, which is the default storage volume for input/output operations. Long Command Format JFORTRANEED Files? GRAPH/LIGTHLD Short Command Format JFORTRAN GRAPH/LISTHY Compilation begins. If the compiler discovers an error during processing, it prints a message. In this particular case, you should see the following on your terminal printer or screen: CHMATN, PFORTRAN-I-L MAIN,] Errors: 5, Warningds: O Errors: 1y Warninds: O FUN PFORTRAN-T-[FUN I This indicates that, during processing, the FORTRAN IV compiler found six errors in the source program. It helps at this 94 Running a point to look at the listing produced by the compiler, because more information is shown there. Print the listing on either the line printer or terminal, using one of the following commands: Long Command Format (Terminal) (Line printer) TYPE Files? GRAPH . LSTHD Short Command Format (Line printer) (Terminal) JPRINT +JTYPE GRAPH.LET GRAPH.LET Your listing should look like the following example. NOTE You do not need to understand the FORTRAN [V language or the way this program works to successfully complete the exercises in this chapter. FORTRAN IV YOILE S8at UB-Jan-83 10:52:04 VERSION T GRAPH.FOR £ £ THIS PROGRAM PRODUCES A PLOT ON THE OF AN EXTERNAL FUNCTION. FUN(XLY) £ THE C "GTABY C U"STRINGTM LIMITS o001 OF THE FILLED 1S USED IS PAGE 001 1 PLOT ARE TERMINAL DETERMINED BY THE DATA OF HEIGHT FLAGS STATEMENTS TABLE WITH A TO BUILD FRINTING GRAPH FOR OF LINE A SEAL 000z (ZMINZMAX MBXZ +K) =ZMINGFLOAT (K- 1)1 # (ZMAN-ZMIN) /FLOAT (MAXZ-1) LOGICAL®1 STRING(LI3:3):8TAB(L10O) jeledine] [elers DATA AMINAMAX MAKX/-5,3.:45/ DATA YMIN YMAX (MAXY/-5,5.72/ 0005 DATA FRINFMAX/O. 010/ 000E CALL SCOPY(’'~ Qo077 MAXF=LEN(GTAR) aoog 00 3 2 1 4 35 8 7 6 +/,8T4AB) 8 IX=1MAXX 20 0008 H=GUAL (XMIN XMAX S MAXN 1) 0010 CALL o011 IF(INGEQ.1 0013 DO "+ STRING MAXY) REPEAT({ 10 GOTO IXLEQ.MAXX) OR. 20 IY=2:MAXY-1 (1Y) MAXY AN Y=S0RLIYPINYM o014 Q013 ® ) -FMIN)Y Z (FMAX-FMIN) LOAT(MAKF-3) IFUN=Z+INT(F(FUNIXHY 0016 10 STRINGOIY)=5TAB(MING (MAXF (MAXO(L IFUNI ) CaLL 0017 30 cabl ool 0018 7 . PUTSTRO7,8TRING EXIT END FORTRAN 1V Diasnostics for Program Unit JMAIN, In line 0003, Error: Modes of variable “MMIN" and data item differ In line 0004, Errors Modes of variable “YMIN® and data item differ In tine 0008, Error: Reference to undefinegd statement label In line 0012, Errors Reference to undefined statement label In line Q016, Error: Wrond FORTRAN 1V Storade Mar PSECT number for of subscriets Unit Prosram %DATA. Size = for array "BTRING" LHMAIN. Local Mariabless 000334 ( 110, words) Name Trvee Gffset Name Trre Offset MName Trvee Offser FHAX Red 0o0230 FMIN R#d 000224 IFUN %2 000312 X 1#2 Q0260 1Y MAXX T#2 I#2 Cou300 Quoz272 K T2 Qoaese MAXF T#2 000274 MAaXe 1#2 000254 MAKD T2 GO0316 MING 12 GO0314 Maxy 1#2 GO0Z76 FORTRAN IV Program Running a FORTRAN IV Program X Red 0002682 XMAX R*g 000266 XMIN R#4 000214 Y R*4 000302 YMAX R#q 000308 YMIN R*q 000220 ZMAX Req 00025¢ ZMIN R#4 000244 Local and Name COMMON Trre 8748 L*1 STRING L#) Vec Subroutines: Arravs: Section Offset ----Size---- $DATA 000047 000144 ( 30.) (100) $DATA 000000 000047 ( 20.) (13,3) Functions, Statement and Dimensions Processor-Defined Functians: Name Trre Name Tyre Name Trre Name Trre Name Tree EXIT R*4 FLOAT R*4 FUN R*4 INT I#2 LEN I»x2 PUTSTR R*4 REPEAT Re4 SCAL R4 Scory Red 15:52:07 PAGE FORTRAN IV v02.95 Sat 0001 FUNCTION FUN(X.Y) 0002 R=GQRT(X%%2+Y482) 0003 #xees FUN=X®YHR®EXP(-R) ) %22 0004 RETURN 0005 END 1V Diagnostics In 0003, Error: (See IV Storage Map line FORTRAN Name 001 P FORTRAN Local 08-Jan-83 Variables, Trre FUN R#*4 Y R#4 .PSECT Offset 000004 B Subroutiness Name Trre SQRT Rad Eav for Prosram scurce for $DATA, Unit FUN listinsg) Prosram Size = Unit FUN 000020 ( 8. words) Name Trree Offset Name Tyre R R*4 ¢G00010 X R#g Statement and Processor-Defined Oftset @ 000000 000002 Functions, Name Trre Name Tree Name Functions: Trre Name Tyre The first part of the listing shows the main program unit and consists of the language statements up to, but not including, the function. This is followed by a diagnostics list, then by a storage map. Next the language statements composing the function program unit are listed, again followed by a diagnos- tics list and a storage map. Before considering the individual sections of the program list- ing, first examine the program logic to determine what this program should do. The first few lines of this program are user comment lines that briefly describe the program. Essentially, this program produces on the terminal a graph of a “threedimensional” function, FUN(X, Y). The graph is plotted using 45 lines down and 72 characters across the terminal page. The limits of the X and Y axes are +5 and —5. The third dimension, height, is a real number within the range 0 to 1 and is represented in the listing as a number within a scale of 1 to 9. These dimensions are illustrated in Figure 9-3. The SCAL function determines the value of the next coordinate on the graph. The statements within the DO loops calculate the coordinates using the SCAL function and determine the height value. This is done for an entire line of coordinates across the terminal page. The entire line is then printed on the terminal, using the CALL PUTSTR statement; the number 7 in this statement is the FORTRAN IV method of naming the terminal Running a FORTRAN IV Program -5 Figure 9-3 ~ N s 72 ChBracters —————————et 4 - +5 45 Lines Dimensions of FUN(X,Y) as the output device. This procedure is repeated until all 45 lines of the graph have been printed. The function to be plotted is shown in the last few lines of the program. It is compiled as a separate program unit and you can edit these lines to plot any function of your choice (several alternate functions are suggested later in the chapter). This program as it stands contains errors. The compiler detected certain error conditions during processing that prevent the program from working properly. The compiler printed appropriate messages in the diagnostics sections of the program listing.! Look first at the messages following the main program unit. Errors were discovered in lines 3, 4, 8, 12, and 16. The messages for lines 3 and 4 indicate that the floating-point variables “XMIN” and “YMIN” are assigned integer values. The DATA statements must be changed. (The same error exists for “XMAX” and “YMAX”; the compiler, however, lists only the first error that it discovers in a line. Both "MAXX” and “MAXY” are integer variable names, so no error exists for them.) You must correct the DATA statements (lines 3 and 4), then, as follows: DATA DATA XMIN XMAX sMAXX/-5.0:5.0,45/ YMIN,YMAX MAXY/-5.0,:5.0.,72/ The next two messages in the diagnostics section show that reference has been made from both lines 8 and 12 to an undefined label. (Line 12 is actually the second portion of line 11, the GO TO statement.) Statement label 20 is referenced in each case, but only labels 10 and 30 are shown in the program. This indicates either that a statement is missing or that a typing 1Refer to the RT-11 System Message Manual for greater detail about any system messages printed. 9-7 Running a FORTRAN IV Program error exists. Examination of the program logic shows a typing error in line 17. Label 30 should actually be 20. Correct line 17 as follows: 20 CALL PUTSTR(7,:STRING," ") The last message in this diagnostics section states that an in- correct number of subscripts was given for the array “STRING”. Again, examination of program logic shows that the error is actually in line 1. “STRING” is really a vector (a one-dimension array), not a matrix (a two-dimension array). Thus the comma is a typing error and line 2 should be changed as follows: LOGICAL*1 STRING(133),5TAB(100) Skip next to the diagnostics section for the FUN program unit. The message printed there refers you to the source listing, to line 3. A letter “P” appears next to this line. The RT-11 System Message Manual describes a P error as an indication of unbal- anced parentheses. Notice that the parentheses are not properly matched in this line. Thus, line 3 should be corrected as follows: FUN=(X*Y*R*#EXP(-R) ) #%2 This explains the errors flagged by the compiler in the diagnos- tics sections. Other sections of the program listing (storage map, for example) simply provide additional information that is helpful to programmers who wish to check the data types of various symbols and later make sure that object modules have been appropriately linked. Before you can continue the exercises in this chapter, you must edit, in the source program, those statements that contain er- -rors. If necessary, review the editing commands in Chapter 5. Then use the RT-11 editor to edit the file GRAPH.FOR on your system volume so that the five lines are error-free. Do not re- name the file. When you are ready, recompile the program, using the FORTRAN command, and obtain a new object module and a new listing. This time the program should compile without error (that is, no diagnostics should list). The compiler will indicate two warnings, but you can ignore them. If diagnostics occur, you have not edited the program correctly. Compare list- ings and try to correct your errors, or go back to the beginning of this chapter and repeat the demonstration. LINKING OBJECT MODULES TOGETHER The object module produced by the FORTRAN command is in itself incomplete. As mentioned earlier, it needs parts of the 9-8 Running a FORTRAN IV Program system library, SYSLIB, and perhaps other object modules and libraries as well, to form a complete functioning program.' All required object modules must be joined, or linked together, before the program can work. Even if your program does not require any other object modules, you must still link it. In addition to joining object modules together, the link operation adjusts the object code to account for many program units being placed one after the other. The result of the link operation is a memory image load module, which is actually a picture of what computer memory looks like just before program execution. Figure 9—4 is a diagram of the link operation. sYSLIB Other OBJ's Y OBJECT LINK MODULE Figure 94 > LOAD MODULE The Link Operation To link the object modules, use the monitor LINK command. The system prompts you to enter the names of the input modules and any libraries other than the system library to be joined together. You can omit typing the .OBJ file types in the command line, since the LINK command assumes this file type for input. The system automatically assigns the file name of the first input file and a file type of .SAV to the output file. The linker will scan the SYSLIB library if it is present on the system volume. Some RT-11 systems store the linker (LINK.SAV) and the default system library (SYSLIB.OBJ) on a volume apart from the !For more information on linking files and using library files, see Chapters 12 and 13, respectively. 9-9 LINK Running a FORTRAN IV Program system volume or the FORTRAN/BASIC language volume.' You can quickly determine whether the system library is on your system volume by using the DIRECTORY command. VDIRECTORY SY:8YSLIB,OBJED If SYSLIB.OBJ did not appear in the directory listing on your terminal, the required files are not part of your system volume. Before you can link GRAPH.OBJ, you must make a volume substitution. Read the section entitled Using the LINK Volume in Appendix B. If you have not included the FORTRAN IV library FORLIB.OBJ in SYSLIB, use the DIRECTORY command to see if the library is on your system volume. Type: JDIRECTORY SY:FORLIB.OBJEED If FORLIB.OBJ did not appear in the directory, the required files are not part of your system volume. Before you can link GRAPH.OBJ, you must make a volume substitution. Read the section entitled Using the LINK Volume in Appendix B. Long Command Format FORLIB not included in SYSLIB: @ NKI o L Files? GRAPH,SYSLIB,FORLIBG&D FORLIB included in SYSLIB: Files? LRAPHED Short Command Format FORLIB not included in SYSLIB: JLINK GRAPH ,SYSLIB . FORLIBED FORLIB included in SYSLIB: Any messages printed on the terminal identify error conditions discovered by the system during the link operation (for exam- 'This is true for any RT-11 system volume that does not have enough free blocks to accommodate the files required for linking. The RX01 diskette is an example. 9-10 Running a FORTRAN IV Program ple, you may not have specified all the object modules that are needed as input). However, assuming that you edited your source program correctly and that it compiled without error, it should also now link without error. A load module is one that you can run on the system. Unless your program contains logic errors that prevent it from running properly (errors that the system cannot always detect), running the .SAV version of your file should produce the results you intended. However, if logic errors exist within your program, running the program will produce either erroneous results or none at all. If this is the case, you must study the source program, rework it, reedit it, and perform the compile and link operations again. If your FORTRAN IV program is error-free, running the .SAV version should produce the expected results. In this demonstration, running the GRAPH.SAYV file should produce a graph on the terminal printer or screen. RUNNING THE FORTRAN IV PROGRAM Before you run GRAPH.SAV, you have the option of changing the output device from the terminal printer or screen to the line printer by using the monitor ASSIGN command to assign device names (see Chapter 4, Assigning Logical Names to Devices). If you prefer to print the graph on the line printer, sim- ply assign the logical device name 7 (which is the FORTRAN IV code for the terminal) to the line printer code (LP:). You have designated a new output device without altering the source program. To change the device assignment to the line printer, type: Long Command Format + ASSIGNED Physical device Logical device name? name? LP:@ED 7@D Short Command Format +ASSIGN LP: 7@ This assignment remains in effect until you deassign the names or reboot the monitor. Now, to execute the FORTRAN IV demonstration program, use the monitor RUN command. You can omit typing the .SAV file type since it is assumed within the RUN command. Long and Short Command Format +RUN GRAPHED 9-11 RUN Running a FORTRAN 1V Program After a brief pause, the graph begins to print on the terminal (or line printer) and should look like the graph shown in Figure 9-5. KKK IOKKSAIOIOK KK AKARAOK N * x X *x X IKRK FHAAR I 1111111113111111111 11111131131123111211111131 11111111 1111111 11111 1111 22222222222 22222 2222 x1111 222 *111 22 333333333 333 111 11 22 333 22 *111 222 333 4444 332 %111 *¥111 222 33 222 4444444 33 3 *111 222 33 x1111 222 11111 ¥ *x 1111 * 11111 * 1t 11 22 2 22 22222 2222 3 333333333 333 1 33 2 1t 11 2 11 2 33 444 4444 444 3 2 11 11 2 3 444 4444 44444444 33 2 11 11 2 33 44444444 211 i1 2 444 444 3333 3 333 22 Q22222222 11111141 2 1 1 11 3 4444444 3 22 111 1111 * 4444 2 11 111 33 1111% 1itx 222 111x 33 111x% 33 111x 33 222 33 111x% 222 33 1111% 222 3333 11i11x 22 1111 222 11111 222222222 1111 11111x% 1111% 22 333 444 333 X X 1111 3 X L3 X x x * 11111 222 1111 22 X111 33 222 33 3 444 2 33 44444444 33 4444 4444 *1111 * 444 3 2 11 11 2 3 444 444 4444444 33 2 11 11 2 33 444 3 2 11 11 2 4444 333 33 2 333 333333333 2222 11111 3 22222 111111 22 2222 22222222222 11111111 ¥ 1 1 11 11 11 11 11 11 111 1111 11111 HRAOKHK KR IOKH A KK A Figure 9-5 1111 1111% 33 1i1x 33 111x 33 111% 4444 333 111x% 333 111x% 3333333332 3 1111% 22 1111% 22222 11111x% 23222222222 111111 1111111 11111 11111111 1111111111131 11111111 IO KK KKK KIK K IR % 11111% 33 4444 2222 1111 2 x 4444 4444444 22 111 X 11111 33 333 22 111 1111111111213141111 KA 3 233 22 111 11111111131 3133111411 FRAK KA COMBINING OPERATIONS 22 22 1111111 X 3333 2 11 33 222 333 i1 11 33 *1111 2 211 2 222 333 1 * 11111 222 3 222 22 1 2222223222 22 33 222 222 2 i1 444 *111 *111 111 1t 11111111 44444444 *111 *1i11 111 333 * 111t 22 3333 222 *ii11 1111 222222222 11111 *11111% * 1111 11111111 * ¥ x 1111 X * % X 11111 11113111 1111 * % % 222 333 1 4444 222 2222 22 11 X 1111111 111111 22222222222 11 33 22 11111 113 i1 11 % * 11111111 2 4444 33 222 1111 111 111 2222 22 3 KK KK KKK KKK KKK KK 111111111113111311 11111444211121311211112 11111 111111 *x11111 *x1111 IORK AR KKK F ORI AR 111311211111111112 IR F KK KA IR AR NOK K KKK % % % * * K KK KK KKK The Result of GRAPH.SAV To produce these results, you first compiled the FORTRAN IV source program (GRAPH.FOR), then linked it with the default library (SYSLIB.OBJ), and finally ran the resulting .SAV file (GRAPH.SAV). You can combine these three operations using EXECUTE one monitor command, the EXECUTE command. NOTE The use of the EXECUTE command requires the following files on your system volume: FORTRA.SAV SYSLIB.OBJ LINK.SAV GRAPH.FOR FORLIB.OBJ (if not included in SYSLIB) If you have substituted the special LINK volume for your system volume, you do not have the necessary files to use the EXECUTE command. Proceed to the next section, entitled Alternate Functions. 9-12 Running a FORTRAN 1V Program The EXECUTE command instructs the system to select the language processor, then process, link, and run the program. There are several ways to establish which language processor the EXECUTE command invokes. One way is to specify a language- name option, such as /MACROQO, which invokes the MACRO as- sembler. Another way is to omit the language-name option and specify the file type for the source files. The EXECUTE com- mand then invokes the language processor that corresponds to that file type. Specifying the file GRAPH.FOR, for example, invokes the FORTRAN IV compiler. A third way to establish the language processor is to let the system choose a file type of .MAC, .DBL, or .FOR for the source file you name. If, for example, you specify the file GRAPH, the monitor searches device SY: (your system device) for the files GRAPH.MAC, GRAPH.DBL, and GRAPH.FOR, in that order. If the monitor finds neither GRAPH.MAC nor GRAPH.DBL, it invokes the FORTRAN IV language processor to compile GRAPH.FOR. For example, to combine the compile-link-run operations that you performed in this chapter, you would use the following command (do not actually type this command until you have read the next section, Alternate Functions): Long and Short Command Format FORLIB not included in SYSLIB: +EXECUTE GRAPH/FORTRAN/LIST/LINKLIB:SYSLIB/LINKLIB:FORLIBED FORLIB included in SYSLIB: JEXECUTE GRAPH/FORTRAN/LISTED The following are some alternate functions that you can substitute in your FORTRAN IV source program to produce different graphs. Simply reedit the program (GRAPH.FOR) so that lines 1-5 in the function portion at the end contain one of the following alternate functions. Then compile, link, and run the programs as described in the previous sections. If the necessary files are available on your system volume (see the previous sec- tion, Combining Operations), use the EXECUTE command to run the program. The source program compiles, links, and runs, and the new graph prints on the terminal (or line printer). Function 1 FUNCTION FUN(X.Y) FUN=EXP{-SQRT(X##2+Y%%2)} RETURN END Function 2 FUNCTION FUN(X.Y) R=CRORT(X#*2+Y*%2) FUN=X#Y*#(R-3.)/ (1. +EXP(3.,#(R-3.5))) RETURN END 9-13 ALTERNATE FUNCTIONS Running a FORTRAN IV Program Function 3 FUNCTION FUN(X.:Y) FUN=EXP(+SQRT(X*%2+Y*%2))/1177.4 RETURN END SUMMARY: COMMANDS TO RUN FORTRAN PROGRAMS EXECUTE Combine the compile-link-run operations into one command. EXECUTE file Combine the compile-link-run operations into one command. Specify the libraries to be used during linking. EXECUTE file/FORTRAN Combine the compile-link-run operations into one command, and specify the input file to be a FORTRAN file. EXECUTE/LIST Combine the compile-link-run operations into one command. Obtain a listing file of the source program and print on line printer. FORTRAN Compile the FORTRAN 1V source program and produce an object module. FORTRAN/LIST Compile the FORTRAN IV source program and produce both an object module and a listing file. LINK Link individual object modules together to form a complete program and produce a load module. RUN Run the indicated load module. FILE MAINTENANCE Before continuing further you should perform the necessary file maintenance operations. NOTE If you used a special LINK volume to perform this demonstration, turn now to the section entited FORTRAN/LINK File Maintenance in Appendix B. Obtain a directory of all files on your system volume that have the name GRAPH regardless of file type; these files were created as a result of the exercises in this chapter. 9-14 Running a FORTRAN IV Program Long and Short Command Format +DIRECTORY 08-Jan-83 GRAPH, @D GRAPH .5AV 21 08-Jan-83 GRAPH ,LST 8 08-Jan-83 GRAPH BAK 2 0B-Jan-83 GRAPH FOR 2 0B-Jan-83 GRAPH ,0BJ 168 08-Jan-83 5 Filess 447 Free 49 Blocks blocKs The fact that you have corrected errors in the source file GRAPH.FOR makes the version of that file on your storage volume obsolete. Therefore, transfer the updated copy from your system volume to VOL: replacing the copy GRAPH.FOR on the storage volume with the new version. of Long Command Format +COPYEED From? GRAPH.FOREED To YOL:GRAPH,FORGED 7 Short Command Format +COPY GRAPH,FOR VOL:GRAPH,FORGED Similarly, transfer GRAPH.LST, GRAPH.OBJ, and GRAPH.SAYV to your storage volume. This allows you to examine a listing or rerun the FORTRAN IV program without re- compiling and relinking the source. Long Command Format YCOPY®ED From? GRAPH.LST GRAPH.OB.JGRAPH, SAVED To ? ugL:@D Files coried: DK:GRAPH.LST to VYOL:GRAPH.LST DK:GRAPH.0BJ to VOL:GRAPH.0BJ DK:GRAPH,.SAY to VYOL:GRAPH,SAV Short Cofilmand Format +COPY Files GRAPHLLSTGRAPH.OBJ GRAPH.5AY VOL:ED coried: DK:GRAPH.LST to VOL:GRAPH.LST DK:GRAPH.DBJ to VYOL:GRAPH.OBJ DK:GRAPH,.BAY to VOL:GRAPH,SAV Once you have transferred all files of value to your storage volume, delete the useless files — that is, all the GRAPH files — from the system volume. 9-15 Running a FORTRAN IV Program Long Command Format +DELETEGRED Files? GRAPH.*@ED Files deleted: DK:GRAPH.BAK ? YGED DK:GRAPH.S5AYV 7 Y@ED DK:GRAPH,FOR 7 Y@ DK:GRAPH.LST 7 YGD DK:GRAPH,0BJ 7 YG@ED Short Command Format +DELETE Files GRAPH.*GD deleted: DK:GRAPH.BAK 7 YGD DK:GRAPH.S5AV 7 YG@D DK:GRAPH.FOR 7 Y& DK:GRAPH.LST 7 YG&D DK:GRAPH.O0BJ 7 YGD Finally, obtain an up-to-date directory listing of your storage volume so that you can see its current status. Long and Short Command Format +DIRECTORY VOL : @D 08-Jan-83 SUM +MAC 3 08-Jan-83 EXAMP EXAMP .MAC ,FOR 3 ZB6-Aug-82 2 GRAPH GRAPH ,LST ,FOR 8 08-Jan-83 2 0B-Jan-83 GRAPH .S5AY GRAPH 21 08-Jan-83 .0BJ 16 08-Jan-83 7 Filess 4707 Free 55 26-Aug-82 blocks blocks This completes the FORTRAN IV demonstration. Continue to Chapter 12 to read about the linking process. If you followed the special instructions in Appendix B to load the language volume, leave this volume in device unit 0 until you have finished Chapter 12. REFERENCES McCracken, Daniel D., A Simplified Guide to FORTRAN Programming. New York: Wiley, 1974. An introduction to programming in the FORTRAN language. PDP-11 FORTRAN Language Reference Manual (AA-1855D-TC). Maynard, Mass.: Digital Equipment Corporation, 1980. A reference manual and guide to programming in the PDP-11 FORTRAN IV language. RT-11 FORTRAN 1V Installation Guide (AA-5240E~TC). Maynard, Mass.: Digital Equipment Corporation, 1980. An RT-11-specific manual that contains instructions for installing the RT-11 FORTRAN IV language processor, and describes known problems and differences between versions. RT-11 RSTS-E FORTRAN IV User's Guide (AA-5749B-TC). Maynard, Mass.: Digital Equipment Corporation, 1980. An RT-11-specific manual that contains information necessary to compile, link, run, and debug a FORTRAN IV program. 9-16 CHAPTER 10 RUNNING A BASIC-11 PROGRAM The BASIC-11 program language' is a machine-independent programming language that is one of the easiest languages for the beginning programmer to learn. It has both elementary language features that you use to write simple programs, and more advanced operations that allow you to produce complex and efficient programs. In addition, a special “immediate mode” lets you use BASIC-11 like a calculator to obtain instant answers to mathematical problems. BASIC (Beginner’s All-purpose Symbolic Instruction Code) —11 is conversational in nature. It uses simple English keywords and common mathematical expressions to form easily under- DEVELOPING A BASIC-11 PROGRAM stood language statements. You write a BASIC-11 program as a series of one or more program lines. You begin each program line with a number that both identifies the line and indicates the order in which the line will be processed. Individual program lines contain one or more BASIC-11 language statements that define the operations to be performed. When you are satisfied with the logic of your BASIC-11 source program, you create it as a file. However, unlike your methods under other programming languages, you create the file under the control of the BASIC~11 language processor, which is part of the RT-11 operating system and is stored on your system volume or on a separate volume of its own. Thus, you use commands that are part of the BASIC-11 language processor to create and edit the program, list it, run it, and save it for later use. The BASIC-11 language processor is an interactive interpreter. It allows you to create and execute a program in its entirety or a few lines at a time. The interpreter examines each program language statement, interprets it, and executes it before going on to the next. If it discovers an error that prevents further processing, it prints on the terminal a message informing you of the error condition and stops. You correct the error so that execution can continue past that point, and then rerun the program. IBASIC-11 is a superset of the standard BASIC language developed at Dart- mouth College. 10-1 USING THE BASIC-11 LANGUAGE PROCESSOR Running a BASIC-11 Program | l | | CREATE | EDIT S l RUN | l | . Figure 10-1 Functions of the BASIC-11 Language Processor USING THE BASIC-11 INTERPRETER The functions of program creation, editing, processing, and execution are all handled by the BASIC-11 language processor. Some RT-11 systems store the BASIC-11 interpreter (language processor) on a volume apart from the system volume.' You can quickly determine whether the BASIC-11 interpreter is on your system volume by typing the monitor DIRECTORY com- mand and specifying the BASIC.SAV program. J,DIRECTORY BASIC,SAVEED In the directory listing that results, if the directory entry for BASIC.SAV is listed on your terminal, then the required BASIC-11 files are on your system volume and you are ready to use the interpreter. However, if BASIC.SAV did not appear in your listing, then the required files are not part of your system volume. Before you can use the interpreter, you must make a volume substitution. Read the section in Appendix B entitled Using the FORTRAN/BASIC Language Volume. Now BASIC use the monitor BASIC command to activate BASIC-11 interpreter: the Long and Short Command Format L BASICED BAGIC-11/RT-11 OPTIONAL V2.1 FUNCTIONS (ALLs NONE: OR INDIVIDUALS? A prompting message is printed by BASIC-11. You must respond with an A, N, or I and a carriage return to indicate whether you want to preserve all, none, or some of the arithmetic functions initially provided by BASIC-11. BASIC-11’s func- tions include operations that calculate random numbers, deterYThis is true for any RT-11 system volume that does not have enough free blocks to accommodate the BASIC-11 system files. RX01 diskette is an example. Running a BASIC-11 Program mine absolute values, convert octal and binary numbers to deci- mal, and so on. You can conserve memory space by saving only those functions that your program needs. For now, however, instruct BASIC-11 to save all the functions. ARED READY BASIC-11 prints the READY message to indicate that it is ready to accept a BASIC-11 command. Any text that you type that is not preceded by a BASIC-11 command is accepted as program (or immediate mode) input. If at any time you wish to return to the monitor command mode, simply type the BYE command following the READY message. READY appears after any BASIC-11 execution that is completed or interrupted by a double CTRL/C, or after any BASIC-11 wait condition that is terminated by a single CTRL/C. BYE NOTE You do not need to understand the BASIC—-11 language or the way the examples work to perform successfully the exercises in this chapter. Immediate mode allows you to use the BASIC-11 interpreter like a calculator to obtain immediate answers to arithmetic problems. You enter the appropriate BASIC-11 statement keyword and any necessary mathematical formula. When you press the carriage return key, BASIC-11 immediately calculates and prints the results. (Use the terminal DELETE key and the CTRL/U command to correct any typing errors.) PRINT immediate Mode (128+75)%3ED 608 BASIC-11 adds the two numbers in parentheses, multiplies them by 3, and prints the answer. The PRINT statement causes the answer to be printed on the terminal. The following command provides another example: PRINT INT(34.67)ED 34 READY The greatest integer less than or equal to 34.67 is printed. You can combine several statements on a single line, or on several lines, including variable names, arithmetic equations, and data. Individual statements are separated from one another by a backslash (\) character. BASIC-11 considers all the 10-3 PRINT Running a BASIC-11 Program information, calculates the answer and prints it on the ter- minal, as illustrated in the following example: A=5\B=14\C=,37296D READY PRINT THE "THE HEIGHT HEIGHT IS IS"3A¥SIN{(C)+B3"METERS"@D 15.8216 METERS READY The first statement equates variable names with values; the second statement introduces a formula for calculating a result and prints it. You can use immediate mode to solve fairly lengthy and complicated mathematical problems by combining statements and printing identifying messages. However, immediate mode infor- mation is temporary. You cannot save it, and you can change it only by retyping every statement line. If your needs are more complex, or if you want to save your statements, you should create a BASIC-11 program. Creating and Editing a BASIC-11 Program To create a BASIC~11 program, assign line numbers to language statements and then type the numbered statements on the terminal keyboard. Now your program lines are saved in memory and you can transfer program control to specific lines within the program, repeat parts of the program any number of times, store the entire program for later use, and perform other similar operations that are not possible in immediate mode. SuB Once you have created the program, you use BASIC-11 editing commands to list lines, change lines, add and erase lines, and correct typing errors. In addition to the DELETE key and the CTRL/U command, BASIC-11 provides a SUB command (SUB- STITUTE) for correcting typing errors. This command allows you to substitute new characters for existing ones in a line. For example, type: 10 PRINT SUB 10 10 PRINT "THIS IS A BADIC PROGRAM"GE A BASIC PROGRAM" BBADBBASRRD "THIS IS READY The SUB command substitutes the letters BAS for BAD in line 10. Use a delimiting character (shown here as @) to separate the old text from the new. The delimiter can be any character as long as it is unique in the line. The corrected line is automatically printed by BASIC-11 after you use the command. As another example, type: 104 Running a BASIC-11 Program 15 B=10\C=5GD 20 LET A-B+CA\PRINT CED There are two typing errors in line 20; the — should be an = and the C at the end of the line should be A. These errors can be corrected with the SUB command, as follows: SUB 20 B-B=RED 20 LET A=B+C \ PRINT C READY SUB 20 BCEARZEED 20 LET A=B+C \ PRINT A READY The second SUB command changes the second occurrence (specified by the 2 after the last @) of C to A. You can erase an entire line by typing the line number followed by a carriage return: 1 0@ED You can also use BASIC-11’s DEL command'. Use the DEL command (DELETE) to erase a single line or several: DEL DEL 15-2060 This erases all statements with line numbers between and including 15 and 20. To list lines of a program, BASIC-11 provides the LIST com- mand. First, create a few program lines: 5 FOR I=1 TO 10GE 20 INPUT JED 2% LET T=T+JED 50 NEXT G 55 PRINT 88 “THE TOTAL 18" iT@ED ENDED List individual lines by specifying the line number. For example, type: LIST 5@ 0B-JAN-83 NONAME S FOR I=1 70O 00:18:49 10 READY Do not confuse the BASIC~11 DEL command with the DELETE key on the terminal keyboard. 10-5 LIST Running a BASIC-11 Program LISTNH Notice that BASIC-11 prints a header line. Since you have not as yet assigned a name to your program, BASIC-11 assigns it the name NONAME and prints this name, along with the date (which is only correct if previously entered via the DATE monitor command) and the time when you use the LIST command. You can omit the header line by using the LISTNH command instead of the LIST command. LISTNH 50-8BED 50 NEXT S5 PRINT I 88 END "THE TOTAL IS"ST READY By typing the LIST or LISTNH commands without indicating any line numbers, you can print on the terminal a listing of your entire program. Terminate the command with a carriage return. LISTNHED S FOR 20 I=1 INPUT 25 LET S0 NEXT 93 PRINT 88 END TO 10 J T=T+J I "THE TOTAL IS"ST READY SCR Finally, to erase the entire program, which you must do before typing a new program, use the SCR (SCRATCH) command. SCRED READY All program lines are erased from memory. SUMMARY: BASIC-11 EDITING COMMANDS line # Erase the indicated program lines. DEL line # Erase the indicated program lines. LIST List the entire program and print a header that includes the program name, date, and time. LIST line # List the indicated lines and print a header that includes the program name, date, and time. 10-6 Running a BASIC-11 Program LISTNH List the entire program but do not print a header. LISTNH line # List the indicated lines but do not print a header. SCR Erase all program lines from memory and change the name to NONAME. SUB line #@FIRST@SECOND@n Replace the nth occurrence of the FIRST character(s) with the SECOND character(s) in the indicated line (default is n=1). Create the following demonstration program’, using the appro- priate BASIC—11 editing commands, exactly as it appears here. If you forget to insert a line, type it at the end or when you notice the omission; BASIC-11 sorts and arranges lines by number before execution, regardless of the order in which they are typed. When you have finished, list the entire program and make a final check for typing errors. 100 REM THE 101 REM 110 PRINT 115 PRINT 120 PRINT PROGRAM Z3 MATCHES “WE BEGIN WITH 23 MATCHES., YOU MOVE FIRST., YOU" “MAY TAKE 1, 2, OR 3 MATCHES., TYPE YOUR CHOICE" "FOLLOWED BY A CARRIAGE RETURN. THEN THE COM-" 125 PRINT "PUTER CHOOSES 1+ 2+ OR 3 MATCHES. YOU CHOOSE" 130 PRINT "AGAIN, AND S0 ON, WHOEVER MUST TAKE THE LAST® 135 140 200 PRINT "MATCH: LOSES.” PRINT \ LET M=23 REM THE HUMAN MOVES 201 REM 210 215 PRINT PRINT 230 240 250 260 270 INPUT H 1F H>M THEN 510 IF H<SINT(H THEN IF H<{=0 THEN 510 IF H»=4 THEN 510 280 LET \ \ PRINT PRINT “THERE ARE NOW"iM3i"MATCHES." "HOW MANY DO YOU TAKE"j 510 M=M-H 290 300 IF M=0 THEN 410 REM THE COMPUTER 301 REM 305 310 320 330 350 IF M=1 THEN 440 LET R=M-4%INT{(M/4) IF R<>»1 THEN 350 LET C=INT(3#RND)+1 \ GO TO LET C=(R+3)-4*INT((R+3)/4) 360 LET 370 IF 380 PRINT 380 GO 400 REM 401 REM 410 PRINT THEN 70 \ 988 END 440 PRINT SOMEBODY 510 PRINT "3 "THE COMPUTER TOOK"3C3i"..s. 310 \ \ 500 REM BAD REM 380 M=M-C M=0 440 PRINT 501 MOVES PRINT PRINT WON "THE COMPUTER "YOU WON," WON."” \ \ GO TO 998 GO TO 988 INPUT "ENTER ONLY 1, 2+ OR 3." \ GO TO 215 193 Matches, 101 BASIC Computer Games, Maynard, Mass.: Digital Equip- ment Corporation, 1975. 10-7 Running a BASIC-11 Program As you can see from the first few lines of the listing, this pro- gram is a mathematical game where you match your logic against the program logic. The PRINT statements in the program print messages, game instructions, results, and so forth, on the terminal. The REM statements identify comment lines — remarks that provide general information about the program, but that are ignored by BASIC-11 during processing. The INPUT statement in line 230 allows you to supply data from the terminal. Depending on the value you enter, program control transfers to various other parts of the program. For example, if you type an invalid value, program control skips ahead to a PRINT statement in line 510 informing you of your mistake and then returns to line 215 to ask for a value again. The mathematical algorithms of this program are in lines 310 through 350, which determine the number of matches the computer will select based on your choice. RUNNING A BASIC-11 PROGRAM RUN Once you have typed the program and checked the listing to be sure that it corresponds to the example, you are ready to run it. The BASIC-11 RUN command initiates program execution. This command prints a header that includes the program name, date, and time. If you want to omit the header line, type the RUNNH command instead. RUNNHG®ED If you typed the program correctly, you will see this text print on your terminal: WE BEGIN WITH 23 MATCHES. YOU MOVE FIRST., YOU MAY TAKE 1: 2, OR 3 MATCHES. TYPE YOUR CHOICE FOLLOWED BY A CARRIAGE RETURN., THEN THE COMPUTER CHOOSES 1, 2, OR 3 MATCHES. YOU CHOOSE AGAIN,s AND MATCH, LOSES. THERE HOW ARE MANY SD NOW DO ON., WHOEVER 23 MATCHES. YOU MUST TAKE THE LAST TAKE? NOTE If this response does not appear, you have not entered the program correctly. Compare your listing very carefully against the one provided earlier. Spacing does not matter, but all other characters must match. To correct your errors type CTRL/C, which, under control of BASIC-11 only, returns you to BASIC-11 command mode, indicated by the READY message. Correct the program and then rerun it. 10-8 Running a BASIC-11 Program When the program pauses and asks you a question, you must supply data, in this case a 1, 2, or 3. Type your choice (represented here by n), followed by a carriage return: n&ED ?SYNTAX ERROR AT LINE 250 READY BASIC-11 discovered an error' in line 250 that prevents further processing. Check line 250 in your listing or list it on the terminal: LISTNH 25060 250 H<>INT(H IF THEN 510 READY Note that a right parenthesis is missing after the second H in this line. Correct the line using the SUBSTITUTE command: SUB 250 250 IF B(HE(H)RED H<>INT(H) THEN 510 READY You are ready to run the program again. RUNNHGEED BASIC-11 begins processing at the start of the program. WE BEGIN MAY TAKE 1, 2, FOLLOWED BY A PUTER WITH CHOOSES AGAIN,» AND MATCH . LOSES. THERE HOW ARE MANY S0 NOW DO 23 MATCHES. OR 3 YOU MATCHES. MOVE TYPE CARRIAGE RETURN., 1+ 3 2, OR ON., WHOEVER 23 MATCHES. YOU THEN MATCHES. MUST FIRST. YOUR THE YOU TAKE YOU CHOICE COM- CHOOSE THE LAST TAKE®? Type your choice again. But notice this time that a different kind of error is detected. The BASIC-11 interpreter has entered an infinite loop, a series of commands that it repeats endlessly. After several lines have printed, type a double CTRL/C; this interrupts execution and returns control to BASIC-11 command mode. Refer to the RT-11 System Message Manual for greater detail about any messages printed during normal system use. 10-9 CTRL/C CTRL/C Running a BASIC-11 Program n@ THE THE COMPUTER COMPUTER TOOK TOOK THE COMPUTER TOOK THE COMPUTER TOOK THE THE COMPUTER COMPUTER ETRLC) STOP AT LINE TOOK TOOK e LI [N LI R + e L)oo THE COMPUTER TOOK THE COMPUTER TOOK A LRI L Wr WM W THE COMPUTER TOOK THE COMPUTER TOOK THE COMPUTER TOOK LR 2N L 2 L CR B N N 380 READY An infinite loop is a programming logic error. However, since the error does not prevent processing, BASIC-11 does not print an error message. Instead BASIC-11 is caught in a loop of instructions and executes them endlessly. This particular loop is obvious because it prints a line of text; other kinds of loops may not be so evident. At this point you must examine the program logic to determine why these instructions are being repeated. Look at your listing of this program. The problem in this case is in line 390. This line instructs program control to return to line 310; therefore lines 310 through 390 are repeated endlessly without ever obtaining your next value choice. Program control should really return to line 210. Correct line 390 as follows: SUB 390 E310B210RED 390 GO 7O 210 READY Now you are ready to run the program again. This time the entire program should execute without error. Enter your value choices when requested. (A hint to playing the game: your first value choice determines whether you can win; if your first choice is wrong, the program has the advantage throughout.) A sample run follows. RUNNHGEED WE BEGIN WITH 23 MATCHES. YOU MOVE FIRST. YOU MAY TAKE 1, 2, OR 3 MATCHES., TYPE YOUR CHOICE FOLLOWED BY A CARRIAGE RETURN. THEN THE COMPUTER CHOOSES 1, 2, OR 3 MATCHES. YOU CHDOSE AGAIN, AND SO ON., MATCH, LOSES. THERE ARE NOW 23 WHOEVER MUST TAKE THE LAST MATCHES. S 10-10 Running a BASIC-11 Program HOW MANY DO YOU TAKE? 1@&D THE COMPUTER TOOK 1 444 THERE ARE NOW 21 MATCHES., HOW MANY DO YOU TAKE? 1@ED THE COMPUTER TOOK 3 444 THERE ARE NOW 17 MATCHES. HOW MANY DO YOU TAKE? Z2ED THE TOOK COMPUTER THERE ARE HOW MANY NOW DO YOU 2 4+ MATCHES. 13 TAKE? 160 THE COMPUTER TOODK 3 444 THERE ARE NOW 9 MATCHES., HOW MANY DO YOU TAKE? 1GED THE COMPUTER TOOK 3 ++4. THERE ARE NOW 5 MATCHES. HOW MANY DO YOU TAKE? 36D THE COMPUTER TOOK 1 4440 THERE ARE NOW 1 MATCHES. HOW MANY DO YOU TAKE? 0@ ENTER ONLY 1,y 2,y DR 3. HOW MANY DO THE COMPUTER YOU TAKE? 1@ WON. READY RUN Execute the BASIC-11 program currently in memory; print a header line including the program name, date, and version number. SUMMARY: BASIC-11 EXECUTION COMMANDS RUNNH Execute the BASIC-11 program currently in memory; omit the header line. CTRL/C Under control of BASIC-11 only, interrupt execution of the BASIC-11 program and return control to BASIC-11 command mode. BYE Return control to monitor command mode (only when using BASIC-11). 10-11 Running a BASIC-11 Program FILE MAINTENANCE You can transfer the BASIC-11 program currently in memory to a storage volume by using the SAVE command of BASIC. The SAVE command copies the program to the storage volume and gives the program the file name and file type that you indicate in the command line. A file type of .BAS is assigned automatically unless you indicate otherwise. SAVE Use the SAVE command to store this BASIC-11 program as MATCH.BAS on the storage volume (VOL:) as follows: SAVE VOL:MATCHED READY NEW After you save a BASIC-11 program on a storage volume, you can create a new program in memory by typing the BASIC-11 NEW command. This command erases the current memory contents and asks you for a new program name: NE WEED NEW FILE NAME-- You can type any file name you wish and BASIC-11 assigns it to the file you create. Or you can respond by typing only a carriage return; BASIC-11 then assigns the file name NONAME. Another way to create a new program in memory is to type the BASIC-11 SCR command. This command simply erases the current memory contents. It assigns the name NONAME: SCRED READY OoLD To use an existing BASIC-11 program, one that you have previously stored on a storage volume, type the BASIC-11 OLD command: OLDED OLD FILE NAME-- Reply by typing the device name, file name, and file type of the file that you want to use. If you omit an explicit device name, BASIC-11 assumes DK: (the default volume); if you omit an explicit file type, BASIC-11 assumes .BAS. BASIC-11 erases memory and then copies the program from the volume into memory. For example, type: YOL t MATCHED READY This copies VOL:MATCH.BAS back into memory. Assume that you have edited or changed the MATCH.BAS file and now want to transfer it back to VOL:. Since the file already 10-12 Running a BASIC-11 Program exists as MATCH.BAS on that volume, you must use the BASIC-11 REPLACE command: REPLACE VOL:MATCHED READY The REPLACE command replaces an existing file with a new version. REPLACE The SAVE and REPLACE commands copy a BASIC-11 program from computer memory to a storage volume. As these commands copy the program, they convert it from the internal format used by BASIC-11 to ASCII format. Thus, you can, if you prefer, use the RT-11 editor to create and edit BASIC-11 programs, since the editor also uses ASCII format. However, many users would rather use BASIC-11 to create and edit a BASIC-11 program, since they can then run the program, reedit it, rerun it, and save the new version — all in BASIC-11 command mode — rather than perform the several corresponding monitor commands. The last file maintenance operation that you should perform is to obtain an up-to-date directory of your storage volume so that you can see its current status; however, you must return to monitor command mode to do this. Type the BYE command,; this BASIC-11 command (rather than CTRL/C) returns control to monitor command mode. Next use the DIRECTORY monitor command to check the status of your storage volume. BYE®ED +DIRECTORY/BRIEF VOL: 08-Jan-83 SUM +MAC EXAMP FOR EXAMP .MAC GRAPH GRAPH 5AV MATCH .BAS 8 .0BJ Filess 4704 Free 58 GRAPH ,FOR GRAPH ,LGT Blocks blocKs NEW Create a new BASIC-11 program, assigning the file name indicated. SUMMARY: BASIC-11 FILE MAINTENANCE COMMANDS OLD Copy into memory an existing BASIC-11 program (for use under BASIC-11). REPLACE Copy the BASIC-11 program currently in memory to the in- dicated storage volume, replacing the version that already exists on that volume. SAVE Copy the BASIC-11 program currently in memory to the indicated storage volume. 10-13 Running a BASIC-11 Program This completes the BASIC-11 demonstration. Before you con- tinue to Chapter 14 to learn about program debugging, make sure that the main system volume is loaded in device unit 0. If you followed the special instructions in Appendix B to load the language volume, you should now stop the system, unload that volume, load the main system volume, and rebootstrap the system. REFERENCES BASIC-11 Language Reference Manual (AA—1908A-TC). Maynard, Mass.: Digital Equipment Corporation, 1976. A reference manual and guide to programming in the BASIC-11 language. BASIC-11/RT-11 Installation Guide and Release Notes (AA-K724B-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. An RT-11-specific manual that contains instructions for installing the RT-11 BASIC-11 language processor and lists known problems and differences between versions. BASIC-11/RT-11 User's Guide (AA-5071B-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. An RT-11-specific manual that contains information necessary to create, edit, run, and debug a BASIC-11 program. 10-14 CHAPTER 11 RUNNING A MACRO-11 ASSEMBLY LANGUAGE PROGRAM The MACRO-11 programming language is a machine-dependent programming language developed for the PDP-11 programmer, or for the FORTRAN IV programmer who intends to combine assembly language routines and FORTRAN IV routines. The MACRO-11 language enables the knowledgeable programmer to access all the features of the RT-11 computer system using a precise and efficient programming code. The MACRO-11 assembly language uses the PDP-11 instruc- tion set, a list of mnemonic instructions that correspond to various PDP-11 computer operations. These instructions allow you to add, compare, increment, complement, and perform many other manipulations on numerical data. The instructions are summarized in a pocket-sized folding card, called the PDP-11 Programming Card (Figure 11-1), and are described in detail in the PDP—11 Processor Handbook. By choosing the appropriate instructions and by providing any additional data needed, you can create a complete program. Figure 11-1 PDP-11 Programming Card You write the MACRO-11 program as a sequence of lines, each a single assembly language statement in the following format: LABEL: OPERATOR OPERAND(S) COMMENTS The operator and/or operand are instructions selected from the PDP-11 instruction set, data needed by the instructions, or assembler directives (instructions to the assembler to guide the assembly process). The optional statement label identifies the statement line so that you can refer to the instructions or data on that line from other parts of the program. Optional comments describe generally what operations are being done. Sequences of language statements constitute a routine (to perform a specific function); groups of routines and data compose the entire executable program. 11-1 DEVELOPING A MACRO-11 ASSEMBLY LANGUAGE PROGRAM Running a MACRO-11 Assembly Language Program When you are satisfied with the logic of your MACRO-11 source program, you use the RT-11 editor to create it as a file (see Chapter 5). You use tabs and spaces to make the program more readable. When you have finished creating the program as a complete, edited file, you next enter it as input to the MACRO-11 language processor, which is part of the RT-11 operating system and is stored on your system volume. The MACRO-11 language processor processes (assembles) the lan- guage statements, converting them into an internal machine language code called object code. This code is next processed by the system linker, which combines your program units and makes the program suitable for execution. Figure 11-2 repre- sents the development of an executable MACRO-11 program. CREATE EDIT Figure 11-2 USING THE MACRO-11 LANGUAGE PROCESSOR ASSEMBLE LINK RUN Evolution of a MACRO-11 Program The MACRO-11 language processor is an assembler that accepts information in one format (that is, your source program) and translates it into another format (that is, a machine lan- guage program). The assembler interprets and processes the assembly language statements, one at a time, and generates one or more computer instructions or data items. Since you originally use the editor to create a MACRO-11 program in ASCII format, you must next translate it into a machine format that the computer can use. The MACRO-11 assembler performs this conversion, producing as output a new version of the program, in object format, called an object module. You may request the MACRO assembler to produce a listing of the source program at the same time. The role of the assembler is represented below in Figure 11-3. SOURCE _ PROGRAM ASSEMBLE OBJECT MODULE LISTING (OPTIONAL) Figure 11-3 Function of a MACRO-11 Assembler 11-2 Running a MACRO-11 Assembly Language Program During assembly processing, the MACRO-11 assembler: e Accounts for all instructions used within the source program and determines their relative positions in computer memory; it does this by means of a storage location (program) counter. o Keeps track of all user-defined symbols and their respective values in a symbol table. ¢ Converts assembly language mnemonics, user-defined symbols, and data values into their respective machine language (object code) equivalents. The program counter keeps track of addresses in computer memory where instructions and data will be stored. PDP-11 computer memories are composed of physical storage locations that can hold numerical data. These locations are numbered consecutively from 0 up to the highest memory location, which varies according to the amount of memory acquired with the computer system (Figure 11—4). PDP-11 computers used in an RT-11 system have at least 32,768 bytes (16,384 words). CONVERTED INSTRUCTION CONVERTED INSTRUCTION CONVERTED INSTRUCTION Figure 11-4 PDP-11 Computer Memory 11-3 The Program Counter Running a MACRO-11 Assembly Language Program During processing, the assembler converts each program language statement into numerical data (the object code) and as- signs the data a relative storage location. The system linker will convert the relative storage locations assigned by the as- sembler to absolute storage locations in the computer memory.! The location’s associated number is called its address. As the assembler translates and assigns each statement, it updates the value of the program counter accordingly. The Symbol Table Since you may not know which locations, or how many locations, the program needs, you use symbolic names (variables, constants, and labels) to represent individual locations and their contents. As the assembler processes the source program, it constructs a symbol table, which is a compiled list of all the symbolic names and labels that you have used within the pro- gram. The MACRO-11 assembler defines each symbolic name by assigning an address or data value, as appropriate, and adds the symbol definition to the symbol table. After assembly, you can refer to the symbol table, which is printed at the end of the assembly listing, to find all symbol definitions. Machine Language Code The third function of the assembler is to convert your MACRO-11 source language statements into machine language code (the object module). NOTE The following information will help you understand the assembly listing used later in this chapter. Machine language code is numerical data in the form of binary numbers (numbers composed of only the digits 0 and 1). Binary numbers are appropriate because the digits 0 and 1 can be easily manipulated by the two-state electronic logic of the computer. For example, a typical assembled instruction in PDP-11 com- puter memory looks like this: location location address contents 01000 11000000 01001 11100101 "The system linker is discussed in Chapter 12. 114 Running a MACRO-11 Assembly Language Program Since a single instruction requires two (or more) consecutive memory locations, the instruction is actually put together in memory in the following manner: 01001 high-order byte low-order byte 11100101 11000000 01000 Each individual digit of the instruction is called a bit (binary digit). A single memory location, called a byte, contains 8 bits; two memory locations, called a PDP-11 word, contain 16 bits. The byte in the even-numbered memory address is called the low-order byte and is stored first; the byte in the odd-numbered memory address is called the high-order byte and is stored next. Both bytes together form one PDP-11 16-bit word (Figure 11-5). PDP-11 Word gioorf 11+ 0 10 1t 0 v+ t}1 0O O O O O 0] 01000 \\T etc. bit -~ - - ~ —" - Low-order byte High-order byte Figure 11-5 PDP-11 Word The computer works in terms of 8-bit bytes and 16-bit words of binary data. However, binary numbers are generally too long and cumbersome to be used effectively by a programmer. But binary numbers can be easily represented as octal numbers (numbers composed of digits within the range 0 to 7). Since octal numbers are closer to the familiar decimal number system and are much more readable than binary numbers, the programmer more often uses octal numbers than binary numbers. Table 11-1 shows the decimal numbers 0 through 10 and their respective octal and binary equivalents. Tables and formulas are available to calculate higher conversions. Thus, you can think of the binary instruction shown earlier in terms of its octal equivalent as follows (conversion is done from low-order to high-order byte in groups of three bits): 01001 high-order byte low-order byte 11100101 11000000 1 7 6 2 0 0 01000 = 162700(8) 11-5 Running a MACRO-11 Assembly Language Program A MACRO-11 assembly listing shows the addresses of memory locations and their contents as octal numbers. The octal numbers represent the respective binary machine language code that makes up the object module. Table 11-1 Decimal/Octal/Binary Conversion — QWX TITDHOp WN O Decimal ASSEMBLING THE MACRO-11 PROGRAM Octal Binary 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 10 1 000 11 1 001 12 1 010 In Chapter 5 you used the RT-11 editor to create a MACRO-11 source program; you then stored it on your storage volume. Since a source program is in ASCII format, the next step is to use the MACRO-11 assembler to convert the source program to object code. Copy the MACRO-11 source program from the storage volume back to the system volume (which is the default volume for input/output operations). On your storage volume are two MACRO-11 source programs, the one you created, SUM.MAC, and the one provided for you, DEMOX1.MAC, which was renamed to EXAMP.MAC in Chap- ter 7. Which of these you should copy depends on the results of the source comparison you performed in Chapter 6. If the comparison resulted in no differences except for the title lines, copy your own program (SUM.MAC) as follows: Long Command Format .COPYGED From? VOL:SUM.MACGEED To 7 SUM,MACGED Short Command Format ,COPY VOL:SUM.MAC SUM.MACED However, if differences were listed in addition to the title lines, substitute the program EXAMP.MAC: 11-6 Running a MACRO-11 Assembly Language Program Long Command Format +COPYGED From? VOL:EXAMP.MACED ? SUM,MACGEED To Short Command Format ,COPY VOL:EXAMP,.MAC SUM.MACED Whichever source file you copied now resides on your system volume under the name SUM.MAC and is the file that you will process with the MACRO-11 assembler. The command used to assemble a MACRO-11 source program is the monitor MACRO command. Use the MACRO command with its /LIST and /CROSSREFER- ENCE options to assemble your source program and produce a cross-referenced assembly listing. The system prompt asks you to supply the input file name. You can omit typing the .MAC file type, since the MACRO command assumes this file type unless you indicate otherwise. The system will automatically assign the name SUM.OBJ to the object module and SUM.LST to the listing file, and store both newly created files on the system volume. (The system volume is the default storage volume for input/output operations.) Long Command Format + MACROGED Files? SUM/LIST/CROSSREFERENCEGE Short Command Format +MACRD SUM/LIST/CROSSREFERENCEGED Assembly begins. When it is finished, a message similar to the following prints on the terminal printer or screen: ?MACRO-W-Errors detected:- B DK:SUMDK:SUM/C=DK:5UM This message indicates that the assembler detected errors in six lines of the source program during processing. It helps at this point to look at the listing produced by the assembler for information. Long Command Format (Line Printer) L PRINTED Files? SUM.LSTGD (Terminal) , TYPEGD Files? SUM,LSTED 11-7 MACRO Running a MACRO-11 Assembly Language Program Short Command Format (Line Printer) (Terminal) +PRINT +TYPE SUM.LSTEED SUM,LETRD Your listing should look like the following example. An explanation of this listing follows. You should refer to the listing as you read the accompanying explanation. NOTE You do not need to understand the MACRO-11 language or the way this program works to successfully complete the exercises in this chapter. BUM.MAC VERSION 1 MACRD V05,00 Ssturdaw 08-Jan-83 093121 ~TITLE SUM.MAC VERSION JHMCALL JTTYOUT, JEXIT, PRINT #NO. DIGITS 1 Fage 1 1 2 3 4 5 6 S 7 000106 N 8 9 = 70, = THE TO 1701 SFRINT SMESSAG $PRINT MOV #NsRS $NG. OF CHARS MOV #NHLPRO #NO. OF DIGITS OF MOV #A,R1 3$ADDRESS 1720 4+ RECIFROCALS OF THE 1738 + 1/50 CALCULATE i 4+ THE 'E‘ EXF! 1710 OF OF ‘E’ 4+ SUM OF ¥ + 1/40 FACTORIALS 4 ... 10 M u 11 000000 12 000006 012705 000104 13 000012 012700 000107 14 000014 012701 000000 16 000024 011146 MoV BR1y—(SF) 18AVE 17 000026 006311 ASL ar1 ka4 18 000030 004311 ASL eRt %8 ADL (SF) 4y (R1D+ FNOW DEC RO AT END OF BIGITS? BNE SECOND PBRANCH IF NOT MOV #NsRO 60 THRU ALL =(R1)+R3 $BY THE FLACES 15 000022 006311 19 000032 082621 20 000034 005300 21 000038 001371 22 000040 012700 23 000044 014103 24 Q00046 012702 25 000052 005202 FIRST: SECOND? 0001046 THIRD: ASL MOV 177777 @rR1 INTROBUCTORY OF OF TO PRINT ACCURACY 00 MULTIPLY BY 10 VECTOR (DECIMAL) X2 %10, POINT TO NEXT PLACES, MOV #-1,R2 FINIT QUOTIENT INC R2 i BUMF QUOTIENT 160003 SUB ROsR3 $SUBTRALT LOOP 103375 BCC FOURTH FNUMERATOR $FOR NEXT $BREATEST FOURTH?: TEXT ‘E’ DIGIT DIGIT LDIVIDING INDEX REGISTER 26 27 000054 28 AR 0000546 29 000060 30 000062 080003 010311 31 32 000064 046167 ADT MOV 000000 000000 ROYR3 R3IsBR1 DIGIT INTEGER ADD R2-2(R1) #70 GIVE 34 000072 005300 DEC RO #AT END OF DIGIT 35 000074 001363 BNE THIRD PBRANCH IF NOT 346 000076 014100 37 000100 1482700 000104 103375 40 000106 41 000112 42 000114 062700 000000 003011 43 000116 44 000120 43 000122 33 MOV 37 ~(R1)sRO ¥GET BIGIT #10.,R0 JFIX THE FTHAT IT BEC FIFTH # (REALLY ADD STTYON CLR #10,1/0sRO 2Rt #MAKE DIGIT JOUTPUT THE FCLEAR NEXT 003305 DEC RS #MORE 001334 BNE FIRST FBRANCH IF $WE DONE FIFTH! 000072 BAD < 10%N CEXIT TO S CARRIES VECTOR? OQUTPUT 2.7 1O IS ONLY DIVIDE .7 TO 80 1 DIGIT BY ASCII DIGIT DIGIT DIGITS ARE ~— DIGIT 8SUB 000012 38 u ISN'T IS ALWAYS $FIX REMAINDER FSAVE REMAINDER AS BASIS 10) LOCATION PRINT? YES as " 47 000124 48 000107 EXP? +REFT +WORD 49 50 51 000342 124 110 105 000345 040 126 101 000353 040 117 104 000354 040 105 040 000361 111 123 072 114 000344 0135 VERSION 1 128 012 MACRO 0003467 056 B4 Swmbol A TO ALL ONES MESSAG: (ASCIT /THE VALUE OF £ IS3/ <1%5>412: /2./ <200> 062 V05,00 Saturdaw 08-Jan-83 Q%9i21 Fade 1~1 Fagde 1-2 200 000000 VERSION 1 SJEND MACRO V05.00 Saturdaw 08-Jan-83 EXF 09121 table = KXKRKK FIFTH 0001 00R FOURTH Q00052R N 000000R FIRST 000012R MESSAG 000342R SECOND + 000000 ABS, 000372 Errors Kork Work detected! Assembler file file of vreads! writes! core Operating 000 (RWrI,GBLyARS,OVR) 001 (RW>TsLCL+REL s CONY = 000106 THIRD Q00044R 000022R STTYON= RRXARK & statistics Size of work file! Size T EXP *k¥ . JEVEN 53 BUMMAC VECTOR 105 52 ) FINIT +JENDR 0006350 SUM.HAC N+1 1 O Q 8222 Words rooll 15872 swystem! RT-11 UWords ( 33 Fasmes) ( 62 Pasges) —” 11-8 Running a MACRO-11 Assembly Language Program Elarsed DK time! 00:0C104.34 SUMy DK I SUM/C=DK! 5UN SUM.MAC Cross VERSION reference «TTYON 1 HACRO table (CREF 1-11% 1-47% FIFTH FIRST 1-37% 1-13¢ 1-29 1-44 MESSAG 1-11 1-51% N SECOND 1-7% 1-15¢ 1-12 1-21 THIRED 1-23% 1-35 FOURTH 1-25¢ SUM.MAC 0%:21 Page 5-1 VERSION reference MACRO 1-3¢ 1-45 1-38 i-11 LTTYDU 1-38 VERSION reference 1-13 1 table +PRINT SUM.HAC 1-54 1-28 JEXIT STIP D> 08-Jan~-83 1-14 EXP Cross Saturdaw 1-41 A Cross V05.00 V05.00) (CREF 1 (CREF V05,00 1-47 Saturdaw 08-Jan-83 09i21 Fase M-1 Saturdaw 08~Jan-83 09121 Fase E-i VQ5.00) HACROQ table 1-22 V05,00 V05,00) 1-32 1-54 31-~311 1~47 1-32 1-14 t~41 The first part of the listing has four logical sections, as follows: line number octal memory octal instruction address value(s) statement line The assembler assigns consecutive decimal line numbers to each line of the source program, including blank lines and comment lines. These numbers are used for reference purposes. The next column to the right shows the relative' even-numbered octal memory (byte) addresses of storage locations assigned by the program counter to each instruction in the program. This has been assigned relative memory addresses 0 through 370. The third column (and possibly fourth and fifth) program shows the octal equivalent of the assembled instruction or data value. An apostrophe following an octal value indicates a relative value that must be modified before it can be used (the actual value is determined during linking). Finally, the source program as you created it appears in the right-hand portion of the listing. For example, look at line 18 of the listing: 18 000030 0086311 ASL @r1 %8 The instruction ASL @R1 is stored in relative memory locations 30 and 31 as binary data (the comment, ;*8, is ignored): 31 00001100 0 0 6 11001001 3 1 30 1 !The assembler assigns relative memory addresses to instructions. Actual addresses are not determined until the link operation is performed. Linking and address relocation are discussed in Chapter 12. 11-9 Running a MACRO-11 Assembly Language Program Some instructions require more than two memory locations; for example, those at lines 13 and 14. The number of memory locations required depends upon the operation. Following the assembled code in the listing is the symbol table, an alphabetical listing of user-defined symbols and labels in the program and their respective definitions. Symbols are defined as values. For example, the symbolic variable name N is de- fined (in line 7) as 000106(octal) or 70(decimal), an absolute value. Labels are defined as addresses. The symbolic label FIRST is defined (in line 14) as 000012, a relocatable address (the R following 000012 in the symbol table indicates that the address will be relocated or modified during linking). A row of asterisks next to any symbolic name in the table indicates that for some reason — possibly a programming error — the assembler could not define the symbol. At the very end of the symbol table (where the . ABS. occurs) is the program’s size information (or synopsis) in terms of the to- tal number of octal storage locations it requires (in this case, 372). Following is the number of errors detected, and the amount of free and used memory pages (statistics provided by the assembler). Following the symbol table is the cross reference (CREF) listing. The CREF listing is optional — as is the assembly listing — but provides you with useful reference and debugging information, especially if the program is large. The CREF listing can contain several kinds of tables of reference information, each beginning on a new page. The default tables are the three shown here. Every reference in a CREF table shows the page number of the listing (in the preceding example, all references are on page 1), followed by the appropriate line number. A number sign following a line number indicates that this line is where a label or symbol definition occurs. The first CREF table shown here lists alphabetically all userdefined symbol and label references. The second CREF table lists alphabetically all macro symbol references. (Macro symbols are a special feature of the MACRO-11 assembly language; they are described shortly.) The third CREF table lists alphabetically the codes of the er- rors detected during assembly. These errors must be corrected before you can run the program. Now that you are familiar with the format of an assembly listing, go back to the beginning of the example listing to determine what this program should do. 11-10 Running a MACRO-11 Assembly Language Program The first two comment lines (preceded by semicolons) indicate that the program calculates the value of ‘E’, which is the sum of the inverse of the factorials between 1 and infinity. The algorithm used in this program is somewhat complicated (this was necessary to keep the program reasonably short). ‘E’ is calculated one digit at a time by using a difference function between its actual value and the current approximation for each new digit. The program forms: 1+ +0+.. .+ 1+ 1+ 1/N)/N-1)/(N-2))/.../2)/1) and is 2.11111... in the inverse factorial base system, which is the first sum shown in the program listing. The statements between lines 1 through 7 define initial states to the assemblers, such as the value of N, and designate the macros that will be used throughout the program. Macros, from which the MACRO-11 language processor derives its name, are a useful feature of the MACRO-11 assembly lan- guage. You can define as a macro any recurring sequence of coding instructions. By giving the macro a name, you can thereafter call it from any other part of the program by using a single language statement. In addition to the macros you define yourself, the RT-11 system provides system macros that your programs can access. System macros are defined in a special system library file called SYSMAC.SML (SML stands for System Macro Library). SYS- MAC.SML is part of the RT-11 operating system and is stored on the system volume. If you request a system macro from your source program, the MACRO-11 assembler automatically searches SYSMAC.SML for the required information. The system macros defined in SYSMAC.SML are calls to certain services performed by the RT—11 monitor, such as terminal handling, input and output operations, program termination, file capabilities, and so on. The portion of the monitor that performs these services, or that is capable of getting the necessary program code to perform these services, is always in memory and is therefore called the resident monitor. Thus, whenever your source program is in memory and is to be executed, the resident monitor is also there with its services. You communicate the need for a monitor service by issuing a programmed request in your source program. A programmed request consists simply of a macro call to a specific macro defined in SYSMAC.SML. The macro expands into the appropri- ate machine language code, which, during program execution, makes a request to the resident monitor to supply the desired service. 11-11 Running a MACRO-11 Assembly Language Program You specify all programmed requests that you intend to use in your source program in an .MCALL statement, like the one shown at line 3 in the listing. For example, the programmed request .TTYOUT requests the monitor to print an ASCII char- acter on the console terminal. During assembly, the .TTYOUT macro in SYSMAC.SML is expanded into machine language code. During program execution this code requests the resident monitor to take the indicated ASCII character and send it to the console terminal. Line 12 in the program uses another programmed request, PRINT, to print a message on the terminal. Lines 13 through 15 are initialization instructions: they set initial values in three of the special registers. Lines 16 through 22 represent a routine that does a multiplication by 10. Lines 23 and 24 are setup instructions for the division routine of lines 25 through 28. Lines 29 through 35 save the quotient and remain- der. Lines 36 through 40 print the digits of E. Lines 43 and 44 count the number of digits. The statements at lines 47 through 49 reserve a buffer area (a series of locations in memory) to be used by the program and therefore not to be assigned to other instructions. The statement at line 51 provides the data for printing the ASCII text message THE VALUE OF E IS: 2. This program, however, contains errors. The assembler discov- ered six lines with errors that prevent the program from assembling properly. The assembler flags (points out) errors by printing a code letter in the assembly listing or on the terminal if no listing is requested.’ The first error occurs at line 12 and is an M error. This means a label was defined more than once. You can refer to a label any number of times, but you may define it only once. By looking at the CREF user symbol table, you can see that the label is defined at line 12 and again at line 47; one of these definitions is wrong. Examination of the program logic reveals that the definition at line 12 is correct. Before deciding how to change line 47, though, check the other errors to see if one of them indicates what should be done. In fact, the next error encountered (line 15) shows what is wrong. A U error identifies an undefined symbol. The label A is referenced in line 15, but is never defined within the program. It should be defined logically at line 47. Therefore, line 47 should be changed to read: A: +REPT N+1 1Refer to the RT—11 System Message Manual for greater detail about any system messages printed during normal system use. 11-12 Running a MACRO-11 Assembly Language Program Thus, this one change eliminates three errors flagged by the assembler; those at lines 12, 15, and 47. The next error occurs at line 32. Actually, the assembler flagged two errors here. An A error indicates an addressing problem and an R error indicates a register error (invalid use of a register, a special PDP-11 storage feature). If you look at the language statement in line 32, you can see that the ADD operator is followed by one operand. However, ADD is an instruction that requires two operands (two values to be added together) separated by a comma. This statement simply contains a typing error, which can be corrected by inserting a comma between the R2 and the —2(R1). Thus, changing the line as follows both corrects the addressing problem and eliminates the invalid register expression: ADD R24+-2(R1) At line 41 is another undefined symbol, the macro symbol .TTYON. Since the program designated the macro symbol TTYOUT in line 3, this error indicates a misspelling. Correct line 41 to read: JTTYOUT Finally, a D error occurs in line 54. This indicates that refer- ence was made to a symbol that is defined more than once. This error has already been eliminated as a result of the correction made to line 47. Thus, by changing the three lines indicated, you can correct all the errors flagged during assembly. So the next step is to edit the appropriate lines in the source program. If necessary, re- view the editing commands in Chapter 5, and then edit the file SUM.MAC on your system volume so that the three lines indicated are error-free. Do not rename the file. When you are ready, reassemble the program, using the MACRO command, and obtain a new object module and a new listing. This time the program should assemble without error. If errors occur, you have not edited the program correctly. Compare listings and try to correct your errors, or go back to the beginning of this chap- ter and repeat the demonstration. The object module produced by the MACRO command may in itself be incomplete. It may need to be joined with other object modules or library files to form a complete functioning program,’ since all required object modules must be joined before the program can work. !Chapters 12 and 13 give more information on linking files and using library files, respectively. 11-13 LINKING OBJECT MODULES TOGETHER Running a MACRO-11 Assembly Language Program Thus, you must next link the SUM object module with any other object modules it requires. However, the only file used by this program was the macro library file SYSMAC.SML, and it was used during assembly. So in this case, you do not need to join the SUM object module with any other modules. NOTE Some other MACRO-11 programs that you write later may reference system subroutines supplied in the sys- tem subroutine library, SYSLIB.OBJ. Programs that reference these routines must be linked with the system subroutine library to satisfy external references. If SYSLIB.OBJ is not present on your system volume, follow the guidelines in the section of Appendix B entitled Using the LINK Volume. Even though SYSLIB is not required for SUM.OBJ, you must still link the file. The link operation, in addition to joining object modules together, also assigns absolute memory addresses to the relative addresses calculated by the MACRO-11 assembler. Since the memory addresses of one object module must be relocated to accommodate addresses used in another object module, the link operation serves to resolve all address changes. The result of the link is a memory image load module, with all module links resolved and all absolute memory addresses and storage information assigned (Figure 11-6). The memory image module, then, is actually a picture of what computer memory looks like just before program execution. OTHER OBJECTS OBJECT MODULE Figure 11-6 LINK o LOAD | MODULE The Link Operation To link the object modules, use the LINK command. The system LINK prompts you to enter the names of the input object modules to be linked together. You can omit typing the .OBJ file type in the command line since the LINK command assumes this file type for input. After you have entered the input information, the system begins linking the object module. You do not have to 11-14 Running a MACRO-11 Assembly Language Program specify an output file, since the system automatically assigns the file name of the first input file and a file type of .SAV to the output file. Long Command Format +LINKGED Files? SUMED Short Command Format +LINK SUMED Any messages printed inform you of error conditions discovered during the link operation (for example, if you fail to specify all the necessary input object modules). However, assuming you edited your source program correctly and that it assembled without error, it should also now link without error. A load module is one that you can run on the system. Unless your program contains logic errors that prevent it from running properly (errors that the system cannot always detect), running the .SAV version of your program should produce the results you intended. However, if logic errors exist within your program, running the program will produce either erroneous re- sults or none at all. If this is the case, you must study the source program, rework it, reedit it, then perform the assembly and link operations again. If your MACRO-11 program is error-free, running the .SAV version should produce the expected results. In this demonstra- tion, running the SUM.SAV file should produce a value on the terminal that is the constant E (2 followed by 70 digits). To execute the MACRO-11 demonstration program, use the monitor RUN command. You can omit typing the .SAV file type, since the RUN command assumes this file type. Type the following, and note the results printed on the terminal: Long and Short Command Format +RUN THE SUMGED VALUE OF E IS: 2.3/606/806237.2301314,065253/130440275535025,71477737352744745405502.,544 + You can see that something is wrong. Slashes and periods appear in the result, indicating that an error still exists somewhere in the program. Programming errors, called “bugs,” can be difficult to find and fix. A debugging aid called ODT (On-line Debugging Tech- nique) is described in Chapter 14. You will use it to correct the program’s final error and to rerun the program. For now, however, the error will be pointed out and explained. 11-15 RUNNING THE MACRO-11 PROGRAM Running a MACRO-11 Assembly Language Program Look at line 40 in the assembly listing. Notice that the instruction in this line converts a digit into the appropriate ASCII code before printing it on the terminal. To do this, the constant 10 is added into the value of the digit already stored in memory, and then the value is converted — via ’0, the ASCII code for 0 — to an ASCII code that can be printed. Unless you ex- plicitly designate a value as decimal, however, the assembler assumes all values used in the program are octal. Therefore, it interprets the constant as 10(octal) or 8(decimal), and adds the wrong value every time. The conversion consequently causes the codes of the ASCII characters / and . to be used as results in some cases. The codes of other digits, while representing numeric values, are also off by two. To correct this error, you must insert a period after the 10 in line 40. The period instructs the assembler to accept the constant value 10 as a decimal value. COMBINING OPERATIONS EXECUTE To produce program results, you first assembled the MACRO-11 source program, SUM.MAC, then linked it, and finally ran the resulting .SAV file, SUM.SAV. You can combine these three operations using one monitor command, the EXECUTE command. NOTE In order to use the EXECUTE command, the following files must be present on your system volume: SUM.MAC MACRO.SAV LINK.SAV SYSLIB.OBJ The last file, SYSLIB.OBJ, is required only if the MACRO-11 program you need to link refers to routines that are contained in the system library. The program used in this demonstration, SUM.MAC, does not require SYSLIB.OBJ. The EXECUTE command instructs the system to select the appropriate language processor, then process, link, and run the program. There are several ways to establish which language processor the EXECUTE command invokes. One way is to specify a language-name option, such as /MACRO, which invokes the MACRO-11 assembler. Another way is to omit the language-name option and explicitly specify the file type for the source file’ The EXECUTE command then invokes the language processor that corresponds to that file type. Specifying the file SUM.MAC, for example, invokes the MACRO-11 as- sembler. A third way to establish the language processor is to let the system choose a file type of MAC, .DBL, or .FOR for the source file you name. If, for example, you specify the file SUM, 11-16 Running a MACRO-11 Assembly Language Program the monitor searches device SY: (your system device) for the files SUM.MAC, SUM.DBL, and SUM.FOR, in that order. If it finds a file named SUM.MAC, it invokes the MACRO-11 assembler to process the file. For example, to combine the assemble-link-run operations you performedin this chapter, you use the following command: Long Command Format +» EXECUTE®ED Files? SUM/LIST/CROSSREFERENCEGE Short Command Format +EXECUTE SUM/LIST/CROSSREFERENCEGD THE VALUE OF E IS: 2.5/608/606237,2301314.,06525/130440275535025,71477737352744745405502,544 Notice how you use the /LIST and /CROSSREFERENCE options following the file name to request both an assembly and a cross-referenced listing. EXECUTE Combine the assemble-link-run operations into one command. EXECUTE file/eMACRO Combine the process-link-run operations into one command, and specify the input file to be a MACRO-11 file. EXECUTE/CROSSREFERENCE Produce a cross-referenced listing file. EXECUTE/LIST Produce a listing file of the source program. LINK Link individual object modules together to form a complete program and produce a load module. MACRO Assemble the MACRO-11 source program, and produce an object module. MACRO/CROSSREFERENCE Assemble the MACRO-11 source program, and produce both an object module and a cross-referenced listing file. MACRO/LIST Assemble the MACRO-11 source program, and produce both a listing on the line printer and an object module. RUN Run the indicated load module. 11-17 SUMMARY: COMMANDS TO RUN MACRO-11 PROGRAMS Running a MACRO-11 Assembly Language Program FILE MAINTENANCE Before continuing, you should perform the necessary file maintenance operations. Obtain a directory of all files on your system volume that have the name SUM, regardless of file type; these files were created as a result of the exercises in this chapter. Long and Short Command Format ,DIRECTORY SUM,*ED 08-Jan-83 SUM SUM .BAK .L8T 3 9 0B-Jan-83 08-Jan-83 0B-Jan-83 t .0BJ SUM S Filess 18 Blocks 480 Free blockKs SUM SUM +SAV +MAC 2 3 08-Jan-B3 08-Jan-B83 The fact that you have corrected errors in the source file of SUM.MAC makes the version of that file on your storage volume obsolete. Therefore, transfer the updated copy from your system volume back to VOL:, replacing the copy of SUM.MAC on the storage volume with the new version. Long Command Format +COPYGED From? SUM.MACGED To ? VOL:5UM.MACGD Short Command Format \COPY SUM.MAC VOL:SUM.MACEED Similarly, transfer SUM.SAV and SUM.OBJ to your storage volume. This allows you to rerun the MACRO-11 program without reassembling and relinking the source. Long Command Format +COPYERED From? SUM.SAV,SUM.0BJGD To 7 VOL:ED Files coried: DK:SUM,.5AV to YOL:SUM,.8AV DK:SUM,0BJ to YOL:SUM.0BJ Short Command Format +COPY Files SUM.SAV,S5UM.DBJ VOL:ED copied: DK:5UM,5AV to VOL:8UM.SAV DK:SUM.0BJ to VOL:SUM.0BJ Once you have transferred to your storage volume the files you want saved, delete from the system volume those you no longer need (that is, all the SUM files). o 11-18 Running a MACRO-11 Assembly Language Program Long Command Format +DELETE/NDQUERYGED Files? SUM,»ED Short Command Format +DELETE/NOQUERY SUM, @D Notice that the /NOQUERY option suppresses confirmation when wildcard construction is used. Finally, obtain an up-to-date directory listing of your storage volume so that you can see its current status. Long and Short Command Formats ,DIRECTORY VOL:@D 08-Jan-83 +5AV SUM EXAMP FOR GRAPH .FOR GRAPH SUM ,0BJ +MAC 4701 Free 10 Filess 2 2 2 18 3 B1 08-Jan-B3 26-Aud-82 08B-Jan-83 08-Jan-83 08-Jan-83 BlocKs +0BJ SUM EXAMP .MAC GRAPH .LST GRAPH MATCH ,8AV .BAS 1 3 8 21 3 08-Jan-B83 26-Aug-82 08-Jan-83 08-Jan-83 08-Jan-83 blockKs This completes the MACRO-11 demonstration. Continue now to Chapter 12 to learn more about the link operation. PDP-11 MACRO-11 Language Reference Manual (AA-5075C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A reference manual for the PDP-11 programmer using the MACRO-11 assembly language. PDP-11 Peripherals Handbook. Maynard, Mass.: Digital Equipment Corporation, 1981-82. A technical description of the PDP-11 peripheral devices, including nec- essary programming information. PDP-11 Processor Handbook. Maynard, Mass.: Digital Equipment Corporation, 1981. A technical description of the various PDP-11 processors, including complete information concerning the PDP-11 instruction set. PDP-11 Programming Card. Maynard, Mass.: Digital Equipment Corporation, 1975. A pocket-sized folding card summary of PDP-11 machine instructions used by the various PDP-11 assembly language processors. PDP-11 Software Handbook (EB~21759-20). Maynard, Mass.: Digital Equipment Corporation, 1982-83. A general overview and introduction to available PDP-11 software, operation systems, and language processors. 11-19 REFERENCES Running a MACRO-11 Assembly Language Program RT-11 Programmer’s Reference Manual (AA-H378B-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. An RT-11 system-specific programming manual for the MACRO-11 programmer. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. RT-11 System Utilities Manual (AA-M239A-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 System Utilities. 11-20 CHAPTER 12 LINKING OBJECT PROGRAMS Programs that you write in the MACRO-11 and FORTRAN IV programming languages require additional processing after their conversion to object format. Before you can run these programs on the system, you must link them. The link operation: ¢ Joins together the object modules that use a symbol with the object module that defines it. ¢ Relocates individual object modules as necessary and assigns absolute (permanent) memory addresses; it can also define an overlay structure. ® Produces a load module and an optional load map (Figure 12-1). OBJECT MODULE(S) N - LINK LOAD —"1 MODULE LOAD MAP (OPTIONAL) Figure 12-1 Link Functions Program linking gives you the advantage of a modular approach to programming. You can create an entire program as a series of smaller, independent subprograms. One of these is written as the main, or controlling, program, and the rest as subordinate subprograms and subroutines. You use a language processor to translate each part of the program into an object module. Then you use the linker to join all the object modules together into a complete, functioning unit. Modular programming makes program creation and debugging easier. For example, several programmers can simultaneously work on a single program, each creating a portion of it. The individual portions, or subprograms, can be processed and linked with test programs and debugged for logic errors separately. Then all the object modules can be joined together to form a complete program that can be tested as a whole. If errors occur at this stage, only those object modules with errors need be debugged and changed. 12-1 Linking Object Programs In addition, modular programming allows you to make use of library files. These are files containing subprograms and subroutines that have been debugged. After you join library files with your program at link-time, their routines can be used by your program as needed. RESOLVING SYMBOLIC AND LIBRARY The linker reads through all the object modules that you indicate as input to the LINK command. It gathers and evaluates REFERENCES essor) that is necessary for program linking. For each input information (provided to the modules by the language procmodule, this information includes the object code, information needed for relocation, the relative address of the first instruction, the global symbols used, and the absolute length of each program and program section. One of the linker’s first functions is to resolve all user-defined symbolic references and library references in the joined routines. There are two types of user-defined symbols — internal symbols and global symbols. Internal symbols are limited to the object module in which they appear; thus, they cannot be referenced from or defined in any other module. A program containing only internal symbolic references — like those in the demonstration program in Chapter 11 — is complete in itself and does not need to be joined with any other object programs at link-time. Thus, in- ternal symbols are not resolved at link-time because they have already been resolved by the language processor. Global symbols, on the other hand, are the key to modular programming. Global symbols provide the communication between object modules. Such symbols may be symbolic labels to instructions, symbolic labels to data, or symbols that are equated to a value or constant. Global symbols are defined in one object module and referenced from other object modules that have been separately assembled or compiled. Such symbols must be designated as global in the source code. The following segment of MACRO-11 assembly language code illustrates the use of global symbols: Al MACRO VO5.00 SATURDAY CB-JAN-83 0B8:42 PAGE 1 SGLOBL AC/VALUE MOU B(RS}I+.RO SDECLARE iAS 060000 000002 013500 016701 A Q00016 Mav LOCAL 4RI A, GLOBAL 3CLOBAL Cr AND A iHERE AND IFROM OTHER iBY SUBROUTINE A FLDCAL CAN 1S BE IS AN IHITHIN THIS ®ODULE Q00000 000007 ©Q0000G 12 00014 013501 13 000016 005003 1a 000020 000207 15 000022 000011 VALUE oodoza 177777 LOCAL: usR PC.C L1019 (RS} +,R1 CLR R3 RYS PC «WORD 11 WORD 177777 11 1B TO 000001 +END 12-2 FGLOBAL IN SYMBOL REFERENCED GLOBAL iDEFINEQ 18 17 $CALL ANGC PROBABLY CALL INTERNAL IDEFINED 000006 DEFINED REFERENCED MODULES. a8 10 VALUE SYMBOLS SYMBOL © N DAD W N - +MAIN. ROUTINE ANOTHER SYMBOL THIS FINTERNAL SYMBOL C» MODULE VRLUE FREFERENCE ONLY DATA USED IS USED YO LOCATION FOR DATA Linking Object Programs While internal symbolic references, such as LOCAL in the example, can be resolved by the assembler or compiler within the single program unit, global references, such as C, cannot. They require other object modules. During translation, the language processor notes in the object module those symbols that are global. During linking, the linker keeps track of the global references and definitions found in all the object modules. As linking proceeds, it makes the appropriate correlations and modifies instructions or data as necessary. After linking, the linker prints on the terminal a list of all symbolic references that were not resolved (undefined globals), either because of a programming error or because all necessary object modules were not included in the linking process. References to library files also involve the use of global symbols. You access the routines in a library by naming a routine as a global symbol in the source code of your program. You then link your program with the appropriate library file, and the linker resolves the library references just as it does any global symbol. Library usage is discussed in greater detail in Chapter 13. A second important function of the linker is to “fix” the relative memory addresses so that they are absolute.' The object module represents translated source instructions that have been assigned memory addresses relative to a base address of 0. Look back at the assembly listing in Chapter 11. Note the second column; these addresses are relative to a base address of 0. Thus the first instruction is assembled at relative address 0, the second at relative address 6, and so on. A program cannot actually be stored and run in memory using locations relative to address 0, however, because system information is already stored in some of these locations. For example, the RT-11 operating system uses byte addresses 40 through 57 to store information about the program currently executing. In addition, the RT-11 operating system uses locations in the upper range of memory for storing the resident monitor. Thus, the linker must assign memory addresses to your program that are not already in use or that will not be used during program execution. It must, therefore, assign absolute memory addresses to the relative addresses assigned by the language processor. The linker normally starts assigning memory addresses at address 1000, since this begins a large section of free memory IFORTRAN IV and BASIC-11 users who have not performed the demonstra- tion in Chapter 11 may wish to read the section in that chapter entitled The MACRO-11 Language Processor. That section explains the concept of converting and storing instructions in computer memory. 12-3 PROGRAM RELOCATION AND ADDRESS ASSIGNMENT Linking Object Programs space. So, to obtain the actual addresses used for program loading, you must add the relocation constant 1000 to each relative address shown in the assembly listing. A conflict arises when several individually processed object modules are linked together. The linker cannot assign memory addresses starting at 1000 to every module, since address assignments of one would then override those of another. However, part of the information that the language processor calcu- lates and passes to the linker is the size of each program section in each module. So the linker simply adds this size into the relocation constant for each module and assigns higher addresses, appropriately modifying the relative location of all instructions and data as necessary to account for the relocation of each individual module. Figure 12-2 illustrates the relocation that must occur to together.! accommodate o object modules linked 0 372 {octal) PROG bytes 370 RESERVED 1000 0 I SUBONE 42 (octal) bytes 40 PROG 1370 1372 SUBONE 1432 Y 1434 SUBTWO 170 {octal) bytes SUBTWO s | ke v assembied/compiled programs s 1624 Relative addresses of three Absolute addresses of three linked programs Figure 12-2 ABSOLUTE AND RELOCATABLE PROGRAM SECTIONS Object Module Relocation Just as global symbols allow you to create an entire program, using several individual object modules, program sections allow you to create an object module as a series of individual sections. The advantages gained through the sectioning of programs relate primarily to control of memory allocation, program modu1A load map for this relocation example is shown later in the chapter. 124 Linking Object Programs larity, and more effective partitioning of memory. The linker processes the program section information in the object modules as directions on how to create the executable program image. The FORTRAN IV and MACRO-11 language processors insert program sectioning information into the object module. The FORTRAN IV language processor does this automatically when program sectioning is implied by the source language statements in a user program. For example, FUNCTION, SUBROUTINE, and COMMON statements result in the production of program section directives. In MACRO-11 assembly language, you are responsible for explicitly directing the assembler to output program section information for the linker. You do this through the .PSECT (or .CSECT and .ASECT) MACRO-11 assembly language statement. Some of the basic functions associated with program sections are: 1. Instructions or data can be placed in absolute locations in memory. The named absolute program section (. ABS.) allows you to instruct the linker as to exactly where to place program code or data. Declaring a section as part of the absolute program section instructs the assembler or compiler to use the internal value of the program counter as the physical memory address to be assigned after linking. This section is processed relative to absolute memory address 0 and is not relocated at link time. 2. Named relocatable program sections are used to group data or instructions into logical portions of memory. The FORTRAN IV COMMON statement invokes this construct to allow access to named data areas from many separate routines. Declaring a section as part of a named relocatable program section causes the section to be processed at relocatable address 0. Such sections are relocated by the linker. 3. If you do not care about having exact control over where a portion (section) of a program will be placed in memory, use the blank program section — a special program section that the linker treats as relocatable. The linker decides where to place this program section in the loadable memory image. The blank program section is the default for a MACRO-11 source program and remains in effect until an explicit program section is identified (the program example in Chapter 11 used the blank program section). 4. A program section can be identified as an instruction section. The linker, using this information, can provide automatic loading of declared overlay code when needed by the executing program (this will be discussed in more detail). 12-5 Linking Object Programs The language processor, then, actually maintains several program counters — one for the absolute program section, one for the unnamed relocatable program section, and as many as needed (maximum is 254) for named relocatable program sections. The assembled example that follows helps explain this concept. +MAIN, NMACRO V05.00 SATURDAY OB-JAN-B3 08:04 PAGE 1 1 iUNNAMED RELDCATABLE PROGRAM 2 iSECYION IS {BY 3 F(".PSECT" a 000000 005000 5 000002 012701 & 000006 0B2100 7 000010 022701 8 000014 100374 BTARY: 000034 LOOP: RO naov #BEG /R1 ADD 000044 SBEG+10,RI BPL Loop nov *2000.A00R CLR R3 «FSECT 89 000018 012767 000024 605003 1 000000 CLEAR INAMED 12 000000 012703 000100 nov #100+R3 FSECTION 13 000004 012701 ©o000aa noy #RADDR R} 14 000010 005021 CLR {(RL)+ 15 000012 005303 DEC R3 16 000014 001278 BNE AGRIN 17 000000 18 60004z 000020 AGAIN: +ASECTY 000042 82 001000 +®ORD 1000 000026 +PBECT 23 000026 008267 24 000032 000000 25 000034 000001 000042 000004 000044 000000 000012 INC PROGRAM (VIA VALUE (VIA “.PSECT NAME") SECTION “.ABECT") 1000 IN PROUGRAM DECLARED MILL ABSOLUTE iWHEN THE 3IBACK TO UNNAMED iPROGRAM SECTION PROCRANM 1S BE MEMORY LOCATIN 42 EXECHTED RELOCATABLE HALT 000002 000002 BEG: <WORD ADDR: SNOTE 28 SCONTIGUOUSLY 29 FIN 0006001 1:243.4 +HORD 27 3e ADDR IS IDECLARED ISTORED 21 26 RELOCATABLE FABSOLUTE 3THE zc 22 DEFALLT) ASSUMED} (R1)}+ RO cne 10 18 002000 CLR DECLARED 15 THAT THE O YOU CAN IN SOURCE WRITE MEMDRY ., PROGRAM LANGUAGE BUT DO (1.E,,» STATEMENTS MOY THE THAT NEEESSARILY CODE AT LINES +END WILL DCCUR 1-10 BE LOADED CONTIGUOUSLY AND 22-29) Since the system does not know at assembly (or compile) time into which actual memory locations each relocatable section goes, all references among sections (see line 18) are relative to the base of the section. This information is then passed to the linker so that it can make the appropriate adjustments at link- time. The Overlay Feature The RT-11 linker is also capable of handling the special relocation and address assignments that are required whenever you indicate that an overlay structure is needed. An overlay structure is necessary when you write a program that is too large to fit in the available memory of your system. You write the program in discrete parts (some programming restrictions must be observed) so that your program can subsequently be executed in parts. Some of these parts, or segments, are allowed to share memory with other segments, thus reducing the overall memory requirements of the program. One segment of the pro- gram is called the root segment and must remain in memory at all times. The root segment contains the necessary information for use by the other segments of the program, called overlay segments. Overlay segments are stored on storage volumes and brought into memory as needed. The purpose of the overlay structure is for parts of the program to share the available memory in such a way that when one part is complete, it is overlaid (and therefore erased) by another. You indicate how to plan to overlay your program by using the /PROMPT option in the LINK command line. The linker then 12-6 Linking Object Programs creates a load module that contains the necessary information for loading the appropriate segments as needed during execution. The RT-11 System Ultilities Manual explains the overlay feature in more detail. You need not specify an overlay structure for the examples demonstrated in this chapter. The load module is the result of the linking processes described so far: joining object modules, resolving symbolic and library references, relocating object modules, assigning absolute addresses, and creating an overlay structure if required. The load map is essentially a synopsis of the load module — that is, what memory looks like when the program is loaded and ready to be PRODUCING A LOAD MODULE AND A LOAD MAP executed. In Chapters 9 and 11, you produced load modules, but you did not request load maps. You obtain a load map by using the /MAP option with the LINK (or EXECUTE) command. At this time, relink the FORTRAN IV or MACRO-11 object module that you stored on VOL: and use the /MAP option to produce a load map.! The load map is created as a file on the system volume, which is the default storage volume for input/output operations. The load map has the name of the first input module and a file type of MAP. Long Command Format MACRO-11 object module: + L INKGED Files? VOL:SUM/MAPGRD FORTRAN IV object module, if FORLIB is not included in SYSLIB: +LINKG@ED Files? SYSLIB.FORLIB VOL:GRAPH/MAPGEED ‘FORTRAN IV object module, if FORLIB is included in SYSLIB: +LINKGEED Files? VOL:GRAPH/MAPEED Short Command Format MACRO-11 object module: +LINK VOL:SUM/MAPED 1FORTRAN IV users who followed the special instructions in Appendix B for loading the LINK volume should check that this volume is loaded in device unit 0. FORTRAN IV users who have a special FORTRAN IV language volume, but not a LINK volume, should make sure that the FORTRAN IV volume is now loaded in device unit 0. 12-7 /MAP Linking Object Programs FORTRAN IV object module, if FORLIB is not included in SYSLIB: +LINK SYSLIB,FORLIB,VOL:GRAPH/MAPEED FORTRAN IV object module, if FORLIB is included in SYSLIB: +LINK VOL:GRAPH/MAPGRED Now list the .MAP file on either the line printer or terminal, choosing the appropriate command: Long Command Format (Line printer) (Terminal) MACRO-11 object module: +PRINTED Files? » TYPEGED SUM.MAPED Files? — SUM.MAPED FORTRAN IV object module: +PRINTGEED + TYPEGRED Files? Files? GRAPH.MAPED GRAPH.MAPED Short Command Format e’ (Line printer) (Terminal) MACRO-11 object module: +PRINT SUM.MAPGD +TYPE SUM.MAPGE) +TYPE GRAPH.MAPGEE FORTRAN IV object module: +PRINT GRAPH.MAPGD _ For your convenience, both maps are provided here. In addition, a load map of the relocation example used in Figure 12-2 is also provided. RT-11 LINK SUM + 8AV Section « ARS, ) Transfer +« ABS., toad Mar Saturdaw 08-Jan-83 Title! SUM.MA Ident! Addr Size Global Value Global 000000 001000 = 204, words (RW»IsGBL,ARS,OVUR) 001000 000372 = 125, words (RWrsI/LCLsRELCON) address RT~11 LINK SYSLIR,SAV Section 408,00 = 001000, V08.00 Titlet Addr Size 000000 001000 12-8 High limit Load Mar Ident! MAIN., = = 001370 Value = 380, Global Value Pade 1 Value words Saturdaw 08-Jan-83 FORVO2 Global 10100 10111 Global Pade Global Value 236, $USRSW words 000000 VIR 000000 $NLCHN 000004 $8YSV$s 000012 $WASIZ 000152 $LRECL 000210 $TRACE 004737 (RWsIsGBLARSyQUR) $RF2A1 000000 $HRIWR 1 Value 000000 e Linking Object Programs [228-1 39 RT-11 001000 017722 = 4073, LINK SYSLIB.SAV V08.00 Title! words (RWsIs{.CLYRELsCON) $$0TSI 001000 S$CUTIF 001000 $CVUTIC 001014 $CVUTID 001014 (CCIS 001026 CDI$ 001026 $IC 001024 $ID 001026 CFI¢ 001042 $IR 001042 EXF 0011246 ADFSIS 001466 ADF$PS 001474 SUF$FS 001500 SUF$MS 001504 ADF$MS 0015186 SUF$IS 001526 $ADDF 001534 $SUBF 001550 SUF$SS 001542 $SER 001562 ARF$58 00135446 $ADR 001566 ALE 001602 DIFSFS 002226 DIFSMS 002232 DIF$IS 002242 $DIVF 002250 DIF$SS 002262 $DOVR 002262 MUF$FS SMULF 002550 002572 MUF$SMS MUF$SS 002554 002604 MUF$IS $MLR 002564 0024604 $0TI 003142 $3%0TI 003144 $SETOF 003354 $$SET 005026 SQRT 005322 STR$L Q05516 STK¢1 005522 STK$F 0055246 IOR$ Q05536 ANDS 005542 EQVS 005550 XOR$ 005552 NMI$iM BEQS 000546 005612 NMIS1II BGTS 005600 005620 ELES$ ERGE$ 005610 Q05622 BRAS 005424 BNES 0054630 BLTS Q05632 CAls 005642 CALS 005650 END$ 005700 ERR$ 005712 $END 005724 $ERR Q05742 SOPNER 005764 $CHKER 004022 $I0EXI 006046 $EOL 006114 EOLS 006116 EXIT 006232 MOF$SS 0062346 MOFSMS 006250 MOF$FS 0046262 MOF$SM 004266 MOF$SF 006276 MOF$MM 006302 MOF$MA 006314 MOF$SMF 006322 MOFSFM 006330 MOF$FPA 006334 MOF$FF 006340 HMOF$SRS 006344 MOF$RM NGD$S 006352 006372 MOF$RA NGF$S 006342 006372 MOFSRF NGDSM 006386 0046404 NGF $M 006404 NGDOSF 006420 NGFS$F 006420 NGD$A ADI$SA 006424 006434 NGF$A ADISSM 006424 006440 ALI$SS ADRISIS 006430 0046444 ADISIA 006450 ADISIM 006454 ADISMS 006440 ADI$MA 008464 ADISMM 008470 CMI$SS 006474 CMI$SI CHMI$II 006500 006514 CMI$SM CMI$IM 008504 004520 CMI$IS CMISMS 006510 006524 CMISMI $IFW MOI$SRS 006530 006544 006656 CMISMM $$IFW MOLSRS 006534 006550 006656 IFW$ IFWSS HMOISRM 006540 Q06606 006662 MOISRF MOL$SS 006866 006674 HMHOISRA MOISSM 006670 004700 MOISSS MOISSA 0084674 006704 MOIS$IS 0046710 MOL$IS 006710 RELS 006710 HOISIM MOISMM 006714 006730 MOISIA MOISMA 004720 0046734 MOISMS MOIS0S 008724 006740 MOISOM 004744 MOISOA 006750 MOI$1S 006754 MOI$1M 006762 HOIS1A 006770 ICISS 006776 ICIsH DCIsS 007002 007014 ICISP DCISM 007006 007020 ICISA DCISF 007010 007024 DCISA 007026 IDINT 007032 INT 007032 MOISIF 007060 MOISSP 007042 MOISFF 007070 Load Mar Saturdaw 08-Jan-83 10:11 Fade JHMAIN. Ident! FORVO2 MOISMP MOISPA ISNS 007074 007120 007144 MOISFS MOISOP SISNTR 007104 007126 007150 MOISPFM MOI$iP LSNS$ 007112 007134 007164 SLSNTR SUISSM SUIS$IM 007170 007334 007350 SUI$SS SUISIS SUISMS 007324 007340 007354 SUIs$SA SUISIA SUISMA 007330 007344 007360 SUIsMM MOLS$MS MOL$SF 007364 007400 007420 MOLSSM MOLSMM MOLSFF 007370 007410 007424 MOL$SA MOLSMA MOLSMF 007374 007414 007432 HMOLSFM 007442 HMOLS$FS 007450 MOLSPA 007454 MOLSIM LLES 007462 007506 MOLSIA LEQS 007470 007510 MOL$IF LGTS 007476 007516 LGES 007520 LNES 007530 LLTS 007532 TSL$S 0075386 TSLM 007542 TSL$I1 007546 TSLSP 007554 MAXO 007562 MINO 007606 RETSL 007632 RETSF 007636 RET$I 007644 RETS TVLS 0076446 010024 $OTIS $TUL 007702 010024 $$0TIS TUF$ 007704 010032 $TVUF TGRS $TUP 010032 010046 TVD$ $TVUR 010040 0100446 $TVD TUFPS$ 010040 010054 010054 TVI$ 010042 $TVI Q10062 SALSIM 010216 SAL$SSM 010220 SVLSIM 0103224 SUL$SM SALS$IF 010226 010244 SALs$MM SALSSF 010234 010244 SULSMM SULSIF 010240 010252 SVULS$SF 010254 SALSHP 0102462 SUVLSMF 0102646 $CUTFB 010272 $CVUTFI 010272 $CYTCB $CVUTCI 010306 $CVUTDE 010306 $CVYTDI 010306 cIics 010320 CIDs 010320 CLCs 010320 CLD$ 010320 DI 010320 CIFs 010330 CLFs 010330 $RI 010330 CILs 010442 CLIs 0104446 SINITI 010450 SCLOSE 010566 $ERRTE 011344 $ERRS 011451 S$FCHNL 015212 12-9 010306 2 Linking Object Programs $FI0 016054 $$FI0 0160460 $FUTRE 017224 $FUTBL. 0178532 $GETBL 017742 $EOFIL 020124 $EOF2 020142 SAVRGS 0201462 THRID$ 020340 020342 STF$ 020350 4STF 020350 020354 $EXIT 020374 $UWAIT 020520 SURINT 22, 020562 SDUMFL 020574 words (RWsDyGELYREL yQUR) 0TS ¢F 020722 Q00054 = SYS$I 020776 000244 = LEN 020776 USER$I 021242 000000 = 0, words (RWsI LCL RELyCON) $CODE 021242 0013146 = 359. words (RWsT«LCL,REL,CONY 0TS$0 022560 001036 $$0TSC 021242 it $8TES FOOs 271, words SYS$0 sDATAF 023616 0234616 000000 0001046 = = 0TSsn 023724 000006 = 82, words 023732 000002 = REFEAT RELCON) 021014 FUN 022120 SCOFY FPUTSTR 022560 0, 35, words words (RWsI+LCL REL,CON) (RUsDeLCL REL CON) $OFEN 3. words (RW-DyLCL,REL yCON) 023730 1, words $A0TS Q23732 2. words (RWsDyLCL,RELyCON) 023734 000004 = $SYSLE 023734 $DATA 023740 000536 = 175, words (RWsIyLCLyREL yCON) USERSD 024476 000000 = 0. words (RWsDeLCLREL,CTOND «$4%%, 0244746 000000 = words (RWsDyGRLyREL yOVR) LINK SYSLIB.S5AV Transfer RT-11 TEST + ABS., = O, Load Title: address LINK .54V Section v08,00 Mas MAIN., 021242y VO08.00 Title: Hiagh Transfer (RUsDLCLRELsCON) $LOCK Ident! limit 023734 08-Jarn-83 024474 %5278, FORVO2 = $CRASH Saturdaw = Load Mar MAIN. Ident: Saturday Global Value Global Sire 000000 001000 = 2564. words (RWy I»GELARS»OVUR) 001000 000626 = 203, words (RWsIsLCLsRELYCON) address = 001000, High 001000 limit Vaslue SUBONE = 001624 = 10111 023737 Fadge 3 Fade 1 words 08-Jan-83 Addr FROG 022264 022560 SYS$S RT-11 021146 (RWsIyLCLYyRELyCON) $30TSO NHCLN$ aT15%S (RWsI.LCL 1016 Glohal 001372 SUBTWO 458, worids Value 001434 The second line has the name and file type of the load module created. Next, the absolute section and each named and unnamed section are listed under the SECTION column. To the right are abbreviated codes designating whether the section contains Instructions or Data, is Read/Write or Read Only, is a Local or Global section, is Relocatable or Absolute, is Concatenated or Overlaid. Below this falls a listing of all the global symbols (GLOBAL) and their values (VALUE). Finally, at the end of the map is the transfer address where the program actually starts when executed, followed by the high limit — the total number of bytes used by all the individual program sections. Look first at the MACRO-11 load map. The default absolute section starts at absolute location 0; its size is 1000 bytes. Thus, it extends from absolute memory location 0 through absolute memory location 777. The unnamed program section (there were no named program sections in this program) starts at absolute 1000; its size is 372 bytes. Thus it extends from absolute location 1000 to absolute location 1370. The high limit of this program (total bytes) is therefore 1370. Since this program is not linked to any other object modules, there are no global sym- bols and the rest of the map is blank. Look now at the FORTRAN IV load map, remembering that it reflects the appropriate expansions into machine language code provided by the FORTRAN IV compiler. Again, the absolute 12-10 Linking Object Programs section extends from absolute 0 through absolute 777. Globals listed in the absolute section show the global variable names that the program uses as constants throughout the program. The unnamed relocatable program section begins at absolute location 1000. Some of the named relocatable sections that are declared are OTS$P, SYS$I, and $CODE. Global symbols and their respective addresses appear to the right of all sections. The total number of bytes used is 24474, or 5278(decimal) words. The third load map is for the program illustrated in Figure 12-2. First, the map shows the absolute program section, labeled .ABS. It extends from location 0 through location 777. Next, the map shows the unnamed program section, which begins at location 1000 and is 1624 bytes long. This program section consists of a main program, called PROG, and the subroutines SUBONE and SUBTWO that were linked with PROG. Look again at Figure 12-2 to see how these routines fit into memory. The transfer, or starting, address is 1000, and the total number of bytes the program occupies is 1624, or 458(decimal) words. Load maps are most helpful when used in debugging to locate and correct assembly language programming errors. Load maps are not generally obtained or used for FORTRAN IV programs, except to determine program size. In Chapter 14 you will see how a load map is used to debug the one remaining error in the MACRO-11 demonstration program. LINK Link individual object modules together to form a complete program and to produce a load module. SUMMARY: COMMANDS FOR LINKING PROGRAMS LINK/MAP Link individual object modules, and produce a load map showing all address assignments made during linking. NOTE FORTRAN |V users who followed the special instructions in Appendix B to load the language or LINK volume should now stop the system, unioad that volume, load the main system volume, and rebootstrap the system before going on to Chapter 13. RT-11 System Utilities Manual (AA-M239A~TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 system utilities. 12-11 REFERENCE CHAPTER 13 CONSTRUCTING LIBRARY FILES A library is a specially constructed file consisting of one or more programming routines. Generally, these routines provide services that you are apt to need repeatedly, or services that are related and so have been gathered together for ease in use and storage. You use the routines in a library by joining the library file with your source program. Usually this occurs at link-time: but in the case of assembly language programs, it may also occur at assembly-time. The RT-11 operating system provides several library files; SYSLIB and VTLIB for example. These libraries supply the monitor services, input and output routines, conversion routines, and other programming services that user programs may need. You can create other library files yourself. Thus you can construct libraries that contain routines specific to your programming needs or to the combined needs of those using your RT-11 system. There are two kinds of library files — macro libraries and object libraries. KINDS OF LIBRARY FILES Macro libraries, such as SYSMAC.SML, are used by MACRO-11 source programs at assembly-time and consist entirely of macros. A macro is described in Chapter 11 as a recurring sequence of coding instructions, which, when defined in a .MACRO statement, can then be called and used anywhere in your program. A macro library is merely several macro definitions gathered together into a single file. To use the macros in a macro library, you simply name those macros you plan to use in a .MCALL statement. When the assembler encounters the .MCALL statement during processing, it searches the appropriate macro library (SYSMAC.SML is default) for the definitions. It takes the definitions from the library and inserts them in a special table called the macro symbol table where they become available for use during assembly. Macro Libraries Object libraries, such as SYSLIB, are used by assembled Object Libraries MACRO-11 source programs and/or by compiled FORTRAN IV source programs at link-time. These libraries consist of object modules that contain global routines; such routines have been defined with global entry points and then named as global symbols in the source program. During the link operation, the linker searches the object libraries to determine if they provide 13-1 Constructing Library Files definitions for any undefined globals. If the linker finds defini- tions, it takes those object modules containing the definition from the library and includes them in the link. A special table, called the global symbol table, lists each global in a given object library. You can print this list on the terminal or the line printer and thus keep track of an object library’s current contents. CREATING AND MAINTAINING A LIBRARY FILE You create a library file by combining several macro routines, or several object modules, into a single larger file using the monitor LIBRARY command. To build a macro library, first use the editor to create an ASCII text file that contains all the macro definitions. Then process this file using the LIBRARY command in combination with its /MACRO option. To update a macro library (that is, to add or delete macro definitions), simply edit the ASCII text file and then reprocess the file with the LIBRARY command. To build an object library, use the editor to create an ASCII text file. The file contains the routines and functions written as complete program segments in either the MACRO-11 assembly language or the FORTRAN IV programming language. Then process the file, producing an object module. Next, use the LI- BRARY command in combination with its /CREATE option. Once the library file is created, update it (add and delete routines) by means of various other options to the LIBRARY command. In the following exercises, you create an object library that con- tains three input object modules. The routines in two of these modules can be used by both MACRO-11 and FORTRAN IV programs; the routine in the third module can be used only by FORTRAN 1V programs. To build the library file, first use the editor to create the three ASCII text files. Then convert the ASCII text files to object format. Finally, process the object files with the LIBRARY com- mand. Once you create the library files, use LIBRARY command operations and options to add and delete modules and globals and to obtain a listing of the library file contents. Creating Object Library Input Files The first step in building an object library is to prepare the source code of the routines and functions that you choose to include in the library. Use the editor to create the following three text files, calling them FIRST.MAC, SECOND.MAC, and THIRD.FOR, respectively. FORTRAN IV users should create all three files; MACRO-11 users (who do not use FORTRAN IV) should create only the first two files. 13-2 Constructing Library Files FIRST.MAC «TITLE comMp +MCALL +PRINT H I=LEN(A)} LEN: TST (R3)+ iGKIP MOV BRS5,RO SGET STRING TSTB (RO} + §FIND END BNE 1% iLOOP UNTIL DEC RO iBACK UP suB EBRS RO SCALC # RTS FC +GLOBL 1%: i PRINT: LEN CALL PRINTC(ISTRNG) +GLOBL PRINT MOV +«PRINT Z2(R3) sRO RTS PC # OF ARGS POINTER OF OF STRING NULL BYTE CHARS $ADDR IN OF STRING ISTRNG 3 PRINT $AND RETURN +END SECOND.MAC +TITLE ITTOUR i I=ITTOUR(CICHAR) 3 I=0 H =1 CHARACTER RING +MCALL +TTOUTR +GLOBL ITTOUR ITTOUR:MOUB BZ(RS5) RO +TTOUTR HAS BUFFER IS BEEN OUTPUT FULL iGET CHARACTER i.TTOUTR BIC RO ADC RO RTS PC RO sCLEAR ERROR FLAG iRETURN +END THIRD.FOR C CALL PUTSTR(LUNAREA,CC) SUBROUTINE PUTSTR(LUNAREA,CC) LOGICAL#*1 AREA(230) .CC IF(CC) GOTO 1 WRITE (LUN.99)(AREA(I) »I=1,LEN(AREA)) RETURN i WRITE 99 FORMAT (250A1) (LUN,S9)CC,(AREA(I) »I=1+LENC(AREA)) END The routines in these files are representative of the kinds of services generally provided in a library file. They are, in fact, taken from the RT-11 system subroutine library, SYSLIB. 13-3 Constructing Library Files FIRST.MAC contains two global routines, LEN and PRINT. The LEN routine returns the number of characters in a string. PRINT outputs an ASCII string terminated with a zero byte to the terminal (it is the FORTRAN IV equivalent of the system macro .PRINT, used in the demonstration program in Chapter 11). SECOND.MAC contains one global routine, ITTOUR, which transfers a character to the console terminal. THIRD.FOR also contains one global routine, PUTSTR. This routine can be used only by FORTRAN IV programs and writes a variable-length character string on a specified FORTRAN IV logical unit (see GRAPH example). Once you create these text files, the next step is to convert them from ASCII format to object format. Assemble or compile the text files as appropriate, first assembling FIRST.MAC and ob- taining an object module (a listing is not necessary). FORTRAN IV users who are not familiar with the assembly process simply type the MACRO commands as shown. Long Command Format + MACROGED Files? FIRSTEED Short Command Format .MACRO FIRST®D e The command creates an object module called FIRST.OBJ on the system volume. If errors occur, the assembler prints a message on the terminal, indicating the number of errors encountered during assembly. No errors should occur. In the same way, assemble SECOND.MAC. Again, no errors should occur. Long Command Format + MACROGED Files? SECONDGED Short Command Format +MACRO SECONDGE If any errors occur during the assembly operations, you have typed the source files incorrectly. Find and correct the typing errors, and reassemble. If you are a FORTRAN IV user, THIRD.FOR. 13-4 continue by compiling Constructing Library Files NOTE If in Chapter 9 you needed to load the special FORTRAN/BASIC language volume, you must again load that volume before you can compile THIRD.FOR. Read Appendix B, Substituting Volumes During Operations, before continuing. Long Command Format +FORTRANGD Files? THIRDGD PUTSTR Short Command Format +FORTRAN THIRDGD PUTSTR Notice that the compiler prints the name of the global (PUTSTR) generated. If any errors occur during the compile operation, you have typed the source file incorrectly. Find and correct the typing errrors, and recompile. Once you have produced the object modules, you are ready to build the object library file. Use the LIBRARY command in combination with its /CREATE option to construct a library file. You must indicate in the command the name of the library file and the names of the input Building the Object Library object modules. Call the library file LIBRA and specify as input the two object modules, FIRST and SECOND. The LIBRARY command assumes that the input modules have the .OBJ file type (unless you indicate otherwise) and automatically assigns .OBJ to the library file. Long Command Format LIBRARY/ +LIBRARY/CREATEGD CREATE Library? LIBRAGD Files ? FIRST,SECONDGD Short Command Format LLIBRARY/CREATE LIBRA FIRST ,SECONDED Once the CREATE operation is complete, obtain a listing of the library file’s contents, using the LIBRARY command with its LIST operation. The line printer is the assumed output device for the list file, although you may indicate a different output device by adding the two-letter device mnemonic to the LIST option that follows. 13-5 Constructing Library Files Long Command Format LIBRARY/LIST (Line printer) (Terminal) +LIBRARY/LISTED Library? +LIBRARY/LIST:TT 6D : LIBRAGD Library? LIBRAGD Short Command Format (Line printer) (Terminal) +LIBRARY/LIST LIBRAGD +LIBRARY/LIST:TT: LIBRAGD The listing produced shows the library file’s current contents. This library has three entry points: LEN and PRINT in the first module, and ITTOUR in the second module. RT-11 LIBRARIAN V03,00 DK:LIBRA.OBJ MODULE SAT B8-JAN-B83 11:03:28 SAT B8-JAN-B83 10:59:43 GLOBALS GLOBALS LEN PRINT GLOBALS ITTOUR Updating the Object Library LIBRARY/ INSERT Once you have created an object library, you use various LIBRARY command operations to update and maintain it by adding and deleting modules and globals. If you created the THIRD.OBJ object module, you can add it to the library file using the INSERT option. If you did not create this module, read through this section anyway; the command steps apply to any object module you wish to insert. Long Command Format +LIBRARY/INSERTGEED Librarvy? Files 7 LIBRAGD THIRDGE Short Command Format +LIBRARY/INSERT LIBRA THIRDGD This operation inserts the object module contained in the file THIRD.OBJ, including all its globals, into the library file LIBRA. Obtain a listing of the library contents, using the LIST option, to verify that the new globals have been added. The listing should look like this: RT-11 LIBRARIAN V05.00 DK:LIBRA.OBJ MODULE SAT B8-JAN-B83 11:05:1 SAT B8-JAN-83 11:04:21 GLOBALS GLOBALS LEN PRINT ITTOUR PUTSTR 13-6 GLOBALS Constructing Library Files This listing shows the complete library file containing the globals from all three modules. You can remove individual globals by using the REMOVE option. For example, to remove the global ITTOUR, type: Long Command Format LIBRARY/ REMOVE . LIBRARY/REMOVEGE Library? LIBRAGD Global? ITTOURGH Global? @D Short Command Format +LIBRARY/REMOVE LIBRAGD Global? ITTOURGED Global?@D The library file’s contents now look like this: RT-11 LIBRARIAN DK:LIBRA.0BJ MODULE V05,00 SAT SAT B-JAN-B3 B-JAN-B3 GLOBALS GLOBALS LEN PRINT 11:10:22 11:10:05 GLOBALS PUTSTR These are some of the library maintenance operations that you can perform by using the LIBRARY command. Other library operations are available and are explained in the RT-11 System Utilities Manual. SUMMARY: LIBRARY/MACRO Create a macro library. COMMANDS FOR LIBRARY/CREATE Create an object library. LIBRARY FILES MAINTAINING LIBRARY/INSERT Insert object modules into the object library. LIBRARY/LISTI:filespec] List the current contents of an object library on the line printer; [:filespec] is an optional output file and/or device. LIBRARY/REMOVE Remove globals from the object library. Since all the object modules used in this chapter already exist as modules within the provided system library SYSLIB, there is no need to save them or the LIBRA library file. You can delete these object modules and their source files from your system 13-7 FILE MAINTENANCE Constructing Library Files volume by using the DELETE command as follows (exclude THIRD.* from the command line if you did not create this file): Long Command Format +DELETE/NOQUERYED Files? FIRST.%*,SECOND,*,THIRD.* ,LIBRA.0BJED Short Command Format +DELETE/NOQUERY FIRST.*,8ECOND.#,THIRD.*,LIBRA.OBJED FORTRAN IV users who performed the special instructions given in Appendix B should also delete the THIRD files from the storage volume. Long Command Format +DELETE/NOQUERYGE Files? VUDL:THIRD.*RED Short Command Format +DELETE/NOOUERY REFERENCE VYOL:THIRD . *@D RT-11 System Utilities Manual (AA-M239A~TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 system utilities. — 13-8 CHAPTER 14 DEBUGGING A USER PROGRAM Debugging is the process of finding and fixing the programming errors that almost every user program initially contains. From your experience in Chapters 9, 10, and 11, you already know about some of the kinds of programming errors that can prevent a program from working properly when you run it on the system. Frequently, debugging a program requires more time and persistence than writing the program code requires. Therefore, you should anticipate the debugging process throughout the entire program development cycle. That is, you should follow some common programming practices that help you first to make as few programming errors as possible. When errors become apparent during the various phases of development, correct them immediately. Test the validity of any algorithms used within your program. Finally, even though the program appears to be working properly, check it thoroughly with test data. You can take several steps to decrease the likelihood of intro- AVOIDING ducing errors into your program and to make debugging easier. PROGRAMMING First, always use a high-level language if one will suit your programming needs. High-level language programs tend to use fewer statements. English-like words and phrases in the lan- ERRORS guage statements make the program logic easier to follow. Design the program. The technique of flowcharting the program and then correlating it with the program coding simplifies tracking the program logic and module interrelationships. Use modular programming. Create the program as a series of smaller, self-contained subprograms. Debug the program in parts. For frequently used functions, maximize the use of subroutines, subprograms, and — in the case of assembly language programs — macros. These help to structure the program and make it easier to alter or to add features that may be required in the future. Make use of any software provided by the system, such as library routines and functions. System software has already been debugged and can save you the trouble of re-creating the services. Make the general flow of a program proceed down the page. Avoid nonstructured branching and convoluted logic, as these 14-1 Debugging a User Program tend to produce programs that are difficult to debug. Finally, use comments liberally throughout the program to show what individual statements or groups of statements do. Use spaces and tabs in the program code to make it easier to read. Following these preventative steps eliminates many common programming errors and helps to create a programming style. However, even the most careful programmer may overlook a small detail: a typing error during program creation, an unde- fined label in the code, or some other programming bug. When something is overlooked, debugging becomes necessary. WHEN PROGRAMMING ERRORS OCCUR There are three general types of programming errors — syntax, clerical, and logical. Syntax errors are errors in the physical coding, such as omit- ting necessary portions of the statement (delimiters for example), reversing the order of information within the statement, or misspelling keywords or instructions. Clerical errors are non-syntax errors in the physical coding, such as mistyped letters or digits in data. Clerical errors may result in valid statements that do not reflect correct programming logic. Logical errors are errors made in program development. The translating program (compiler/assembler/interpreter) gen- erally catches syntax errors and flags them as such in the pro- gram listing or on the terminal. On the other hand, you must locate clerical and logical errors by reexamining the program code and logic, using one or more debugging techniques. Some debugging techniques involve insertion of special debugging code within the program. For example, one way to locate logical errors is to write out intermediate results of a program. You can insert WRITE or PRINT statements at strategic points in the program logic to show the intermediate state of values being calculated. When debugging is complete, you can remove these statements or change them to comments. You may also find it useful to write a special debugging subroutine that writes out values, particularly if the same variables must be examined in several places or many times. Another method for finding logic errors — unit testing — is to break the program into smaller parts and test each part separately with artificial data. After you test all parts individually, you can test routine and module linkage — system testing — to see that all related code fits together properly. Check the program with test data. A standard method for checking out modules is to write a test program that calls the 14-2 Debugging a User Program program with possible options. The test should cause the pro- gram to execute all steps in all algorithms. Check programs first with representative data, then with improper data (data that is not in the correct range or size). You should also do volume testing to see that the program works successfully with a representative amount of data. Each programming language has special debugging aids for examining immediate states. For example, BASIC-11 has a STOP statement that you can insert at strategic points in the program. When the program arrives at a STOP statement, it pauses so that you can use BASIC-11’s immediate mode to ex- amine variables, values, and so on. Use an immediate mode GO TO statement pointing to the appropriate line number to continue execution. FORTRAN 1V has a special DEBUG statement indicator, a D in the first column of a statement line. Operations in statements marked with a D can perform useful debugging func- tions, such as printing intermediate results. You can treat such statements as source text (and thus execute them) or as com- ments (and thus ignore them), depending on whether you use a special compiler command option. In addition, FORTRAN IV has a traceback feature that locates the actual program unit and line number of a run-time error. If the program unit is a subroutine or function subprogram, the error handler traces back to the calling program unit and displays the name of that program unit and the line number where the call occurred. This process continues until the calling sequence has been traced back to a specific line number in the main program unit. Finally, FORTRAN IV has an optional interactive debugger called FDT (FORTRAN DEBUGGING TECHNIQUE) that can be linked with a user program. For MACRO-11 users, RT-11 provides a special on-line debugging tool called ODT (On-line Debugging Technique). This is provided as part of the RT-11 operating system and is an object program on your system volume. It is used exclusively for de- bugging assembled MACRO-11 programs. The use of ODT is described next for MACRO-11 users and for those FORTRAN IV users who will be combining MACRO-11 and FORTRAN IV program code. Other users can continue to Chapter 15, or go back and perform one of the other language demonstrations. Refer to the reading path outlined in the Preface. ODT is an interactive debugging tool that allows you to monitor program execution from the console terminal. ODT is provided as the object module ODT.OBJ on your system volume. To use it, you link ODT.OBJ with the assembled MACRO-11 14-3 USING THE ON-LINE DEBUGGING TECHNIQUE Debugging a User Program program that needs debugging. You then start execution of the resulting load module, not at the transfer address of your program, but at the entry point of the ODT module (shown on the linker load map as the global symbol O.0DT). Once ODT is started, you can use its special debugging commands to control the execution of your assembled machine language program from the console terminal, to examine memory locations, to change their contents, and to stop and continue program execution. The MACRO demonstration program in Chapter 11 still contains one error, which you can locate and correct using ODT. Several ODT debugging commands are demonstrated in the process. Throughout the examples in this chapter you need to refer to the program assembly listing of SUM.MAC. The listing that was produced in Chapter 11 was deleted, so you must create a new program assembly listing. Assemble your source program and produce a cross-referenced assembly listing as you did in Chapter 11. (Remember that SUM.MAC is now on your storage volume.) Long Command Format +MACROGED Files? VOL:SUM/LIST/CROSSREFERENCEGE Short Command Format +MACRO VOL:SUM/LIST/CROSSREFERENCEGRED Print the listing on either the terminal or the line printer: Long Command Format (Line printer) (Terminal) + PRINTGEED Files? ' SUM,LSTED +TYPEGED Files? SUM.LSTED Short Command Format (Line printer) +PRINT SUM,LSTGED VERSION OB G SUMMAC (Terminal) 1 MACRD V05,00 $ 000000 SUM,LSTGEED 08-Jan-83 09:38 «TITLE SUM,MAC VERSION «MCALL LTTYOUT, .EXITy JPRINT #NO. OF DIBITS THE RECIPROCALS N CD 000106 10 11 +TYPE Saturdas = ‘€’ Page 70, = 1] 1700 EXP? «FRINT THE SUM 4+ 1780 OF 4 1/20 #MESSAB 1 & 1% 1/30 4+ OF 1/4) PPRINT 'E‘ OF TO THE % 1/50 CALECULATE FACTORIALS 4 INTRODUCTORY TEXT R 144 Debugging a User Program 12 000004 13 000012 012705 012700 000104 000107 14 000016 13 000022 012701 004311 000124 FIRST! MOV MOV WNSRG #N+1 RO $ND. #NO. SECOND?! Moy ASL $4,R1 @R1 JADDRESS OF DIGIT VECTOR B0 MULTIFLY BY 10 (DECIMAL) ié 000024 011144 17 000026 004311 18 000030 006313 Hov BRLy~(8F) TSAVE ASL 2R1 ixa ASL 2Rl 122 19 000032 20 000034 042421 005300 ADD (SPY44+ (R1) % INOW 21 0000346 22 000040 001371 012700 BEC BNE MOV RO #AT END 23 000044 014103 24 000046 012702 2% 000052 005202 000106 THIRL! 177777 FOURTHT MOV SECOND 4NIRO OF CHARS OF ‘E‘ TD FRINT OF DIGITS OF ACCURACY A2 %10, POINT OF TO NEXT DIGIT DIGITS? $BRANCH IF NOT 360 THRU ALL PLACES, -(R1},R3 $BY MOV $-1sR2 FPINIT QUOTIENT INC R2 $BUMP THE PLACES QUOTIENT UIVIDING INDEX REGISTER 26 28 000054 103375 140003 |UB ROLRY $QUBTRACT LOOP 29 000040 30 000062 27 0000%4 040003 010311 apn MOV ROsR3 R35@R1 $FIX REMAINDER JBAVE REMAINDER AS BASIS JFOR NEXT DIGIT 32 060261 AT R2s~2(R1) FOREATEST INTEGER CARRIES 31 000084 BCC 177776 FOURTH INUMERATOR 33 34 000070 005300 35 000072 001344 36 000074 37 000076 38 39 000102 A0 000104 014100 142700 000012 103375 062700 000072 FIFTH: DEC RO $AT END OF DIGIT VECTOR? BNE THIRD $BRANCH - (R13 rRO #10. RO BCC ADD FIFTH #10.4°0sR0 SBET DIGIT TO DUTPUT SFIX THE 2.7 TO .7 SO JTHAY IT IS ONLY 1 DIGIT 3} (REALLY DIVIDE BY 10) PMAKE DIGIT ASCI NOT JOUTPUT THE DIGIT 42 000114 005011 CLR @R1 SCLEAR NEXT DIGIT 43 44 000114 000120 00530S 001334 bee BNE RS FIRST IMORE DIGITS TO PRINT? #BRANCH IF YES 43 48 000122 47 000124 STTYOUT IF 000110 A9 50 31 000342 SEXIT Q00107 Al 124 110 105 000343 040 126 101 114 040 040 125 117 105 1035 106 040 000341 000344 111 123 072 015 012 062 52 53 54 Swabol N+1 JWORD 1 ARE SINIT 1 MESSAS! MACRO V05,00 Saturdau 056 JASCII 08~Jan-83 /THE VALUE OF E TO ALL ONES 09:38 Fage 1-1 FPage 1-2 /2./ 200> 200 +EVEN 000000 VERSION +END 1 HACRO VO03.00 Ssturdaw 0B-Jan—-83 EXF 09:38 table 000124R FIFTH 000076R FOURTH 0Q00%2R EXP 000000R N FIRST 000012R MESSAG 0003AZR SECOND ABS. 000000 000 {RW:X,GBL7ABSYOVR) 000372 001 {RW» I+LCLsREL,CON) Errors detected: A% Assembler Wark DONE VECTOR I8!/ <13><12> A Work LOCATION . 000350 000353 000356 VERSION SJWE REPT JENDR 000347 BUM.HAC 10%N Hov SUB 41 SUM.MAC Size ISN’T BAD ALWAYS < 3TO GIVE DIGIT 48 +« 1S THIRD 000044R statistics reads: file writes? work 000106 QO0022R O file of = file! O O B222 Words 8ize of core rool! 15872 Orerating RT-11 sustem! ( Words 33 ( Pases) &2 Fases) Elarsed time: 00100:04,31 DBK$8UM DK SUM/C=DR $ SUM BUM.MAC VERSION i Cross refarence table A MACRO V05.00 (CREF V05.00) 1-14 1-474 EXp 1-11% 1-54 FIFTH FIRST FOURTH 1-37¢ 1-138 1-2G# 1-39 1-44 1~28 MESSAG N SECOND 1~-11 1-51¢ 1-74 1-158 1-12 1-21 THIRD 1-23¢ 1-35 BUM.MAC VERSION Cross 1-13 I MACRO reference table SEXIT 1-3¢ 1-45 +PRINT LTTYOU 1-3% 1-3% 1-11 1-41 Saturday 08-Jan-B3 1-22 093138 fase S-1 1-47 V05.00 Saturdaw 08-Jan-83 09338 Pase N-1 (CREF V05.00) Now link the MACRO-11 program object module (SUM.OBJ) stored on the storage volume (VOL:) with ODT.OBJ by using the /DEBUG option, and print a load map directly on the terminal or the line printer, choosing one of the following com- mands: Long Command Format (Line printer) (Terminal) +LINK/MAP/DEBUGHED Files? VOL:SUMGED +LINK/MAP:TT:/DEBUGED Files? V0L :SUMGEED 14-5 LINK/DEBUG Debugging a User Program Short Command Format (Terminal) (Line printer) JLINK/MAP/DEBUG VOL:SUMED RT-11 SUM LINK +BAY Section + ABS. $0DTS Transfer V08,00 Titles Addr Size 000000 001000 001372 001000 000372 006152 address = JLINK/MAP:TT:/DEBUG VOL :SUMED l.oad Map Saturday 08-Jan-83 Ident: VO05.00 ODT Global 256, 125, 1589, 001824, High Value Global words words words (RW,I,GBL,ABS,0UR) (RW,I,LCL,REL,CON) (RW,I.LCL,REL,CON) 0.0DT 001624 limit = VYalue 10:08 007342 = Pagde Global 1969, 1 Value words Look at the load map, and note that ODT starts at address 1372. The two modules together, ODT and SUM, reside in memory up to location 7542, the high limit. Look at the symbol table listing for the MACRO-11 program. This shows that the program is 372(octal) bytes long and starts at location 1000. To load and start execution of the load module, use the monitor RUN command. The RUN command brings the entire load module, called SUM.SAYV, into the absolute (physical) memory locations shown in the load map and begins execution automatically at the starting, or transfer, address of the first module in memory, which is ODT. Type: Long and Short Command Format +RUN SUMGEED oDT V05,00 * ODT prints an identifying message on the terminal and an asterisk indicating that you are in ODT command mode and can enter an ODT command. You are now using ODT to control the execution of your program.' ODT commands let you execute the entire program or just portions of it, examine individual locations, examine the contents of the PDP-11 general registers, and change the contents of any locations in your program you wish. If you make a mistake while you are typing any commands, type the DELETE key; ODT responds with a question mark (?) and an asterisk (¥), allowing you to enter another command. 1Be sure to read the chapter on ODT in the RT—-11 System Ultilities Manual before you use ODT with any of your own programs. You must observe certain precautions when you write your program and when you load it with ODT. For example, you should make sure that ODT is not loaded into memory locations used by your program. Follow the precautions described in the RT-11 System Utilities Manual. 14-6 Debugging a User Program Look at locations 6 through 16 in the assembly listing. With ODT, you can examine these locations in memory as follows (all ODT commands use octal numbers, as does the assembly listing): *#1006/0127030 001010 /0001060 001012 /0127000 001014 /000107 001016 /01270160 By typing a location address and a slash, you open that location for examination and possible modification. A line feed closes that location and opens the next sequential location for examination. A carriage return simply closes the currently open location. Note that since the MACRO-11 program was linked to begin at address 1000, you must add the constant 1000 to each address shown in the assembly listing to obtain the actual address used during loading. ODT can do this for you by using special internal locations called relocation registers. Each register can be set to a relocation constant. Thus, if you have linked several modules together, you can set various relocation registers to the corresponding relocation constants of the individual modules. You then indicate in your command which register to use, and ODT automatically adds the constant in that register to the address specified in your command. For example, set relocation register 0 to 1000: *100030R Now, to examine locations 0 through 10 in the assembly listing, type: *0,0/01270008 0:+000002 /0013420 0000004 /1043531 0+000006 0:000010 /012705@ /000106GD In your commands, indicate the number of the relocation register (followed by a comma), since generally you will have more than one register set at a time. Execute the MACRO-11 program now, using the ODT ;G command, indicating in the command where you wish execution to start. In this case, the program’s start (transfer) address is 1000, so type: *040iG THE VALUE OF E IS: 2,5/6806/606237,2301314.,06525/130440275535025.,71477737352744745405502,544 14-7 Debugging a User Program As you discovered in Chapter 11, these program results are incorrect. Note that a period has printed, indicating that you are back in monitor command mode. This particular MACRO-11 program returns to the monitor after execution. Therefore, to continue using ODT, you must RUN the load module again: Long and Short Command Format +RUN SUMED goT Y05.00 * Changes that you make to a program while using ODT, and ODT register assignments that you make, are temporary. Thus, when you restart ODT, you must reenter any commands, such as relocation register commands, that you want to remain in effect. Reset relocation register 0: *100030R To help you find programming errors, ODT provides a break- point feature. Setting one or more breakpoints in a program causes program control to pause at those locations during execution. When control pauses, ODT prints a short message on the terminal, informing you that a breakpoint has occurred and showing the location at which execution has stopped. This pause returns control to ODT and gives you the opportunity to examine and possibly modify variables or data. Breakpoints are numbered from 0 to 7, so that you can have a total of eight breakpoints set at various instructions in the program at one time. For example, set breakpoint 0 at location 22 (line 16 in the assembly listing) and breakpoint 1 at location 40 (line 23): *0,2250B *¥0.,404%1B Now when you run the program, control pauses first at location 22. Since the breakpoint was set at the instruction at location 22, that instruction has not yet been executed, but all preceding instructions have: *0,035G TB0i0,000022 Note the message that ODT prints when execution reaches the breakpoint. Normally when execution encounters a breakpoint, only the breakpoint number and location are printed on the 14-8 Debugging a User Program terminal. In this case, the letter T precedes the breakpoint message. This happens because of the way the ODT program uses the console terminal. The assembly instruction .PRINT at line 12 of the assembly listing requests the monitor to print a program message at the same time that ODT needs to print the breakpoint message. ODT, however, has higher priority. By the time the .PRINT request starts to print the program message, execution reaches the breakpoint and gives control to ODT. The .PRINT request has time to print only one character of its message before ODT takes over and prints the breakpoint message. When the program regains control, its message will continue printing from the second character. Program control has paused at location 22 in the MACRO-11 program. Look in the assembly listing at the instructions that occur there. The instruction at location 16 (line 15) stores the address of the digit vector (at label A) in register 1 (R1). Examine the contents of register 1 to discover what this address is; then open the address and examine its contents and the contents of several addresses following it by using two new ODT commands, $ and @: ¥$1/001124 @ 0,000124 /0000010 0:000126 04000130 /0000010 /000001 0:000132 /000001GD The $ command opens for examination the contents of one of the general PDP-11 registers 0 through 7. The @ command uses the contents of the currently open location as an address and opens that location for examination. Notice that the digit vector A, which begins at location 124, has been initialized to the value 1, the precise value indicated by the comments at line 48 of the program listing. If you were to continue program execution now, the branch in- struction at line 22 of the assembly listing would cause program control to loop back to the instruction at line 16 where breakpoint O is set, again causing execution to pause. Since you wanted to continue to the next breakpoint (set at location 40), you must first cancel the breakpoint at location 22. To do this, type: *308B This removes the breakpoint at location 22. The number (in this case 0) indicates which breakpoint is to be removed. Now continue program execution using the ;P command (proceed from breakpoint). Execution progresses through the loop and continues until it reaches the breakpoint set at location 40: 14-9 Debugging a User Program *iP HB13i0,000040 (Note that the monitor has time to print the second character, and perhaps additional characters, of the program message be- fore ODT gains control.) Now examine the contents of several of the program vector locations beginning at location 124: *0:124/0000120 0,000126 /000012010 0,000130 0+000132 /0000120 /00001260 The instructions prior to the breakpoint at location 40 constitute a multiplication routine. This routine multiplies the vector contents by 10 (12 octal), as you have just verified. You can see how the breakpoint feature is a very useful debugging aid. It allows you to execute selected portions of a program and verify that data and variables are being used correctly during execution. You can use the breakpoint feature to locate the error that is in this program. First, clear all previously set breakpoints (in this case, there is only the one at location 40) by typing the ;B command with no argument. *iB Now set a breakpoint at location 110 (line 41 of the assembly listing). You want to verify the data that is being passed to the monitor in register 0 in the ADD instruction in line 40. *0,110508B *3P EB0O30,000110 Now examine the contents of register 0. *$0/000065 \0BS =5@D At this point in execution, register 0 contains 000065. The backslash (\) command prints the low-order byte of the opened location on the console terminal and also converts this to an ASCII character (if it is a valid ASCII code) and prints the character. In this case, the number 5 prints. If you look back at the program results printed earlier in this chapter, you can see that 5 is the first digit of the tabulated result (following the message THE VALUE OF E IS 2). If you are experienced in mathematics, you know this result is incorrect because the ap- proximate value of E is 2.718. And you now also know that the 14-10 Debugging a User Program program error is not in the interface to the monitor service used to print the result (TTYOUT), but that it occurs somewhere before location 110. So the next step in debugging this program is to set a breakpoint at some earlier point in the program logic and to rerun the program. You must restart ODT to do this. Return to monitor mode by typing CTRL/C. The remainder of the program message prints on the terminal; then the monitor period appears, indicating that you are in monitor mode. *CTRLC) VALUE OF E IS: 2, Restart ODT and reset relocation register 0. RUN SUMED oDy vo5.00 *100030R Set a breakpoint at location 76 (line 37 in the assembly listing), and start program execution at its beginning. *04+7684508B *01035G TB0O30 000076 Again, examine register 0 to verify its contents. #$0/0000336D By following the program logic in the assembly listing, you know that the value in register 0 should at this point be 33(octal) (2.7, previously multiplied by 10, = 27[decimal] = 33[octal]). So the value in register 0 is correct. From this, you can deduce that the error must occur somewhere between locations 76 and 110. The proper step now is to check the assembly listing, where you find the error at line 40. The decimal point that should follow the 10, identifying it as a decimal 10, is missing. Therefore the program treats the 10 as an octal 10, or 8(decimal), making each digit in the result off by an additive factor of 2. The data in location 106, then, should be 72, not 70. Since this data has not yet been used, you can change it now with ODT and continue program execution; if it had been used, you would need to restart ODT and then change the data. To change the contents of a location, simply open the location, type in the new contents, and close the location, using a carriage return. *#0,106/000070 726D 14-11 - Debugging a User Program Now eliminate all breakpoints. *3B Continue program execution; the correct results should print. *iP THE VALUE OF E I8: 2,71828182845904523536028747135266249775724709389899505749668676277240766 + SUMMARY: COMMANDS FOR DEBUGGING To Start ODT LINK/DEBUG Link the assembled program (the program to be debugged) PROGRAMS with the ODT object module. To Use ODT! Close the currently open location and open the next sequential location for examination and possible modification. EED Close the currently open location. addr/ Open the location indicated (addr) for examination and pos- sible modification. addr;G : Begin program execution at the indicated address (addr). P Continue program execution from a previous breakpoint. addr;nB Set one of the eight available breakpoints (n) at the indicated address (addr). ;nB Cancel the indicated breakpoint (n). ;B Cancel all breakpoints. addr;nR Set one of the eight available relocation registers (n) to the relocation constant value indicated by addr. !Only a very few of the available debugging commands have been demon- strated in this chapter. Consult the RT-11 System Utilities Manual for all ODT commands. 14-12 Debugging a User Program $n Open one of the eight general registers (n) for examination and possible modification. @ Use the contents of the currently open location as an address; close the currently open location; go to the new address, and open it for examination and possible modification. Print on the console terminal the low-order byte of the currently open location; if possible, convert the value to an ASCII code and print the corresponding character on the ter- minal. Changes you make with ODT are temporary. Therefore you should now use the editor to correct the source program FILE MAINTENANCE SUM.MAC. You should edit line 40 so that it reads: ADD #10.,+'0:RO iMAKE DIGIT ASCII The file SUM.MAC is currently stored on the storage volume VOL:. Edit this file, then reassemble, relink, and rerun it to verify that it is correct. When you have done this, store the updated version of the source file on the storage volume under the same name (SUM.MAC), including the files SUM.OBJ and SUM.SAV. After you have corrected and rerun the program, continue on to Chapter 15, or go back and perform one of the other language demonstrations. Refer to the reading path outlined in the Preface. RT-11 System Utilities Manual (AA-M239A-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 system utilities. 14-13 REFERENCE CHAPTER 15 USING THE FOREGROUND/BACKGROUND MONITOR A special feature of the RT-11 operating system is that it provides a choice of operating environments. You are using its foreground/background environment. This environment allows two independent programs to reside in memory at the same time and to execute concurrently. You have used the foreground/background (FB) monitor to control the system and to perform the various exercises in this manual. The foreground/background environment is designed so that two programs can — but need not — share memory and run concurrently. One of these programs you designate as the foreground program. The system gives priority to the foreground program (or job, as it is usually called) and allows it to run until some condition, perhaps waiting for an I/O completion, causes it to relinquish control to the other program (the background job). The system then allows the background job to run until the foreground job again requires control, and so on. In this way, the two programs share system resources. Whenever the foreground program is idle, the background program runms. Yet whenever the foreground program requires service, its requests are immediately satisfied. To the user at the terminal, the two programs appear to run simultaneously. THE FOREGROUND/ BACKGROUND ENVIRONMENT Foreground priority programs are generally time-critical. For example, you may want to designate as the foreground job a program that collects and analyzes data. Background programs are usually non-time-critical. Thus, you can continue to do program development as the background job by using monitor commands to run the editor, the FORTRAN IV compiler, the linker, and so forth. In order to perform the following exercises your system must have a clock. Verify whether your system has a clock by entering the TIME command twice. If the time displayed changes, your system has a clock. If your system does not have a clock you should skip ahead to Chapter 16. Two programs are provided for you to run a foreground/background demonstration. These programs reside on your system volume. The background job is called DEMOBG, and the foreground job DEMOFG. The function of the foreground job is to send messages every two seconds to the background job, telling it to ring the terminal bell. The background job recognizes 15-1 RUNNING THE FOREGROUND/ BACKGROUND PROGRAMS Using the Foreground/Background Monitor these messages and rings the bell once for each message sent by the foreground job. Although the foreground job is always active, sending messages to the background job every two seconds, other programs be- sides DEMOBG can be executed in the background. Only when DEMOBG is active, however, is the circuit complete so that messages can be successfully received and honored. During the periods when DEMOBG is not running, the foreground program enters the messages in the monitor message queue. Once you restart DEMOBG in the background, the system immedi- ately dequeues all the messages since the last exit of DEMOBG, resulting in many successive bell rings. When the queue is empty, the normal send/receive cycle resumes, and the bell rings every two seconds as each current message is sent and honored. Creating the Background Job The background program DEMOBG.MAC is an assembly lan- guage source file and must be assembled and linked before you can use it. When you execute DEMOBG, it displays a message on the terminal. It is assumed that you have set the date. Editing the Background Job Use the text editor to modify the background job, DEMOBG.MAC. One of the lines of the message that is output by the program has a semicolon character preceding it, which makes the line a comment field. This will prevent the line from being printed as part of the message. Thus, the semicolon must be deleted from that line. Change the line i WASCII /WELL DONE./ to +ASCITI /KWELL DONE./ Running the If you performed the demonstration in Chapter 11, you are al- Background Job ready familiar with assembly/link operations, and the following command explanations can serve as a review. If you did not read Chapter 11, simply type the command lines as shown. Assemble the background job. Long Command Format + MACROGE Files? DEMOBG/LISTED 15-2 e’ Using the Foreground/Background Monitor Short Command Format +MACRD DEMOBG/LISTED Link the .OBJ file produced by the assembler to create a runnable job. Long Command Format +LINKEED Files? DEMOBGGEE Short Command Format LINK DEMOBGGED Now run the background job and check the results. +RUN DEMOBGED RT-11 DEMONSTRATION PROGRAM 1F INCORRECTLY EDITED, THIS WELL DONE. IS THE LAST LINE, If you did not delete the semicolon character, the last line will not be output. Return to the monitor by typing two successive CTRL/Cs. €RI/C) €mUC) “C "C The FB monitor provides you with commands that allow you to control the two-job environment. They let you interact with the two jobs and let the two jobs interact with one another. USING THE FB MONITOR When two jobs run simultaneously, you must have some means of indicating the job to which you are directing commands. Communication in a Two-Job Likewise, the two jobs must have the means to identify themselves when they have messages to print. The following are some conventions that apply to system communication in a twojob environment. Environment 1. The foreground job has priority. If both the foreground and the background job are ready to print output at the same time, the foreground job prints first. The foreground job prints a complete line, then the background job prints a complete line, and so on. 15-3 Using the Foreground/Background Monitor 2. Either job can interrupt your input at the terminal if it has a message to print. 3. 4. Messages printed by the background job are preceded by the characters B>. Messages printed by the foreground job are preceded by the characters F>. 5. Typed commands are initially directed to the background job. You can redirect control alternately to the foreground and background jobs by using the CTRL/F and CTRL/B commands. To direct typed input to the foreground job, type CTRL/F. This command instructs the monitor that all subsequent terminal input — commands and text — is directed to the foreground job. Typing this command causes the system to print an F> on the terminal, unless output is already coming from the foreground job. Command input remains directed to the foreground job until the foreground job terminates, or until it is redirected to the background job through CTRL/B. To direct typed input to the background job, type CTRL/B. This command instructs the monitor that all subsequent terminal input — commands and text — is directed to the background job. Typing this command causes the system to print a B> on the terminal, unless output is already coming from the background job. Command input remains directed to the background job until redirected to the foreground job through CTRL/F. Creating the The foreground program DEMOFG is an assembly language Foreground Job source file; it must be assembled and linked before you can use it. Long Command Format +MACROGED Files? DEMOFG/LISTGED Short Command Format MACRO DEMOFG/LISTED The output resulting from this MACRO command includes an LINK/ object file FOREGROUND DEMOFG.LST. The command creates both files on your system volume. You must link the .OBJ file to produce a runnable foreground program. You use the LINK command, just as you called DEMOFG.OBJ and a listing file called have in earlier chapters, but you also use the /FOREGROUND 154 Using the Foreground/Background Monitor option.' This option produces a load module with a .REL file type which signifies to the system that the file is a foreground program and is to be run as the priority job. Long Command Format WLINK/FOREGROUNDGRED Files? DEMOFGGD Short Command Format +LINK/FOREGROUND DEMOFGGEED Now you are ready to operate the two-job environment. Many times, you have to consider the devices that are used for output in a foreground/background environment. For example, if your program assumes that the output device is a line printer, and you do not have a line printer or you want to output to another device, use the ASSIGN command. Type this command in the following way, substituting the two-letter mnemonic from Executing the Foreground and Background Jobs Table 4-2 for the storage volume in place of dd. Long Command Format + ASSIGNGED Physical device name? dd:@D Lodical device name? LP:GD Short Command Format +ASSIGN dd: LP:@D You do not have to consider the above information for the demonstration programs that are provided, since the foreground job communicates with the background job, and both jobs send their output to the terminal. When you use the FB monitor, you must always load into memory the peripheral device handlers needed by the foreground job. You use the monitor LOAD command to make a device handler permanently resident in memory. For example, if your foreground job requires the use of the line printer, you must load the LP device handler. You must specify the jobtype with the command. For a foreground job, the jobtype is F; for a background job, the jobtype is B. If you have assigned the code LP: to another device, the system automatically loads the as- signed handler and you need not enter a LOAD command. If you are using the line printer, type: 1This command option also applies to compiled FORTRAN IV programs that are to be linked as a foreground job. 15-5 LOAD Using the Foreground/Background Monitor Long Command Format LDADED Device? LP:=F&D Short Command Format +LOAD LP:=FGED The command to load and start execution of the foreground job FRUN is FRUN, which is similar to the RUN command except that the system automatically loads and starts the execution of the foreground .REL program. (To execute a FORTRAN IV foreground job, you must use the /BUFFER:n option with the FRUN command. The argument n represents, in octal, the number of words of memory to allocate.) Use this command to start the execution of DEMOFG.REL. Long and Short Command Format +FRUN DEMOFGEED F> FOREGROUND DEMONSTRATION SENDS A MESSAGE TO EVERY 2 SECONDSs THE PROGRAM BACKGROUND TELLING IT TO PROGRAM RING THE "DEMOBG" BELL. B> The foreground program DEMOFG is now running and queuing the message for the background program every two seconds. You now execute the background program DEMOBG to allow it to receive the messages that were queued and to ring the bell. +RUN RT-11 IF DEMOBGGED DEMONSTRATION INCORRECTLY WELL PROGRAM EDITEDs THIS IS THE LAST LINE, DONE. The bell rings several times in rapid succession as the monitor dequeues the messages, and then every two seconds as the foreground job sends its message to the background job. You can run other jobs in the background. First, terminate the background job DEMOBG, using the double CTRL/C command. €RUC) EmRi/C) + Execute a DIRECTORY command in the background to get a listing of all the .OBJ files on the system volume by typing: +DIRECTORY *,0BJGEED 15-6 Using the Foreground/Background Monitor The foreground job is still running and queuing its messages to the monitor. Rerun the background program to collect all the foreground messages while the background job was stopped and the directory was printing. +RUN DEMOBGRED RT-11 DEMONSTRATION PROGRAM IF INCORRECTLY EDITED» THIS WELL DONE. IS THE LAST LINE,. The bell again rings several times in succession and then rings once every two seconds. Stop the background job by using the double CTRL/C command. + Now stop the foreground job and remove it from memory. To do this, you must first use the CTRL/F command to direct terminal input to the foreground. Type: + CRLE) F> The system prints the characters F> to remind you that you are now directing command input to the foreground job. Use the double CTRL/C command to interrupt and terminate the execution of the foreground job, and return control to the background job. CIRL/C) CRL/C) B> You should unload the foreground job to reclaim memory space for background use. Use the monitor UNLOAD command as follows: Long and Short Command Format UNLOAD FEGED + F represents the foreground job; you should use this code whenever you want to unload the foreground job. To unload any loaded device handlers, you must use their two-letter device mnemonics. Check to see if the' .LST files were produced as a result of this demonstration. 15-7 UNLOAD Using the Foreground/Background Monitor Long and Short Command Format +DIRECTORY #,L8T 08-Jan-83 DEMOBG.LST 4 0B-Jan-83 2 Filesy 10 Blocks 406 Free blocks DEMOFG,LST 6B 08-dan-83 The foreground program has access to all the system features available to a background program — opening and closing files, reading and writing data, and so on. However, before you begin to write and use programs in the foreground, read the RT-11 Software Support Manual for coding restrictions. SUMMARY: COMMANDS USED IN AN FB ENVIRONMENT CTRL/B Direct all keyboard input to the background job (until CTRL/F). CTRL/F Direct all CTRL/B). keyboard input to the foreground job (until £ FRUN Load and start execution of the foreground job. LOAD dd Bring the indicated device handler into memory; the handler becomes resident in memory. UNLOAD dd Take the indicated device handler out of memory, reclaiming its memory space; the handler becomes nonresident in memory. UNLOAD FG Reclaim the memory space used by the foreground job. FILE MAINTENANCE You assembled the source file DEMOFG.MAC and produced an .OBJ file, linking it to produce DEMOFG.REL. You also created a .LST file named DEMOFG.LST on your system volume. You should save on your storage volume the files DEMOFG.REL and DEMOFG.MAC, and delete from your system volume the files DEMOFG.OBJ and DEMOFG.LST. Do not delete DEMOFG.MAC, since this file was distributed as part of the RT-11 operating system. Do the same for the file DEMOBG, which you created as a .SAV file instead of a .REL file. ’ 15-8 Using the Foreground/Background Monitor Long Command Format , COPYGED From? DEMOFG.MAC,DEMOFG.RELGEED To % YOL:*,*ED Files copied: DK :DEMOFGMAC DK : DEMOFG.REL to YOL:DEMOFG.MAC to YOL:DEMOFG.REL DELETEGD Files? DEMOFG.0BJ:DEMOFG.LSTEE Short Command Format ,COPY DEMOFG.MAC,DEMOFG.REL VYDL:*,*ED Files coried: DK :DEMOFG.MAC DK :DEMOFG.REL to to VOL:DEMOFG.MAC VOL:DEMOFG.REL ,DELETE DEMOFG.OBJ.DEMOFG.LSTGED Finally, obtain a brief directory listing of your storage volume so that you can see its current status: Long and Short Command Format ,DIRECTORY/BRIEF VOL:GD RT-11 Software Support Manual (AA-H379B-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A technical manual providing RT-11 programming concepts. RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. 15-9 REFERENCES CHAPTER 16 USING INDIRECT FILES The RT-11 system provides an operational aid called an indirect file, which allows the system to run unattended. An indirect file is a file composed entirely of monitor operating commands. When you start the execution of the indirect file, the monitor processes these commands in consecutive order. So once you have created an indirect file and started its execution, you can direct your attention to other tasks or even physically leave the system, since the monitor executes the commands au- tomatically and consecutively.' The kinds of operations that RT-11 can best perform in an indirect file are those that involve much computer processing but that do not require your supervision or intervention. For example, multiple assemblies, compilations, and data transfer operations are ideal operations for indirect file processing. Also, any series of commands that you are likely to type often can easily run as an indirect file. Use the editor to create an indirect file as a text file. You can call the file by any file name you wish, but you should give it a file type of .COM, since this file type is the default used by the monitor to locate the file. CREATING AN INDIRECT FILE You structure the lines of text that make up an indirect file just like keyboard input. Thus, if you were to list the indirect file it would look like terminal keyboard text without any monitor prompts. You enter monitor commands into the indirect file as you would on the terminal. As an example, both of the following accomplish the same operation when executed as part of an indirect file: COPYRD INFIL.MACGE QUTFIL . MACED COPY INFIL.MAC OUTFIL.MACGE Since monitor prompts are not included in the indirect file, using the long command format requires that you anticipate IThe indirect file concept is similar to BATCH processing. Although indirect files lack many of the BATCH capabilities, they are easier to use than BATCH. (The RT-11 computer system also supports a BATCH processor, as described in the RT—11 System Ultilities Manual.) 16-1 Entering Monitor Commands Using Indirect Files each prompt and its proper response. It is suggested that you use the short command format and enter the command as a single line of text. Terminate each command line with a carriage return. Using the Editor to Create an Indirect File The indirect file that you will now create incorporates several of the commands previously demonstrated in this manual. Thus it serves both as an example of the format of indirect file input and as a brief review of the monitor commands used to copy, process, and delete files. In addition, one new command, DEASSIGN, is demonstrated. List a directory of your storage volume. The only files that should appear in the listing are GRAPH.FOR, SUM.MAC, and MATCH.BAS. All three files will be in the directory only if you performed the exercises for all three languages (FORTRAN IV, MACRO-11, and BASIC-11). Long and Short Command Format ,DIRECTORY vOL:G68 08-JAN-83 SUM +MAC 3 08-JAN-B3 GRAPH FOR 2 0B-JAN-B3 3 Filess 4754 8 Free MATCH .BAS 3 0B-JAN-83 Blocks blocks If any other files are listed, delete them using the DELETE command before you create the indirect file. Use the EDIT/CREATE monitor command to create a file called INDCT.COM, inserting the commands according to the directions in the right-hand column. When you have finished cre- ating the file, list it and check for typing errors. Correct any errors you find, and then close the file, using the EX editing command. Long and Short Command Format JEDIT/CREATE *IDATE INDCT.COM@ 8-JAN %3@ TIME B:00:00 Enter a hypothetical date and time (if your system has a clock). DATEGD Print the date. DEASSIGNED Deassign all previous device assignments and set new ones as follows: ASSIGN TT: LP:E Assign the logical name LP: to the terminal. ASSIGN ddn VOL:@D Assign the logical name VOL: to the storage volume (dd). 16-2 Using Indirect Files DIRECTORY/BRIEF VOL:@ COPY YOL:GRAPH.FOR GRAPH,FOREE List an abbreviated direc- tory of VOL.:. FORTRAN IV users insert this command to copy the FORTRAN IV pro- demo gram to the system volume. COPY UOL:SUM.MAC SUM.MACED MACRO-11 users insert this command to copy the MACRO-11 demo program to the system volume. COPY VOL:MATCH.BAS MATCH.BASED BASIC-11 users insert this command to copy the BASIC-11 demo program to the system volume. FORTRAN/LIST GRAPHED LINK/MAP GRAPH:SYSLIB FORLIBGEED FORTRAN 1V users who do not need to load the lan- guage volume include these commands to compile and link the FORTRAN demo program. IV MACRO/LIST/CROSSREFERENCE sum@ All users assemble and link RENAME MATCH.BAS MATCH.MAPED BASIC-11 users simply re- LINK/MAP SUMED the demo program. name the demo program. MACRO/LIST/CROSSREFERENCE DEMOFGED LINK/FOREGROUND/MAP All users assemble and link DEMOFGEED the DEMOFG file. DIRECTORY *.0BJED List a directory of object DELETE/NOQUERY GRAPH.*ED FORTRAN IV users delete DELETE/NDOUERY SUM, »@D MACRO-11 DELETE MATCH.MAPE® BASIC-11 users delete the DEASSIGNGED files. the GRAPH files. the SUM files. users delete MATCH file. Deassign all device assignments. TIMEE If your system has a clock, print the time to show how long total processing took. EED *B /L BOED Terminate the insert command and list the indirect TIME 8:00:00 file to check for errors. (Ex- DATE B-JAN-83 ample input is shown here.) 16-3 Using Indirect Files DATE DEASSIGN ASSIGN TT: ASSIGN RK1i: LP: VOL: DIRECTORY/BRIEF VOL: VOL:GRAPH.FOR GRAPH.FOR VOL:SUM.MAC SUM.MAC VOL:MATCH.BAS MATCH.BAS COPY COPY COPY FORTRAN/LIST LINK/MAP GRAPH GRAPH,SYSLIB,,FORLIB MACRO/LIST/CROSSREFERENCE LINK/MAP SUM RENAME MATCH.BAS MATCH.MAP MACRO/LIST/CROSSREFERENCE LINK/FOREGRODUND/MAP DIRECTORY DEMOFG DEMOFG #.0BJ DELETE/NOQUERY GRAPH.#* DELETE/NOQUERY SUM.* DELETE SUM MATCH.MAP DEASSIGN TIME *EXEDED EXECUTING AN INDIRECT FILE Close the file INDCT.COM. Once you have created an indirect file and checked it for errors, you are ready to start its execution. The command to start execution of an indirect file is the at sign (@) followed by the appropriate file name (the file type .COM is assumed unless you indicate otherwise). Execution starts immediately, and the system processes commands in the indirect file in consecutive order. Each command is echoed on the terminal as it is pro- cessed. If an error within the indirect file affects the processing of a command, the system prints a system message on the terminal and stops execution of the entire file. Therefore, it is particularly important that you check your indirect file for errors before you start it and then leave the area. You can stop execution of an indirect file at any time by typing two CTRL/Cs. Run the indirect file that you have just created by typing: +BINDCTRED It takes a minute or two for the commands in this file to be processed and for the listings to print. If your system has a clock, the time printed at the end of execution tells you exactly how long command processing has taken. Following is an example run. +RINDCT <DATE 8-JAN-83 .TIME 8:00100 +DBATE #-Jan-83 SDEASSIGN +ASSIGN YTt «ABSIGN RK1! LR VOL?Y SDIRECTORY/BRIEF GRAPH 3 .FOR Filesr 4754 Free VOL: SUM 8 LMAC MATCH . BAS Rlocks blocks «COPY V0L :BRAFH.FOR LCOPY VOL:SUM.MAC GRAPH.FOR SUM,MAT 164 Using Indirect Files JCOPY VOLIMATCH.BAS MATCH.BAS SFORTRAN/LIST GRAPH ) PAGE 001 VERSION 1 GRAPH . FOR c Sat 08~Jan-83 08100116 v02.5 FORTRAN 1y f””‘ € THIS PROGRAM PRODUCES & FLOT ON THE TERNINAL FUN(XsV) C OF AN EXTERNAL FUNCYIONs € THE LIMITS OF THE PLOT ARE DETERWMINED BY THE DATA STATEMENTS 0001 0002 € € *STABR' IS FILLED WITH A YARLE DV NEIENT FLAGS *STRING* 1S USED VO BUILD A LIi GRAPH FOR PRINTIA SCAL(ZNIN-ZN‘X-MXZvK)IZN!NGFLOAY(K'U'(INM( ZH]N)/FLMT(Nth 13 LOGICALE] BYRINGC133).STABL100) 0003 DATA XMIN» XMAX s HAXX/~5.0¢5.0045/ 0004 DATA YHIN: YRAX s HAXY/~5.015,0072/ DATA FAINsFHMAX/0.0s1.0/ 0005 CALL SCOFY(’~ § 23 458 7 8 9 +,5TaB) G004 0007 6008 HAXF=LEN(BTAB) DO 20 IX=1yMAXX X=SCAL (XMIN XHAX e HAXX» IX) 0009 0010 CALL DO 10 0013 0016 0017 0018 JOR. INT CFLOAT CRAXF -3 KEFUN(X 0 Y3 -FNIND / (FMAX-FNINDY IFUNe2+ yMAXO 1y IFUKY ) ) STRING(IY)=STAB(NINOUNAXF 10 *) CALL PUTSTR(ZySTRING» 20 CALL EXIT 001% END JHAIN, Storage Mar for Promram Unit .MAIN. .PSECT $DATAs Size = 000476 (156, words? Local Variabless Hame FNAX Ture REA MAXF NAXZ 122 %2 Ix XHIN Offset 000402 Name FMIN Twre R®4 Uffset 000376 Name IFUN Tyre I%2 000432 000424 HAXX X 152 R4 000362 000434 HAXY AMAX 1%2 RE4 000364 Zuax Rae 000422 ZMIN %2 000434 RE4 000352 R¥A YRIN 2 Qs Warninas! TFORTRAN-1-C.MAIN.] Errors! FORTRAN [V Local IX,E@.MAXX) BOTQ 20 IY=2sHAXY-1 Y=GCAL (YMING YMAXs MAXYS 1Y) 0014 0015 REPEAT(“%° . STRING»NAXY) IFCIX.EQ.1 o011 YHAX 000444 RE4 ¥ X 000442 152 iy I%2 RE4 REA Offset 000430 000430 000324 000356 000370 000416 and COMMON Arraws: Section Offset Twee Neme 000205 000000 $DATA SDATA LAt STAB SYRING LEL ==~ Size---~- Dimensions 000144 ¢ 000205 ¢ 50.) (100} &7.) (13%) m Subroutiness Functions: Statessnt and Processor-Detined Functionsi ¢ Nemy Ture I$2 MAXC SCOPY Nase Tume Nose Ture Hane Twre Name Ture RING I¥2 mvsn R$4 REPEAT RE4 SCAL R4 FLOAT Re4 EXIT Re4 Fum FORTRAN 1V 182 LEN PABE 001 Starase Mae for Prosrss Unit FUN Locel Varisbles:s ¥ 2 INT FUNCTION FUN(X)Y) ReSORT (XN2+Y2E2) C-R) ) 482 FUl=(XEYSREEXP RETURN €MD 0003 0002 0003 2064 0008 Fun R4 Bat 0B-Jan~83 08101144 voz.5 FORTRAN IV Naaw R¥4 Ture RE4 10, words) PSECT 8DATA, Size = 000024 ¢ UOffset Name 000004 Eav R RE4 @ 000002 Twrs R&4 Offset 000010 Name X Tere Offset RE4 & 000000 Subroutinese Functionsr Statement and Processor-Defined Functions! Naae Ture EXP # Nane R4 SGRT Ture Rx4 Name Ture <LINK/MAP BRAPH,SYSLIB»FORLIP lY-ll LINK B Section 08,00 Title: Addr Bize Load Mar Global 000000 001000 = 256, SUSRSM arse1 001000 017722 = 4073, SVIR FORVO2 Value Global 000000 000000 000008 $SYSUS 000210 STRACE $$0TSI 001000 SCVTIF 001000 SCUTIC 001014 SCUTID 001014 CCI 001026 CRIs 001028 e IC 1R ADFSPS ADFSNE 001028 001042 001474 001514 $ID EXP SUFSPS SUFSIS 001024 001124 001300 001528 CFIs ADFSIS SUFSMS SADDF 001042 001466 001304 001534 ADF$SS 001564 $ADR 001585 ADDY 001602 002262 SDUR 001550 002226 002250 002550 002572 003t42 003024 00%S22 003542 DCIe8 DEIsA Titie! Value SLRECL ANDS .. Globai SNLLCHN HUFSPS SHULF 071 $$SET STKSL GRAPN Pasie 1 (RW.isLCLyRELYCON} SDIVF V08,00 Ture wards DIFSPS RT-1% LINK Value (RWsI.GBL,ABSsOVR) words 000000 SRF2A1L 000000 SHRDWR WSUBF - Nane 000152 SMASIZ m Ture Saturdaw 08-Jen-83 08102 Ident! JMAIN. ABS. + Nowmea NOX.!P 007014 007028 SUFSSS DIFSME DIFSES MIFSNS FMUFSSS 80T SORT STKSF £0QUs DCISM IDINT 007040 MIISEP JMAIN. Icent: FORVO2 WOLNP 007074 18N8 007144 Load Nae MOLISPA SLENTR 007120 001362 002232 SSBR DIFSIS 002554 002404 003144 005322 005524 MUFSIS SMLR SSEYOP STKSL IORS 007020 QO7032 DCIWF INT V05550 007042 XORs MOISPP 000012 004737 001562 002242 0022462 002344 002604 003354 005516 VOSB3 005352 007024 007082 Slturdw 08~Jan-83 CBi02 NOISPE 007104 SISNTR 007130 BUISIA 007340 MOISOP 007070 Pase 2 MOISPR 007112 LSNS 007144 007128 MOISIP 007324 SUISSA 007134 007170 BUISEBS MOLSSP 007420 NOLSPP 007426 MOLSMP 007432 MOLOPH MOLSIM 007442 007452 NOLSPE NOLSIA 007430 007470 NOLSPA HMOLSIP 007454 007476 SUISSN HOLSHS 007334 SUTHIA 007330 007344 16-5 Using Indirect Files LiLES 007506 LBEY TBL#S TSLOP 007520 007534 007534 RETSL OTS#P 020732 000054 = Q20776 000244 = 021242 000000 = $CDDE 021242 001314 = RETSF 007636 RETSL $OTIS 007444 007702 $80TIS 007704 #TVL 010024 TUFs 010032 TYVDS 0310040 010048 $TUD $TVA 030046 TUFS STYP 010054 SALSIN 010218 SULSSM 010224 TUls 010062 SALSSH 010220 SVLSIN 010234 SULSHM SALSSP 010245 SULSIP 010254 SALSMP 010242 SCUTFR SULSMF 010272 SCVUTFT 010272 SCYUTCH 010304 SCUTCE 010304 $CUTDR 010306 SCUTDI cIcs 010306 010320 CIDS 010320 cLCS 010320 010320 010330 $DI #RI 010320 010330 CIFs CILt 010444 010330 010442 #INITI 010450 SCLOSE 010364 011344 SFI0 ®ERRS 015054 011451 SFCHNL $$FI0 015212 016080 SFUTBL SFUTRE 017532 017224 SGETBL 017742 SEOFIL SEOF2 020124 020142 SAVRGS 020142 THRDS 020340 STPY $STPG 020342 £oas 020334 020350 SEXIT $5TF 020374 020350 SURINT 020542 S$WAIT SDUNPL 020520 020574 22, wards B2, (RWsDsGBLyREL »DUR) words LER 020776 0, words I59. words S$80TSC 071242 000002 = 1. words 000004 $A0TS = 2. words (RWsLrLOLeREL e CON) REPEAT 021014 SCOFY (Ris L,LCLrRELICONY 271. words 02256C FI 022120 PUTSTR 023730 $OPEN 022560 (RMs I,LCLyREL +CON)Y {RuyDsLCLyREL +CONY (RieDeLCLyREL rCONDY (RWrDyLCLREL /CON) 023732 $SYSLB (RM»DyiCh v KEL »CON) 023734 SLOCK 023736 SCRASH SDATA 023740 000536 = 175. words USERSD 024474 (RWeDeLCLsREL sCONJ 000000 = 0, uprds (RWsDsLCLyREL »COND S#I88. 0R44TE 000000 = O, words (R DyBBL/REL »QUR)Y address = VERSION Nap .HALN. O21242) +MACRO/L I8T/CROSSREFERENCE 1 Saturdaw Ident! Higb limit 000004 s 024474 = V05,00 Saturdaw 000016 012701 000022 008311 000024 3 words GOOL0& 000107 1 SUM.MAC VERSION WMCALL . TIYOUTy .EXITs = ] ‘E’ § 1700 TO. = iNG. THE & SUM 1750 + OF THE 31721 4 § FRINT OF DIGITS OF 'E’ TO CALCULATE REE IPROCALS 1/3 LR OF THE FACTORIALS PZTEE 2% V2. TRE 2NN S EXPY PRINT #MESSAG #PRINT FIRST: MOV N+t §NO. OF DIGITS OF ACCURACY JADDRESS OF DIGIT VECTOR iDO MULTIPLY BY 10 (DECIMAL) 18AVE %2 oV 000124 SECOND: 011144 Page STITLE RS *oR1 ASL ¥R1 ASL w1 HOV ND, RO MOV #R1,-(SP) INTRODUCTORY OF CHARS OF TEXT ‘E‘ 000024 004311 008311 000032 0462421 ADD 000034 (SPI4r(R1} 005300 ik B NOW %10, DEC RO BNE +AT SECOND END OF MOV /RO #BRANCH IF NOT 1G0 THRU ALL PLACES: ASL 001371 000040 012700 000044 014103 000048 012702 000052 005202 000054 000104 THIRD: MOV 177777 ~(RLY,R3 #BY THE PLACES #-1/R2 JINIT QUOTIENT INC R2 $BUMP QUOTIENT SuR ROYRI 103375 BCC FSUBTRACT LOODP FOURTH 080003 #NUMERATOR ADD ROsR3 000084 HOV $FIX R3v@R1 080261 177776 ADp R2y~2¢R1) DIOIT I8 DIVIDING INDEX REGISTER ISN‘T ALWAYS BAD < 10N REMAINDER #SAVE REMAINDER AS $FOR PRINT DIGITST 000056 010311 TO POINT TO NEXT oy FOURTH! 160003 @1 0000480 800082 NEXT BASIS DIGIT GREATEST INTEGER CARRIES $TO GIVE #AT END OF DISIT $BRANCH IF NOT BIGIT 600070 005300 BEC 0600072 RO 001384 000074 018100 BNE THIRD 000076 142700 MoV (K1) yRO #10. 4RO $BET SUB DIGIT #FIX THE 800 FIFTH ADD €10.+°0vRO #MAKE FOUTPUT THE BIGIT JCLEAR WEXT DIGIT LOCATION YMORE DIGITS TG PRINT? 000102 103375 000104 0AZ700 000012 FIFTH: 000072 000110 FTHAT IT #(REALLY STTYOUT 000114 005011 CLR @R} 000116 00530% DEC 000120 RS 001334 BNE FIRST 000122 EXIY & 47 Page 000030 000038 2 08102 0B-Jan-83 08107 N 012705 012700 5278, 023737 SUM HACRO 000012 OB-Jan-83 FORYOQ 000108 006000 022266 (RW»IrLCLeREL+CONY words words words Load 021144 (RurIsLCL/REL»CON) $90TSO NHCLNS Trarsfer 010246 SERRTB 023734 5UK,MAC 010252 CLD$ CLF® 023732 Title: 010240 CLI% SYS#S Y08.00 010224 SALSMM 010244 OTS$S .SAY 010034 010062 SALSIP = 0. = 35, = 3, LINK 010032 010040 $TVI SULSSP 023416 000000 023414 000106 023724 000004 GRAFH 007606 007432 022360 RT-11 007532 007546 007444 0TS0 = 007516 LLT TSLST NING 007562 010024 SYS$0 S$DATAF OTS$D 001036 LGTS 007530 007342 TULe VoS SYSSI 007510 LNE® THLsM MAXO RETS S$TUF USERSI LEGS 000124 000107 000342 124 At SREPT 48 JWORD 4y TGO 2.7 .7 IS ONLY 1 DIVIDE BY DIBIT SO DIGIT 10) ASCII #BRANCH IF $WE DONE ARE VECTOR? QuTPyY TO YES N4 1 <ENDR FIKIT VECTOR = TD ALL ONES 50 51 000345 040 105 136 114 000353 0an 117 105 106 000356 040 105 040 000341 111 123 oz 125 01% VERSION 012 1 MACRO 000347 (&2 MESSAG: Ssturdaw OH-Jan-B83 V05.00 Saturday 0B-Jan-83 Exr 0000COR . 000000 3 000372 Errors detected: Assembier wark work HACKD 08:07 Pase 1-2 EXF file reads: file urites: N #1IRST 00GOIZK MESSAG 00034TR SECOND +LEL yREL 5 EON) O O file! core rool! 15816 swustem! KRT-1t time! DRISUM)LF Q000SIR 001 work Orerating FOURTH o0 of 8227 0010 Wurds ( Words 33 ( Fages) 61 Fages) 5. 03 SUMSDIC S VERSION reference 1 MACRD table (CREF a 1-14 EXP 1-114 1-54 FIFTH 1-37% 1-3% FIRST 1-13¢ 1-44 FOURTH 1-25¢ 1-28 MESSAG 1-11 1-518 N 1-7% 1-12 SECOND 1-158 1-21 23¢ 1-35 THIRD 1-1 statistics of SUM.HAC Fase 000074R (RMWyT,GBLABSOURY 4ize Cross 08107 FIFTH 000 Gize Elarsed E LEVEN SENTE 000000 VERSION Q001 24K ABS. OF 200 table A TAX VALUE 0622 53 Sumbol /THE Y035.00 52 54 BUM.BAC .ASCII 103 000350 00384 SUM.MAC 110 V05,00 Saturday 0B-Jan-83 V05.00) 1-478 1-13 1-22 166 1-a7 081 7 Page S-1 000106 000022R THIRD 000GR4R Using Indirect Files HACRO V05.00 1 Cross reference table (CREF v03.00) Ssturdaw 08-Jan-83 08307 Pase N-1 SUM.MAC VERSION <EXET <PRINT 1-38 143 136 1-41 1-30 JTTYOU 1-31 LINK/MAP SUN RT-11 LINK U0B.00 Losd Mar SUM.MA Ident? Ssction Global Value Global 000000 001000 = 284, words OUR) (RW« LyBBi.+ABS 001000 000372 125, words (RUs IsLCLIREL 1 CORY “SAY « Title: Addr ABS. Transfer RENAME Size = addrass = 001000y MATCH.BAS Pase Bsturdaw 08-Jan-83 08t11 Global Vaslue Hish lisit = 001370 = 380. 1 Value wards HATCH.HAP «MACRO/LIST/CROSSREFERENCE DENOFG DEMOFS MACRD V0S.00 Saturdes 08-Jan-83 08:11 Fese 1 STITLE DENOFG <IDENT /V05.00/ + FOREGROUND DEMONSTRATION PROGRAM TO PRINT MESSAGE YO BACKGROUND: THEN 4 GUEUE A MESSAGE EVERY 2 SECONDS FOR THE BACKGROUND TO RING MCALL STARTI! 000000 .PRINT «QSET Q00006 10 000020 11 JMRKT 15 000062 026727 16 000070 003020 18 000126 005267 20 000146 21 000207 24 000170 35 000174 005367 000207 000314 000132 000250 000206 24 27 28 29 30 000174 106 31 000240 32 000324 117 123 105 33 34 35 000402 122 105 126 + MKTEM COMPLETION ROUTINE CMP MSGCNT» $90. INC MSGONT BST +SDATC JHMRKT RETURN MKTCL $AREA-PBUFFER #1,#SDATC SAREASBTIMEr 8NKTC, 41 H SDAT SDATCT DEC RETURN ¥ ASCII MESSAGES (NLIET BEX MSG! 116 105 SPRINT SOUEUE»$100, MKTC? MKTCL1: . @MSG #AREAr$TINE) SHKTCy 81 <SPND 000054 38 000404 39 000406 HSGCNT LASCII NORD O 000000 000170 TINE: JWORD JMORD O 40.%2 AREAT BLKW & BUFFER! .BLKN 400 OQUEUE: .BLKM 43 000424 46 001424 47 000000” 48 DEROFG MACRO V05.00 Saturdaw 08-Jan-83 08111 Swmbol TBUNP MESSAGE COUNTER JSET UP aNOTHER MKTIM FOR 2 SECONDS 4RETURN FROM COMPLETION ROUTINE 000410R 000424R MKTC 000042R + 000000 005344 ABS. HKTCL HSG 253 Assesbler file 000 001 FHESSAGE COUNTER $YIME CONSTANT IHIBH ORDER 160 TICKS A SECONDs2 SECONDS FENT ARGUMENT AREA JBUFFER FOR MESSAGES JOUEUE AREA 100.%10. 710, WORDS FER QUEUE ELEMENT FOR THE XM AONITOR START LEND Pase 1-1 001424R 000170R START TIME 00000ORS 000404R 1-19 1-19 +eoV1 = 000003 1eaVU2 = 000027 statistics readst file writest of work filet iz of Orerating QUEUE SDATC 00OA02R (RWrI,GBL,ABSIOVR) ¢RMsIsLCLARELPCON) O dork Size core 00O132R 000176R MBBCNT Errars detected: rool! swstem! O O Y384 Norde (¢ 13618 Nords 37 ¢ Pases) &1 Pases) RT-11 Elarsed time: 00102127.42 DK DEMOF Qs LP :DEMOFG=DK $ BENDFG/C DEMOFG Cross MACRD V05,00 Ssturdaw 08-Jan-83 0BI1Y (CREF V05.00) refarence table 1~9 1-10 1-17 1-10 1~17 1-17 1-17¢ 1-19 1-17 1-10 1-438 1-158 119 MSG 1-16 1-8 1-19¢ 1-30% HSGCNT 1-15 1-18% OUELE 1~ 1-448 SDATC 1-17 1-244 START TIME 1-8¢ 1-10 DEMOFG Cross 1-17 1-19 1-17¢ 1-41¢ 1-24% 1-48 1-19 NACRD 05.00 reference 1-35¢ 1-38¢ Saturdaw 08-Jan-83 08111 table Pase S-1 Fase M-t (CREF V05.00) 1-9 1-17 1-10 1-17 1-9 1-10 1-10 1-17 1-10 1-17 1-19 1-19 1-16 1-19 1-10 1-64 1-6% 1-64 1-8 1- 1-68 1-17 1-5% 1-11 +LINK/FOREGROUND/MAF RT~11 LINK DEMOFG.REL Section . ABS, Addr Size 000000 001000 = 005344 address +BIRECTORY = 1-17 = Load Mar DEMOFG Tdent? Ssturday Slobal Value Global %6, words 1394. wards (RU»I)GBL»ABSYOVR) sREL sCONY CRWrY+LEL START Transfer 1-17 1-17 001000, High 0B-Jan-83 08115 Value Global limit = 006342 = 1449. uords B 22-Cct-82 VDT 8 22-0ct-82 SYSLIB.OBJ 46 ERROUT .0BJ 15 22-0ct-82 FORLIB.OBJ 141 12-Naw-80 1 08-Jar-@3 SUM 1 0B-Jan-83 .QBJ .0BJ DEHOFG .OBJ 354 Free 1 245 08-Jan-83 GRAFH .OBJ LOBJ OB 8 16 22-Dct-82 22-Dct-B2 08-Jan-83 Blocks blocks <DELETE/NOGUERY GRAPH.X +DELETE/NOGUERY SUM, % <DELETE 1 VYalue 001000 YTHDLR . OBJ 10 Filess Fage V05,00 £.0BJ 0§-Jan-83 TEST 1-1% DEWOFG ¥08.00 Title: 001000 apT BEEN RECIEVED table AREA BUFFER Work SYES~ND SENSE OUEUEING ANOTHER ISEND MESSAGE TO 80 IONE OF THE MESSAGES HAS SRETURN(RTS PC) 44 45 190 MESSAGES QUEUED YET? /FOREGROUND DEMONSTRATIDN PROGRAN/<I$><12> MSGCNT: 42 $SUSPEND THE FG TILL MKYIN SATISFIED /SENDS A MESSABE TO THE BACKGROUND PROGRAM *DEMOBG*/<1S>:12 /EVERY 2 SECONDS, TELLING LT TD RING THE BELL.. 000000 41 000410 $SET UP HKTIM FOR 2 SECONDS FROM NOW LASCII .ASCIZ <EVEN 40 INTROBUCTORY MESSAGE 3SET ASIPE 100 0 ELEMENTS fOR MESSAGES CONPLETION ROUTINE 36 37 THE BELL. JSDATC, .PRINT:.MRKT» . GSET) .SFND MATCH.MAP 16-7 Using Indirect Files «DEASSIGN 0at1x;as SUMMARY: COMMANDS TO START AN INDIRECT FILE @filnam.COM Start the execution (filnam.COM). of the specified indirect file CTRL/C CTRL/C Halt execution of the indirect command file (use with caution). DEASSIGN Remove logical device assignments. FILE MAINTENANCE Indirect file INDCT.COM contains commands that perform the appropriate copy and delete file maintenance operations. If the commands were not already part of the file, you would need to perform the appropriate file maintenance commands, in monitor command mode, after execution. REFERENCE RT-11 System User’s Guide (AA-5279C-TC). Maynard, Mass.: Digital Equipment Corporation, 1983. A guide to the use of the RT-11 operating system. 16-8 CHAPTER 17 ADVICE TO NEW USERS This manual introduces several common RT-11 functions but is neither exhaustive nor comprehensive in its treatment of system features, commands, or their options. For many users, this manual’s description of these fundamental system operations is sufficient; other users, however, may need or want further description of a programming language, extended system features, or the internal workings of the RT-11 system. These people should consult the references at the end of each chapter, RT-11 System User’s the Guide to RT-11 Documentation, Guide, or the RT-11 System Ultilities Manual. The Guide to RT-11 Documentation lists all RT-11-related material available from DIGITAL; the RT—11 System User’s Guide explains in detail monitor commands and command options; the RT-11 System Utilities Manual describes the use of the RT-11 system utilities to develop programs, execute programs, and maintain files and storage media. The Introduction to RT-11 has shown you the right way to use some important system features and their associated monitor commands. This information, combined with the following basic guidelines for using the system, can help you to avoid pitfalls common to new users: e Do not become dependent on a single copy of a file. Always make a backup copy of any useful file. e When using the editor, close files periodically to preserve edits. Divide long editing sessions into short ones so that user — or hardware — errors do not lose the efforts of long hours of editing. Close the file with the EX command and begin editing again from where you left off. e Avoid careless use of wildcard operations that manipulate multiple files. Use the /QUERY option to verify the operation to be performed. e When using indirect files or BATCH streams, avoid operations that manipulate any of the system (.SYS) files or the indirect file in use. Check the indirect file carefully for errors before you use it. Once the command stream is initiated, you may be unable to detect and prevent possibly serious errors. e If you run two jobs under the control of the foreground/background monitor, be sure there is no conflict of nondirectorystructured devices (LP:, MT:, TT:) used by the two jobs. 17-1 Adpvice to New Users USING THE A HELP file containing information about the keyboard mon- HELP FILE itor commands and how to use them is distributed with the RT-11 system. A list of keyboard monitor commands and a description of their functions can be displayed at the terminal by typing: HELP +HELP »@D To get a detailed description of the use of the HELP command itself, type only HELP. +HEL PEED The following information is displayed on your terminal. HELP Lists SYNTAX HELPL/opPptions]Il or HELP helpful torpicl information subtopicliitemsss eyl % S : SEMANTICS HELP % lists the items for which help is available. HELP lists the HELP text (of which this is a Part). HELP toric lists information on the srpecific toric onlvy. HELP topic subtorpic lists information on the specific subtoric only (for example, HELP HELP SEMANTICS lists the paradgrarh of which this text is a part), HELP torpic subtopiciitem lists only the text associated HELP the with the specific S’ item. topic/item lists the text associated with specific item under the subtoric QOPTIONS, Valid torpics are the Kevboard monitor commands. Subtorics are "SYNTAX", "SEMANTICS", "OPTIONS", and "EXAMPLES". Items are specific command orPtions, OPTIONS PRINTER Prints TERMINAL Tyrpes the HELP text (default) the HELP text on the line Printer B on the terminal EXAMPLES HELP COPY 'Lists 'COPY HELP/PRINTER EXECUTE 'Prints tabout HELP PRINT OPTION:COPIES HELP COPY/BOOT/DEVICE information about command information EXECUTE command 'Describes the COPIES tortion for PRINT !Describes loptions the for listed COPY In the command syntax shown above, topic represents a specific keyboard monitor command about which you need information. The subtopic represents a specific category within a topic; the subtopics are syntax, semantics, options, and examples. The 17-2 Advice to New Users item represents one of the members within the subtopic group. You can specify more than one item in the command line if you separate the items with a colon (2). The only two options you can use with the HELP command are /PRINTER and /TERMINAL. The option /PRINTER sends the help information to a printer if one is available. The option /TERMINAL (the default mode) sends the information to the terminal. To get all the information in the help file about the keyboard monitor command ASSIGN, type the following command: JHELP ASSIGNGED You have used this command in examples in the other chapters. The following information is displayed at your terminal: ASSIGN Associates physical a logdical device name with a device SYNTAX ASSIGN physical-device-name SEMANTICS Phrsical-device-name rermanent name for {ogical-device-name characters long The phrvysical separated by is the the one no name and a space. RT-11 standard device. is with logical-device-name to three alphanumeric intervenind logical name srpaces must or tabs., be OPTIONS None EXAMPLES ASSIGN DK: RK1: When you want specific information for a keyboard monitor command, such as the syntax, semantics, options, or examples, include that subtopic in the command. For example, the following command lists all the options that are available for use with the DIRECTORY keyboard monitor command: +HELP DIRECTORY OPTIONSEED If you need information only about a specific item in a list of options, type the item in the command line. +HELP DIRECTORY OPTIONS:ORDERGE ORDER[:catesory] Orders the specifyi directory same as listing /SORT, according Catedories to the category are: NAME- orders alphabetically by file name TYPE- orders alphabetically by file tvpe SIZE- orders by file DATE- orders by creation POSITION- orders by size file date Position 17-3 on the device APPENDIX A MANUAL BOOTSTRAPPING OPERATIONS PDP-11 computers that do not have the automatic bootstrapping capability described in Chapter 2 require manual bootstrapping. This appendix’s first section, Bootstrapping the System, provides information that you will need to bootstrap the system manually. Follow the procedure described in this section; you will be referred — if appropriate for your system — to one of the other sections, which describe using a pushbutton console to bootstrap, using a switch register console to bootstrap, and typing the bootstrap. Once you have identified your hardware configuration, you are ready to bootstrap the system. The purpose of the bootstrap procedure is to load and start the RT-11 monitor in computer memory, activating the RT-11 operating system for your use. 1. Set the terminal to an on-line condition. 2. Make sure that the computer power is on and that the computer is not already in use. Stop the computer, following one of two procedures: e If your operator’s console has switches, set the switches to HALT, then ENABLE. o If your operator’s console has pushbuttons, locate the button labeled CNTRL; hold it down and push the button labeled HLT/SS; then release both. 3. Place the system volume in device unit 0. Make sure that the system volume is write-protected (for all except RX01 or RX02 diskettes, which are always write-enabled). 4. Place the storage volume in the device unit you identified for question 8 in the Hardware Configuration section of Chapter 2. Make sure that this volume is write-enabled. 5. If your operator’s console has pushbuttons, continue to step 6. 6. Otherwise, go to step 8. Locate the pushbutton labeled CNTRL, hold it down and push the button labeled BOOT. Check the terminal printer or screen. If there is no response, read the Using a Pushbutton Console to Bootstrap section of this appendix; otherwise, continue to step 7. 7. Your terminal printer or screen should show several numbers and then a dollar sign ($). BOOTSTRAPPING THE SYSTEM Manual Bootstrapping Operations Type on the terminal keyboard the two-letter mnemonic that represents your system volume (from question 6 in the Hardware Configuration section') followed by a carriage re- turn. Be sure to use the SHIFT key so that you type upper- case characters. For example, for RX02 diskette, type: $DYGRD Continue to step 11. Check your switch console. If it has a three-way dial labeled DC OFF, DC ON, and STAND BY, go to step 9. If it has three individual switches labeled DC ON/OFF, ENABLE/HALT, and LTC ON/OFF, go to step 10. If it has a row of switches across the entire console, read the Using a Switch Register Console to Bootstrap section of this appendix. Set the three-way dial to DC ON. Then locate the BOOT switch (to the left of the dial) and raise it. Go to step 11. 10. Put all three switches in the up position; then move the DC ON/OFF switch down and up and check the terminal response. e If the terminal displays the dollar sign ($), type on the keyboard the two-letter mnemonic that represents your system volume (from question 6 in the Hardware Configuration section) followed by a carriage return. Be sure to use the SHIFT key so that you type uppercase characters. For example, for RX02 diskette, type: $DYGD Continue to step 11. ¢ Any other response indicates that you must type the bootstrap on the terminal keyboard. Read the Typing the Bootstrap on the Terminal Keyboard section of this appendix. 11. If your system has been successfully bootstrapped, a mes- sage like the following prints on the console terminal. RT-11FB V05.xx (the xx’s represent numbers that have significance only for DIGITAL’s software development; you can ignore these numbers) The RKO5 disk is an exception. Hardware bootstraps use DK, not RK, for RKO5. Manual Bootstrapping Operations If the message indicating RT-11FB V05 does not appear, refer to Appendix B and read the section entitled Suggestions for Bootstrapping the System. The message indicates that the foreground/background monitor component of the RT-11 Version 5.0 operating system is active. Set the system volume to a write-enabled condition (for all except RX01 and RX02 diskettes, which are always write-enabled). You should now direct your attention to the console terminal, since system interaction continues on this device. Continue to Chapter 3. The bootstrap for your RT-11 computer system consists of a series of six-digit numbers that you must type on the terminal keyboard. First, obtain the bootstrap from the RT-11 Installation Guide, and copy the numbers into the space below: Now, follow the instructions below to type, on your terminal keyboard, the bootstrap (if you make a mistake, type the DELETE key on the terminal keyboard, once for each typing error, SR and then type the correct digitls)]): Type 001000. Type slash (/). Type the first number in the bootstrap column. Type the LINE FEED key. Type the next number in the bootstrap column. Repeat steps 4 and 5 until you have typed all the numbers N in the column. Type the RETURN key. 8. Type 1000G. 9. Continue to step 11 in the section entitled Bootstrapping the System in this appendix. A-3 TYPING THE BOOTSTRAP ON THE TERMINAL KEYBOARD Manual Bootstrapping Operations USING A PUSHBUTTON If your computer has a pushbutton console similar to the one shown in Figure A-1, you can use the buttons to manually give CONSOLE TO the computer the information it needs to bootstrap the system. BOOTSTRAP oo sy Figure A—-1 Pushbutton Console The bootstrap for your RT-11 computer system consists of a series of six-digit numbers that you must load into the computer using the pushbutton console. First, obtain the bootstrap of your system device from the RT-11 Installation Guide, and copy the numbers into the space provided below. If your system has a hardware bootstrap,' the bootstrap will consist of only two numbers, which you should copy into the left-hand space; otherwise, the bootstrap will consist of two columns of numbers labeled Location and Contents, which you should copy into the right-hand space: Hardware Bootstrap Other Bootstraps Load Address = Start Address = To activate the hardware bootstrap, use the pushbuttons to set the numbers as described in the following steps (if you make a mistake, push the button labeled CLR, then reenter the number): 1. Push the appropriate buttons for the load address (read the number from left to right). 2. Push LAD. 3. Push the appropriate buttons for the start address (read the number from left to right). 4. Push the button labeled CNTRL, and, while holding it down, push the button labeled START. 5. Continue to step 11 in the Bootstrapping the System section of this appendix. 'A hardware bootstrap is bootstrapping information that is already in computer memory but that you must activate by entering a load address and a start address, each a six-digit number. Ad Manual Bootstrapping Operations To activate other bootstraps, use the pushbuttons to set the numbers as described in the following steps (if you make a mistake, push the button labeled CLR, then reenter the number): 1. Push 1000 (read the number from left to right). 2. Push LAD. 3. Push the appropriate buttons for the first number in the Contents column (read the number from left to right). Push DEP; push CLR. Push the appropriate buttons for the next number in the Contents column (read the number from left to right). Repeat steps 4 and 5 until all numbers in the column have been used. Push 1600. Push LAD. Push the button labeled CNTRL, and, while holding it down, push the button labeled START. 10. Continue to step 11 in the Bootstrapping the System section of this appendix. If your computer has a switch register console similar to the one shown in Figure A-2, you can use the switches to manually give the computer the bootstrapping information it needs to start the system. Figure A-2 Switch Register Consoles Several switches on the console are spring-loaded. This means that the switch moves in only one direction and returns to its initial position after you use it. You must set the remaining switches either up or down as instructed. USING A SWITCH REGISTER CONSOLE TO BOOTSTRAP Manual Bootstrapping Operations The bootstrap for your RT-11 computer system consists of a series of six-digit numbers that you must load into the computer using the switch register console. First, obtain the boot- strap of your system device from the RT-11 Installation Guide, and copy the numbers into the space provided below. If your system has a hardware bootstrap,’ the bootstrap consists of only two numbers, which you should copy into the left-hand space; otherwise, the bootstrap consists of two columns of numbers, labeled Location and Contents, which you should copy into the right-hand space: Hardware Bootstrap Load Address Other Bootstraps = Start Address = Next, convert the numbers in the column to binary numbers, using the conversion process shown in Table A-1. Table A-1 Binary Conversion Octal Binary 0 = 1 = 001 2 = 010 000 3 = 011 4 = 100 5 = 101 6 = 110 7 = 111 For example, the number 173100 is converted to 001 111 011 001 000 000. You set this 18-digit binary number into the switch register by placing each individual switch in an up posi- tion for a 1 or a down position for a 0. The number 173100 is set into the switch register as follows: 28 20 N B A R B AR O The number 012700 is converted to 000 001 010 111 000 000 and is set into the switch register as follows: OS T T O I A A S A A 'A hardware bootstrap is bootstrapping information that is already in com- puter memory but that you must activate by entering a load address and a start address, each a six-digit number. A-6 Manual Bootstrapping Operations NOTE The switch register is the group of switches appearing on the left of the console. Your switch register may have only 16 switches rather than 18; in this case you can ignore the left-hand two digits of the binary number when you set the switches. To activate the hardware bootstrap: 1. Set the switch register to the appropriate positions for the load address. Press the spring-loaded LOAD ADDR switch. Set the switch register to the appropriate positions for the start address. Press the spring-loaded START switch. Continue to step 11 in the Bootstrapping the System section of this appendix. To activate other bootstraps, set the numbers into the switch register using the following method: 1. Set the switch register to the appropriate positions for the number 001000. Press the spring-loaded LOAD ADDR switch. Set the switch register to the appropriate positions for the first number in the Contents column. Press the spring-loaded DEP switch. Set the switch register to the appropriate positions for the next number in the Contents column. Repeat steps 4 and 5 until all the numbers in the column have been used. Set the switch register to the appropriate positions for the number 001000. Press the spring-loaded LOAD ADDR switch. Press the spring-loaded START switch. 10. Continue to step 11 in the Bootstrapping the System section of this appendix. APPENDIX B SELECTED SYSTEM TOPICS The remarks in this appendix cover a variety of topics that should prove helpful to you as you perform the demonstrations in the manual. Included, for example, are instructions for starting and stopping the system, alternate methods for performing some system operations, and directions for using the language volume. The sections are listed here in the order in which they are referenced from within the text of the manual. You can plan to take a break at the end of any individual chapter in this manual. If you intend to be away from the computer system for any length of time, you should halt the system and remove your system and storage volumes. Perform the following steps in order: 1. Stop the computer. STOPPING AND STARTING THE SYSTEM Stopping the System e If your computer is a PDP-11/23-PLUS, lift the HALT toggle switch to the up position. e If your computer is a PDP-11/24 or a PDP-11/44, push the HALT/CONT/BOOT horizontal toggle switch to the HALT position. e If your computer operator’s console has switches, press the HALT switch. e If your computer operator’s console has pushbuttons, hold the CNTRL button down and push the HLT/SS button. 2. Unload the system volume. Set the device unit to an off-line condition, and remove the system volume. 3. Unload the storage volume. Set the device unit to an offline condition, and remove the storage volume. 4. Remove and save all terminal and line printer output listings. Perform the following steps in order: 1. Follow the bootstrap procedure, as described in Chapter 2 or Appendix A. Starting the System Selected System Topics Enter the current date and time-of-day (Chapter 4). Make any necessary logical device assignments. For the examples in this manual, you must assign the logical name VOL: to your storage volume (Chapter 4). THE SYSTEM STOPS UNEXPECTEDLY If for any reason the computer system stops unexpectedly, re- quest help from an experienced user if possible. The problem may be accompanied by an error message (see the R7T-11 System Message Manual); the problem may be in the hardware, in the software, or in your program. Once the problem is diagnosed and corrected, try to bootstrap the system again. SUGGESTIONS FOR BOOTSTRAPPING THE SYSTEM You must be able to bootstrap your RT-11 system before you can perform the demonstrations in this manual. Three common bootstrapping problems and suggestions for their correction follow. 1. You cannot remember how to bootstrap your system. Ask an experienced RT-11 user to help you. If no one is available, read the bootstrapping instructions in the RT—11 Automatic Installation Booklet or the RT-11 Installation Guide. If necessary consult the appropriate hardware manuals for the devices that are part of your system; these manuals provide a description of the device and operating proce- dures. Then try the bootstrap procedures again. You have followed the bootstrapping instructions correctly, but your system printed a message other than what you expected. a. The message can be one of the following: ?BO0OT-F~-No boot on volume ?BOOT-U-Conflicting SYSGEN ortions ?BO0OT-U-Handler file not found ?BO0OT-U-Insufficient memory ?BOOT-U-I/Derror ?800T-U-Manitar file not found ?BOOT~-U-No KT11 ?BO0OT-U-Swar file too small ?PBOOT-U-SWAP.S5YS not found Selected System Topics ?BO0OT-W-Error redding handler ?BOOT-W-Invalid ormissing TT.SYS These are bootstrap error messages, indicating that a problem in the system is preventing bootstrapping. These eleven messages are fully explained in the RT-11 System Message Manual, but you should not try to correct the problem yourself if an experienced user is available to help. b. The message can be one of the following: RT-118J VOS-xx RT-11XM VOS-xx These indicate that a valid RT-11 V5 monitor program has been bootstrapped, but it is not the one you should be using. Reboot the correct monitor program by typing the following commands on the terminal: . BOOTGEED Device or file? RT11FB,.SYSED c. Any other message indicates that an old version of RT-11 (V1, V2, V2B, V2C, V3, V3B, or V4) has been bootstrapped. Only Version 5 of RT-11 can be used to perform the demonstrations in this manual. 3. You followed the bootstrapping instructions correctly, but nothing happened, that is, there was no terminal response at all. Repeat the bootstrap procedure from the beginning. Before you begin, make sure that the system volume is properly mounted in device unit 0. The computer should be on but not running (the light labeled RUN should not be on); if the computer is running, stop it as described above. Make sure that the terminal is on line and that its baud rate is set to 300. If you are using a display terminal, make sure that the screen is bright enough for you to read. If your terminal uses a paper printer, make sure that the paper is properly loaded. A copy of the RT-11 Version 5 system volume, as distributed by DIGITAL, should be stored away for safekeeping as a backup copy. If you do not have a backup copy of your system volume, create one before you continue. Manual backup instructions are in the RT-11 Installation Guide; an experienced user should perform the backup operation. B-3 BACKING UP THE SYSTEM VOLUME Selected System Topics DIRECTORY- VS NONDIRECTORY- STRUCTURED VOLUMES Storage volumes are called file-structured volumes because they are capable of physically storing files. These volumes can be further categorized as directory-structured and nondirectory- structured; the distinction is based on the method of directory information storage, collection, and printing. Directory information includes file names and types, dates of creation, and (in most cases) file lengths. When you type the DIRECTORY command, this directory information prints on your terminal. Volumes such as disks and diskettes keep this information in a single place at the beginning of the volume. Each time you add or delete a file, the directory information is updated. These volumes, which maintain a directory separately from the files described, are said to be directory-structured. Magtape volumes, on the other hand, do not keep directory information in any single, separate place on the tape but rather with each individual file. For these volumes the directory information is collected for printing as each file is encountered during a sequential reading of all files on the tape. Thus, these volumes are said to be nondirectory-structured. You can list the directory from either type of volume in complete or abbreviated format. Complete directories include the file name, file type, file length, and date of creation (if the DATE command was used before the file’s creation). For most volumes, the directory format is as follows: 8-Jan-83 FILE LTYP 26 Zi-Feb-80 Abbreviated directories include only the file name and file type, and are printed in five columns. For more information about directory-structured and nondirectory-structured volumes, see the RT-11 System User’s Guide. ALTERNATE RENAME OPERATION FOR MAGTAPE USERS You cannot use the RENAME monitor command if your volume is a magtape because of the magtape’s sequential (nondirectorystructured) nature. To perform the RENAME operation, you must first copy the file, using the new file name, and then delete the old file. For example, to change the name of the GRAPH.TWO file, lo- cated on your storage volume, to GRAPH.FOR, first make a copy of GRAPH.TWO, giving the new file the name GRAPH.FOR. Long Command Format . COPYGED From? VOL:GRAPH.TWOGED To 7 GRAPH.FORGD B4 Selected System Topics Short Command Format ,COPY YOL:GRAPH.TWO GRAPH.FORED You now have two copies of the GRAPH file. Delete the one not wanted, using the monitor DELETE command. (This command is described in Chapter 7 in the section entitled File Delete Operations.) Long Command Format .DELETE@® Files? VOL:GRAPH.TWOGED Short Command Format JDELETE VOL:CRAPH, TWOED A single copy of GRAPH.FOR now resides on your system volume. Copy the file onto your storage volume. Long Command Format ,COPYED From? GRAPH.FORGED To ? VOL:GRAPH,FORGD Short Command Format ,COPY GRAPH,FDOR VOL:GRAPH.FORGEED Delete the original file. Long Command Format ,DELETEGE Files? GRAPH,FORGRD Short Command Format (DELETE GRAPH.FORED The combined effect of these four commands is to “rename” GRAPH.TWO to GRAPH.FOR. The FORTRAN/BASIC language volume was created during system installation specifically for your use with this manual. USING THE FORTRAN/BASIC This volume contains the FORTRAN IV and/or BASIC-11 lan- LANGUAGE VOLUME guage processors and the monitor files required to use these language processors. Before you can perform the FORTRAN IV or BASIC-11 demonstrations, you must substitute B-5 this Selected System Topics FORTRAN/BASIC language volume for the system volume currently mounted in device unit 0. The language volume then serves as the system volume during the course of the FORTRAN IV and BASIC-11 demonstrations. Make sure that no system operations are in progress (the monitor prompt, the period, should appear at the left margin of the terminal printer), and stop the system (see Stopping and Starting the System, this appendix). Now remove the system volume currently loaded in device unit 0, and insert and write- protect the language volume. Bootstrap the system (see Stopping and Starting the System, this appendix). The following monitor message should appear: RT-11FB VYOS xx Write-enable the volume. Then enter the current date and time-of-day, and assign the logical name VOL: to your storage volume, just as you did in Chapter 4. When you have done this, you are ready to run the language demonstration. Return to the main text of this manual. SUBSTITUTING VOLUMES DURING OPERATIONS Users of FORTRAN IV on diskette who have the FORTRAN IV language processor on a volume apart from their system volume must occasionally copy files and substitute volumes. These operations are necessary when files needed are not stored on a currently mounted volume. The appropriate volume, containing needed files, must be substituted for a currently mounted volume. If the volume to be dismounted contains nec- essary files, these files must be copied to a volume that will remain mounted. For example, before you can compile the FORTRAN IV file THIRD.FOR, you must substitute the language volume containing the FORTRAN IV compiler for the system volume currently loaded in device unit 0. First, however, you must copy the file THIRD.FOR to your storage volume so that it will be available for use. Long Command Format ,COPY@ED From? THIRD.FORGED To 7 VOL:THIRD.FODRED Short Command Format +COPY THIRD,FOR VOL:THIRD.FORGED Selected System Topics When the copy operation is finished, stop the system, remove the system volume currently loaded in unit 0, and insert and write-protect the language volume. See Stopping and Starting the System (this appendix) if necessary. The following message appears when the language volume is bootstrapped. . XX VOS RT-11FB Write-enable the volume. Then enter the current date and time-of-day, and assign logical name VOL: to your storage volume, as described in Chapter 4. Next, compile the FORTRAN IV program THIRD.FOR, which is now on VOL.. Long Command Format +FORTRANGED Files? VOL:THIRD.FORGD PUTSTR Short Command Format +FORTRAN VOL:THIRDG®ED PUTSTR The FORTRAN command causes the object module to be created on the default storage volume, which is presently the system volume (that is, the language volume). Any errors that occur during the compile operation indicate that the source file, THIRD.FOR, contains typographical errors. You must edit the file to correct any errors, recompile, and then copy the file to VOL:. Once you have an object module compiled without error and stored on VOL:, reload the main system volume in unit 0. Follow the directions in Stopping and Starting the System. Bootstrap and write-enable the system volume, enter the current date and time-of-day, and assign the logical name VOL: to your storage volume. Now copy the object module on VOL: back to the system volume. Long Command Format +COPYGED From? To ? UDOL:THIRD OBJED THIRD.OBJGD Short Command Format +COPY VOL:THIRD.OBJ THIRD.OBJGED Continue to Chapter 13, to the section entitled Building the Object Library. B-7 Selected System Topics USING THE LINK VOLUME The LINK volume was created during system installation for you to use with this manual. This volume contains the linker, LINK.SAV, and the system subroutine library, SYSLIB.OBJ. Before you can perform the linking demonstrations in Chapters 9 and 12, you must substitute this LINK volume for your cur- rent system volume, which is mounted in device unit 0. The LINK volume then serves as the system volume during the course of the linking demonstration. First, transfer the object file you need to link to the storage volume. Long Command Format +COPYRED From? GRAPH,.OBJGED To YDL:GRAPH,OBJGED 7 Short Command Format +COPY GRAPH.0BJ YOL:GRAPH.OBJGED Make sure that no system operations are in progress (the monitor prompt, the period, should appear at the left margin of the terminal printer), and stop the system (see Stopping and Starting the System, this appendix). Now remove the system volume currently loaded in device unit 0, and insert and writeprotect the LINK volume. Bootstrap the system. The following monitor message should appear: RT-11FB VOS5 . xx Write-enable the volume. Then enter the current date and time, and assign the logical name VOL: to your storage volume, just as you did in Chapter 4. Finally, transfer the object file from the storage volume to the system volume. Long Command Format +COPYGED From? UOL:GRAPH.OBJED To ? GRAPH,OBJGED Short Command Format +COPY VOL:GRAPH.OBJ GRAPH.OBJRED When you have done this, you are ready to run the linking demonstration. Return to the main text of this manual. Selected System Topics Follow the file maintenance operations outlined in this section if you substituted both a FORTRAN IV language volume and a LINK volume to perform the demonstrations in Chapter 9. First, mount the FORTRAN IV language volume in device unit 0. If you do not remember how to do this, follow the instructions in the section of this appendix entitled Using the FORTRAN/ BASIC Language Volume. Next, obtain a directory listing of all the files on your FORTRAN IV volume that have the name GRAPH, regardless of file type; these files were generated as a result of the exercises in Chapter 9. Long and Short Command Formats +DIRECTORY GRAPH.*@0D 8-Jan-83 GRAPH .BAK GRAPH 2 16 .0BJ 4 Filess» 48 Free 28 08-Jan-83 0B8-Jan-83 GRAPH GRAPH .FOR 2 08-Jan-83 ,LST 8 08-Jan-83 BlocKs blocKks Since you have corrected errors in the source file GRAPH.FOR, the version on your storage volume is obsolete. Transfer the corrected GRAPH.FOR file from your system volume to VOL:, thus replacing the obsolete file. Long Command Format +COPYGED From? GRAPH.FORGD To 7 VOL:GRAPH.FORGEED Short Command Format +COPY GRAPH.FOR VOL:GRAPH.FORGED Next, transfer GRAPH.LST to your storage volume. This en- ables you to examine the listing without having to recompile the program. Long Command Format +COPYED From? GRAPH.,LSTGED To 7 VOL:GRAPH.LSTGEED Short Command Format +COPY GRAPH.LST VOL:GRAPH.LSTED Once you have transferred all valuable files to your storage volume, delete the unnecessary files from the system volume. B-9 FORTRAN/LINK FILE MAINTENANCE Selected System Topics Long Command Format JDELETERED Files? GRAPH.*GD deleted: Files DK.GRAPH.BAK DK,.GRAPH.FOR DK.GRAPH.O0BJ DK.GRAPH.LST 7 7 7 7 YGED YED Y@ YED Short Command Format GRAPH, #GHD +DELETE Files deleted: DK .GRAPH.BAK DK.GRAPH.FOR DK.GRAPH.0BJ DK .GRAPH.LST 7 7 7 7 YGED YED YED YGD Make sure that no system operations are in progress (the monitor prompt, the period, should appear at the left margin of the terminal printer), and stop the system (see Stopping and Starting the System, this appendix). Now remove the system volume currently loaded in device unit 0, and insert and writeprotect the LINK volume. Bootstrap the system (see Stopping and Starting the System, this appendix). The following monitor message should appear: RT-11FB VYOS xx Write-enable the volume. Then enter the current date and time, and assign the logical name VOL: to your storage volume, just as you did in Chapter 4. Obtain a directory of all files on the system volume that have the name GRAPH, regardless of file type; these files were cre- ated as a result of the linking demonstrations in Chapter 9. Long and Short Command Formats ,DIRECTORY e GRAPH.*ED 8-Jan-83 GRAPH .0BJ 2 Filess 80 Free 14 33 08-Jan-83 GRAPH ,S5AV 13 08-Jan-B83 BlocKs blocks Transfer GRAPH.SAV to your storage volume. Because GRAPH.SAV is an executable file, you can run the program without relinking it. Long Command Format .COPY@ED From? GRAPH.SAVEED To ? VOL:GRAPH.SAVGEED B-10 Selected System Topics Short Command Format +COPY GRAPH.SAY VOL:GRAPH.SAVED Next, delete the unnecessary files from your system volume. Long Command Format +DELETEGD Files? GRAPH.0BJ GRAPH.SAVGED Short Command Format +DELETE GRAPH.OBJ,GRAPH.SAVGRD Finally, list the up-to-date directory of your storage volume so that you can see its current status. +DIRECTORY VOL:G@D Leave the LINK volume mounted in device unit 0, and proceed to Chapter 12, Linking Object Programs. B-11 Glossary Absolute address The binary number that is assigned as the address of a physical memory storage location. Absolute section The portion of a program in which the programmer has specified physical memory locations of data items. Access time The interval between the instant at which data is requested from or for a storage device and the instant at which the data actually begins moving to or from the device. ADC (Analog to Digital Converter) A circuit that converts analog (voltage) signals to binary data. Address A label, name, or number that designates a location in memory where information is stored. Algorithm A prescribed set of well-defined rules or processes for the solution of a problem in a finite number of steps. Alphanumeric The subset of ASCII characters including the 26 alphabetic characters and the 10 numeric characters. ANSI American National Standards Institute. Application program (or package) A program that performs a function specific to the needs of a particular end-user or class of end-users. An application program can be any program that is not part of the basic operating system. Argument A variable or constant value supplied with a command that controls the command’s action, specifically its location, direction, or range. Array An ordered arrangement of subscripted variables. Glossary-1 Glossary ASCII The American Standard Code for Information Interchange; a standard code consisting of eight-bit coded characters for upper- and lower-case letters, numbers, punctuation, and special communication control characters. Assembiler A program that translates symbolic source code into ma- chine instructions. This program replaces symbolic oper- ation codes with binary operation codes and symbolic addresses with absolute or relocatable addresses. Assembly language A symbolic programming language that can be translated directly into machine language instructions and is specific to a given type of control processing unit. Assembily listing A listing, produced by an assembler, that shows the symbolic code written by a programmer next to a repre- sentation of the actual machine instructions generated. Asynchronous The type of operation that is triggered by another event, as opposed to synchronous, or occurring at set time intervals. Background program A program that runs at a low priority, that is, when a higher priority (foreground) program is not using system resources. Backup file A copy of a file, created as a precaution against loss of the primary file. Base address An address used as the basis for computing the value of some other relative address; the address of the first location of a program or data area. BASIC-11 (Beginner’s All-purpose Symbolic Instruction Code) An interactive, algebraic computer language that combines English words and decimal numbers. It is a widely available, standardized, simple beginner’s language ca- pable of handling industry and business applications. Batch processing A processing method in which programs are run consec- utively without operator intervention. Glossary—2 Glossary Baud A unit of measurement of transmission speed; bits per second. Binary The number system with a base of two; used by the internal logic of all digital computers. Binary code A code that uses two distinct characters, usually the numbers 0 and 1. Bit A binary digit. The smallest unit of information in a binary system of notation. It corresponds to a 1 or 0 and to one digit position in a physical memory word. Block A group of physically adjacent words or bytes of a size that is specific to a device. For input/output operations, the smallest addressable unit on a mass storage device. Bootstrap A technique or routine whose first instructions are sufficient to start a system of programs that bring an operating system into memory. BOT (Beginning Of Tape) A reflective marker that is applied to the backside of magtape and identifies the beginning of the magtape’s recordable surface. Bottom address The lowest memory address into which a program is loaded. Breakpoint A location at which program operation is suspended to allow operator investigation. Buffer A storage area used to temporarily hold information being transferred between two devices or between a device and memory. A buffer is often a special register or a designated area of memory. Bug A flaw in the design or implementation of a program; a problem that can cause erroneous results. Glossary—3 Glossary A flat, flexible cable consisting of many transmission lines, or wires. It interconnects computer system components to provide communication paths for addresses, data, and control information. Byte The smallest memory-addressable unit of information. In a PDP-11 computer system, a byte is equivalent to eight bits. Call A transfer from one part of a program to another with the ability to return to the original program at the point of the call. Calling sequence A specified arrangement of the instructions and data necessary to pass parameters and control to a given subroutine. Central processing unit (CPU) A hardware unit of a computer that includes main memory and the registers and circuits that control the interpretation and execution of instructions. Character A single letter, numeral, or symbol used to represent information. Character pointer The place where the next character typed will be entered. During editing, the character pointer indicates the place in an ASCII text file where the next character typed will be entered into the file. Clear To delete the contents of a storage location by replacing the contents, usually with Os or spaces. Clock A device within a computer system that keeps time, counts pulses, measures frequency, or generates regular periodic signals for synchronization. Code A system of symbols used to represent data or instructions that are executed by a computer. Glossary—4 Glossary Coding The writing of instructions for a computer, using a system of symbols that is meaningful to a computer, an assembler, a compiler, or a language processor. Command A word, mnemonic, or character that, by virtue of its syntax in an input line, causes a computer system to perform a predefined operation. Command language The vocabulary used by a program or set of programs that directs the computer system to perform predefined operations. Command language interpreter The program that translates a predefined set of commands into instructions that a computer system can interpret. Command string A line of input entered into a computer system that generally includes a command, one or more file specifications, and optional qualifiers. Compile To produce binary code from the symbolic instructions of a high-level source language. Compiler A program that translates a high-level source language into machine instructions. Computer A machine that can be programmed to execute a set of instructions. Computer program A plan or routine for solving a problem on a computer. Computer system A data processing system that consists of hardware devices, software programs, and documentation that describes the operation of the system. Concatenation The joining of two or more strings of characters to produce a single string. Glossary—5 Glossary Conditional assembly The assembly of certain parts of a symbolic program that occurs only when certain conditions are met during the assembly process. Configuration A selection of hardware devices, software routines, or programs that function together. Console terminal A keyboard terminal that acts as the primary interface between the computer operator and the computer system. The console terminal is used to initiate and direct system operations by running software on the computer. Constant A value that remains the same throughout a distinct operation. (Compare with Variable.) Context switching The saving of key registers and other memory areas before switching between jobs with different modes of execution. An example of context switching is the use of foreground/background programming. Conversational See Interactive. CPU See Central processing unit. Crash A hardware crash is the failure of a particular device to operate; the operation of an entire computer system may be affected. A software crash is the result of an operating system malfunctioning; the system’s protection mechanisms may have failed or the software may not have executed correctly. Create To open, write data to, and close a file for the first time. Cross-reference listing A printed listing that identifies all references in a program to each specific symbol in a program. It includes a list of all the symbols used in a source program and the statements where the symbols are defined or used. Glossary-6 Glossary Current location counter A counter kept by an assembler to determine the address assigned to an instruction or constant being assembled. Data A term used to denote facts, numbers, letters, and symbols. Data are the basic elements of information that can be processed by a computer. Data base An organized collection of interrelated data items that allow one or more applications to process the items, while disregarding physical storage locations. Data collection To bring data from one or more locations to a central location for eventual processing. Debug To detect, locate, and correct coding or logic errors in a computer program. Default The value of an argument, operand, or field assumed by a program if not specifically supplied by the user. Define To assign a value to a variable or constant. Delimiter A character that separates, terminates, or organizes elements of a character string, statement, or program. Device A hardware unit such as an I/O peripheral, magnetic tape drive, or line printer. Device control unit A hardware unit that electronically supervises one or more of the same type of devices. It acts as the link between the computer and the I/O devices. Device handier A routine that services and controls the hardware activities of an I/O device. Device independence The ability to program I/O operations independently of the device for which the I/O is intended. Glossary-7 Glossary Device name A unique name that identifies each device unit on a system. It consists of a two-letter device mnemonic followed by an optional device unit number and a colon. For example, the common device name for RL02 disk drive unit 1 is DL1:. Device unit One of a set of similar peripheral devices. An example of a device unit is disk unit 0. It may be used synonymously with volume. Diagnostics A set of procedures used to detect and isolate malfunc- tions and mistakes. Digit A character used to represent one of the non-negative integers smaller than the radix (for example, in decimal notation, one of the characters 0 to 9; in octal notation, one of the characters 0 to 7; in binary notation, one of the characters 0 and 1). Direct access See Random access. Directive Assembler directives are mnemonics in an assembly language source program that are recognized by the assem- bler as commands to control a specific assembly process. Directory A file in the form of a table containing the names of and pointers to files on a mass storage volume. Directory-structured A storage volume is directory structured if the directory at the beginning of the volume contains information (file name, file type, length, and date-of-creation) about all the files on the volume. Such volumes include all disks, diskettes, and DECtapes. Disk device An aucxiliary storage device on which information can be read or written. Display A peripheral device used to represent data graphically; normally refers to some type of cathode-ray tube system. Glossary—8 Glossary Downtime The time interval during which a device or system is inoperative. Echo The printing of characters typed by the programmer on an I/0 device such as a terminal. Edit To arrange and/or modify the format of data; for example, to insert or delete characters. Editor A program that allows the user to enter text into the computer and edit it. Editors are language-independent and will edit anything in character representation. Effective address The address used in the execution of a computer instruction. Emulator A hardware device that permits a program written for a specific computer system to be run on a different type of computer system. Entry point A location in a subroutine to which program control is transferred when the subroutine is called. EOT (End Of Tape) A reflective marker applied to the backside of magtape, which precedes the end of the reel. Error Any discrepancy between a computed, observed, or measured quantity and the specified value or condition. Execute To perform an instruction or run a program on the computer. Expression V A combination of operands and operators that can be evaluated to a distinct result by a computing system. Extension The synonym used for file type. Glossary-9 Glossary External storage A storage medium other than main memory, for example, a disk or tape. Field A specified area of a record used for a particular category of data. FIFO (First In/First Out) A data manipulation method in which the first item stored is the first item processed. File A logical collection of data that is treated as a unit, occupies one or more blocks on a mass storage volume, and has an associated file name and type. File maintenance The activity of keeping a mass storage volume and its directory up to date by adding, changing, or deleting files. File name The alphanumeric character string assigned by a user to identify a file. It can be read by both an operating system and a user. A file name has a fixed maximum length that is system-dependent. (The maximum length in an RT-11 operating system is six characters, the first of which must be alphabetic. Spaces are not allowed.) File specification A name that uniquely identifies a file maintained in any operating system. A file specification generally consists of at least three components: a device name, a file name, and a file type. File-structured device A device on which data is organized into files. The device usually contains a directory of the files stored on the volume. (For example, a disk is a file-structured device, but a line printer is not.) File type The alphanumeric character string assigned to a file ei- ther by an operating system or a user. It can be read by both the operating system and the user. System-recognizable file types are used to identify files having the same format or type. If present in a file specification, a file type follows the file name in a file specification, separated from the file name by a period. A file type has a Glossary-10 Glossary fixed maximum length that is system-dependent. The maximum in an RT-11 operating system is three characters, not including any spaces and excluding the preceding period. Flag A variable or register used to record the status of a program or device; the detection of errors by a translating program. Floating point A number system in which the position of the radix point is indicated by the exponent part of a number and another part represents the significant digits or frac- tional portion of a number (for example, 5.39 X 10° — Decimal; 137.3 X 8* — Octal; 101.10 X 2° — Binary). Flowchart A graphical representation for the definition, analysis, or solution of a problem, in which symbols are used to represent operations, data, flow, and equipment. Foreground The area in memory designated for use by a highpriority program. The program that gains the use of machine facilities immediately upon request. FORTRAN IV (FORmula TRANslation) A problem-oriented language designed to permit scientists and engineers to express mathematical operations in a form with which they are familiar. It is also used in a variety of applications, including process control, information retrieval, and commercial data processing. Full duplex In communication, pertaining to a simultaneous, twoway, independent, asynchronous transmission. Function An algorithm, accessible by name and contained in the system software, that performs commonly used operations. For example, the square root calculation function. General register One of eight 16-bit internal registers in the PDP-11 computer. These are used for temporary storage of data. Global A value defined in one program module and used in others. Globals are often referred to as entry points in Glossary-11 Glossary the module in which they are defined and as externals in the other modules that use them. Half duplex Pertaining to a communication system in which twoway communication is possible, but only one way at a time. Handler See Device handler. Hardware The physical equipment components of a computer system. Hardware bootstrap A bootstrap that is inherent in the hardware and need only be activated by specifying the appropriate load and start address. High-level language A programming language whose statements are translated into more than one machine language instruction. Examples are BASIC-11 and FORTRAN IV. High-order byte The most significant byte in a word. The high-order byte occupies bit positions 8 through 15 of a PDP-11 word and is always an odd address. Image mode A mode of data transfer in which each byte of data is transferred without any interpretation or data changes. Indirect address An address that specifies a storage location containing either a direct (effective) address or another indirect (pointer) address. Indirect file A file containing commands that are processed sequentially, and that could have been entered interactively at a terminal. Initialize To set counters, switches, or addresses to starting values at prescribed points in the execution of a program, particularly in preparation for re-execution of a sequence of code. To format a volume in a particular file-structured format in preparation for use by an operating system. Glossary—12 Glossary input The data to be processed; the process of transferring data from external storage to internal storage. input/Output device A device attached to a computer that makes it possible to bring information into the computer or get information out. instruction A coded command that tells the computer what to do and where to find the values it is to work with. A symbolic instruction looks like ordinary language. Symbolic instructions must be changed into machine instructions before they can be executed by the computer. Interactive processing A technique of user/system communication in which the operating system immediately acknowledges and acts upon requests entered by the user at a terminal. Compare with batch processing. interface A shared boundary. An interface might be a hardware component to link two devices, or it might be a portion of storage or registers accessed by two or more computer programs. internal storage The storage facilities that form an integral physical part of the computer and that are directly controlled by the computer; for example, the registers of the machine and main memory. Interpreter A computer program that translates and executes a source language statement before translating and executing the next statement. interrupt A signal that, when activated, causes a transfer of control to a specific location in memory and breaks the normal flow of control of the routine being executed. interrupt-driven Software that uses the interrupt facility of a computer to handle IO and responds to user requests: RT-11 is such a system. Glossary—-13 Glossary Interrupt vector Two words containing the address of an interrupt service routine and the processor state at which that routine is to execute. Iteration Repetition of a group of instructions. Job A group of data and control statements that does a unit of work. A program and all of its related subroutines, data, and control statements is an example; also, a batch control file. Label One or more characters used to identify a source language statement or line. Latency The time from the initiation of a transfer operation to the beginning of actual transfer; that is, verification plus search time. The delay while waiting for a rotating memory to reach a given location. Library A file containing one or more macro definitions or one or more relocatable object modules that are routines that can be incorporated into other programs. LIFO (Last in/First Out) A data manipulation method in which the last item stored is the first item processed; a push-down stack. Light pen A device, resembling a pencil or stylus, that can detect a fluorescent cathode-ray tube (CRT) screen. The pen is used to input information to a CRT display system. Linkage The code that connects two separately coded routines and passes values and/or control between them. Linked file A file whose blocks are joined together by references rather than by consecutive locations. Linker A program that combines many relocatable object mod- ules into an executable module. It satisfies global references and combines program sections. Glossary—-14 Glossary Listing The printed copy generated by a line printer or terminal. Load To store a program or data in memory. To place a volume on a device unit and put the unit on line. Load map A table, produced by a linker, that provides information about a load module’s characteristics; for example, the transfer address, the global symbol values, and the low and high limits of the relocatable code. Load module A program in a format that is ready for loading and executing. Location An address in storage or memory where a unit of data or an instruction can be stored. Locked Pertaining to routines in memory that presently cannot be swapped or transferred. Logical device name An alphanumeric name assigned by the user to represent a physical device. The name can then be used synonymously with the physical device name in all references to the device. Logical device names are used in device-independent systems to enable a program to refer to a logical device name assigned to a physical device at run-time. Loop A sequence of instructions that is executed repeatedly until a terminal condition prevails. Low-order byte The least significant byte in a word. The low-order byte occupies bit positions 0 through 7 in a PDP-11 word and is always an even address. Machine language The language used by the computer when performing operations. Macro An instruction in a source language that is equivalent to a specified sequence of assembler instructions, or a com- Glossary-15 Glossary mand in a command language that is equivalent to a specified sequence of commands. Main program The module of a program that contains the instructions at which program execution begins. The main program usually exercises primary control over the operations performed; it also calls subroutines or subprograms to perform specific functions. Mask A combination of bits that is used to manipulate selected portions of any word, character, byte, or register while retaining other parts for use. Mass storage Pertaining to a device that can store large amounts of data that are readily accessible to the computer. Matrix A rectangular array of elements. Any matrix can be considered an array. Memory Any form of data storage, including main memory and mass storage, in which data can be read and written. Memory usually refers to main memory. Memory image A replication of the contents of a portion of memory, usually in a file. Mnemonic An alphabetic easy-to-remember representation of a function or machine instruction. Monitor The master control program that observes, supervises, controls or verifies the operation of a computer system. The collection of routines that controls the operation of user and system programs, schedules operations, allocates resources, performs I/0, and so forth. Monitor command An instruction or command issued directly to a monitor from a user. Monitor command mode The state of the operating system — indicated by a period at the left margin — that allows monitor commands to be entered from the terminal. Glossary--16 Glossary Mount a volume To logically associate a physical mass storage medium with a physical device unit. To place a volume on a physical device unit; for example, to place a magtape on a magtape drive and put the drive on line. Multiprocessing Simultaneous execution of two or more computer pro- grams by a computer which contains more than one central processor. Multiprogramming A processing method in which more than one task is in an executable state at any one time, even with one CPU. Nondirectory-structured Refers to a storage volume that is sequential in structure and therefore has no volume directory at its beginning. File information (file name, file type, length, and date-of-creation) is provided with each file on the volume. Such volumes include magtape and cassette. Non-file-structured device A device, such as a line printer or terminal, in which data cannot be organized as multiple files. Object code Relocatable machine language code. Object module The primary output of an assembler or compiler, which can be linked with other object modules and loaded into memory as a runnable program. The object module is composed of the relocatable machine language code, relocation information, and the corresponding global symbol table defining the use of symbols within the module. Object Time System (OTS) The collection of modules that is called by compiled code in order to perform various utility or supervisory operations; for example, FORTRAN IV Object Time System. Octal Pertaining to the number system with a radix of eight; for example, octal 100 is decimal 64. oDT On-line Debugging Technique: an interactive program for finding and correcting errors in programs. Off-line Pertaining to equipment or devices not currently under direct control of the computer. Glossary-17 Glossary Offset The difference between a base location and the location of an element related to the base location. The number of locations relative to the base of an array, string, or block. One’s complement A number formed by interchanging the bit polarities in a binary number; for example, 1s become 0s; 0s become 1s. On-line Pertaining to equipment or devices directly connected to and under control of the computer. Op-code (operation code) The part of a machine language instruction that identifies the operation the CPU is to perform. Operand The data that an instruction operates upon. An operand is usually identified by an address part of an instruction. Operating system The collection of programs, including a monitor and sys- tem programs, that organizes a central processor and peripheral devices into a working unit for the develop- ment and execution of application programs. Operation The act specified by a single computer instruction. A program step undertaken or executed by a computer; for example, addition, multiplication, comparison. The operation is usually specified by the operator part of an in- struction. Operation code See Op-code. Operator’s console The set of switches and display lights used by an operator or a programmer to determine the status of the computer system and to start the computer. Option An element of a command or command string that en- ables the user to select alternatives associated with the command. In the RT-11 operating system, an option consists of a slash character (/) followed by the option name and, optionally, a colon, and an option value. Glossary-18 Glossary Output The result of a process; the transferring of data from internal storage to external storage. Overfiow A condition that occurs when a mathematical operation yields a result whose magnitude is larger than the hardware is capable of handling. Overlay segment A section of code treated as a unit that can overlay code already in memory and be overlaid by other overlay segments when called from the root segment or another resident overlay segment. Overlay structure A program overlay system consisting of a root segment and optionally one or more overlay segments. Page That portion of a text file delimited by form feed characters and generally 50 to 60 lines long. Corresponds approximately to a physical page of a program listing. Parameter A variable that is given a constant value for a specific purpose or process. Parity A binary digit appended to an array of binary digits to make the sum of all bits always odd or always even. It is used to check the validity of data. Patch To modify a routine in a rough or expedient way, usually by modifying the binary code rather than by assembling it again. PC See Program counter. PDP Programmable data processor. Peripheral device Any device distinct from the computer that can provide input and/or accept output from the computer. Physical device An I/O or peripheral storage device connected to or associated with a computer. Glossary-19 Glossary Priority A number, associated with a task, that determines the order in which the monitor will process the request for service by that task, relative to other tasks requesting service. Process A set of related procedures and data that are executed and manipulated by a computer. Processor In hardware, a data processor. In software, a computer program that includes the compiler, assembler, translator, and related functions for a specific programming language (for example, FORTRAN IV processor). Processor status word (PSW) A register in the PDP-11 that indicates the current priority of the processor, the condition of the previous operation, and other basic control items. Program A set of machine instructions or symbolic statements combined to perform some task. Program counter (PC) A register used by the central processor unit to record the addresses of the instructions to be executed. The PC (register 7 of the eight general registers) always contains the address of the next instruction to be executed, or the second or third word of the current instruction. Program development The process of writing, entering, translating, and debugging source programs. Programmed request A set of instructions (available only to programs) that is used to invoke a monitor service. Program section A named, contiguous unit of code (instructions or data) that is considered as an entity and that can be relocated separately without destroying the logic of the program. Protocol A formal set of conventions governing the format and relative timing of information exchange between two communicating processes. Glossary-20 Glossary PSW See Processor status word. Queue Any dynamic list of items; for example, items waiting to be scheduled or processed according to system- or userassigned priorities. Radix The base of a number system; the number of digit sym- bols required by a number system. RAM (Random-Access Memory) Memory that is accessed in such a way that the next location from which data is to be obtained is not dependent on the location of the previously obtained data. Random access Access to data in which the next location from which data is to be obtained is not dependent on the location of the previously obtained data. Contrast Sequential access. Read-only memory (ROM) Memory whose contents are not alterable by computer instructions. Real-time processing The computation performed while a related or controlled physical activity is occurring. The results of the compu- tation can be used for guiding the process. Record A collection of related items of data treated as a unit; for example, a line of source code or a person’s name, rank, and serial number. Recursive Pertaining to a repetitive process in which the result of each process is dependent upon the result of the previous one. Re-entrant Pertaining to a program composed of a shareable segment of pure code and a nonshareable segment that is the data area. Register See General register. Glossary-21 Glossary Relative address The number that specifies the difference between the actual address and a base address. Relocate In programming, to move a routine from one portion of storage to another and to adjust the necessary address references so that the routine, in its new location, can be executed. Resident Pertaining to data or instructions that are permanently located in main memory. Resource Any means available to users, such as computational power, programs, data files, storage capacity, or a combination of these. Restart To resume execution of a program. ROM See Read-only memory. Root segment The segment of an overlay structure that, when loaded, remains resident in memory during the execution of a program. Routine A set of instructions arranged in proper sequence to cause a computer to perform a desired operation. Run A single, continuous execution of a program. Sector A physical portion of a mass storage device. Segment See Overlay segment. Sequential access A method of data access in which the next location from which data is to be obtained immediately follows the location of the previously obtained data. Contrast Random access. Glossary—-22 Glossary Software The collection of programs and routines associated with a computer. Compilers and library routines are examples. Software bootstrap A bootstrap that is activated by loading the instructions of the bootstrap and specifying the appropriate load and start address. Source code Text, usually in the form of an ASCII format file, that represents a program. Such a file can be processed by an appropriate system program. Source language The system of symbols and syntax used to describe a procedure that a computer can execute. Spooling The technique by which /O with slow devices is placed on mass storage devices to await processing. Storage Pertaining to a device into which data can be entered, in which it can be held, and from which it can be retrieved at a later time. String A connected sequence of entities, such as a line of characters. Subprogram A program or a sequence of instructions that can be called to perform the same task (though perhaps on different data) at different points in a program, or in different programs. Subroutine See Subprogram. Subscript A numeric valued expression or expression element that is appended to a variable name to uniquely identify specific elements of an array. Subscripts are enclosed in parentheses. There is a subscript for each dimension of an array. Multiple subscripts must be separated by commas. For example, a two-dimensional subscript might be (2,5). Glossary-23 Glossary Supervisory programs Computer programs that have the primary function of scheduling, allocating, and controlling system resources. Swapping The process of moving data from memory to a mass storage device, temporarily using the empty memory area for another purpose, and then restoring the original data to memory. Synchronous Pertaining to related events where all changes occur si- multaneously or in definite timed intervals. Syntax The structure of expressions in a language and the rules governing the structure of a language. System program A program that performs system-level functions. A pro- gram that is part of the basic operating system (for example, a system utility program) is a system program. System volume The volume on which the operating system is stored. Table A collection of data in a well-defined list. Terminal An I/0O device, such as an LA120 terminal, that includes a keyboard and a display mechanism. In PDP-11 systems, a terminal is used as the primary communication device between a computer system and a user. Time sharing A method of allocating resources to multiple users so that the computer processes a number of programs concurrently. Toggle To use switches on the computer operator’s console to enter data into the computer memory. Translate To convert from one language to another. Trap A conditional jump to a known memory location performed automatically by hardware as a side effect of executing a processor instruction. The address location from Glossary—24 Glossary which the jump occurs is recorded. It is distinguished from an interrupt, which is caused by an external event. Truncation The reduction of precision by ignoring one or more of the least significant digits; for example, 3.141597 truncated to four decimal digits is 3.141. Turnkey Pertaining to a computer system sold in a ready-to-use state. Two’s complement A number used to represent the negative of a given value in many computers. This number is formed from the given binary value by changing all 1s to 0s and all 0s to 1s and then adding 1. Underflow A condition that occurs when a mathematical operation yields a result whose magnitude is smaller than the smallest amount the hardware can handle. User program An application program. Utility program Any general-purpose program included in an operating system to perform common functions. Variable The symbolic representation of a logical storage location that can contain a value that changes during a processing operation. Vector A consecutive list of associated data. Volume A mass storage medium that can be used for file-structured data storage. Wildcard A valid substitute for characters in a file specification. Used to perform operations on multiple files. Can be asterisks to represent entire file names or file types, or percent signs to represent single characters in file names or file types. Wildcard operation A shorthand method of referring to all files with a specific characteristic in their name. Glossary-25 Glossary Word Sixteen binary digits treated as a unit in PDP-11 computer memory. Write-enabled The condition of a volume that allows information to be written on it. Write-protected The condition of a volume that protects the volume against information being written on it. Glossary—26 INDEX Absolute program sections, 124 Addresses assignment by LINK, 12-3 Advance (A) command (EDIT), 5-9 Application packages, 1-10 Assembler, 11-2 Assembler errors, 11-7 Assembly language See Machine-level language Assembly listings, 11-8 demonstration program, 10-7 errors, 10-9 running, 10-1 exiting, 10-3 immediate mode, 10-3 interpreter, 10-2 language processor, 10-1 programming language, 10-1 BASIC-11 program creating, 10-4, 10-12 ASSIGN keyboard command assigning logical device names, 4-11 changing the output device, 9-11, 15-5 editing, 104 Background job creating, 15-2 directing input to, 154 editing, 15-2 executing, 15-5 running, 15-2 terminating, 15-6 Background program running, 15-1 saving, 10-12 Backup copy files, 17-1 system volume, B-3 BASIC-11 commands, 10-3 to 10--13 command summary edit, 106 execution, 10-11 file maintenance, 10-13 maintaining files, 10-12 replacing, 10-13 running, 10-8 using, 10-12 BASIC-11 programming language, 1-10, 8-3 BASIC keyboard command, 10-2 BATCH stream, 17-1 Beginning (B) command (EDIT), 54 Bit definition of, 11-5 Bootstrap manual operations, A-1 procedure, 2—4 prompts and responses (table), 2-6 pushbutton console, A-1, A—4 relationship with computer (figure), 2-2 suggestions for bootstrapping, B-2 Index-1 Bootstrap (cont.) switch register console, A—1, A~5 terminal keyboard, A-3 typing, A-3 Breakpoints clearing, 14-9 clearing all, 14-10 setting, 14-8 /BRIEF DIRECTORY option, 4-14 BYE command BASIC-11, 10-3 Byte definition of, 11-5 Character insertion immediate mode, 5-17 Character search (EDIT), 5-9 Command arguments (EDIT) table of, 5-5 Commands BASIC See BASIC-11 control format of, 4-3 correcting typing errors, 44 EDIT See EDIT keyboard See Keyboard commands format of, 4-2 oDT See ODT Compiler, 9-2 Computer hardware configuration, 2-3 memory, 2-1 PDP-11 (figure), 1-3 Console, 14, 3-1 See also Terminals COPY keyboard command, 7-3 /CREATE EDIT option, 5-2 LIBRARY option, 13-2, 13-5 CREF table, 11-10 /CROSSREFERENCE MACRO option, 11-7 Cross-reference (CREF) listing, 11-10 Cross-reference (CREF) table See CREF table CTRL/B, 15-4 CTRL/C CTRL/C aborting program execution, 4-14 returning to BASIC~11 command mode, 10-9 Index-2 terminating background job, 15-6 terminating indirect file execution, 164 CTRL/C ESCAPE ESCAPE (EDIT), 5-6, 5-19 CTRL/D, 5-19 CTRLV/E, 4-7 CTRL/F, 15-4 CTRL/G, 5-18 CTRL/L, 5-10 CTRL/N, 5-18 CTRL/O, 4-12 CTRL/U, 4-4 CTRL/U (EDIT), 5-3, 5-8 CTRIL/V, 5-18 CTRL/X, 5-8 CTRL key, 3-4 Date See also Time displaying, 4-9 entering, 4-8 DATE keyboard command, 4-8 /DEBUG LINK option, 14-5 Debugging a program, 1-9 See also ODT techniques, 14-2 Decimal/octal/binary conversion, 11-6 Delete (D) command (EDIT), 5-8 DELETE (DEL) command BASIC-11, 10-5 DELETE key correcting typing errors, 4—4 editing, 5-3, 5-8 function, 3-3 immediate mode, 518 ODT, 14-6 DELETE keyboard command, 7-6 Demonstration programs BASIC-11, 10-7 creating, 5-19 FORTRAN, 5-20 library files, 13-3 load maps, 12-8 MACRO, 5-21 Device assignments changing, 9-11 Device handlers, 1-8 Device names, 4-9 Devices random-access, 1-5 random-access (figure), 1-5 Device unit, 3-5, 4-10 DIFFERENCES keyboard command, 6-2 DIRECTORY keyboard command, 4-12 Directory listings, 3-7, 4-12 generating, 7-1 Directory-structured volumes, B—4 Documentation, 1-10 hardware manuals, 1-10 software manuals, 1-11 source listings, 1-11 Drive See Device unit DUMP, 1-9 ESCAPE key, 34, 5-3 See also ESCAPE command and ESCAPE ESCAPE command Examples re-creating, 4-3 EXECUTE keyboard command, 9-12, 11-16 Exit (EX) command (EDIT), 5-3 FB monitor, 15-3 File maintenance BASIC-11, 10-12 programs, 1-9 See also File maintenance commands EDIT command arguments (table), 5-5 commands summary of, 5-13 exiting, 5-19 EDIT commands, 5-3 to 5-13 Editing command mode, 5-3 Editing commands ESCAPE returning to editing command mode, 5-19 Editing commands, multiple entering, 5-8 erasing, 5-8 EDIT keyboard command creating a file, 5-2 editing a file, 54 Edit lower (EL) command (EDIT), 5-12 Editors EDIT See EDIT Edit upper (EU) command (EDIT), 5-13 Errors avoiding programming, 14-1 types of assembler, 11-7 clerical, 14-2 compiler, 94 logical, 14-2 syntax, 14-2 File maintenance commands summary, 7-9 File maintenance operations, 7-1 File names, 3-7 changing, 7-5 Files backup copy, 5-12, 17-1 closing, 5-3, 5-11 comparing, 6-1, 6-2 copying, 7-3 creating, 5-2 deleting, 7-5 editing, 5-4 editing (figure), 5-2 indirect See Indirect command files paging, 5-2 protecting, 3-7, 7-7 removing protection from, 7-7 renaming, 5-6, 7—4 storing, 3-7 transferring, 7-3 File types, 3-7 changing, 7-5 File types (table), 4-13 Foreground/background environment, 15-1 Foreground/background monitor See FB monitor ESC Foreground/background program See ESCAPE key ESCAPE command /FOREGROUND/LINK option, 15-4 entering multiple commands, 5-8 returning to editing command mode, 5-19 ESCAPE ESCAPE command activating immediate mode, 5-17 executing editing commands, 5-3 executing multiple editing commands, 5-8 communication, 15-3 Foreground job creating, 154 directing input to, 15-4 executing, 15-5 linking, 154 loading device handlers, 15-5 terminating, 15-7 unloading, 15-7 Index-3 Foreground program running, 15-1 FORLIB.OBJ, 9-3, 12-7 FORTRAN compiler, 9-2 demonstration program, 5-20 running, 9-1 library modules, 9--2 object time system (OTS), 9-2 programming language, 1-10, 8-3 FORTRAN/BASIC language volume, B-5 FORTRAN demonstration program errors, 9-7 FORTRAN keyboard command, 9-4 FORTRAN language processor, 91 FORTRAN program Immediate mode (EDIT) character insertion, 5-17 VT11 display hardware, 5-16 Immediate mode (EDIT) commands, 5-17 to 5-19 VT11 display hardware (table), 5-17 Indirect command files, 16-1, 17-1 creating, 16-1 entering monitor commands, 16-1 executing, 16-4 using, 16-1 using the editor to create, 16-2 INITIALIZE keyboard command, 4-15 Initializing volumes, 4-15 Input/output devices See Peripheral devices compiling, 9-3 /TINSERT execution commands LIBRARY option, 13-6 Insert (I) command (EDIT), 5-3 summary, 9-14 linking, 9-8, 9-9, 12-7 producing a load map, 12-7 producing a load module, 12-7 running, 9-11 sectioning, 12-5 FORTRAN programming language, 9-1 FRUN keyboard command, 15-6 Get (G) command (EDIT), 5-9 Global symbols, 12-2 Graphics display terminal See VT11 display hardware GT keyboard command, 4-6 GT OFF keyboard command, 4-7, 5-2 GT ON keyboard command, 4-6, 5-16 Hardware, 1-1 computer, 1-1 storage medium, 14 terminal, 1-3 Hardware configuration, 2—1 computer, 2—-3 languages, 2—4 optional devices, 2—-4 storage volume, 2-4 system volume, 2—-3 terminal, 2-3 Hardware manuals, 1-10 HELP file, 17-2 HELP keyboard command, 17-2 High-level languages, 1-10, 8-1 See also BASIC-11 and FORTRAN Immediate mode BASIC-11, 10-3 Index—4 Internal symbols, 12-2 Interpreter description of, 10-2 Jobs background, 15-2 foreground, 15-4 Jump (J) command (EDIT), 5-7 Keyboard commands, 41 Keyboard layouts (figure), 3—-3 Keyboard monitor See KMON Keyboard symbols (table), 4-4 Kill (K) command (EDIT), 5-9 KMON, 4-1 Language comparisons (table), 8-2 Language processors, 1-10, 8-1 BASIC-11, 10-1 FORTRAN, 9-1 MACRO, 11-2 Languages See Programming languages Language volume FORTRAN/BASIC, B-5 Librarian, 1-9 See also Library files Library files creating, 13-2 demonstration programs, 13—-3 macro, 13-1 maintaining, 13-2 maintenance commands for summary, 13-7 demonstration program, 5-21 Library files (cont.) object libraries, 13—1 errors, 11-12 LIBRARY keyboard command, 13-2, 13-5 Library modules, 9-2 Library references running, 11-15 MACRO keyboard command, 11-7 MACRO language processor, 11-2 Macro library files, 13-1 resolving, 12-2 LINE FEED key, 3—4 ODT, 14-7 Linking a program, 1-9 See also LINK keyboard command and Link operation LINK keyboard command, 9-9 linking a foreground program, 15—4 linking a MACRO program, 11-14 linking ODT, 14-5 Link operations, 12-1 overlay feature, 12-6 resolving symbolic references, 12-2 summary of commands, 12-11 Link volume, B-8 FORTRAN option, 94 LIBRARY option, 13-6 MACRO option, 11-7 List (L) command (EDIT), 5-5 LIST command sectioning, 12-5 Macros, 1111 /MAP LINK option, 12-7 /MATCH DIFFERENCES option, 6-3 Memory, 2-1, 11-3 Memory image load module, 11-14 Monitor description of, 1-8 See Keyboard commands NEW command BASIC-11, 10-12 Next (N) command (EDIT), 5-11 Nondirectory-structured volumes, B4 LISTNH command BASIC-11, 10-6 : demonstration programs, 12-8 producing, 12-7 Load modules producing, 12-7 Logical device names assigning, 4-9 special (table), 4-10 Lowercase characters EDIT, 5-12 Machine language code, 114 Machine-level language, 1-10, 8-1 See also MACRO MACRO producing a load module, 127 Monitor program, 3—1 BASIC-11, 10-5 LIBRARY option, 13-2 producing a load map, 12-7 Monitor command format, 4-2 Monitor command language /LIST /MACRO assembling, 11-6 developing, 11-1 linking, 11-13, 11-14, 12-7 11-17 producing a load map, 12-7 producing a load module, 12-7 program relocation, 12-3 program sections, 12—4 resolving library references, 12-2 Load maps MACRO programs summary of execution commands, address assignment, 12-3 LOAD keyboard command, 15-5 running, 11-1 programming language, 8-3, 11-1 MACRO assembler, 11-2 Object libraries, 13-1 building, 13-2 creating input files, 13-2 listing, 13-6 updating, 13-6 Object module relocation (figure), 12-4 Object modules, 12-1 linking FORTRAN, 9-8 MACRO, 11-13 linking (figure), 9-9 Object programs linking, 12-1 Object time system (OTS), 9-2 ODT, 14-3 accessing general registers, 14-9 clearing breakpoints, 14-9 assembly listing, 11-8 Index-5 ODT (cont.) BASIC-11, 8-3, 10-1 closing the currently open location choosing, 8-1 address, 14-7 commands comparing (table), 8-2 summary, 1412 continuing execution, 14-9 DIBOL, 8-3 FORTRAN, 8-3, 9-1 hardware configuration, 2—4 executing MACRO programs, 14-7 linking with a program, 14-5 Program relocation, 12-3 location addresses, 147 Programs opening addressed locations, 14-9 MACRQO, 8-3, 11-1 See also FORTRAN program, opening bytes, 14-10 BASIC-11 program, and MACRO opening location addresses, 147 programs opening sequential location addresses, 14-7 debugging, 14-1 Program sections relocation registers, 147 absolute, 124 removing a breakpoint, 14-9 blank, 12-5 removing all breakpoints, 14-10 instruction, 12-5 running, 146 running a program with, 14-8 setting breakpoints, 14-8 setting relocation registers, 14-7 ODT commands, 14-6 to 14-10 OLD command BASIC-11, 10-12 On-line debugging technique See ODT Operating system applications packages, 1-10 named relocatable, 124 /PROMPT LINK option, 12—-6 Prompts bootstrap, 2-6 EDIT, 5-3 monitor, 4-1 PROTECT keyboard command, 7-7 Pushbutton console using to bootstrap, A—4 Pushbutton console (figure), A—4 description of, 1-8 device handlers, 1-8 language processors, 1-10 /QUERY DELETE option, 7-6 monitor program, 1-8 utility programs, 1-8 Operating system (figure), 1-9 Optional devices, 1-6 hardware configuration, 2-4 Output device changing, 9-11, 15-5 Overlay feature See Overlay segments Radix conversion table, 11-6 Random-access devices See Devices Read (R) command (EDIT), 54 Relocatable program sections, 12-4 Relocation registers ODT, 14-7 Overlay segments, 12-6 /REMOVE Peripheral devices, 1-6 RENAME keyboard command, 5-6, 7-5 Peripheral devices (figure), 1-6 Physical device names (table), 4-9 Renaming files LIBRARY option, 13-7 /PRINTER DIRECTORY option, 4-14 Printer enabling, 4-7 PRINT keyboard command, 7-8 Processor stopping the, B-1 cassette users, B—4 magtape users, B—4 REPLACE command BASIC-11, 10-13 Resident monitor See RMON RETURN key executing commands, 4-1, 4-3 Program counter, 11-3 function, 3—4 Programmed requests, 11-11 ODT, 14-7 Programming languages, 8-1 Index-6 RMON, 4-1 RT-11 computer system description of, 1-1 RT-11 computer system (figure), 1-2 RT-11 operating system See Operating system RUN command BASIC-11, 10-8 ODT, 14-8 RUN keyboard command background job, 15-3 RUNNH command BASIC-11, 10-8 SAVE command BASIC-11, 10-12 SCRATCH (SCR) command hardware configuration, 2-3 loading, 2-5 System volume (table), 2—4 TAB key, 3-4 Terminal hardware configuration, 2-3 Terminal (figure), 3-2 Terminal devices (figure), 1-4 Terminals, 1-3, 3—-1 console, 1-4 Text buffer, 5-1 pointer, 5—4 Time See also Date displaying, 4-9 entering, 4-8 BASIC-11, 10-6 SHIFT key, 3-3 TIME keyboard command, 48 TYPE keyboard command, 7-8 Software defined, 1-7 operating system, 1-8 Software (figure), 1-8 Software manuals, 1-11 UNLOAD keyboard command, 15-7 UNPROTECT keyboard command, 7-7 Source files comparing, 6-1 Source listings, 1-11 Storage medium definition of, 1-4 Ve. ify (V) command (EDIT), 5-7 SHOW keyboard commands, 4-11 Source comparison program, 1-9 See also Source comparison random-access See Devices Storage volumes hardware configuration, 2—4 initializing, 4-15 loading, 2-5 protecting files, 3-7 using, 34, 3-7 Storage volumes (figure), 3-6 SUBSTITUTE (SUB) command BASIC-11, 104 Switch register console using to bootstrap, A-5 Switch register console (figure), A-5 Symbolic references resolving, 12-2 Symbols global, 12-2 internal, 12-2 Symbol table, 11-4, 11-10 SYSLIB.OBJ, 9-2, 12-7 System macro library, 11-11 System volume, 2-2 backing up, B-3 User service routine See USR USR, 4-1 Utility programs, 1-8 Volume directory file storage, 3—7 listing, 4-12 operations, 7-1 Volume structures comparing, B—4 ‘olume substitution during operations, B-6 VT11 display hardware commands, 4-6, 4-7 enabling, 4-6 enabling the printer, 4-7 immediate mode, 5-16 using, 4-5, 5-15 VT11 display hardware (figure), 4-6 Wildcards using with DELETE keyboard command, 7-6 with DIRECTORY keyboard command, 5-12 Word definition of, 11-5 Write enable file protection, 3-7 Write protect file protection, 3—7 Index-7 HOW TO ORDER ADDITIONAL DOCUMENTATION From Call Chicago 312-640-5612 Digital Equipment Corporation 8:15 AM. 10 5:00 PM. CT Accessories & Supplies Center Write 1050 East Remington Road Schaumburg, IL 60195 San Francisco 408-734-4915 Digital Equipment Corporation 8:15 AM. t0 5:00 P M. PT Accessories & Supplies Center 603-884—6660 Alaska, Hawaii 8:30 am. t0 6:00 PM. ET or 632 Caribbean Drive Sunnyvale, CA 94086 408-734-4915 8:15 am. to 5:00 P M. PT New Hampshire Rest of US.A,, Puerto Rico* 6038846660 Digital Equipment Corporation 8:30 AM. 10 6:00 PM.ET Accessories & Supplies Center 1-800-258-1710 8:30 AM. 10 6:00 PM. ET P.O. Box CS2008 Nashua, NH 03061 *Prepaid orders from Puerto Rico must be placed with the local DIGITAL subsidiary (call 809-754~7575) Canada British Columbia Ottawa-Hull Elsewhere 1-800-267-6146 Digital Equipment of Canada Ltd 8:00 aM. t0 5:00 Pm. ET 940 Belfast Road 613-234-7726 Attn: A&SG Business Manager 8:00 am. 10 5:00 PM. ET Ottawa, Ontario K1G 4C2 112-800-267—6146 8:00 Am. to 5:00 PM. ET Elsewhere Digitai Equipment Corporation A&SG Business Manager* *¢/0 DIGITAL's local subsidiary or approved distributor Introduction to RT-11 AA-5281C-TC READER’S COMMENTS NOTE: This form is for document comments only. DIGITAL will use comments submitted on this form at the company’s discretion. If you require a written reply and are eligible to receive one under Software Performance Report (SPR) service, submit your comments on an SPR form. Did you find this manual understandable, usable, and well organized? Please make suggestions for improvement. Did you find errors in this manual? If se, specify the error and the page number. Please indicate the type of user/reader that you most nearly represent. — Assembly language programmer — Higher-level language programmer — Occasional programmer (experienced) — User with little programming experience — Student programmer — Other (please specify) Name Date Organization Telephone Street City . State _____ Zip Code or Country =~ — Do Not Tear — Fold Here and Tape No Postage Necessary if Mailed in the United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE SSG/ML PUBLICATIONS, MLO5-5/E45 DIGITAL EQUIPMENT CORPORATION 146 MAIN STREET MAYNARD, MA 01754 Cut Along Dotted Line Do Not Tear — Fold Here H E 4 —
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies