Digital PDFs
Documents
Guest
Register
Log In
DEC-8E-OCASA-B-D
May 1974
223 pages
Original
8.4MB
view
download
Document:
CAPS8 UG
Order Number:
DEC-8E-OCASA-B-D
Revision:
Pages:
223
Original Filename:
http://bitsavers.org/pdf/dec/pdp8/caps8/DEC-8E-OCASA-B-D_CAPS8_UG.pdf
OCR Text
o users manual digital equipment corporation DEC- 8E-OC1LSA-B-D CASSETTE PRO G RAM MIN G S Y S T E M USE R 'S MAN UA L For additional copies, order No. DEC-8E-OCASA-B-D from Software Distribution Center, Digital Equipment. Corporation, Maynard, Massachusetts 01754 First Printing, March, 1973 Revised September, 1973 Printed July, 1974 The information in this document is subj,ect to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporat:ion assumes no responsibility for any errors that may appear in this manual. The software described in this document is furnished to the purchaser under a license for use on a single computer system and can be copied (wi th inclusion I:>f DIGITAL's copyright notice) only for use in such system, except as may otherwise be provided in writing by DIGITAL. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright. © 1973, 1974 by Digital Equipment Corporation The HOW TO OBTAIN SOFTWARE INFORMATION page, located at the back of this document, explains the various services available to DIGITAL software users. The postage prepaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in preparing future documentation. The following a:re trademarks of Digital Equipment Corporation: CDP COMPUTER LAB COMSYST COMTEX DDT DEC DECCOMM DECTAPE DIBOL DIGITAL DNC EDGRIN EDUSYSTEM FLIP CHIP FOCAL GLC-8 IDAC IDACS IND.~C KAIO LAB-8 LAB-8/e LAB-K OMNIBUS 05/8 PDP PHA PS/8 QUICKPOINT RAD-8 RSTS RSX RTM RT-ll SABR TYPESET 8 UNIBUS CONTENTS PAGE CHAPTER 1 THE CASSETTE PROGRAMMING SYSTEM 1.1 1.1.1 1.1.2 INTRODUCTION TO A CASSETTE STORAGE SYSTEM Hardware Components Software Components 1-1 1-2 1-2 1.2 1.2.1 1.2.2 vvHAT IS A CAPS- S CASSET'I'E? The Format of a Cassette The sentinel File 1-2 1-4 1-4 1.3 THE SYSTEM CASSETTE 1-4 1.4 !JIOUNTING AND DISMOUNTING CASSETTES 1-5 1.5 CONCERNING EXAMPLES 1-6 CHAPTER 2 GETTING ON-LINE WITH THE CAPS_oS SYSTEM 2.1 SYSTEM PROGRAMS 2-1 2.2 2.2.1 2.2.2 2.2.3 SYSTEM CONVENTIONS File Formats Filenames and Extensions Input/Output Devices 2-1 2-1 2-2 2-2 2.3 LOADING THE KEYBOARD MONITOR 2-3 2.4 2.4.1 2.4.2 2.4.3 USING THE KEYBOARD MONITOR Making Corrections Special Characters I/O Designations and Specification Options 2-3 2-3 2-4 2-5 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.S KEYBOARD MONITOR COMMANDS Run Command Load Conunand DAte Conunand DIrectory Command DElete Conunand Zero Conunand REwind Command Version Command 2-5 2-6 2-7 2-7 2-7 2-S 2-9 2-10 2-10 2.6 NOTES ON DEVICE HANDLERS 2-11 2.7 MONITOR ERROR MESSAGES 2-12 CHAPTER 3 SYMBOLIC EDITOR 3.1 INTRODUCTION 3-1 3.2 3.2.1 3.2.2 3.2.3 CALLING AND USING THE EDITOR EDITOR Options Input and Output Specifications Version Numbers 3-1 3-1 3-2 3-3 iii 3.3 3.3.1 MODES OF OPERATION Transition Between Modes 3- 4 3-4 3.4 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.4.11 3.4.12 3.4.13 SPECIAL CHARACTERS AND FUNCTIONS RETURN Key Erase (CTRL/U) RUBOUT Key Form Feed (CTRL/FORM) The Current Line Counter (.) Slash (/l LINE FEED Key ALT MODE Key Right Angle Bracket (» Left Angle Bracket «) Equal Sign (=) Colon (:) Tabulation (CTRL/TAB) 3-4 3-5 3-5 3-5 3-5 3-6 3-6 3-6 3-7 3-7 3-7 3-7 3-7 3-7 3.5 COMMAND STRUCTURE 3-8 3.6 3.6.1 3.6.2 3.6.3 COMMAND REPERTOIRE Input Conunands Output Conunands Editing Conunands 3-8 3-9 3-10 3-12 3.7 TEXT COLLECTION 3-15 3.8 3.8.1 3.8.2 CHARACTER SEARCHES Single Character Search Character String Search 3-16 3-16 3-17 3.9 EDITOR ERROR MESSAGES 3-21 3.10 EDITOR DEMONSTRATION RUN 3-23 3.4.1~ CHAPTER 4 SYSTEM COpy 4.1 INTRODUCTION 4-1 4.2 4.2.1 4.2.2 4.2.3 CALLING AND USING SYSTEM COpy System Copy Options Input and Output Specifications System Copy Example 4-1 4-1 4-2 4-3 4.3 SYSTEM COpy ERROR MESS1~GES 4-4 CHAPTER 5 PALC ASSEMBLER 5.1 INTRODUCTION 5-1 5.2 5.2.1 CALLING AND USING PALC PALC Options 5-1 5-5 5.3 CHARACTER SET 5-5 5.4 5.4.1 5.4.2 5.4.3 5.4.4 STATEMENTS Labels Instructions Operands Conunents 5-6 5-6 5-6 5-7 5-7 iv 5.5 5.5.1 5.5.2 5.5.3 FORMAT EFFECTORS Form Feed Tabulations Statement Terminators 5-7 5-7 5-7 5-8 5.6 NUMBERS 5-9 5.7 5.7.1 5.7.2 5.7.3 5.7.4 5.7.5 5.7.6 5.7.7 5.7.8 SYMBOLS Permanent Symbols User-Defined Symbols Current Location Counter Symbol Table o'irect Assignment Stat~ements Symbolic Instructions Symbolic Operands Internal Symbol Representation for PAGC 5-9 5-9 5-9 5-10 5-11 5-12 5-13 5-13 5-13 5.8 5.8.1 5.8.2 EXPRESSIONS Operators Special Characters 5-14 5-14 5-17 5.9 5.9.1 5.9.2 5.9.3 5.9.4 INSTRUCTIONS Memory Reference Instructions Indirect Addressing Microinstructions Autoindexing 5-20 5-20 5-20 5-21 5-23 PSEUDO-OPE RATORS 5.1.0 5.1.0.1 Indirect and Page Zero Addressing Radix Control 5.1.0.2 Extended Memory 5.1.0.3 5.1.0.4 End-of-File 5.1.0.5 Resetting the Location Counter 5.1.0.6 Entering Text Strings Suppressing the Listing 5.1.0.7 Reserving ~emory 5.1.0.8 Conditional Assembly Pseudo-Operators 5.1.0.9 Controlling Binary Output 5.1.0.1.0 Controlling Page Format 5.1.0.11 Altering the Permanent: Symbol Table 5.1.0.12 5-24 5-24 5-24 5-25 5-26 5-26 5-27 5-27 5-27 5-28 5-28 5-29 5-29 5.11 :GINK GENERATION AND STOHAGE 5-30 5.12 CODING PRACTICES 5-31 5.13 5.13.1 PROGRAM PREPARATION AND ASSEMBLER OUTPUT Terminating Assembly 5-32 5-33 5.14 PALC ERROR CONDITIONS 5-33 CHAPTER 6 CASSETTE BASIC 6.1 INTRODUCTION 6-1 6.2 CALLING BASIC 6-1 6.3 NUMBERS 6-2 6.4 VARIABLES 6-3 v 6.5 6.5.1 6.5.2 6.5.3 ARITHMETIC OPERATIONS Priority of Operations Prentheses and Spaces Relational Operators 6-4 6-4 6-5 6-5 6.6 6.6.1 6.6.2 6.6.3 IMMEDIATE MODE PRINT Command LET Command Looping PRINT and LET Commands 6-6 6-6 6-7 6-7 6.7 EXAMPLE RUN 6-8 6.8 6.8.1 6.8.2 6.8.3 6.8.4 6.8.5 6.8.6 6.8.7 6.8.8 6.8.9 6.8.10 6.8.11 6.8.12 BASIC STATEMENTS Statement Numbers Commenting the Program Terminating the Program The Arithmetic Statement Input/Output Statements Creating Run-Time Input Files Loops Subscripted Variables Transfer of Control Statements Program Chaining Subroutines Functions 6-10 6-10 6-10 6-11 6-11 6-12 6-25 6-27 6-29 6-31 6-34 6-35 6-37 6.9 6.9.1 6.9.2 6.9.3 6.9.4 6.9.5 IMPLEMENTING A USER-CODED FUNCTION Coding Formats Floating-Point Format Incorporating Subroutines with UUF Writing the Program Examples of User-Coded Functions 6-44 6-44 6-46 6-46 6-47 6-47 6.10 6.10.1 6.10.2 FLOATING-POINT PACKAGE Instruction Set Addressing 6-50 6-50 6-51 6.11 6.11.1 6.11.2 6.11.3 6.11.4 6.11.5 6.11.6 6.11.7 6.11.8 EDITING AND CONTROL COMMANDS Erasing Characters and Lines Listing a Program Running a Program Stopping a Run Loading a User-Coded Function Erasing a Prbgram In Memory Renaming a Program Saving a Program 6-52 6-52 6-53 6-54 6-54 6-55 6-55 6-55 6-56 6.12 CASSETTE BASIC ERROR MESSAGES 6-57 6.13 CASSETTE BASIC SYMBOL TABLE 6-59 CHAPTER 7 USING CAPS-8 CODT 7.1 FEATURES 7-1 7.2 7.2.1 USING CODT Commands 7-2 7-2 7.3 ILLEGAL CHARACTERS 7.4 7.4.1 7.4.2 ADDITIONAL TECHNIQUES TTY I/O-FLAG Interrupt Program Debugging 7-8 7-9 7-9 vi 7.4.3 7.4.4 Octal Dump Indirect References 7-9 7-9 7.5 ERRORS 7-9 7.6 7.6.1 7.6.2 OPERATION AND STORAGE Storage Requirements - CAPS-8 System Programming Notes Summary 7-9 7-10 7-10 7.7 COMMAND SUMMARY 7-11 CHAPTER 8 CAPS-8 UTILITY PROGRAM 8.1 INTRODUCTION 8-1 8.2 8.2.1 8.2.2 CALLING AND USING THE UTILITY PROGRAM Utility Program Options Input and Output Specifications 8-1 8-1 8-2 8.3 UTILITY PROGRAM ERROR MESSAGES 8-2 CHAPTER 9 9.1 BOOT OPERATING PROCEDURES 9-1 APPENDICES A ASCII Character Codes A-I B Error Message and Command Summaries B-1 C PALC Permanent Symbol Table C-l D CAPS-8 Demonstration. Run D-l E Monitor Services E-l F Assembly Instructions F-l TABLES Table :2-1 CAPS-8 Extension Names Table 2-2 Directory Options Table 2-3 Keyboard Monitor Error Messages Table 3-1 EDITOR Options Table 3-2 Command Format Table 3-3 Input Commands Table 3-4 List Commands Table 3-5 Text Transfer Commands Table 3-6 Editing Commands Table 3-7 Search Character Options Table 3-8 Terminating a Strinq Search Table 3-9 EDITOR Error Codes Table 4-1 System Copy Options Table 4-2 System Copy Error Messages Table 5-1 PALC Options Table 5-2 Use of Operators Table 5-3 PALC Error Codes vii 2-2 2-8 2-12 3-1 3-8 3-9 3-10 3-11 3-12 3-16 3-20 3-21 4-1 4-4 5-5 5-15 5-34 Table 6-1 Cassette BASIC Functions Table 6-2 Function Addresses Table 6-3 Floating-point Accumulator Table 6-4 Floating-Point Instructions Table 6-5 Relative Addresses Table 6-6 Cassette BASIC Error Messages Table 6-7 Cassette BASIC Symbol Table Table E-l Monitor Memory Map Table E-2 utility Subroutines and Locations Table E-3 Header Record Structure 6-38 6-45 6-46 6-50 6-51 6-57 6-60 E-l E-l E-ll ILLUSTRATIONS Figure 1-1 Figure 1-2 Figure 1-3 Figure E-l Figure E-2 Cassette Progranuning System CAPS-8 Cassette l-1ounting a Cassette Switch Option Characters Ring Buffers viii 1-1 1-3 1-6 E-IO E-IO CHAPTER 1 THE CASSETTE PROGRAMMING SYSTEM 1.1 INTRODUCTION TO A CASSETTE STORAGE SYSTEM The PDP-8 Cassette Programming System (CAPS-8) is a small programming system for the PDP-8/E (8/M or 8/F) computer and is designed around the use of cassettes for program storage, rather than DE~tape, paper tape or disk storage. CAPS-8 replaces paper tape procedures completely. The MI8-E Hardware Bootstrap initially loads the Cassette Keyboard Monitor into memory: with the use of the Monitor all file transfers and program loading and storage is done via cassette. Cassettes are more convenient and reliable and much easier to use than paper tape, and in addition, cut the time involved in loading and storing programs using paper tape by almost one half. CAPS-8 provides the user with a Keyboard ~1oni tor, I/O facilities at the Monitor level, and a library of System Programs, including a machine language assembler, an editor, and a higher-level programming language. Figure 1-1 Cassette Programming System 1-1 1.1.1 Hardware Components The Cassette Pro9ramming System is built~ around a PDP-8/E, 81M, or 8/F computer with a minimum of one TU60 dual cassette unit, a console terminal (LA30 DECWriter, LT33 or LT35 'I'eletype, or VT05 DECterminal), and 8K of memory. A line printer is opt:ional. 1.1.2 Software Components A brief description of the software Cassette Programming System follows. greater detail later i.n the manual. package available with the Each program is discussed in 1. MONITOR -- The Keyboard Monitor provides communication between the user and the Cassette System Executive Routines by accepting commands from the console terminal keyboard. The commands allow i:he user to run system and user proograms, save programs on cassette, and obtain directories of cassettes. 2. Symbolic EDITOR - The EDITOR allows the user to modify or create source files for use as input to language processing programs such as BASIC and PALC. The EDITOR contains powerful text manipulation commands for quick and easy editing. 3. PALC Ass-embler (Program Assembly Language--Cassette) PALC accepts source files in the PAL machine language and generates absolute binary files as output. These files can then be loaded and executed using Monitor commands. 4. BASIC BASIC provides a higher-level programming language which is easy to learn and use. It includes such language features as user-coded functions, data files on cassette, and program chaining. 5. System Copy (SYSCOP) - SYSCOP allows the user to transfer files from one cassette to another, giving him the ability to make multiple copies of a cassette and "clean up" full cassettes so that they may become available for future use. 1.2 WHAT IS A CAPS-8 CASSETTE? A CAPS-8 cassette is a magnetic tape device much like that used in a cassette tape recorder. The tape itself and the reels it is wound on are enclosed inside a rectangular plastic case (see Figure 1-2), making handling, storage, and care of the cassette convenient for the user. 1-2 On either end of one side of the cassette are two flexible plastic tabs called write protect tabs (see A in Figure 1-2). There is one tab for each end of the tape; since data should only be ~Titten in one direction on the t.ape, the user will need to be concerned with only the tab which is specifically marked on the cassette label. Depending upon the position of this tab, the user is able to protect his tape against accidental wri ting and destruction of data. wt.en the tab is pulled in toward the middle of the cassette so that the hole is uncovered, the tape is write-locked; data cannot be writ.ten on it and any attempt to do so will result in an error message. wt.en the tab is pushed toward the outside of the cassette so that the hol.e is covered, the tape is write-enabled and data can be written onto it. Data can be read from the cassette with the tab in either positior .. The bottom of the cassette (B in Figure 1-2) provides an opening where the magnetic tape is exposed. The cassette is locked int.o position on a TU60 cassette unit drive so that the tape comes in cont.act with the read/write head through this opening. Both ends of the magnetic tape in a cassette consist of clear plastic leader/trailer tape; this section of the tape is not used for information storage purposes, but as a safeguard in handling and storing the cassette itself. Since cassette tape is ~:usceptible to dust and fingerprints, the leader/trailer tape should be the only part of the tape exposed whenever the cassette is not on a drive. UNCOVER HOLE TO PRCTECT DATA \'----A-~ Figure 1-2 B CAPS-8 Cassette 1-3 c 1.2.1 The Format of a Cassette A cassette is formatted so that it consists of a sequence of one or more files. Each file is preceded and followed by a file gap. (A gap in this sense is a set length of specially coded tape.) All cassettes must start with a file gap; any information preceding the initial file gap is unreliable. A file consists of a sequence of one or more records separated from each other by a record gap. The first record of a file is call~:!d the file header record and contains information concerning the name of the file, i t:s type, length, and so on. (Chapter 2 provid~:!s more information concerning header records.) A record generally contains 128 (decimal) characters of information; there are approximately 600 records per cassette tape. Records consist of a sequence of one or more cassette bytes; a byte in turn consists of eight bits each representing a binary zero or one. Characters and numbers are stored in bytE!s using the standard ASCII character codes (see Appendix A) and binary notation. The number of records of information on a .cassette tape may be estimated by the user. On the outside of the cassette case is a clear plastic window (C in Figure 1-2). Along the bottom of this window is a series of marks; each mark represent:"s about 50 inches of magnetic tape. Knowing that approximately 2 records fit on an inch of tape, the user is able to make a reasonable 9uess as to the length of tape and number of records available for use. By simply glancing at the width of the tape reel showing in the window, the user can tell quickly if he is very close to the end. Since he is given no advance warning of a full tape condition, the USE!r must visually keep track of the length of tap4~ he has available. Should the tape become full before his file transfer has complet:ed, another cassette must be substituted, and the transfer or output operation must be restarted. 1.2.2 The Sentinel File The last file on a cassette tape is called the sentinel file. This file consists of only a file header record and represents the logical end-of-tape. A zeroed or blank cassette tape is one consisting of only the sentinel file. 1.3 THE SYSTEM CASSETTE The software discussed in Section 1.1 is provided to the user on a single cassette called the System CassHtte. This is the cassette on which the entire CAPS-8 System resides, cmd it is utilized for all system functions. The System Cassette must always be mounted on drive 0; drive 0 serves as the default device \\Then the user fails to specify another. 1-4 NOTE Each TU60 dual cassette unit has two drives. The drive on the left is always odd-numbered and the drive on the right even-numbered; thus, drive 0 will be the le!ft drive. If the user has more than one TU60 dual cassette unit, he should probably label the drives in consecutive order so that there will be no confusion when he is using the system. The write protect tab on the System Cassette should usually be in the write-locked position so that data will not accidently be written on it; it is suggested that the user make a copy of this cassette as protection against loss or accidental destruction. 1.4 MOUNTING AND DISMOUNTING A CASSETTE To mount a tape on a drive, hold the tape so that the open part of the cassette is to t:he left and the full reel is at the top. Set the top write protect tab to the desired position depending upon whether data is to be written on the tape. Open the locking bar on the cassette drive by pushing it: to the right away from the drive (see A in Figure 1-3). Next hold the tape up to the cassette drive at approximately a 45-degree angle and insert the tape into the! drive by applying a leftward pressure while simultaneously rotating the cassette over the drive sprockets. This brings the tape! into position against the read/write head. Push the tape into the uni.t so that when the cassette is properly mounted, the locking bar automatically closes over the cassette back edge. (Figure 1-3 illustrates this procedure.) Press the rewind button on the cassette unit (see B in Figure 1-3; there is a rewind button for each drive). This causes t:he cassette to rewind to the beginning of its leader/trailer tape. (Pressing the rewind button a second time causes the cassette to re"rind to the end of the leader/trailer tape and to the physical end·oof-tape. The cassette unit will click; this sound is almost inaudible and the user may not hear it unless he is listening carefully. Normal usage requires that t:he user press the rewind button only once whenever he wishes to manually re\"lind a cassette). Even though tapes which are not actively being used on a drive should already be po!;;i tioned at the beginning, the user should develop the habit of automatically rewinding a cassette. When the tape has finished winding, the cassette will stop moving. The cassette is now in plaCE! and ready for transfer operations. 1-5 B A Figure 1-3 Mountin9 a Cassette Before removing a cassette from a drive, the tape should always be rewound to its beginning. This can be done by pressing the rewind button on the cassette unit or by issui.nq the REwind Monitor Command as explained in Chapter 2. Rewinding a tape ensures that the clear leader/trailer tape will be the only tape exposed at the open part of the cassette. To remove a cassette from the cassette drive, open the locking bar and the cassette will pop out. When cassettes are not being actively used on a cassette drive, they can be stored in the small plastic boxes provided for this purpose by the manufacturer. NOTE Before using a new cassette, or prior to using a cassette that has just been shipped or accidently dropped, mount the cassette on a drive so that the Digital label faces the inside of the unit and perform a rewind operation. Remove the cassette, turn it over, and perform another rewind operation. This packs ,the tape neatly in the cassette and places the full tape reel at the proper tension. 1.5 CONCERNING EXAMPIJES In the chapters that follow, care has been taken to include acutal machine printout whenever possible. In cases in which there may be some discrepancy as to whether a character was typed by the user or by the system, that typed by the system will be underlined. 1-6 CHAPTER 2 GETTING ON-LINE WITH THE CAPS-a SYSTEM 2.1 SYSTEM PROGRAMS The Cassette Programming System is distributed on a single cassette, called the System Cassette, which contains all the proc;rrams necessary for loading the Monitor into memory and creating and running system and user programs. The directory of the System Cassette is as follows: C2BOOT.BIN MONfOrl.BIN bt!:lCOP.BIN .BIN EDIT ~ALC .B IN BA!:)IC .BIN 01/22/73 01/22/73 01/25/73 01/02/73 01/02/73 01/02/73 V1 V1 V2 V1 V1 VI System files are in binary format (see section 2.2.1). The first two files on any System Cassette must be C2BOOT.BIN and MONTOR. BIN; these two files comprise a bootstrap and the Keyboard Monitor. C2BOOT.BIN loads the Moni t:or into memory from the System CassettE~; the Keyboard Monitor links the user and the CAPs-a System by providing a means of communication bet:ween the two. By accepting commands from the console terminal keyboard, the Cassette Keyboard Monitor allows the user to run system and user programs, save and recall files utilizing cassette storage, and create, assemble, and load programs. 2.2 SYSTEM CONVENTIONS The following c:onventions concern file formats and file naming procedures and are standard for the CAPS-a System, as WE!ll as for many other systems. 2.2.1 File Format:s The Cassette Programming System makes use of two types of file formats -- ASCII and Binary. Files in ASCII format conform to the Ame:rican National Standard Code for Information Interchange in which alphanumeric characters are represented by a 3-digit code. A table containing ASCII character codes in 7- and B-bit octal is provided in Appendix A. Binary format files consist of l2-bi t bi.nary words repr~~senting PDP-8 machine language code. The standard DEC binary format is used with the exception that no checksum is necessary. Binary files contain field addresses and memory instructions and are read directly into 2-1 memory for immediate execution. CAPS-8 System Programs are in binary format, and pr09rams which the user assembles with PALC are translated into files in binary format. 2.2.2 Filenames and Extensions System and user files are referenced symbolically by a name of as many as six alphabetic characters (A-~:) or digits (0-9), followed optionally by an extension of from 1 to 3 alphabetic characters or digits; (the :Eirst character in a filename must be alphabetic). The extension to a filename is generally used as an aid in remembering the CAPS-8 format o:f a file. Table 2-1 lists commonly accepted extensions -- the user mayor may not conform to this list as he chooses; it is included here only as a guide: Table 2-1 CAPS-8 Ext:ension Names Extension PAL BIN BAS TXT DOC DAT Meaning PALC source file (ASCII) System or user binary format file BASIC source file (ASCII) Text file (ASCII) Documentation file (ASCII) Data file (ASCII or other) Generally the user may call his files by any mnemonic filename and extension he chooses. In some cases, if he omits specifying an extension, the System Program he is running may assume an extension. For example, PALC assumes an extension of .PAL unless the user .BIN unless another indicates another, and the Run command assumes extension is specified. 2.2.3 Input/Output Devices There are three available categories of input/output devices in the Cassette Programming System: consolE~ terminal keyboard (including paper tape reader and punch if an LT33 Teletype containing these units is used as the console terminal), cassette drives 0-7, and a line printer. There are no permanent devicE~ names in the CAPS-8 System. Command strings and I/O designations are entered in such a way that the user specifies the device by a drive number and the file by a filename; option characters allow th.~ user to direct listings to the line printer or to otherwise change th.~ normal operating procedure of a program. The System Cassette -- drive 0 -- is the default device if no drive number is specified. For example: .DI/L 2-2 (DI is a Monitor command instructing thE~ computer to print a directory listing of a cassette. Since no drive number is specified, drive 0 -the System Cassette -- is assumed. The option character L sends output to the line printer instead of the console terninal, which is the normal output device.) 2.3 LOADING THE KEYBOARD MONITOR The CAPS-8 hardware bootstrap and C2BOO~~ .BIN on the System Cassette are used to load the Cassette Keyboard Monitor into memory. (Both bootstraps are described in Appendix E.) Loading the Monitor is accomplished as follows: 1. Ensure that the computer and tE~rminal are on-line. 2. Press and raise the HALT key. Make sure that the SINGLE STEP key is in a raised position. 3. Place the System Cassette (wri1:e-locked to p.rotect data) onto cassette unit drive 0; 4. Press and raise the SW key. At this point the RUN lamp should be on and the System Cassette should begin to move. The hardware bootstrap calls the first program on the System Cassette (C2BOOT.BIN) which in turn loads the Keyboard Monitor (MONTOR.BIN) into memory. If an error occurs during the loading process (for example, an error may be caused by the cassette being improperly mounted, by a missing file on the tape, or by the occurrence of an I/O error) no error message will inform the user since the Monitor is not completely in memory. Instead, the System Cassette may stop moving and the computer may loop or halt. If this is the case, steps 2-4 above should be repeated. Once the Monitor has been loaded, the System Cassette stops moving and a dot is typed at the left margin of the console terminal page. This instructs the user that the Monitor is now in memory and ready to accept input commands. 2.4 USING THE KEYBOARD MONITOR Each command to the Keyboard Monitor is typed at the console terminal keyboard in response to the dot at the left margin. A command is entered by pressing the RETURN key. 2.4.1 Making Corrections Corrections may be made to the command line providing they are made before the line is entered (that is, before a carriage return has been typed). The RUBOUT key is used to correct typing errors. Pressing the 2-3 RUB OUT key once causes an open bracket ([) to be typed followed by the last character entered into memory. Aft~er this character is echoed on the console terminal it is deleted from memory. Successive RUBOUTs each cause one more character to be printed and deleted. The first non-RUBOUT character typed (after the last RUBOUT in a sequence) causes a closing bracket (]) to be printed, thus enclosing only the deleted portion of text within brackets. For example: The user types: .. R BACIC (RUBOUT) (RUBOUT) (RUBOUT) SIC The console terminal shows: .H 8AC I C (C I C] SIC The string is entered to the-Keyboar~~itor as: .R BASIC 2.4.2 Special Characters (CTRL/C, CTRL/O, and CTRL/U) Control can be rE~turned to the Keyboard Moni tor while under any of the System Programs by typing a CTRL/C (produced by holding down the CTRL key and simul tanE~ously pressing the C ke!y). If the Monitor is not still in memory, a CTRL/C causes a complete rebootstrap by reading the appropriate files from the System Casset:te on drive O. When it is ready to accept input, the Keyboard Monitor types a dot at the left margin of the teleprinter (i.e. console terminal) page. Teleprinter output can be suppressed by typing a CTRL/O (produced by holding down the CTRL key and simultaneously pressing the 0 key) • This allows execution of the program to continue, but stops all console printout. Typing a second C'l'RL/O will resume output again. Unless output is extremely lengthy, or unless the program is waiting for input from the user, processing of a program after an initial CTRL/O will usually be completed before the user is able to type a second CTRL/O. Printout will automatically resume when control is returned to the Keyboard Monitor (indicated by a dot at the left margin) • NOTE crRL/o does not prevent certain important error messagE!S from printing on the console terminal. A corranand line ma.y be deleted completely, before it is entered, by typing a CTRL/U (produced by holding down the CTRL key and pressing the U key). This causes the current command line to be ignored and returns control to the Keyboard Monitor. The Monitor prints a dot at the left margin to indicate that it is ready to accept another command. 2-4 2.4.3 I/O Designations and Specification Options Whenever the user runs a System Program or performs any I/O operation, he must indicate1:he file(s) to be accessed, the cassetb! drive(s) on which they are located, and any desired options associa1:ed with the operation. Procedures used in entering t~his information are explained below. Monitor commands q-enerally require only Gl single command line which specifies the wlit drive number (in the range 0-7), filename (s), and option(s) in the following format: .COMMAND DRIVE #:FILENAME:.EXT/OPTION(S) COMMAND represents one of the eight Monitor commands discussed in Section 2.5. The filename should be se~parated from thl~ drive number by a colon. Options are alphabetic characters and are sl~parated from the rest of the command line by the slash character (/1. Successive options follow onl~ another without any separating ch,3.racter. The command line is executed by typing a carriage return. I/O specifications to System Programs follow a diffl~rent format. First the System Program is called from the System Cassette using the Monitor Run command. The System Program then asks for the input filename, drive number, and options, and then the out:;>ut filename, drive number, and options. This informat:ion is usually reques ted in two separate command lines, but the actual format "aries between System Programs. Generally, the command strings appear as follows: .R SYSTEM PROGRAM/OPTIONS *INPUT-DRlVE # : FILENAME *OUTPUT-DRIVE #: FILENAME The appropriate chapter should be referenced for the accurate format. Options are available in most System Programs and Monitor commands allowing the user to change the order or format of input and output operations from that which would normally be carried out by the program. Again, interpretation of options varies; the user should refer to the appropriate section or chapter to learn which options are available and what actions will result from their use. 2.5 KEYBOARD MONITOR COMMANDS There are eight Keyboard Monitor commands available to the user. Commands are typed in response to the dot printed by the Monitor and are entered when the RETURN key is pressl~d. Each command consists of one or more alphabetic characters, followed by a space (or any non-alphabetic character). Any error made while utilizing these commands will result ~n a message informing the user (see Section 2.8). After occurrence of an error, control returns to the Keyboard Moni tor and the command must be re-typed. (Since several of the commands begin with the same letter, the user must be sure to note how much of the command must be entered in order to distinguish it from other commands. While it does not matter if too many characters are entered, too few will cause errors.) 2-5 2.5.1 Run Command The Run command is of the form: • R Drive #:Filename/Option (s) The Run command instructs the Monitor to load and execute the file specified in t~e command line. The file should be in self-starting binary format (t:hat is, the last location in the source file must be an origin sett:ing which indicates the starting address of the file); as the file is not in self-starting binary format, the program will be loaded but execution will not begin; the user will have to proceed as though he were using the Load command (see Section 2.5.2). The user may omit specifying an extension as the Monitor assumes .BIN. For example: :R CART.BIN or .ft CART Regardless of which command string the user types, the Monitor assumes .BIN, searches drive 0 for the file CART. BIN, and executes it. Options allowed in the command line depend upon the program the user is running. Availability of options and results of their use are discussed in Chapters 3, 4, 5 and 6. No error occurs if the user specifies an option not allowed by a program; the option is simply ignored. Multiple files may be executed using the Run command. Patches to programs, BASIC user-coded functions, and programs the user may have created using PALC can be executed as follows: .R Drive #:PROGl,Drive #:PROG2, ••• PROGn/Option(s) where n represents any number of programs as long as the total number of characters on the input specification line does not exceed 64. The user must enter programs in the command line in the order in which he wants them executed and must be careful to include appropriate starting, chaining, and return addresses (see Appendix E). For example, assume the user has written a routine which will be used for debugging purposes; each time a certain condition is met during execution, this routine will be accessed, print a message and cause execution to halt. The routine ha.s been created using the CAPS-8 EDITOR, assembled with PALC, and is stored on cassette drive 1 as DBG.BIN; it is loaded into memory with the user's program (TABLE.BIN stored on casset:te drive 0). The programs are loaded as follows: 2-6 Chapter 6, BASIC, contains an example of running multiple conjunction with the BASIC user-coded function feature. files in 2.5.2 Load Command The Load command is used to load a binary file into memory the form: and takes .L Drive #:Filename.ext/Option(s) This cormnand is similar to the Run cormnand except that the computer halts after loading the file. To start execution, the user sets the correct starting .address in the Swi tch RE~gister, presse:3 ADDR LOAD, CLEAR and CONT (if the file is in self-starting binary format, the user need only press CONT): appropriate addresses included in the program (see Appendix E) will return control to the Keyboard Monitor after execution. Multiple files may be loaded in the same manner as in tha Run command by simply specifying them in correct E~xecution order ':>n the command line: .L Drive #:PROGl,Drive #:PROG2 •••• PROGn/Option(s) Again, n may represent any number of pr09rams as long as the number of characbars on the command line does not exceed 64. total 2.5.3 DAte Command The DAte command is of the form: .DA mm/dd/yy where nun, dd, and yy repres~nt the current month, day and year as entered by the user. (One or two-digit numbers in the range 0-99 are allowed in the DA'te command. The Keyboard Monitor does not check for errors other than the entry of a number which is outsid,a this range.) This date will then appear in directory listings (see Section 2.5.4), and the date of creation of all new files will be included. If the DAte command is not used, directory listings will contain only filenames, as illustrated in section 2.1., 2.5.4 DIrectory Command The DIrectory comnand is of the form: .DI Drive #/Option(s) and causes a directory listing of the cassette on the drive specified to be output on the console terminal. N() colon is necessary after the 2-7 drive number. There are DIrectory command: two options available for use with the Table 2-2 Directory Options Option Heaning IL Causes the listing to be output on the line print.er rather than the console terminal. IF Causes a "fast" listing to be produced (omi t·ting creation dates and version numbers). In the following example a directory of cassette drive 2 is requested and output (the version number in the directory listing reflects the number of times the file has been accessed and changed using the CAPS-8 EDITOR; see Chapter 3, Section 3.:2.3): lr/1/~9/7? FILE .RIN ARCDEF.PAL A .ASC ~3/17/72 R V3 1)22 This same directory using the F option will be reduced to: HlJ/29/7? FILE .AIN ARCDEF.Pl\L A .ASC R 2.5.5 DElete Command The DElete command is of the form: .DE Drive #:Filename.ext and causes the fi.lename on the specified drive number to be deleted from the direct;ory. The fi lename is replaced by the name *EMPTY in the directory listing and the file can no longer be referenced. Only one file may be specified in the DElete command string at a time. 2-8 . For example, assume the user wishes to delete the from the directory of cassette drive 3. He types: filE:name MATH.DAT .DE 3:MATH.DAT and then obtains a directory listing of drive 3. appear as follows: 11 /17/72 TAPE .BAS *EMPTY. TOR .ASe The directory will 11/02/72 11/07/72 V3 where *EMPTY represents the deleted filename MATH. OAT. 2.5.6 Zero Command The Zero command is of the form: .Z Drive #:Filename and specifies that the sentinel file of the indicated cassette is to be moved so that it immediately follows the file indicated in the cornmand line. (See Chapter I for a description of the Bentinel file.) All files following the sentinel file: are deleted from the cassette and that portion of the tape is complete:ly reusable. For example, assume cassette drive 3 contains the follm"ing directory: LOO~ .Ase BASE • RAS FOfJR .RUJ 10/~3/72 V~ 11/17/72 *EMPTY. RAC~ •E and the user wishes to save only the first three files. Zero command as :follows: He and the sentinel fi Ie is placed immediat:ely after the The directory nrnN reads: file LOOK.ASC BASE.gAS 1~/2~/72 v2 2-9 uses the FOUR. BIN. When no filename is specifed in the command line, for example: .2 the cassette is said to be zeroed, or completely deleted of files; the sentinel file i.s moved to the beginning of the cassette so that the entire tape is available for use. This method is useful in "cleaning up" cassettes which may contain several *EHPTY files in the directory listing but have become full and therefore unavailable for further use. First, any needed files are transfered to another cassette using SYSCOP (see Chapter 4), then the directory of the old cassette is zeroed. The sentinel file is written at the beginning of the tape making the casset.te completely reusable. All new tapes must be zeroed before they are first used. This ensures that a sentinel file is present on the tape and moved to the beginning of the tape. 2.5.7 REwind Command The REwind command is of the form: .RE Drive # and causes the cassette on the drive number specified to be rewound to its beginning. (The user can also cause the tape to rewind by pressing the rewind button on the cassette unit.) System Programs and Moni tor commands always re'''Iind a cassetbe before accessing a file, but if the user delevopes the habit of rewind.ing the cassette himself he performs a timesaving action. A cassette should always be rewound before it is removed from a drive. 2.5.8 Version Command The Version command is used to find out Monitor currently in use. Typing: the version number of the .V instructs the Monitor to respond with example: the appropriate .v lLa indicates that version 1.2 is currently in use. 2-10 number. For 2.6 NOTES ON DEVICE HANDLERS Device handlers for the CAPS-8 System are~ described in Appendix E. few notes of interest concerning the1r use are included llere. A The line printer performs a form feed ope:ration before beginning an output task. Characters are unpacked from the output buffer and printed. A form feed is also produced following the completion of an output task. ThE~ line printer handler is capable of handling only an 80 column printer .. If the console terminal is an LT33 Tele:type containinq reader and punch units, these may be used as input/output devices :i.n conjunction with the Teletype keyboard. To punch a t,ape, simply place the punch unit to ON; to read a tape, place the reader unit to START. Characters will be printed on the Teletype keyboard as tiley are read or punched. Binary tapes may not be punched. NOTE The purpose of the Cassette Programming System is the elimination of paper tape procedures. CassettE~s provide a more convenient, reliable and faster means of program storage than paper tape. Therefore, although paper tapes may be read and punched using the LT33 paper tape units, therE~ is no support for this type of I/O and its use is not encoura g ed • If the user's pro<Jram does not over-write certain areas of memory, the parts of the Monitor which are in these locations are available for use. This allows the user who takes advantage of wri 1:ing his own programs in the PAL machine language to access system handlers and to restart or rebootstrap the Cassette Keyboard Monitor after program execution. Information concerning Monitor Service Routines, I/O routines, device handlers, and internal descriptions of the Keyboard Monitor are provided in Appendix E. 2-11 2.7 KEYBOARD MONITOR ERROR MESSAGES The following error messages may occur when the used incorrectly: Table 2-3 Keyboard Monitor Keyboard Monitor Error Messages Message Meaning BAD COMMAND The user has failed to follow the correct synt:ax for Moni tor commands. This may be the result of mispelled commands or too many or improper arguments in a command string. FILE NOT FOUND The Monitor could not locate the file (or files) specified. The user should check to be sure that filenames are spelled correctly and that the unit drive number specified is correct. INPUT ERROR ON UNIT n OUTPUT ERROR ON UNIT n An I/O UNIT n NOT RE,ADY There is no cassette on the drive specified, or no such drive exists. UNLOCK UNIT n The user tried to write data when the write protect tab of the cassette on the drive specified was write-locked. To write data this tab must be write-enabled. error has occurred on the cassette drive specified. This may be caused by an incorrectly formatted cassette or may be due to a timing error. The user should try the I/O transfer using another cassette. 2-12 is CHAPTER 3 SYMBOLIC EDITOR 3.1 INTRODUCTION The CAPS- 8 Symbolic EDITOR is used to cre!ate and modify ASCII source files so that these files may be used as input to other System Programs such as BASIC and PALC. The EDITOR considers a file to be divided into logical units called pages. A page of text is generally 50-60 lines long, ruld corresponds approximately to a physical page of a program listing. (Note that this is not the :3ame as a memory page). The EDITOR reads one page of text at a time from the input file into its internal buffer where the page becomes available for editing. ThE~ Editor contain::; commands for creating, modifying, or deleting characters, lines, or complete logical pages of text. All commands consist of a single letter or a letter wi th arguml~nts, and are executed by typing the RE~rURN key. 3.2 CALLING AND USING THE EDITOR To call the EDITOR from the System Cassette, type: • R EDIT/Options in response to 3.2.1 th4~ dot (.) printed by the! Keyboard Monitor. EDITOR Options There are two options available for use with the EDITO:~; these are described in Table 3-1. (Option usage has been previo1lsly discussed in Chapter 2, Section 2.4.3). Table 3-1 EDITOR Options Option Meaning /B Convert two or more spaces reading from input device. /M More than one file will be used fo.r input. (When one of these commands--E, F, J, N, R, or Y--is issued and an end-of-file is encountered, the EDITOR pauses and requests that the user specify another input file, thus allowing continuation of the command. If the /M option has not been previously specified in the input line, the end-of-file condition remains in effect. See Se:tion 3.9 for an example.) 3-1 to a 'rAB when 3.2.2 Input and Output Specifications After the EDITOR has been called from the System Cassette it asks the input specification as follows: for *IN,)'JT FILE- The user responds with the input cassette drive number and filename and extension, if any. For example: the input If only a filename (and no input cassette drive) is specified, the default device--drive O--is assumed; the EDITOR prints the user's input specification line, only first it includes the assumed default device before echoing the filename, as illustrated below: The user has typed the filename AB, but bE~fore this is printed, the EDITOR inserts 0: and then goes on to eeho AB. If the input file is not found or if a syntax error occurs, the EDITOR prints a question mark (1), types an asterisk (*) at the left margin, and waits for another input designation. Any number of input files is permitted. If no input specification is made, (that is, a carriage return only has been typed in response to the INPUT request), a new file will be created using the console terminal keyboard as the input device. The EDITOR allows input from the keyboard via the Append command (see Example Using the EDITOR for an illus1:ration of this method of creating a program). If more than one input file is to be entered, the 1M option must be specified when the EDITOR is called flC'om the System Cassette. The user responds to the INPUT FILE line ''lith the drive number and filename of the first input file. He enters output information as described next, and then edits his file. When the end-of-file is reached during the editing procedure, the EDITOR again prints the INPUT FILE request and the user responds ,.,ith the drive number and filename of the second file. When the us«:!r finishes editing his final file and no more input files are available, he responds to the EDITOR's INPUT request by typing a t:=arriage return; the EDITOR continues and closes the output file. All input files are combined under the one filename specified in the output line. The EDITOR initially requests output information by printing: 3-2 The user responds with the output example : drive: number and :Eilename. For Again, if no device is designated, drive 0 is assumed and echoed. If the output file is to have the same name as the input file, the user need only type the correct out.put drive number followed by a carriage return; the EDITOR will echo the assumed name. For example: *I\Jp'rr FILf~-l :FIL~.f~AS *OJTPJT FILE:~:FILE.8AS The EDITOR allows only one output file and creates the header for this file on the specified cassette, deleting any file already on that cassette under the same name (and replacing it with 'if EMPTY in the directory listing) and leaving the cassette correctly postioned for further output. NOTE If no output designation is specified (that is, a carriage return only has be~en typed in response to the OUTPUT FILE request), the only output operations which may be performed are L (list buffer on the console terminal) or V (list buffer on the line printer). Only cassette files in ASCII mode are acceptable for use by the EDITOR. No error message is given if non-ASCII files are input, but the results of editing operations are garbled. Once I/O file designations are entered, the Symbolic EDITOR is ready to accept commands from the keyboard. It signifies this by printing a number sign (#) c:lt the left margin: this symbol occurs whenever the EDITOR is waitin9 for a command. 3.2.3 Version Numbers Each time a filename is indicated in response to thE~ output file specification line, the number 0 is assigned to it:. This number (called the version number) signifies that a new file has been created and that it has not been previously edited or referenced under this filename. The user may call a file from a specified cassette, make corrections to it and change it any number of times before he is finally satisfied with it or ready to use it for some other operation. In this case, he may reference the file in the output specification linH by specifying only the output c:assette drive number followed by a carriage return, since the filename itself will not be changed. Each time he does 3-3 this, the version number of the file i:3 increased by 1. When the version number of a file has been incremented in this manner so that it is greater than 0, it appears in dir.~ctory lis tings on the same line as the filename (see Chapter 2). NOTE Version numbers associab~d with edited files should not be confused with the V Monitor command, which prints the version of the Monitor currently in use. 3.3 MODES OF OPERATION The EDITOR operates in one of two diffe:rent modes: command mode or text mode. In command mode all i:nput typed on the keyboard is interpreted as commands instructing the EDITOR to perform some operation. In text mode, all typed input is interpreted as text to replace, be inserted into, or be appended to the contents of the text buffer. 3.3.1 Transition Between Modes Immediately afte:r being loaded into memory and started, the EDITOR is in command mod.e. The special character # is printed at the left margin of the teleprinter page indicati:ng that the EDITOR is waiting for a command.. All commands are terminated by pressing the RETURN key. In text mode, the EDITOR performs I/O operations on text stored within the text buffer. Text is input to the EDITOR buffer until a form feed is encountered. A line of text is terminated by a carriage return. If no carriage return is present, the "text entered on the current line is ignored. The buffer has room for approximately 5200 (decimal) characters. Whem text has been input to the extent that there are only 256 decimal locations available in the buffer, the console terminal rings a warning bell. From this point on, whenever a carriage return is detected during text input, control returns to the EDITOR command mode and the bell is rung. This line-at-a-time input may continue until the absolute end-of-buffer is encountered. At this point, no more text will be accomodated in the buffer: a "?" is printed and cont:rol returns to command mode every time the user attempts to input more text. 3.4 SPECIAL CHARACTERS AND Fm~CTIONS A number of the functions. These below. console terminal keys have special operating keys and their associated functions are described 3-4 3.4.1 RETURN Key In both command Clnd text modes, typing the RETURN key causes a carriage return and line feed operation and signal~1 the EDITOR to process the information just typed. In command mode, :,-t allows the EDITOR to execute the command just typed. A command will not be executed until ii: is terminated by the F~TURN key (with the exception of =, explained later). In text mode, RETURN causes the line of text which it follows to be entered in the te!xt buffer. A 1:yped line is not actually pari: of the buffer until terminated by the RETURN key. 3.4.2 Erase (CTRL/U) The erase charact:er (CTRL/U combination) is used for error recoveries in both command and text modes. It is generated by holding the CTRL key while simultaneously typing the U ke:y. When used :Ln text mode, CTRL/U cancels everything to its left back to the bHginning of the line; the EDITOR echoes t u and performs a carriage ret. urn/line feed (CR/LF); the user then continues typing on the next l:.ne. When used in command mode I' CTRL/U cancels the entire command; the EDITOR performs a CR/LF and prints a #. The: erase character cannot cancel pas t a CR/LF in Ed ther command or text mode. 3.4.3 RUB OUT Key Rubout is used in error recovery in both command and text modes. In text mode typing the RUBOUT key echoes a. backslash (\) and deletes the last typed character. Repeated rubouts delete from right to left up to, but not including, the CR/LF which separates the current line from the previous one.. For example: TI-fS (:)iJ~JICI-{\\\\ICK RROW'\J FOX will be entered in the buffer as: When used in command mode, RUBOUT is equivalent to the CTRL/U feature and cancels thH entire comma'nd; the EDITOR prints a. #, 'performs a CR/LF, and waits for another command to be entered. 3.4.4 Form Feed (CTRL/FORM) A form feed signals the EDITOR to return to command mod.~. A form feed typingr the CTRL ,ind FORM keys character is generated by simultaneously. This combination is typed while in text mode to indicate that the desired text has be!en entered and t.hat the EDITOR should now return to command mode. The EDITOR performs a CR/LF and 3-5 prints a # in response to a CTRL/FORM to indicate that it is back in command mode. CTRL/G is usually equivalent to CTRL/FORM except in the case of a SEARCH command, as explained in section 3.8.1. 3.4.5 The Current Line Counter (.) The EDITOR keeps track of the implicit decimal number of the line on which it is currently operating. The dot (produced by typing the period key) stands for this number and may be used as an argument to a command. For example, .L means list the current line; .-l,.+lL means list the line preceding the current line, the current line, and the line following- it, then update the dot (current line counter) to the decimal number of the last line printed. The following commands affect the curr,ent line counter as indicated: 3•4•6 1.- After a Read or Append command, the current line counter is equ.al to the number of the last line in the buffer. 2. After an Insert or Change command, the current line counter is equal to the number of the last line entered. 3. After a List or Search command, the current line counter is equ.al to the number of the last line listed. 4. After a Delete command, the current line counter is equal to the number of the line immediately after the deletion. 5. After a Kill command, the current line counter is to O. equal 6. After a Get command, the current line counter to the number of the line printed by the GET. equal 7. After a Move command, the current line counter is not updated and remains whatever it was before the command was issued. is Slash ( /) The slash symbol (/) has a value equal to the decimal number of the highest numbered line in the buffer. It may also be used as an argument to a c:ommand. For example: 10,/L means list from line 10 to the end of the buffer. 3.4.7 LINE FEED Key Typing the LINE: FEED while in command mode is equivalent to typing .+1 and will cause the EDITOR to print the line following the current one and to increment the value of the current line counter by one. 3-6 3.4.8 ALT MODE Key Typing the ALT MODE key while in command mode will cause the line following the current line to be printed and the current line counter to be incremented by one. If the curren 1t line is also the last line in the buffer, typing either ALT MODE or LINE FEED will gain a response of ? from the EDITOR indicating that there is no next line. Some console terminals provide an escape key (ESC) in place of the ALT MODE. Their functions are identical. 3.4.9 Right Angle Bracket (» Typing the right angle bracket (» while in command mode is equivalent to typing .+lL and will cause the EDITOR to echo > and then print the line following the current line. The value of the current line counter is increased by one so that it refers to the last line printed. 3.4.10 Left Angle Bracket «) Typing the left angle bracket «) while in command mode is equivalent to typing .-lL and will cause the EDITOR to echo < and then print the line preceding the current line. The value of the current line counter is decreased by one so that it refers to the last line printed. 3.4.11 Equal Sign (=) The equal sign is used in conjunction wi·th the pointer's dot (.) or slash (I). ~Vhen typed in command mode the equal sign causes the EDITOR to print the decimal value of the argument preceding it. In this way the user may determine the nurnb.~r of the current line (. = ), or the total number of lines in the buff.~r (/= ), or the number of some particular line (/-8= ) without counting lines from the beginning of the buffer. No carriage return need be typed following the equal sign. 3.4.12 Colon (:) Typing a colon produces the same result .as the equal sign (=). 3.4.13 Tabulation (CTRL/TAB) The EDITOR is written in such a way as to simulate tab stops at 8-space intervals across the teleprinber page. When t.he CTRL key is held down and the: TAB key is typed, the EDITOR produces a tabulation. A tabulation consists of from one to 'eight spaces, de'pending on the number needed to bring the carriage to the next tab stop. Thus, the 3-7 EDITOR may be used to produce neat columns on the teleprinter or line printer page. The tab function is used in conjuction with the /B option (for input. and output) to allow the user to produce and control tabulations in the text buffer during input operations. On input (under a Read command), the EDITOR will replace a group of two or more spaces with a tabulation if the user has specified the /B option. 3.5 COMMAND STRUCTURE A command directs the EDITOR to perform a desired operation. Each command consists of a single letter, preceded by zero, one, two or three arguments. The command letter tells the EDITOR what operation to perform; the a.rguments usually specify which numbered line or lines of text are affec'ted. Command format is illustrated in Table 3-2, where E represents any command letter. Table 3-2 Command Format Type of Command Command Format No Argument: E Perform operation E One argument: nE Perform operation referenced line. E on Two Arguments: m,nE Perform operation E through n, inclusive. on lines Three Arguments: m,n$jE 3.6 .Meaning the m This combina.tion is used by the MOVE command only and is explained in Section 3.6.3. COMMAND REPERTOIRE Commands to the EDITOR are grouped under three general headings: Input Commands Output Commands Editing Commands Explanation of the three types of commands is detailed in the following sections. Each command description will state if the EDITOR returns to comman.d mode after completing the operation specified by the command. All commands are entered when the RETURN key is typed. The EDITOR prints an error message consisting of a question mark whenever the user has requested nonlexistent information or used inconsistent or incorrect format in typing a command. For example, if a command requires two arguments, and only one (or none) is provided, the EDITOR will print ?, perform a carriage return/line feed, and ignore the command as typed. Similarly, if a nonexistent command character is typed, the error message ? 'N'ill be printed, follo\'led by a carriage return/line feed; the command will be ignored. However, if 3-8 an argument is provided for a cormnmand that does not require one, the argument will be ignored and the normal function of the conmunand performed. For example: Resul t: User Types: The buffer is empty. The user is aBking for nonexistent information. L ? The arguments are in. the wrong order. EDITOR cannot list backwards. 7,5L ? The ? This cormnand requires two arguments before the $: only one was provided. H The user types a nonexistent command letter. l7$lOM ? 3.6.1 Input Commands Two commands are available for inputting text, and Table 3-3. are described Table 3-3 Input Commands Command A Format Action. and Explanation Append the incoming text from 1:he console terminal keyboard to the information already in the buffer (if there is no input file t.he buffer will be empty initially). The EDITOR will enter text mode upon receiving this command and the user may then t.ype in any number of lines of text. The n.ew text will be appended to the information. already in the buffer, if any, until a form feed (C~rRL/FORM key combination) is typed: control then returns to command mode. By using the Append command wi ':h an empty buffer, a symbolic program may effectively be generated on-line by en':ering the program via thE! keyboard. Any rubout encountered during 4~xecution of an Append command will del4~te the last typed character. Repeated rllbouts will delete from right to left up to but not beyond the beginning of the current line. in Table 3-3 Input Commands (Cont'd) Command Format #R R Action and Explanation Read a page of text from the input file on the specified unit drive. The EDITOR will read information from the input file until a form feed character (CTRL/FORM key combination) is detected or until the EDITOR senses a text buffer full condition. All incoming text except the form feed is appended to the contents of the text buffer. Information already in the buffer remains there. NOTE In both these commands, the EDITOR ignores ASCII codes 340 through 376. These codes include the codes for the lower case alphabet (ASCII 341-372). The EDITOR returns to command mode only after the detection of a form feed or when a buffer full condition is reached. 3.6.2 Output Commands Output commands are subdivided into 1is·t and text transfer commands. List commands will cause the printout of all or any part of the contents of the text buffer to permit e:Kamination of the text. Text transfer commands provide for the output of form feeds, corrected text, or for the duplication of pages of an input file. List or text transfer commands do not affect the con'tents of the buffer. List Commands The commands in Table 3-4 cause part or all of the contents of text buffer to be listed on the console terminal or line printer. Table 3-4 List Commands Command Format Action and Explanation L #L LIST the entirl:! page. This causes the EDITOR to list the entire contents of the text buffer on the console terminal. L #nL LIST line n. followed by feed. 3-10 This line will be printed a carriage return and a line the Table 3-4 List Commands (Cont I d) Action and Explanation Command Format L im,nL LIST lines m through n console terminal. V iV V V inclusive on the List the entire text buffer on printer (if one is available) • the line inV List line n of printer. the line im,nV List line m through line printer. on the the buffer n on inclusive The EDITOR remains in command mode after a list command, and the value of the current line counter is updated so as to equal the number of the last line printed. Text Transfer Commands The The following commands control the output: of text and form feeds. EDITOR is designed to m1n1m1ze the possibility of illegal or meaningless characters being written into a source file: therefore the codes 340-376 and 140-177, and most illegal illegal (nonexistent) control characters will not be output. Table 3-5 Command Format Text TransfE!r Commands Action and Explanation E iE Output the current buffer to the output file and transfer all input to the output file: close the output file. P iP Transfer the entire contents of buffer to the output buffer. P inP Transfer line n only to the output buffer. P im,nP Transfer lines m through n inclusive (where m must be less than n) to the output buffer. When the output buffer becomes full, the text is output to the indicated output file. The P command automatically outputs a FORM character (214) after the last line of output. N iN Transfer the contents of the text buffer to the output buffer, delete the text buffer and read in the next logical page of text from thE! input file. , 3-11 the text Table 3-5 Command Format N inN Text Transfer Commands (Cont'd) Action and Explanation Execute the above sequence n times. If n is greater than the number of pages of input text, the command will proceed in the specified sequence until it reads the end of the input. file, then it will return to command modle. The N command <cannot be used with an empty text buffer. A? is printed if this is attempted. 3.6.3 Immediate end·-of-file. The Q command causes the lentire text buffer to be output. All text written into the output buffer is then written into the output file and the file closed, with control returning to the Cassette Keyboard Monitor. #Q Q Editing Commands The following commands permit deletion, alteration, text in the buffer. or expansion Table 3-6 Editing Commands Command Format Action and Explanation B #B List the n~ber of available memory locations in the text buffer. The EDITOR returns the number of locations on the next line. Iro es timate the number of characters tha"t can be accomodated in this area, mUltiply the number of free locations by 1.7. C inC Change line n. Line n is deleted, and the EDITOR enters text mode to accept input. The user may now type in as many lines of text as he desires in place of the deleted line. If more than one line is inserted, all subsequent lines will be automatically renumbered and the line count will be updated appropriately. A CTRL/FORM terminates the command. C #m,nC Change lines m through n inclusive (m must be numbered lless the n). Lines m through n are deleted and the EDITOR enters text mode allowing the user to type in any number of lines in their place. All subsequent lines will be automatically 3-12 of Table 3-6 Editing Commands (Cont'd) Command Action and Explanation Format renumbered to account for the! change the line count wi 11 be updatE!d. and After any Change operation, a return to command mode is accomplishE!d by typing a CTRL/FORM. After a Change, t:he value of the current line counter (.) is equal to the number of the last line input. The C command utilizes the Text Collector in altering text (see Section 3.7). o 'nD Delete line n. Line n is removed from the text buffer. The current line counter and the numbers of all succeeding lines are reduced by one. o im,nD Delete lines m through n inclusive. The space used by the line to be deleted is reclaimed as part of the Delete function (refer to Section 3.7, Text Collection). F iF Used during a string search. Find the next occurrence of the string currently being searched for (see SE!ction 3.8.2, Inter-Buffer Character Strinq Search). G iG Get and list the next line which has a label associated with it. (A label in this context is any line of text which does not begin with a spacE~, slash, TAB, or RETURN). The EDITOR begins with the line following the current l:.ne (line .+1) and tests for a line with a label. This will most often be a line beqinning with a tag; it might also be a line containing an origin. For example: TAD DCA ITHIS IS A COMMENT H~R~, 0 (This is line) the current (This line would be printed by the command G) TAD ISZ; (This line would also be prin1:ed if another G were typed) G tnG Get and list the next line which begins with a label; the EDITOR beqins at line n and tests it and each succeeding line as described in the preceding e:{ample. 3-13 Table 3-6 Editing Commands (Cont'd) Conunand Format Action and Explanation Both G and nG update the current line counter after finding the specified line. However, if ei 1:her version of the GET conunand reaches the end of the buffer before finding il line beginning with an ASCII character other than a tab, slash, or space, the current line counter retains the value it was assigned before the GET was issued, and a ? is typed to indicate that no tagged line was found. The EDITOR remains in con~and mode after a GET command. I In! Insert the typed text before line n until a form feed (CTRL/FORM) is encountered. The EDITOR enters text mode to accept input. The first line typed becomes the new line n. Rubouts are recognized. Both the line count: and the numbers of all lines following the insertion are increased by the! number of lines inserted. The value of the current line counter is equal to the number of the last line inserted. To re!enter conunand mode, the CTRL/FORM key combination must be typed (terminating te>:t mode). If this is not done, all subsequent commands will be interpreted erroneonusly as text and entered in the! program inunediately after the insertion. I II Insert text before line wi thout an argument). J IJ Initiate an inter-buffer string search (See Section 3.8.2, Inter-buffer Character String Search). K IK Kill (delete) the entire page in the buffer. The values of the special characters (/) cLIld (.) are set to zero. The EDITOR remai.ns in conunand mode. 1 (when NOTE The EDITOR ignores the commands nK or m,nK. This prevents the buffer from accidently being destroyed if the user intended to type a I,ist command (m,nL). 3-14 used 'rable 3-6 Editing Commands (Cont' d) Command Format M im,n$jM Action and Explanation Hove lines m through n inclusi vc~ to before line j (m must be numerically less than n and j may not be in the range between m and n). Lines m through n a.re deleted from their current position and are inserted before line j. The lines are renumbered after the move is completed although the value of the current line counter (,) is unchanged, as mO'/ing lines does not use any additional bu::fer space. (The $ character is produced by typing a SHIFT/4. ) A line or group of lines may be moved to the end of the! buf fer by spec:L fying j as /+1. For example, 1,lO$/+lM. Since the MOVE command re!quires three arquments, it must have three arguments in order to move even one line. This is done by specifying the same line number twice. Fo::::- example, 5,5$23M. This will move line !) to before line 23. The EDITOR remains :Ln command mode after a Move command. 3.7 S inS Search line n for the character specified after typing the S and a carriage return. Allow modification of the line when the character is found. (See Section 3.8.1, Single Character String Search~) Y inY Skip to a logica.l page in the input file, without writing any output. For example, #5Y.. This command reads through 4 logical pages of input, deleting them without producing output. The ::ifth page is read into the text buffer ~md control automatically returns to command mode. If there are no more pages of input, the EDITOR issues a ? and returns 1:'0 command mode. $ i$TEXT" #$TEXT' #" Perform a chara.cter string search for the string TEXT (see section 3.8 .. 2, IntraCharacter String Search). Buffer Following a string search, #" causes a search for the next occurrenGe of the string. TEXT COLLECTION The CAPS-8 EDITOR contains an automatic text collector which reclaims buffer space following the use of a D, S, or C command. If a full 3-15 buffer condition is reached, the user may output lines of text (using the P command, for example), and the,n delete these lines from the buffer--text collection is automatic and. always occurs on the three commands mentionE~d above. NOTE If extremely large amounts of 1:ext are deleted, the text collection process could take several seconds. For small amoun.ts of text, no appreciable time is lost. 3.8 CHARACTER SEARCHES Two types of searches were mentioned in Table 3-6--the standard character search and the character string search. Each is explained in turn. 3.8.1 Single Character Search The single character search may take one: of the following forms: #S or inS or im,nS where m and n represent line numbers (m<n), and S initiates the search command. This command searches the enti.re text buffer (or the line(s) indicated) for the search character. The search character is typed by the user after he types the RETURN key which enters the command, and does not echo on the teleprinter. The EDITOR prints the contents of the entire buffer or the indicated linE!(s) until the search character is found. When the se:arch character is found, printing stops and the user types a response chosen from the following table: Table 3-7 Search Character Options Option text CTRL/G Result Enter text: at that point at which the search character was found and printing stopped. (bell rings) Change the search character to the next character typed: search continues. If the character is not contained in the line, the remainder of the line will be typed and control will be returned to command mode. (For example, CTRL/G CTRL/G would cause the remainder of the line to be lis ted. ) 3-16 Table 3-7 Search Character Options (Cont'd) option 3.8.2 Result CTRL/FORM Continue searching for the occurrence of the charactHr. next RETURN key End line here, dele1:ing subsequent text on that l:.ne. all LINE FEED kE!y Make two lines out of thE! current line. Typing a line feed actually inserts a carriage return without returning control to command mode. RUB OUT key Delete cha.racters from the line. A rubout echoes a backslaBh (\) for each chara.cter deleted. When all characters have been deleted, echoing of "\" stops. Character String Search The character string search can identi~y a given line in the buffer by the contents of that line or any un~que combination of characters. This search returns the line number as a. parameter that can be used to further edit the text. There are two types of string search available: intra--buffer search and inter-buffer search. Intra-Buffer Character String Search The intra-buffer search scans all text in the current buffer for a specified character string. If the string is n01: found, a ? is printed and control returns to command mode. If the string is found, the number of the line which conta.ins the string :Ls put into the current line counter and control waits for the user to issue a command. Thus, searching for a cha.racter string in this manner furnishes a line number which can then be used in conjunction with other EDITOR cormnands. This provides a. useful framework for editing, as it eliminates the need to count lines or search for line numbers by listing lines. An intra-buffer search is signalled by typing the ALT MODE key (which echoes as $) in response to the i printed by the EDITOR. The user then types the string to be found (as ma~ny as 20 characters may be specified--any additional characters typed are echoed but not included in the search). The search string calnnot be broken across line boundaries. Typing a single quote (') terminates the character string; when the RETURN key is typed the! search is performed beginning at line 1 of thE! text buffer. Use of t:he double quote (") causes the search to begin at the current line +1. (Use of 'and n as command elements prohibits their use in the: search string,. An incorrect response resets the current line counter to the be9inning of the buffer. ) 3-17 For example, assume the text buffer contctins the following text: ABC DEF' GJO lA283C4D5E6 .STRINGABCD The user wants to list the line that cont:ains ABC; this could be by typing: done ~$ARC'L The search begins with line 1 and continues until the string is found. The current line counter is set equal to the line in which the string ABC occurred, and the L command causes t:he line to be printed as follows: ARC DEF' llJO Control returns to command mode, awaitinq further commands. user wanted to find the next reference tel ABC, he could type: If the In this case, " is a command which causes: the last string searched for to be used again, with the search beginning at the current line +1. It is not necessary to enter the search string again. The command may be used several times in succession. For example, if the user wanted to find the fourth occurrence of a string containing the characters FEWMET he could type: IS F'EINl-:ET' .. "' .. L This command lists the line which contains the fourth occurrence of that string. The L (List) command (or aLny other command code) can be given following either • or" The L command causes the line to be listed when and if it is found. In order to clear the text string buffer, the user can type: #$' The system responds with a question mark and the text string buffer is cleared. The properties of the commands I and " allow for easy and useful editing, as the following example illustrates. In order to change CIF 20 to CIF 10, the user can issue the following commands: 3-18 #$ D'JM" , $C IF 20 ftC elF 10 /I'vE W F I ~LD (CTRL/FORM) The above set of instructions first causes the EDITOR to start at line 1 and search for a line beginning with DUM,. A search is then made for CIF 20, starting fror.1 the line af1:er the line containing the string DUM,. When this string is found, the line number of the line containing the string CIF 20 becomes thE~ current line number. The C command is gi ven, and the user then c::hanges the line to the correct instruction, CIF 10 /NEW FIELD • Since this search feature produces a line number as a result, any operations which can be done by explicitly specifying a line number can be done by specifying a string instE~ad. For example: #$STQING'+4L will list the fourth line after STRING in the text buffer. the first occurrence of the text 1$ LABEL 1" • " LABEL?" "L will list all lines between the two labeds, inclusive. #$PFLfTG'S will do a characit.er search on the line which contains PFLUG. (The user types the search character aft:er typing the :RETURN key that enters the line.) In cases where both strings and explicit: numbers are used, 'should be used first. For example, the following commands: strings #l+$RAD! 'L will not list th«~ next line after the st:ring BAD! occur::;. syntax is: The correct #$BAD!'+lL Inter-Buffer Character String Search The inter-buffer search scans the current text buffer for a character string. If the string is not found, the current buffer is written to the output file, the buffer is cleared, and the next buffer is read from the input device. The search them resumes at line 1 of the new buffer. This process continues until either the string is found or no more input is le:Et. If input is exhaust:ed, control returns to command mode with all th«~ text having been writt:en to the outpU": file. If the string is found, control returns to command mode with the current line equal to the number of the line containing the first oCI::urrence of the string. For example, a command to find the character s'tring GONZO may 3-19 appear as follows: IJ $llONZO' I. =vH~24 ~ The J command initiates an inter-buffer search; the $ is printed automatically by the EDITOR, and the user types in the character string he wishes to search for. The search proceeds, and when the string is found, control returns to command mode. The user types the .= construction to discover the number of the line in the current buffer on which the string is contained. To find further occurrences of the string GONZO, the user can use the F conunand. The F command uses the last character string entered to search the buffer starting from the current line count +1. #F' #.=0106 - -- The above example causes a search for the string GONZO starting at the current line +1. If no output file is specified in the J or F commarids, the EDITOR reads the next input buffer without attempting to produce any output. This provides an E!asy way of paging through text for a particular string. After the J or F commands have processed the entire input file, or Q command must be executed to close t:he output file. an The following two comnlands may be used command, once given: search to abort the string Table 3-8 Terminating a String Search Command CTRL!U Explanation A CTRL!U will return control to the EDITOR conunand mode if executed while entering text in a string search command; the string search conunand is ignored, as in the following example: #J $WORD ffJ II The inter-buffer search for the characters WO:RD was aborted by the user typing tU before terminating the string with ' or n RUB OUT Executing the RUBOUT key while entering text for use in a string search causes the text so far entered to be ignored and allows a new string to be inserted. The EDITOR anS'rlers the command by typing 3-20 E Table 3-8 Terminating a String Search (Cont'd) Command Explanation $, as seen in the following example: (RUBOUT) An example of the use of the character s'tring search is contained the EDITOR Demonstration Run found at thle end of this chapter. 3.9 in EDITOR ERROR MESSAGES Errors made by the user while running thie EDITOR may be of two types. Minor errors (such as an EDITOR command string error, an attempt to execute a read oz' write command without assigning a device, or a search for a nonexistent string) will cause a question mark to be typed at the left margin of the teleprin'ter paper. The command may be retyped. Major errors force control to return to ·the Keyboard Monitor and may be due to one of the causes listed in Table 3-9. These errors cause a message to be typed in the form: ?ntC where n is one of the error codes i.n Table 3-9 and tC indicates that control will pass to the Keyboard Monitor when a character is typed. Table 3-9 EDITOR Error Codes Error Code Meaning o The EDITOR failed in reading from a device. An error occurred in the device handler; most likely a hardware malfunction. I The EDITOR failed in device; generally malfunction. 2 A file close error occurred. The output file could not be closed; either the cassette reached an end-of-tape condition, or a sentinel file needs to be written before any new output files can be created on the cassette. 3-21 writing onto a a hardware A ? occurs any time the EDITOR encounters a syntax error. In addi tion, the following error message m,ay be printed by the EDITOR: Me,aning Message UNIT HAS OPENED FILE Two files cannot be open on the same device at the same time. During the editing of a file, the outpu-t cassette specified in the command string may become full before the editing process is completed. If this is the case and further writing is attempted on that cassette, an error occurs. Thl3 output file is closed and the message: FULL.OUTPUT FILEis printed. The user must now indicate a new output cassette and file which will contain the text that would not fit on the first cassette and any further editing the user wishes to do. Since the contents of the text buffer are retained through -this procedure, no text will be lost if this error occurs. NOTE If no output file is spe,e:ified when this condition occurs, th,e EDITOR again requests an output file; this continues until the output designation is correctly specified. Assuming the new output device is valid, the EDITOR will continue the operation which filled the old file, putting all output into the new output file. After editing is completed, the output files should be combined using the EDITOR. The entire process may then appear as follows: ....R EDIT *INPUT FILE-0:IN *OUTPUT FILE-I: OUT IY IJ $STRI NG' FULL *OUTPUT FILE-2:0UTEMP l·L TAD STRING Device 1: is full. 2: is specified as the new output device and editing continues. 3-22 At this point the output "file" is 2 files--l:OUT, 2:0UTEMP. When output is split like this, the split may have occurred in the middle of a line. Therefore, the output files should never be edited separately as the split lines will then be lost. In a case such as this, the files should be combined with the EDITOR as follows: .R EDIT/M *INPUT FILE-l:OUT *OUTPUT FILE-3:0UT IE ~INPUT FILE-2:0UTEMP *1 NPUT FILEThe new file, OUT, may then be edited. 3-23 3.10 EDITOR DEMONSTRATION RUN The following ,=xample illustrates both the use of the EDITOR to create a new file and a few of the commands available for editing. Sections of the printout are coded by letters which correspond with the explanations following the example. { .R EDIT *1 NPUT FILE*OUTPU T FI LE-.0: P ROG. PA L A tA {CHRPUT' SNA 0 B C ( D { E {~.- 35 t·l JMP I CHRPU T CDF 0 DCA SHELF TAD WI \HAT 1 SPC JMP PUTII SNA CLO JMP PUTI2 CMA DCA lNH AT 1 IACCEPTS CHAR IN AC AND IPACKS IT INTO OUTPUT BUFFER II GNORES NULL SNA CLO\A SNA ClA C P F .!K !.A TAD SHELF AND (360 ClL RTL G ~E H { I .R EDIT *INPUT FIlE-0:PROG.PAL { ~OUTPUT FILE-l:PROG.PAL J 'R { .l$SPC'L K SPC SPC\A L 3-24 A The user calls the EDITOlt; the output file will be called PROG.PAL and will be stored on the default dE!vice--cassette drive O. There is no input file since one will be created from the console terminal keyboard. The Append command is used to insert text into the empty buffer. B Text is inserted. C The user makes a mistake RUBOUT key to correct it o More text is added. E The user n.otices a typing mistake he has made several lines back in the text. He types a CT'RL/FORM to finish the Append command, searchs for the illegal character, corrects it, and then lists the line. F The P command writes the c:::urrent buffer into the cmtput file plac:Lng a form feed after the last line. ~rhe K command deletes all text in the current buffer in preparation for a new page of text. G The user inserts new t4~xt using the Append command. When he is finished he types a C'1 RL/FORM to end t.he command. and uses the I H file; The user closes the CaSS4:!tte to the returns Monitor. I In lookin9 over the listing, the user notices another mistake~ he opens the file, calling it by the same name in both the input and output: specification lines. J The Intra-Buffer Character String Search is used to locate the illegal instruction and list it. K The Single Character Search is used to find the letter to be corrected, and the RUBOUT key deletes it. L The file is closed and control returns to the Keyboard Monitor. 3-25 control Keyboard again CHAPTER 4 SYSTEM COPY 4.1 INTRODUCTION The CAPS-8 System Copy (SYSCOP) program allows the user to copy individual files or all files from one cassette to another, giving him the ability to make mUltiple copies of a cassette, add files to a cassette, and "clean up" full cassettes so that they may become available for future use. System Copy transfers all non-empty files on the specified input cassette to the specified output cassette; space taken up by previously deleted files (*EMPTY files) is regained. (Single file transfers of ASCII files can be performed using the CAPS-8 EDITOR; see Chapter 3.) 4.2 CALLING AND USING SYSTEM COpy To call SYSCOP from the System CassettE!, the user types: .R SYSCOP/Options in response to -the dot (.) printed by t.he Keyboard Monitor. 4.2.1 System Copy Options There are three options available for use with System Copy; these options are discussed in Table 4-1.. (Option usage is explained in Chapter 2, Section 2.4.3.) Table 4-1 System Copy Options Option Meaning /F This option allows the user to transfer individual cassette files from one cassette to anothE!r. To use the /F option, the user rE!sponds to the request for input specification with the cassette drive number and the name of the file to be copied. If the user makes a typing error while entering the input specification, he can type CTRL/U to redo the entry. /U If the /U option is specified, drive 1 is zeroed and then drive 0 is copied to drive 1. (The /U option is especially useful for makin9 copies of the System Cassette.) When thE! /U option is used, no further I/O specifications are necessary. /Z This option caUSE~S the output drive (indicated in thE~ output specifi,::ation line) to be zeroed before any c()pying begins. 4-1 4.2.2 Input and Output Specifications Before indicating the input and output drives to be used for the copy operation, the user must ensure that the proper cassettes are mounted. The input cassette (the one to be copied) should be write-locked to protect the data. The output cassette (the one that will be the new copy) should be write-enabled to receive the data. When the input and output cassettes are mounted on the correct drives, the user is ready to begin the copy operation. After SYSCOP has been called from the System Cassette, it asks for the input specification as follows: I N- The user responds with a single digit (0 through 7) specifying the input cassette drive number. A carriage return is not necessary. If the IF option was used, the user responds to the IN- query with the drive number and the name of the file to be copied; in this case, the user must also type a carriage return. In the following example, a file named ECHO is to be copied from drive 1. IN-:ECHO After the input specification has been entered, System the output specification as follows: Copy requests The user responds with a single digit (0 through 7) specifying the output drive number. The output drive number cannot be the same as the input drive number. If the user wishes to change the input/output specifications at this point, he may type a carriage return instead of the drive number after OUT- to return to the IN- message. After both input and output drives have been indicated, the copy operation starts. All non-empty files on the input cassette are copied, in order, onto the output cassette. (If a file is to be copied onto a cassette under the same filename and extension as one already present on the cassette, it will still be copied; however, future reference to the file will cause the first file under that name to be accessed. To circumvent this condition, the user should first delete any old files or zero the output cassette.) t~en all files have been copied, control returns to the Keyboard Monitor. 4-2 Only two responses other than the digits 0 through 7 are accepted in reply to the input/output specification messages: carriage return and CTRL/C. Carriage return returns the US4~r to the input specification message; CTRL/C returns the user to the Keyboard Monitor. Any other response is considered illegal. Illegal responses are neither accepted nor echoed by System Copy; System Copy simply waits for the user to type a legal response. 4.2.3 System Copy Example In this example, the user wishes to mak4~ a copy of the Sys tern Cassette which is mounted on drive O. One purpose of the copy operation is to regain wasted space being taken up by previously deleted files. A directory listing shows that the System Cassette currently contains the following files C2BOOT.BIN 01/22/73 MONTOR.BIN 01/22/73 SYSCOP.BIN 01/25/73 *EMPTY. EDIT .BIN 01102/73 PALC .BI N 01/02/73 BASIC .BI N 01/~2/73 *EMPTY. *EMP TY • *EMPTY. *EMP TY. ABC 01/22/73 The user mounts a write-enabled cassetb~ on drive 2 tape. He than calls System Copy as follows ~R and rewinds the SYSCOP IZ The /Z opti?n will zero the cassette mounted on the cassette drive specified 1n the OUT- message (drive 2), leaving only the sentinel file on the cassette. System Copy then requests the input and output drive numbers and the user responds as .follows: The copy operation starts. If System Copy detects any problems during the copy opera.tion, it prints one of the error messages explained in Section 4.3. A successful copy operation returns control to the Keyboard Monitor. The user can then issue a DIrectory command to ensure that all files were copied correctly. In this example, a successful copy operation should produce the follm.,ing directory listing: C2BOOT.BIN MONTOR.BIN SYSCOP.BIN ED IT .B IN PALC .BIN BASIC .BIN ABC 01/22/73 01/22/73 01/25/73 01/02/73 01/02/73 01/02/73 01/22/73 4-3 4.3 SYSTEM COPY ERROR MESSAGES Errors which occur during a System Copy operation may be of two types: user errors and cassette errors. Use:r errors may be corrected with the appropriate action as detailed in Table 4-2. Cassette errors normally require the user to use another cassette (for either input or output) to complete the copy operation. Control does not return to the Keyboard Monitor when a System Copy error occurs. The user may use CTRL/C to return to the Monitor if he cannot correct the indicated error. Table 4-2 System Copy Error Messages Message Meaning INPUT ERROR ON UNIT n An input error has occurred on the cassette drive specified. The user should try the copy operation using another cassette. UNIT n NOT READY There is either no cassette on the cassette drive specified or no such drive exists. UNIT n WRITE LOCKED The user tried to write data when the write protect tab of the cassette on the drive specified was write-locked. OUTPUT ERROR ON UNIT n An output error has occurred on the cassette drive specified. The user should try the copy operation using another cassette. 4-4 CHAPTER 5 PALC 5.1 INTRODUCTION PALC (an acronym for Program Assembly Language for Casse:tte) is an 8K 2-pass assembler (with an optional third pass) designed for the CAPS-8 System. A program written in PALe sourcle language is translated by the assembler into a binary file in two passes. Pa.ss I reads the input file and sets up the symbol table; pass 2 reads the input file and uses the symbol table created in pass 1 to gene~ate the binary (object) file. The binary file may then be loaded into memory using the Cassette Keyboard Monitor. PALC allows I/O using any CAPS-8 device ~,.,hich handles ASCII text. It is called from the System Cassette using the Keyboard Monitor Run command, accepts input generated by the CAPS-8 EDITOR, and will generate output acceptable for use with both the Moni tc,r Load and Run commands. 5.2 CALLING AND USING PALC The user calls PALC from the System Cassette by typing: .R PALC/Options PALC responds by printing: -INPUT FILES ..!... The user enters his input cassette drive number and filename in answer to the asterisk printed by PALC; a total of three input specifications are allowed, so that the input interacti()n may appear as follows: -INPUT. FILES *l:TRA.PAL i0 zTRB .PAL ,.!11 THe .PAL Usually input files will contain the extension .PAL (see Chapter 2, Section 2.2.2), and PALC will assume 1:his extension unless the user explicitly designates another. Thus in 1:he above example the user may have responded by typing only I:TRA, O:TRB, and I:TRC, in which case PALC would automatically assume and echo the .PAL extension. If the filename contains an extension other than .PAL, the user specify this extension when entering the input. For example: -INPUT FILES ..!.lIFAIL.l i2ITABLE.ASC. ~zSHOR. 5-1 must In the case of the third input file (SHOR.) an extension is not to be indicated. If the user wants to prevent PALe from assuming .PAL, he must be sure to include a period in the input line; otherwise PALC will append .PAL a.nd look for the filename with that extension. If the user does not specify a drive number in his input line, the default device--drive O--is assumed. PALC will automatically insert 0: in the input line before echoing the filename as the user has entered it. For I~xample: *0: FLOA .PAL The user actually typed only the charactE!rs FLOA; PALC assumed both the drive number 0 and the .PAL extension and correctly inserted these in the I/O line before echoing the complE!te line. A carriage return typed in response to any of the asterisks that there are no more input files. After the input specifi.cations have been entered, binary output as follows: PALC indicates requests the -BINAH.Y FILE ..!. The user responds similarly here by indicating an output drive number and filename. Only one binary file is allowed and it should have the extension .BIN (since the Monitor Run and Load commands assume this extension). If the user wants his binary file to be called by the same name as the first input file he need only type the drive number, a colon, and a. carriage return. Pl~C will echo this, adding the filename with a .BIN extension. For example: -INPuT F'ILES ~l :OPEN.PAL ~ -8 I NAR Y FILE_ ..!0:0PEN.BIN As in the input line, drive 0 and the extension (.BIN) are assumed if the user fails to specify them, and a response of only a carriage return indicates that no binary file is to be produced. Once the binary output line has been ans\Olered, PALC prints: -LIST TO * The user has a choice of sending his output listing to either the console terminal or the line printer. To send output to the console terminal the user types the characters TTY in response to the asterisk as follows: -LIST TO ..!.ITY 5-2 To send output to the line printer, the user responds by typing LPT: -LIST TO ~LPT A response of a carriage return indicates that no produced. listing is to be During a PALC assembly only one listing is produced and :it may be sent to only one device, either the line printer or consoll~ terminal. A second listing must be produced by anothe!r assembly. If more cassettes are to be involved in t:he assembly than the user has TU60 unit drives, a certain procedure must be follml7ed during the assembly process. For example, assume the user has only one TU60 dual cassette unit, and 3 input files are s t:ored on individual cassettes. His I/O specification is as follows: -INPUT FILES *l:Fl.PAL .:!0:F2.PAL *0:F3.PAL -=BINARY FILE *l:RESLT.BIN -=-LIST TO ~LPT PALC is a 3-pass assembler, therefore all three input files will be referenced 3 times. Assume the user has. mounted 1:Fl.P1U, on drive 1, and 0:F2.PAL on drive 0: assembly begin.s. First the file Fl is processed, then F2. After assembly of F2 PALC looks for F3, but since the file is on a t:hird cassette which is not mounted, the assembly pauses and PALC prints: This pause in the assembly allows the user to dismount a cassette and replace it with the cassette containing the file F3.PAL. The user then responds to t:he above I/O line with the drive number on which he has mounted the nE~W cassette (assume 0), as follows: MOUNT F3.PAL'?0 If the response is valid, PALC responds by typing a CR/LF and continues pass 1 of the assembly. (An in.valid response Gauses PALC to print a ?: the USE!r may then type the correct response.) When pass 1 is completed PALC automatically begins the second pass, which creates the binary file. The binary output file specification must now be made. Regardless of the output specification indicated in the initial dialo9ue, PALC pauses and asks: MOUNT rtESLT.BIN1 5-3 The user must mount the output cassette which is to contain the binary file and respond with the drive number on which he has mounted it. Assume he decides to mount the cassette on drive O. He replaces the cassette currently on that drive (c:ontaining F3.PAL) with the new cassette and responds to the conunand line as follows: MOUNT RESLT.BIN?0 PALC then opens the binary file on this cassette and prints: BINAHY FILE OPENED ON 0 NOTE The cassette used for binary output may not contain any of the input files. Under no circumstances: should the cassette containing thE! binary file be removed from the drive until pass 2 is completely finished. PAI,C will indicate completion of the pass by printing the message, "BINARY FILE CLOSED". After specification of the binary output~ file, PALC continues pass 2 of the assembly by processing the first: input file, Fl.PAL, currently on drive 1. After this file is process€!d, PALC pauses and asks: MOUNT F2.PAL? Since the binary file being created on drive 0 is only partially complete at this point, the user must not remove the cassette from that drive. He must instead remove the cassette from drive 1 and replace it with the cassette containi.ng F2.PAL. He then types 1 in response to the I/O line and assembly continues until F3.PAL is needed. PALC again pa,uses and asks: MOUNT F3.PAL? Again the user replaces the cassette on drive 1 with the appropriate one, correctly answers the I/O line, and assembly continues. Once pass 2 is done, pass 3--the listi.ng pass--must be processed. Drive 0 may again be used for input, and assembly of input files continues in the same manner as during passes 1 and 2. The procedure of mounting and dismounting cassettes may be repeated as many times as necessary until all input files are processed and the desired output produced. If an I/O error occurs during any of the three passes or if an output casset~te becomes full, the user must restart the assembly beginning with pass: 1. 5-4 NOTE When the assembly is complete, PALC prints tc (CTRL/C). The user then mounts the system cassette and types CTRL/C to return to the Monitor. 5.2.1 PALC Options Table 5-1 lists the options available in PALC which may in the Monitor Run or Load specification line. Option 5.3 be Table 5-1 PALC Options Meaning /0 Generate a DDT-compatible symbol t.able (applicable only if a listing file is specified). /H Generate non-paginattad output. Hea.der, page numbers and page format are suppressed (applicable only if a listing file is specified). /K Used in assembling v 4ary large programs; causes system containing 12K or more of memory to use fields 2 and up as symbol table storage. /N Generate the symbol table, but not the listing (applicable only if a listing file is specified; the /H option is assumed) • /5 Omi t the symbol tab14a normally generated with the listing (,applicable only if a listing file is specified). /T Output a carriage return/line feed in place of the form .feed character (s) in the program (appli'cable only if a listing file is specified). CHARACTER SET The following characters are acceptable .as input to PALe: 1. The alphabetic characters: A through Z 2. The numeric characters: 0 throu9h 9 3. The characters described in following sections as special characters and operators 5-5 indicated 4. Characters which are ignored during assembly such as LINE: FEED, FORM FEED, and RUB OUT All other characters are illegal (except when used in a cause the error message: comment) and IC AT nnnn to be printed during pass 1; nnnn represents the location at which the illegal character occurred. (As assembly proceeds, each instruction is assigned a location determined by the current location counter (see section 5.7.3). When an illegal character or any other error is encountered during assembly, the value of the current location counter is returned in the error message.) Illegal characters do not generally cause assembly t:o halt. If an illegal character occurs in the middle of a symbol, the symbol is terminated at that point. 5.4 STATEMENTS PALC source programs are usually prepared on the console terminal (using the CAPS-8 EDITOR) as a sequence of statements. Each statement is written on a single line and is terminated by typing the RETURN key. There are four types of elements in a PALC statement which are identified by the order of their appearance in the statement and by the separating (or delimiting) character which follows or precedes the element. These are: label, instruction operand /comment A statement must contain at least one of these elements and may contain all four types. The assembler interprets and processes the statements, generating one or more binary instructions or data words, or performing an assembly prpcess. 5.4.1 Labels A label is the symbolic name created by the programmer to identify the location of a statement in the program. If present, the label is written first in a statement. It must begin with an alphabetic character, contain only alphanumeric characters, and be terminated by a comma; there must be no intervening spaces between any of the characters and t:he comma. 5.4.2 Instructions An instruction may be one or more of the mnemonic machine instructions or a pseudo-operation which directs assembly processing. (Assembly pseudo-ops are described later in this chapter; Appendix C summarizes both the mnemonic machine instructions and pseudo-ops used by PALC.) Ins tructions arE:! terminated with one or more spaces (or tabs if an 5-6 operand follows) or with a semicolon, slash, or described in Sec1:ion 5.5.3. 5.4.3 carriaqe return, as Operands Operands are the octal or symbolic addresses of an assE~mbly language instruction or the argument of a pseudo-operator, and can be any expression. In each case, interpretation of an operand depends upon the instruction or the pseudo-op. Operands are terminated by a semicolon, slash, or carriage return. 5.4.4 comments The programmer may add notes or comments to a statement by separating these from the remainder of the line with a slash. Such comments do not affect assembly processing or program execution but are useful in the program listing for later analysis or debugging. The assembler ignores everything from the slash to the next carriage return. (For an example see Section 5.5.3, Statement Terminators.) It is possible to have only a carriage return on a line, resulting a blank line in the final listing. No error message is given. 5.5 in FORMAT EFFECTORS The following characters are useful in controlling the format of an assembly listingr • They allow a neat r,eadable listing to be produced by providing a me:ans of spacing through the program. 5.5.1 Form Feed The form feed code causes the assembler to output blank lines in order to skip to a new page in the output listing during pass 3; this is useful in creating a page-by-page listin9. The form feed is generated by typing a CTRL/L on the console terminal. 5.5.2 Tabulations Tabulations are u.sed in the body of a source program to separate fields into columns (for details refer ·to Chapter 3). For example, a line written: GO,TAD TOTAL/MAIN LOOP is much easier to read if tabs are inserted to form: 5-7 5.5.3 IMAIN LOOP TAD TOTAL GO, statement Terminators The RETURN key is used to terminate a statement and causes a line feed/carriage return combination to occur in the listing. The semicolon (;) may also be used as a statement terminator and is considered identical to a carriage return except that it will not terminate a comment. For example: ITHIS IS A COMMENT; TAD R TAD A The entire expression between the slash (/) and the carriage return is considered a comment. Thus in this caSE~ the assembler ignores the TAD B. If, for example, the user wishes to wri1:e a sequence of instructions to rotate the contents of the accumulator and link six places to the right, it might look like the following:: rlTH RTrl HTH However, the programmer can alternatively place all three instructions on a single line by separating thE~m with the special character semicolon (;) and terminating the entirE~ line with a carriage return. The above sequence of instructions can 1:hen be written: These multi-statement lines are particularly useful when setting aside a section of data storage for use during processing. For example, a 4-word cleared block could be reserved by specifying either of the following: LIST, 0; 0; o or LIST~ 0 o o o Either format may be used to input data words (data words may be in the form of numbers, symbols, or expres~;ions, explained next.) Each of the following lines generates one storaqe word in the object program: 5-8 DATA.. 1111 A+C-B 5 123+82 5.6 NUMBERS Any sequence of digits delimited by either a SPACE, TAB, semicolon, or carriage return forms a number. PALC initally interprets numbers in octal (base 8). This base can be changed to decimal using a special pseudo-operator (discussed in Section 5.10.2). Numbers are used in conjunction with symbols to form expressions. 5.7 SYMBOLS A symbol is a string of alphanumeric characters beginning with a letter and delimited by a non-alphanumeric character. Although a symbol may be any length only the first six characters are recognized; since additional characters are ignored, symbols which are identical in their first six characters are considered identical. 5.7.1 Permanent Symbols The assembler contains a table (called its permanent symbol table) which lists the symbols for all PDP-8 pseudo-op codes, memory reference instructions, operate and lOT (Input/Output Transfer) instructions. These instructions are symbols which are permanently defined by PALC and need no further definition by the user; they are summarized in Appendix C. For example: HLT 5.7.2 This is a symbolic instruction assigned the value 7402 by the assembler and stored in its permanent symbol table. User-Defined Symbols All symbols not defined by the assembler (and represented in its permanent symbol table) must be defined within the source program. A symbol may be used as a statement label, in which case it is assigned a value equal to the current location counter; it is called a symbolic address and can be used as an operand or as a reference to an instruction. Permanent symbols (instructions, special characters, and pseudo-ops) may not be used as symbolic addresses. The following are examples of legal symbolic addresses: ADDR" TOTAL" .sUM" AI .. 5-9 The following are illegal symbolic addresses: AD>M .. 7ABC .. LA BEL .. D+TAG .. LABEL .. (contains an illegal character) (first character must bE~ alphabetic) (must not contain imbedded spaces) (contains a legal but non-alphanumeric character) (must be terminated by a comma with no intervening spaces) 5.7.3 Current Location Counter As source statements are processed, Pru~c assigns consecutive memory addresses to the instructions and data words of the object program. The current location counter contains the address in which the next word of object code will be assembled cmd is automatically incremented each time a memory location is assigned. A statement which generates a single object program storage word increments the location counter by one. Another statement might generate six storage words, incrementing the location counter by six. The user sets or resets the location counter by typing an asterisk followed by the octal absolute address value in which the next program word is to be stored. If the origin is not set by the user, PALC begins assigning addresses at location 200. TAG, B, A, *300 CLA JMP A /SET LOCATION COUNTER TO 300 0 DCA B The symbol TAG (in the preceding example) is assigned a value of 0300, the symbol B a value of 0302, and the symbol A a value of 0303. If a symbol is defined more than 40nce in this manner, the assembler will print the illegal definition diagnostic: ID address where address is the value of the location counter at the second occurrence of the symbol definition. The symbol is not redefined. (For an explanation of diagnostic messages refer to Section 5.14 PALC Error Conditions.) For example: *3~~0 START, CONTIN, A, COUNTER, START, TAD A DCA COUNTER JMS LEAVE JMP START -74 o CLA CLL 5-10 The symbol START would have a value of 0300, the symbol CONTIN would have a value of 0302, the symbol A would have a value of 0304, the symbol COUNTER (considered COUNTE by the assembler) would have a value of 0305. When the assembler processed the next line it would print (during pass 1): IR CQUNTE+0001 Since the first pass of PALC is used to define all symbols, the assembler will print a diagnostic during pass 2 if reference is made to an undefined symbol. For example: *7170 A, TAD C CLA CMA HLT JMP A 1 C, The dollar sign must terminate all PDP-8 assembly programs. o $ This would produce the undefined symbol diagnostic: US A+0003 5.7.4 Symbol Table Initially, the assembler's symbol table contains the mnemonic op-codes of the machine instructions and the assembler pseudo-op codes as listed in Appendix C; this is its permanent symbol table. As the source program is processed, user-defined symbols along with their binary values are added to the symbol table. The symbol table is listed in alphabetical order at the end of pass 3. During pass 1, if PALC detects that the symbol table is full (in other words, there is no more memory space in which to store symbols and their associated values), the symbol table exceeded diagnostic is printed: SE address The assembler then prints t C and waits for a response from the user. By typing t C the user can return control to the Monitor. If the system contains more than 8K of memory, the user may choose the /K option with the Run command (see section 5.2.1), or more address arithmetic may be used to reduce the number of symbols. It is also possible to segment a program and assemble the segments separately, taking care to generate proper links between the segments. (See Section 5.11.) PALC's symbol capacity is 768 symbols. The permanent symbol table contains 69 symbols, leaving space for 699 possible user-defined symbols. Each additional 4K allows 768 new symbols. Section 5.10.12 provides instruction.s concerning altering PALC's permanent symbol table should the USE!r wish to add instructions more suited to his programming needs. 5-11 5.7.5 Direct Assignment statements The programmer may insert new symbols with their assigned values directly into the symbol table by USin9 a direct assignment statement of the form: SYMBOL=VALUE VALUE may be a number or expression. No spaces or tabs may appear between the symbol to the left of thE~ equal sign and the equal sign itself. The following are examples of direct assignment statements: A=6 EXIT=JMP I 0 C=A+B All symbols to the right of the equal si.gn must be already defined. The symbol to the left of the equal sign is subject to the same restrictions as a symbolic address, and its associated value is stored in the user's symbol table. The use of the equal sign does not increment the location counter: it is, rather, an instruction to the assembler itself. A direct assignment statement may also E!quate a new symbol to the value assigned to a previously defined symbol. In this case, the two symbols share the same memory location. 8ETA=17 GAMMA=BETA The new symbol, GAMMA, is entered into the user's the value 17. symbol table with The value assigned to a symbol may be changed as follows: ALPHA=5 ALPHA=7 The second line of code shown changes the value assigned to ALPHA from 5 to 7. (This is legal but will generate an RD error message, explained below.) Symbols defined by use of the equal sign may expression. For example: A=100 B=400 A+B TAD A be used in any valid IDOES NOT UPDATE CLC IDOES NOT UPDATE CLC ITHE VALUE 500 IS ASSEMBLED AT LOC. 200 ITHE VALUE 1200 IS ASSEMBLED AT LOC. 201 If the symbol to the left of the equal sign has already been the redefinition diagnostic: defined, RD address will be printed as a warning, where address is the value of the location counter at the point of redefinition. The new value will be 5-12 stored in the symbol table; for example: CLA=7600 will cause the diagnostic: RD +0200 Whenever CLA is used after this point, it will have the value 7600. 5.7.6 Symbolic Instructions Symbols used as instructions must be pr,edefined by the assembler or the programmer. If a statement has no label, the instructions may appear first in the statement and must be terminated by a space, tab, semicolon, slash, or carriage return. The following are examples of legal instructions: TAD PAGE ZIP 5.7.7 (a mnemonic machine instruction) (an assembler pseudo-op) (an instruction defined by the user) Symbolic Operands Symbols used as operands normally have a value defined by the user. The assembler allows symbolic referlences to instructions or data defined elsewhere in the program. Operands may be numbers or expressions. For example: TOTAL, TAD ACI + TAG The values of the two symbols ACI and 'TAG (already defined by the user) are combined by a 2' s compl,ament add (see section 5.8.1, Operators). This value is then used as the address of the operand. 5.7.8 Internal Symbol Representation For PALC Each permanent and user-defined symbol occupies four words in the symbol table storage area. A PDP-8 instruction has an operation code of three bits as well as an indirect bit, a page bit, and seven address bits. The PALC assembler distinguishes between pseudo-ops, memory reference instructions, other permanent symbols, 'and user-defined symbols in the symbol table. 5-13 5.8 EXPRESSIONS Expressions are formed by the combination of symbols, numbers, and certain characters called operators, \~hich cause speci fic arithmetic operations to be performed. An expression is terminated by either a comma, carriage return, or semicolon. 5.8.1 Operators There are seven characters in PALC which act as operators: + t % & SPACE Two's complement addition TWo's complement subtraction Hultiplication (unsigned, l2-bit) Division (unsigned, l2-bit) Boolean inclusive OR Boolean AND Treated as a Boolean inclusive OR except in a memory refE~rence instruction Two's complement addition and subtraction are explained in detail in Chapter 1 of INTRODUCTION TO PROGRA1~ING; the user should refer to that handbook if he wi.shes more informat:ion. No checks for overflow are made during assembly, and any overflow bits are lost from the high order end. For 4~xample: 7755+24 will give a result of 1 The operators + and - may be used freely as prefix operators. Mul tiplication is accomplished by repeat:ed addition. No checks for sign or overflow are made. All 12 bits of each factor are considered as magnitude. For example: 3000t2 will give a result of 6000 Division is accomplished by repeated subtraction. The number of subtractions which are performed is t:he quotient. The remainder is not saved and no checks are made for sign. Division by 0 will arbitrarily yield a result of O. For example: 7000%1000 will yield a result of 7 This could be written as: -1000%1000 in this case the answer might be expecte!d to be -1 (7777), but all bits are considered as magnitude and the result is still 7. 12 Use of the multiplication and division operators requires an attention to sign on the part of the programmer beyond that which is required for simple addition and subtraction. The following table of examples is given for reference. 5-14 Table 5-2 Use of Operators Expression Also written as: 7777+2 7776-3 Ot2 2tO 1000t 7 0%12 12%0 7777%1 7000%1000 1%2 Result -1+2 -2-3 +1 7773 or -5 0 0 7000 or -1000 0 0 7777 or -1 7 0 -1%1 -1000%1000 The ! operator causes a Boolean inclusive OR to be performed bit by bit between the left-hand term and the right-hand term. (The inclusive OR is explained in Chapter 1 of INTRODUCTION TO PROGRAMMING.) For example: if A=l and B=2 then A!B=0003 The & operator causes a Boolean AND to be performed bit by bit between the left and right values. The operation is the same as that indicated by the memory reference instruction AND. SPACE has special significance depending on the context in which it is used. When it is used to separate two permanent symbols or two user-defined symbols, as in the following example: Sfv'JA CLA it causes an inclusive OR to be performed between them. In this case, SMA=7500 and CLA=7600. The expression SMA CLA is assembled as 7700. When SPACE is used following pseudo-operators and memory reference instructions, it merely delimits the symbol. User-defined example: symbols are treated as operate instructions. For A=333 *222 8.1 ClA possible expressions and their values using the symbols just defined are shown below. Notice that the assembler reduces each expression to one 4-digit (octal) word: A B A+B A-B -A I-B B-1 AlB -71 0333 0222 0555 0111 7445 7557 0221 0333 7707 (an inclusivE~ 5-15 OR is performed) If the information generated is to be counter is incremented. For example: loaded, the current location B-1 ;A+4 ;A-B produces three words of information; the current location incremented after each expression. The! statement: counter is HAL'f=HLT eLA produces no information to be loaded (it produces an association in the symbol table) and hence does not increment the current location counter. *4721 TEMP, TEM2, 0 The location counter is not incremented after the line TEMP,; the two symbols TEMP and TEM2 are assigned the same value, in this case 4721. Since a PDP-8 instruction has an operation code of three bits as well as an indirect bit, a page bit, and seven address bits, the assembler must combine memory reference instructions in a manner somewhat differently from the way in which it combines operate or lOT instructions. The assembler differentiates between the symbols in its permanent symbol table and user-defined symbols. The following symbols are used as memory reference instructions: AND TAD ISZ DCA JMS JMP 0000 1000 2000 3000 4000 5000 Logical AND Two's complement addition Increment and skip if zero Deposi t and cl,ear accumulator Jump to subroutine Jump When the assembler has processed one of these following it acts as an address field dlelimi ter. symbols, the space *4100 A, JMP A CLA A has the value 4101, JMP has the value 5000, and the space acts as field delimiter. These symbols are represented as follows: A JMP a 100 001 000 001 101 000 000 000 The seven address bits of A are taken, «:!. g. : 000 001 000 001 The rema1n1ng bits of the address are tested to see if they are zeros (page zero reference); if they are not, the current page bit is set: 5-16 000 011 000 001 The operation code is then ORed into thE! JMP expression to form; 101 011 000 001 or, written more concisely in octal: 5301 In addition to the above tests, the pagE! bits of the address field are compared with the page bits of the current location counter. If the page bits of the address field are nonze!ro and do not equal the page bits of the current location counte!r, an out-of-page reference is being attempted and the assembler will t;ake action as described in Section 5.11, Link Generation and Storagre. 5.8.2 Special Characters In addition to the operators described i.n the previous section, PALC recognizes several special characters which serve specific functions in the assembly process. These characters are: = equal sign comma '* asterisk dot " double quote ( ) parentheses [] square brackets / slash semicolon <> angle brackets $ dollar sign , The equal sign, comma, asterisk, slash, and semicolon have previously described. The remainder will be described next. been The special character dot (.) always has a value equal to the value of the current location counter. It may be used as any integer or symbol (except to the left of an equal sign), and must be preceded by a space when used as an operand. For example: *200 JMP • +2 is equivalent to JMP 0202. Also, *300 • +2400 will produce in location 0300 the quantity 2700. *2200 CALL=JMS 1 • 0027 5-17 Consider: The second line (CALL=JMS I.) does not increment the current location counter; therefore, 0027 is placed in location 2200 and CALL is placed in the user's symbol table with an associated value of 4600 (the octal equivalent of JMS I). If a single character is preceded by a double quote ("), the 8-bit value of ASCII code for the character is used rather than interpreting the character as a symbol (ASCII codes are listed in Appendix A). For example: CLA TAU ("t\ The constant 0301 is placed in the accumulator. The code: " will be assembled as 0256. The characber must not be a carriage return or one of the characters which is ignored on input (discussed at the end of this section). Left and right parentheses member is optional). () enclose a current page literal (closing CLA TAD INDEX TAD (2) DCA I ~DEX The left parenthesis is a signal to the a.ssembler that the expression following is to be evaluated and assigned a word in the constants table of the current page. This is the same table in which the indirect address linkages are stored. In the above example, the quanti ty 2 is stored in a word in th49 linkage and literals list beginning at the top of the current memory page. The instruction in which the literal appears is encoded with an address referring to the address of the literal. A literal is assigned to storage the first time it is encountered; subsequent reference to that literal from the current page is made to the same register. The use of literals frees symbol storage space for variables and makes programs much more readable. If the programmer wishes to assign literals to page zero rather than to the current page, he may use square brackets, [and] , in place of parentheses. This enables the programmer to reference a single literal from any page of memory. For example: TAD (2] TAD [2] 5-18 The closing member is optional. forms: constant term, variable another literal. Literals may take term, instruction, the following expression, or NOTE Literals can be nested, for example: TAD (TAD (30 This type of nesting may be continued in some cases to as many as 6 levels, depending on the numbl3r of other literals on the page and the complexity of the expressions within the nest. If the limits of the assembll3r are reached, the error messages BE (too many levels of nesting) or PE (too many literals) will result. Angle brackets are used as conditional dlelimi ters. The code enclosed in the angle brackets is to be assembled or ignored contingent upon the definition of the symbol or value of the expression within the angle brackets. (The IFDEF, I~~DEF, IFZERO, and IFNZRO pseudo-operators are used with angle brackets and are described in section 5.10.9.) The dollar sign character ($) is mandatory at the end of a program and is interpreted as an unconditional end-of-pass. It may however occur in a text string, comment or II term, in 1flhich case it is interpreted in the same manner as any other character. The following characters are handled by the assembler for the listing, but are otherwise ignored: FORM FEED LINE FEED RUB OUT pass 3 Used to skip to a ne\,l page Used to create a line spacing without causing a carriage return Used by the EDITOR to allow corrections in the input file. Nonprinting characters include: SPACE TAB RETURN These characters are used for format control and have been explained in Section 5.5. 5-19 previously 5.9 INSTRUCTIONS There are two basic groups of instructions: memory reference and microinstructions. Memory reference instructions require an operand, microinstructions do not. 5.9.1 Memory Reference Instructions In PDP-8 computers, some instructions require a reference to memory. They are appropriately designated memory reference instructions, and take the following format: o I 2 3 4 5 OPERATION C~DE ? 6 7 8 9 10 11 ADDRESS t INDIRECT ADDRESSINGf MEMORY PAGE ---~- Memory Reference Bit Instructions Bits 0 through 2 contain the operation code of the instruction to be performed. Bit 3 tells the computer if the instruction is indirect (see Section 5.9.2). Bit 4 tells the computer if the instruction is referencing the current page or page ZE~ro. This leaves bits 5 through 11 (7 bits) to specify an address. In these 7 bits, 200 octal (128 decimal) locations can be specified; the page bit increases accessible locations to 400 octal or 256 decimal. For a list of the memory reference instructions and their codes •. see Appendix C. In PALe a memory reference instruction must be followed by a space(s) or tab(s), an optional I or Z designation, and any valid expression. It may be defined with the FIXMRI instruction as explained in Section 5.10.12, Altering the Permanent Symbol Table. Permanent symbols may be defined using the FIXTAB instruction and may be used in address fields as shown below: A =123 4 FIXTAB TAD A 5.9.2 Indirect Addressing When the character I appears in a statE~ment between a memory reference instruction and an operand, the operand is interpreted as the address (or location) containing the address of the operand to be used in the current statement. Consider: 5-20 TAD 40 which is a direct address statement, where 40 is interpreted as the location on page zero containing the quantity to be added to the accumulator. References to locations on the current page and page zero may be done directly. An alternate way to note the page zero reference is with the letter Z, as follows: TAD Z 40 This is an optional notation, not differing in effect from the previous example. Thus, if location 40 contains 0432, then 0432 is added to the accumulator. Now consider: TAD I 40 which is an indirect address statement, 'where 40 is interpreted as the address of the location containing the quantity to be added to the accumulator. Thus, if location 40 contains 0432, and location 432 contains 0456, then 456 is added to the accumulator. NOTE Because the letter I is used to indicate indirect addressing, it is never used as a variable. Likewise the letter Z, which is sometimes used to indicate a page zero reference, is never used as a variable. 5.9.3 Microinstructions Microinstructions are divided into two groups: operate and Input/Output Transfer (lOT) :microinstructions. Operate microinstructions are further subdivided into Group 1, Group 2, and Group 3 designations. NOTE If a programmer mistakenly specifies an illegal combination of microinstructions, the assembl'er will perform an inclusi ve OR betw1een them; for example: eLL SKP is interpreted as SPA (7100) (7410) (7510) Operate Microinstructions within the operate group, there are thre·e groups of microinstructions which cannot be mixed. Group 1 microinstructions perform clear, complement, rotate and increment operations, and are designated by the presence of a 0 in bit 3 of the machine instruction word. 5-21 L 0 5 4 3 2 0 ISSW I lAC I ICLA I CLL ICMAI CML I t ROTATE AC AND l RIGHT ROTATE AC AND L LEFT ROTATE 1 POSITION IF A 0,2 POSITIONS IF A 1 (BSW IF BITS 8,9 ARE 0) LOGICAL SEQUENCE: 11 10 9 8 7 6 j t 2 - CMA,CML 1 -ClA , Cll 3-IAC 4 - RAR, RAl, RTR ,RTl, BSW Group 1 Operate Microinstruction Bit Assignments Group 2 microinstructions check the contents of the accumulator and link and, based on the check, continue to or skip the next instruction. Group 2 microinstructions are identified by the presence of a 1 in bit 3 and a 0 in bit 11 of the machine instruction word. o ~I 234 I 1 5 6 7 8 I 1 ICLA ISMA I SZA ISNL I REVERSE SKIP SENSING OF BITS 5,6,7 IF SET 9 10 11 IOSR IHLT o ~ LOGICAL SEQUENCE: 1 (BIT 8 IS 0) - SMA OR SZA OR SNL (BIT 8 IS I) - SPA AND SNA AND SZL 2 - ClA 3 - OSR, HlT Group 2 Operate Microinstruction Bit Assignments Group 3 instructions reference the MQ register. They are differentiated from Group 2 instructions by the presence of a 1 in bits 3 and 11. The other bits are part of a hardware arithmetic option. o 1 2 3 ___ ___ 4 5 6 7 8 9 10 11 ~O_t~6_~!_IO~i_N .~ ~IC_l_A~IM_QA~I ~I_MQ_-_L~I~~~~~~~~~~~~~~~~I '----" CONTAINS A 1 TO SPECIFY GROUP 3 ___ ___ "----' \.. ) '-..-J '---~ CONTAINS A 1 TO KEel-E EXTENDED SPECIFY GROUP 3 ARITHMETIC ELEMENT Group 3 Operate Microinstruction Bit Assignments Group 1 and Group 2 microinstructions cannot be combined since determines either one or the other. 5-22 bit 3 Within Group 2, there are two groups ()f skip instructions. be referred to as the OR group and thE! AND group. OR Group AND Group SMA SPA SNA SZL SZA SNL They can The OR group is designated by a 0 in bit B, and the AND group by a 1 in bit B. OR and AND group instructions cannot be combined since bit B determines either one or the other. If the programmer does combine lE~gal skip instructions, important to note the conditions under which a skip may occur. 1. it is OR Group--If these skips are combined in a statement, the inclusive OR of the conditions determines the skip. For example: SZA SNL The next statement is skipped if the contains 0000 or the link is a 1 or both. 2. accumulator AND Group--If the skips are c:ombined in a statement, the logical AND of the conditions determines the skip. For example: SNA SZL The next statement is skipped only if differs from 0000 and the link is O. the accumulator Input/Output Transfer Microinstructions These microinstructions initiate operation of peripheral equipment and effect an information transfer betwE~en the central processor and the Input/Output device (s); i.e., cassettE~s, console terminal, and line printer. The Permanent Symbol Table in Appendix C lists PALC's rOT's. 5.9.4 Autoindexing Interpage references are often necessary for obtaining operands when processing large amounts of data. ThH PDP-B computers have facilities to ease the addressing of this data. When one of the absolute locations from 10 to 17 (octal) is indirectly addressed, the contents of the location is incremented before it is used as an address and the incremented number is left in the location. This allows the programmer to address consecutive memory locations using a minimum of statements. 5-23 It must be remembered that initially ~lese locations (10 to 17 on page 0) must be set to one less than the first desired address. Because of their characteristics, these locations are called auto index registers. No incrementation takes place when locations 10 to 17 are addressed directly. For example, if the instruc1t::ion to be executed next is in location 300 and the data to be refer4:!nced is on the page starting at location 5000, autoindex register 10 can be used to address the data as follows: 0276 0277 0300 1377 3010 1410 TAD C4777 DCA 10 TAD I 10 0377 4777 C4711,4111 1=5000-1 ISET UP AUTO INDEX IINCREMENT TO 5000 IBEFORE USE AS AN ADDRESS When the instruction in location 300 :Ls executed, the contents of location 10 will be incremented to 5000 and the contents of location 5000 will be added to the contents OlE the accumulator. When the instruction TAD I 10 is executed again, the contents of location 5001 will be added to the accumulator, and so on. 5.10 PSEUDO-OPERATORS The programmer uses pseudo-operators to direct the assembler to perform certain tasks or to interpre1: subsequent coding in a certain manner. Some pseudo-ops generate storage words in the object program, other pseudo-ops direct the assembler how to proceed with the assembly. Pseudo-ops are maintained in the permanent symbol table. The function of each PALC pseudo-op is described below. 5.10.1 Indirect and Page Zero Addressing The pseudo-operators I and Z are used to specify the type of addressing to be performed. These have been previously discussed in Section 5.9.2. 5.10.2 Radix Control Numbers used in a source program are initially considered to be octal numbers. However, the prograrraner may change or alternate the radix interpretation by the use of the pseudo-operators DECIMAL and OCTAL. The DECIMAL pseudo-op interprets all following until the occurrence of the pseudo-op OCTAL. numbers as decimal The OCTAL pseudo-op resets the radix to its original octal base. 5-24 5.10.3 Extended Memory The pseudo-op FIELD instructs the assembler to output a field setting so that it may recognize more than one memory field. This field setting is output during pass 2 and is recognized by the Run (or Load) command, which in turn causes all subsequent information to be loaded into the field specified by the expression. The form is: FIELO n n is an integer, a previously defined symbol, or an expression the range 0<=n<=7. within This field setting is output on the binalry file during pass 2 followed by an origin setting of 200. This word is read when the Run (or Load) command is executed and begins loading i.nformation into the new field. The field setting is never remembered by the assembler and no initial field setting is output. A binary file produced without field settings will be loaded into field 0 when using the Run (or Load) command. NOTE A symbol in one field may be used to reference the same location in any other field. The field to which it refers is determined by the use of the COF and crF instructions. (The pr09rarnrner who is unfamiliar with the rOT's but wishes to use them should refer to the POP/BE SMALL COMPUTER HANOBOO~: and experiment with several short teBt programs to satisfy himself as to their effect.) COF and CIF instructions must be used prior to any instruction referencing a location outside the current field, as shown in the following example: *200 TAD P301 CDF 00 CI F 10 Ji'1S PRINT CI F 10 JMP NEXT P3Q11 , NEXT, 301 FIELD 1 *200 TAD P302 CDF 10 JMS PRINT HLT P302, PRINT, 302 o TLS TSF 5-25 JIVJP • - 1 CLA RDF TAD P6203 DCA .+1 00~1 P620~i , .1MP 6203 PRINT When FIELD is used, the assembler follolNs the new FIELD setting with an origin at location 200. For this reason, if the programmer wants to assemble code at location 400 in field 1 he must write: /CORRECT EXAMPLE FIELD *400 The following is incorrect and will not generate the desired code: / I NC"ORii EC T * 4 eI ~~ FIELD " .. 5.10.4 End-of-File PAUSE signals the assembler to stop processing the file being read. The current pass is not terminated, and processing continues with the next file. The PAUSE pseudo-op should be used only at the physical end of a file and with two or more segments of one program. When a PAUSE statement is reached the remainder of the fill~ is ignored and processing continues with the next input file. PAUSE must be present or a PH error will occur. 5.10.5 Resetting the Location Counter The PAGE n pseudo-op resets the location counter to the first address of page n, where n is an integer, a previously defined symbol, or a symbolic expression, all whose terms have been defined previously and whose value is from 0 to 37 inclusive, If n is not specified, the location counter is reset to the next logical page of memory. For example: PAGE 2 sets the location coun1:er to 00400 PAGE 6 sets the location count.er to 01400 If the PAGE pseudo-op is used without an argument and the current location counter 1S at the first location of a page, it will not be moved. In the following example, the code TAD B is assembled into location 00400: .JMP .-3 PAGE TAD B 5-26 If several consecutive PAGE pseudo-ops are given, the first will cause the current location counter to be reset as specified. The rest of the PAGE pseudo-ops will be ignored. 5.10.6 Entering Text Strings The TEXT pseudo-op allows a string of text characters to be entered as data and stored in 6-bit ASCII by using the pseudo-op TEXT followed by a space or spaces, a delimiting character (must be a printing character), the string of text, and the same delimiting character. Following the last character, a 6-bit zero is inserted as a stop code. For example: TAG, The string would be stored as: 5162 5352 0000 5.10.7 Suppressing the Listing Those portions of the source program enclosed by XLIST pseudo-ops will not appear in the listing file; the code will be assembled, however. Two XLIST pseudo-ops may be used to enclose the code to be suppressed in which case the first XLIST with no argument will suppress the listing, and the second will allow it again. XLIST may also be used with an expression as an argument: a listing will be inhibited if the expression is equal to zero, or allowed if the expression is not equal to zero. 5.10.8 Reserving Memory ZBLOCK instructs the assembler to reserVE~ n words of memory containing zeros, starting at the word indicated by the current location counter. It is of the form: ZBLOCK n For example: ZBLOCK 40 causes the assembler to reserve 40 (octal) words. expression. If n=O, no locations are reserved. 5-27 The n may be an The Il"DEF pseudo-op Jed.kes the form: I lo"DE E' syrllbol <SOU.(CE! c:ode> If the symbol indicab::d is previously d\~fLled, the codE:! contained in the angle brackets is assembled; if the synibol is l.mdefined, this code is ignored. Any number of statements or lines of code may be contained in the angle brackets. This format of the IFDEF statement requires a single space before and after the symbol. The IFNDEF pseudo-op is similar in fonn to IFDEF and is expressed: IE'NDEF symbol < source code> If the symbol indicated has not be:en prt~vi()usly defined, the source code in angle brackets is assembled. If the symbol is defined, the code in the angle brackets is ignored. The IFZERO pseudo~op is of the form: Il<'ZERO exp:.:esson <sourCE: cede> If the evaluated (arithmetic or logical) expression is equal to zero, the code within the angle brackets is assembled; if the expression is non-zero, the code is ignored. Any nwru)er of statements or lines of code may be contained in the angle brackets. The expression may not contain any imbedded spaces and must have a single space preceding and following it. IFNZRO is similar in form to the IFZERO pseudo·'op and is expressed: Il~"NZRO expression < source code> If the eValuated (arithmetic or logical) expression is not equal to zero, the source code wi thin the angl(~ brackets is assembled; if the expression is equal to zero, this code is ignored. Pseudo~~ops can be nested, for example: IFDEF S~'M <IF'NZRO X2 <0 •• » The evaluation and subsequent inclusion or deletion of done by evaluating the outermost pseudo·~op first. 5.10.10 s~atements is Controlling Bi.nary Output~ NOPUNCH causes the assembler to cease bi.nary out:put assembling code. It is ignored except du.ri.ng pass 2. but. cont.inue ENPUNCH causes the assembler to resume binary output after: NOPUNCH, and is ignored except during pass 2. For example, these two pseudo-ops might be used ·INhere several programs share the same data on page zero. When these programs ar(~ to be loaded and executed together, only one page zero need be output. 5-28 5.10.11 Controlling Page Format The EJECT pseudo··op causes the listing t:o jump to the top of the next page. A page eject is done automatically every 55 lines: EJECT is useful if the user requires more frequent paging. If this pseudo-op is followed by a string of r,haracters, t:he first 40 (octal) characters of that string will be- used as a new header line. 5.10 .12 Altering the Permanent Symbol 'rable PALC contains a table of symbol definitions for the PDP-8 and CAPS-8 peripheral devices. These are symbols such as TAD, DCA, and CLA, which are used in most. PDP-8 programs. This table is considered to be the permanent symbol table for PAI.l~; all of the symbols it contains are listed in Appendix C. If the user purchases one or more optional devices whose instruction set is not defined among the permanent symbols (for example EAE or an AID converter), he would want to add thE~ necessary symbol defini tions to the permanent symbol table in every p~ogram he assembles. Conversely, the user who needs more space for user-defined symbols would probably want t~o delete all def ini tions except the ones used in his program. For such purposes, PALC h,~s three pseudo-ops that can be used to alter the permanent symboltahle. These pseudo-ops are recognized by the assembler only during pass 1. During either pass 2 or pass 3 they are ignored and have no effect .. EXPUNGE deletes the entire permanent symbol table, except pseudo~'ops. FIXTAB appends all presently defined sY~IDols to the permanent symbol table. All symbols defined befo!'e the occnrrence of FIXTAB are mael.e part. of the permanent symbol table nnt.LI. the assembler is ::t:'~loaded. To append the following instructions to the symbol generates an ASCII fiJ.f> called SYflITS. P)l.T, contain 5.ng ~ MUY=74~5 DVI=7407 CLSK::6131 FIXTAB table, t.he user IMULTIPLY IDIVIDE 15KIP ON CLOCK INTERRUPT ISO THAT THESE WON'T BE IPRINTED IN THE SYMROL TARLE The ASCII file is then entered in PAI,C I S input designation. The user may also place the definitions at the beginning of the source file. This eliminates the need to load an extra file. Each time the assembler :i.s loaded, PALe's permanent symbol table is restored to contain only the penn<'1nent ::;ymbols shown in Appendix C~ The third pseudo-op used to alter the p'Jrrnanent symbol table in PALC is FIXMRI. FIXMRJ is used to def.ine a memory reference instructi.on and is of the form: FIXMRI name:"v,~lue 5-29 The letters FIXHRI must be followed by one space, the symbol for the ins truction to be de fined, an equal sign, and the val ue~ of the symbol. The symbol will be defined and stored in the symbol table as a memory reference instruction. The pseudo-op must be repeated for each memory reference instruction to be defined. For example: EXPUNGE FIXMRI TAD=100C FIXMRI DCt~=3eJ00 CLA=7200 FIXTAB When the preceding program segment is r,ead into the assembler during pass 1, all symbol definitions are deleted and the three symbols listed are added to the permanent symbol table. Notice: that CLA ~s not a memory reference instruction. This process can be performed to alter the assembler's symbol table so that it contains only those symbols used at. a given installation or by a given program. This may increase the assembler's capacity for user-defined symbols in the program. A summary of the PALC pseudo-ops is provided in Appendix C. 5.11 LINK GENERATION AND STORAGE In addition to handling symbolic addressing on the current page of memory, PALC automatically generates links for off-page references. If reference is made to an address not on the page where an instruction is located, the assembler sets the indirect bit (bit 3) and an indirect address linkage will be generated on the current memory page. If the off-page reference is already an indirect one, the error diagnostic II (illegal indirect) will be generated. For example: *2117 A, CLA tJMP A In the example above, the assembler will recognize that the register labelled A is not on the current page (in this case 2600 to 2777) and will generate a link to it as follows: 1. In location 2600 the assembler ,,,,ill place the which is equivalent to JMP I 2777. word 5777 2. In address 2777 (the last available location on the current page) the assembler will place the word 2117 (the actual address of A). During pass 3, the octal code for the instruction will be followed an apostrophe (') to indicate that a link was generated. by Although the assembler will recognize and generate an indirect address linkage when necessary, the progra~ner may indicate an explicit 5-30 indirect address by the pseudo-op I. The assembler cannot generate a link for an instruction that is already specified as being as indirect reference. In this case, the assembler will print the error message II (illegal indirect). For example: *2117 A, CLA J:'1P I A The above coding will not work because 1>:. is not defined on the where JMP I A is attempted, and the indirect bit is already set. page Literals and links are stored on each pa.ge starting at page address 177 (relative) and extending toward page address 0 (relative). Whenever the origin is then set to another page, the literal buffer for the current page is output. This does not affect later execution. There is room for 160 (octal) literals alnd links on page zero ann 100 (octal) literals on each other page of memory. Li terals and links are stored only alS far down as the highest instruction on the page. Further at.tempts to define literals will result in a PE (page exceeded) or ZE (page zero exceeded) error message. 5.12 CODING PRACTICES A neat printout (or program listing, as it is usually called) makes subsequent editing, debugging, and inte~rpretation much easier than if the coding were laid out in a haphazard fashion. The coding practices listed below are in general use, and will result in a readable, orderly listing. 1. A title comment begins with a slash at the left margin. 2. Pseudo-ops may begin at the left margin; often, however, they are indented one tab stop to line up with the executable instructions. 3. Address labels begin at the left margin. They separated from succeeding fields by a tabulation. 4. Instructions, whether or not they are labe 1 fie ld, are indented one t:ab stop. 5. A conunent is separated from thE~ preceding field by one or two tabs (as required) and a slash; if the comment occupies the whole line itusually begins with a slash at the left margin. 5-31 preceded are by a 5.13 PROGRAM PlillPARATION AND ASSEMBLER OUTPUT The following program was generated using the CAPS-8 EDITOR and was assembled with PALC. TAB function of the *200 IEXAMPLE OF INPUT TO THE FORMAT IGENERATOR PROGRAM ISTART OF PROGRAM BEGIN, 0 KeC KSF IWAIT FOR' FLAG IFLAG NOT SET YET Jr1P .-1 IREAD IN CHARACTER KHB DCA CHAR Tt~D CHAR Tt\D MSPACE lIS I T A SPACE? S NA CLA HLT IYES INO:INPUT AGAIN Jr1P BEGIN+2 CHAR, 0 ITEMPORARY STORAGE MSPACE, -~!40 lEND OF EX~\MPLE $ The program consists of statements and pseudo-ops and is terminated by the dollar sign ($). If the program is large, it can be segmented by placing it into several files; this often facili tates t~he editing of the source program since each section will be physically smaller. The assembler initially sets the current location COt.nter to This counter is reset whenever the asterisk (*) is processed. 0200. The assembler reads the source file for pass 1 and defi.nes all symbols used. During pass 2, t~he assembler reads the source file and generates the binary code using the symbol table equivalences defined during pass 1. The binary file that is output may be loaded by the Load command. This binary file consists of an origin setting and date: words. During pass 3, t~he assembler reads the source file and generates the code from the source statements. The assembly listi.ng is output in ASCII code. It consists of the current locatior.. counter, the generated code in octal, and the sourc·e statement. Tr..e 5-digi t first column is the field number and 4-digit octal address (current location counter); the 4-·digi t second column is the assembled object code. The symbol table is printed at the end of the pass. The pc:ss 3 output is: PALe-V1 *200 021~0 12'12120121 012121211 0121202 1210203 1210204 00205 1210206 0021217 0000 6121:52 60:51 002H'I 76~)0 5202 60:36 3213 12 ~l3 12 ~l4 03/08'73 PAGE 1 *200 IE)(AMPLE OF I NPUT Tel THE FORMAT IGEN~RATOR PROGRAM BEGIN, 121 1ST ART OF Kec KSF JMP KRB DCA TAD TAD SNA .-1 CHAR CHAR MSPACE CLA 5-32 Pf~OGR AM IWAIT FOR FI.AG IFLAG NOT SET YET IREAD INC H I~ RACT ER lIS I T A SF j~CE? 021211 00212 2121213 2121214 14212 52212 21212121 15421 HLT IVES INOIINPUT AGAIN ITEMPORARV STORAGE JMP BEGIN+2 CHAR, 21 MSPACE, .2421 lEND Of EXAMPLE $ PALC-V1 213/08/73 PAGE 1-1 BEGIN CHAR 2122121 0213 MSPACE 21214 5.13.1 Terminating Assembly PALC will a) terminate assembly, b) print. a tc, and c) wait for the user to mount the System Cassette on dri'"e 0 and type tc, under any of the following conditions: 1. Normal exit--The $ at the end of the source program was executed on pass 2 (or pass 3 if a listing is being generated) • 2. Fatal error--One of the following error conditions found and flagged (see the next: section) : BE 3. 5.14 DE DF PH was SE tC--If typed by the user, control turns to the Monitor. PALC ERROR CONDITIONS PALC will detect and flag error conditions and generate error messages on the console terminal. The format of t:he error message is: CODE ADDRESS where CODE is a 2-letter code which specifies the type of error, and ADDRESS is either the absolute octal address where the error occurred or the address of the error relative to the last symbolic tag (if there was one) on the current page. For example, the following code: BEG, TAD LBL 7.TAD LBL 5-33 would produce the error message: Ie BEG+0001 since % is an illegal character. If at any time PALC prints tc, the user should make cert,ain that the System Cassette is mounted on drive 0 and then type tc to return to the Monitor. He should examine each error indication to determine whether correction is required. On the pass 3 listing, error messages are output as 2-character messages on the line just prior to the line in which the error occurred. The following table lists thE~ PALC error codes. Those labeled Fatal Error are followed immedia1:ely by an effective tC. Table 5-3 PALC Error Codes Error Code Explanation BE Two PAL-C internal tables have overlapped. error--assembly cannot continue. DE Device error. An error was detected when trying to read or write a devic(~. Fatal error--assembly cannot continue. OF Device full. continue. IC Illegal character. The character is the assembly continued. 10 Illegal redefinition of a symbol. An attempt was made to give a previously defined symbol a new value by means other than the equal sign. The symbol is not redefined. IE Illegal equals--an equal sign was used in the wrong context. Considered a warning and may not indicate an error but rather an undefined symbol at that point. II Illegal indirect--an off-page reference \-J'as made. IP Illegal pseudo-op--a pseudo-op was used wrong context or with incorrect syntax. IZ Illegal page zero reference--the pseudo-op Z was found in an instruction which did not. refer to page zero. The Z is ignored. PE Current non-zero made to: Fatal page 5-34 error--assembly exceeded--an Fatal cannot ignored in attempt and the was Table 5-3 Error Code PALe Error Codes (Cont'd) Explanation 1. Override a literal with an instruction 2. Override an instructi.on with a literal 3. Use more literals thaln the assembler allows on that page. This can be corrected by decreasing either the number of literals on the page or the number of instructions on the page. PH Phase error--either no $ appeared at the end of the program, or < and > in conditional pseudo-ops did not match. Fatal error--assembly cannot continue. RD Redefini tion--a permanent. symbol has been defined with =. The new and old definitions do not match. The redefinition is allow'ed. SE Symbol table exceeded--too many symbols have been defined for the amount of memory available. Fatal error--assembly cannot continue. UO Undefined origin--an undefined symbol has occurred in an origin statement. US Undefined symbol--a syrrbol has been processed during pass 2 that was not defined before the end of pass 1. ZE Page 0 exceeded--same as PE except with to page O. 5-35 reference CHAPTER 15 CASSETTE BASIC 6.1 INTRODUCTION Cassette BASIC is an interactive progJranuning language derived from Dartmouth BASIC and designed to run under the Cassette Keyboard Monitor. The BASIC language is aimed at facilitating communication between the user and the computer. The user types his program as a series of numbered statements, making llse of common English words and familiar mathematical notations. Because the BASIC language involves learning only a small number of commands, it is a very easy language to use. As the user gains familiarity with BASIC, he can add the advanced techniques available to perform more intricate manipulations or express a problem more efficiently and concisely. Cassette BASIC provides approximately 1.7 to 2K of memory for program storage. Important features include 1and 2-dimensional subscripting, user-coded functions, program chaining, use of cassettes for program storage, and use of line printer, if available, for output. Beginning programmers may find a more fundamental approach to language programming in Chapter 1 of THE EDUSYSTEM HANDBOOK. 6.2 BASIC CALLING BASIC (.R BASIC) Using the Cassette Keyboard Monitor, Bl\SIC is called from Cassette by typing: the System !...R BASIC When it is first loaded into memory, Bl\SIC asks the user use run~·time fi Ie input and output as follows: USING RUN-TIME FILE I/O?(Y if he wi 11 OR N) The user responds with Y or N followed by a carriage return. Choosing the run-time I/O feature leaves the user approximately 1.7K of memory for program storage, whereas a responsE~ of N frees the space used by the run-time I/O routines and provides an additional. 3K of memory (enough for approximately 20-25 statements or 75 variables). Statements associated with the run-timE! I/O feature are: OPEN ••• FOR INPU'r OPEN ••• FOR OUTPUT CLOSE IF END# PRINT# INPUT# COMMAS NO COMMAS If any of these statements are used without the run-time I/O option having been chos4:!n during BASIC' s initial dialogue, BASIC will print a NO FILES ERROR message at run-time. BASIC then asks: NEW OR OLD- The user responds NEW if he intends to create a program at the keyboard, and must respond with the namE~ of the new prQo~ram when BASIC requests: NEw PROGRAM NAME- The program name is typed as a standard system filename (6 characters or less) and an optional extension (I to 3 characters); a program name is entered even if the user does not in1:end to save the program for future use. (.A response of only a carriage return causes BASIC to repeat the NEW PROGRAM NAME request. If the user types an ALT MODE in response to this request, the name NONAME.BAS is assigned by BASIC.) When the new program name has been entered, BASIC indicates that it is ready to accept input by issuing a carriage return/line feed combination. If the user responds OLD to BASIC' s ini 1:ial dialogue, BASIC assumes that the program has been previously saved on a cassette and will ask: OLD PROGRAM NAMEUNITI(0-7): The user must respond with the correct program name and file extension (if any), and then must specify which cassette unit drive the file is stored on. (An incorrect response will return an error message.) When this interaction is complete, BASIC will type: READY. and the user may edit or run his progrrun. 6.3 NUMBERS Cassette BASIC t.reats all numbers (in both integer and real formats) as real, or floating point, numbers. 'That is, BASIC a.ccepts as input any number conta.ining a decimal point and assumes a decimal pQint after any intege:r number entered. In addition to i.nteger and real formats, a third format. is recognized and accepted by BASIC in order to express numbers outside the range .01<=x<1000000. This format is called exponential or E:-type notation. In this format., a number is expressed as a decimal number times some power of 10, as follows: 6-2 where E represents "times 10 to the power of" • A number in exponential notation is then read "xx times 10 to the power of n"; for example: 23.4E2 = 23.4*(10 to the power of 2) = 2340 Data may be input in anyone or all three of these forms. Internal computations are carried out in floating point (real) format. Results of computations within the range .01<=x<1000000 are output as either real or integer decimal numbers (whichever is the correct but more concise format); results outside this range are output in exponential format. BASIC handles seven significant digits in normal operation and input/output, as illustrated below: Same Value Output By BASIC Value Typed In .01 .0099 999999 1000000 .01 9.900000E-3 999999 1.000000E+6 BASIC automatically suppresses the pri:nting of leading and trailing zeros in integer and decimal numbers and, as shown above, prints all exponential numbers in the form: (sign) x.xxxxxx E (+ or -) n where x represents the number carried ·to six decimal places, E stands for "times 10 to the power of", and n represents the exponent. For example: -3.4702lSE+S,is equal to -34702lS00 7.260000E-4 is equal to .000726 6. 4 VARIABLES A variable in BASIC is a symbol which represents a number and is formed by a single letter or a letter followed by a digit. For example: Acceptable Variables I B3 Unal:ceptable Variables 2C - A digit cannot begin a variable AB .• Two or more letters cannot form a variable x 6-3 The user may as:sl.gn values to variables either by computing the values in a LET statement or by inputting the values as data: these operations are discussed later. 6.5 ARITHMETIC OPERATIONS BASIC performs addition, subtraction, multiplication, division and exponentiation, as well as more complicated operati.ons explained in detail later in the chapter. The five operators used in writing most formulas are: Symbol + * I t 6.5.1 Meaning Example Addition Subtraction Multiplication Division Exponentiation (Raise A to the Bth power) A + B A - B A * B A I B A t B Priority of Operations In any given mathematical formula, BASIC performs operations in t:he following order of evaluation: arithmetic 1. Parent:heses receive top priority. Any expression wi thin parent:heses is evaluated before an unparenthesized expression. 2. In absence of parentheses, the order of priority is: 3. a. Exponentiation b. Multiplication and Division (of equal pr:Lori ty) c. Addition and Subtraction (of equal priority) If ei t:her 1 or 2 above does not clearly deBignate the order of priority, then the evaluation of expressions proceeds from left to right. The expression AtBtC is evaluated from left to right as follows: 1. AtB 2. (result of step 1) tc = step 1 = answer The expression A/B*C is also evaluated from left multiplication and division are of equal priority: 1. AlB = step 1 2. (result of step 1) *C = answer 6-4 to right since 6.5.2 Parentheses and Spaces Parentheses may be used by the programmer to change the order of priority (as listed in rule 2 of the previous section). Since expressions within parentheses are always evaluated first, the programmer can control the order of evaluation by enclosing expressions appropriately. Parentheses may be nested, or enclosed by a second set (or more) of parentheses. In this case, the expression within the innermost parentheses is evaluated first, and then the next innermost, and so on, until all have been evaluated. Consider the following example: A=7*C CBf2+4)/X) The order of priority is: 1. Bt2 2. (result of step 1)+4 = step 2 3. (result of step 2)/X step 3 4. (result of' step 3)*7 A step 1 Parentheses also prevent any confusion expression is evaluated. For example: or doubt as to how the A*Bf2/7+B/C+Df2 «A*Br2)/7)+«B/C)+Df2) Both of these formulas will be executed in the same way. However, most users will find that the second is easier to understand. Spaces may be used in a similar manner~ ignores spaces, the two statements: LET B Since the BASIC compiler = Of 2 + 1 LETB=Df2+1 are identical, but spaces in reading. 6.5.3 the first statement provide ease in Relational Operators A program may require that two values be compared at some point to discover their relation to one another. To accomplish this, BASIC 6-5 makes use of the following relational operators: :: < <= equal to less than less than or equal to > greater than >= greater than or <equal to <> not equal to Depending upon the result of the comparison, flow of program execution may be directed to another part of the program, or thE~ validity of the relationship ma.y cause a value of 0 (indicating a FAL~E condition) or 1 (indicating a TRUE condition) to be assigned to a variable. For example: 1S X=Y<7. This statement assigns the value 1 to X if Y is greater than Z. Relational operators are used primarily in conjunction with IF and LET statements, bot.h of which are later discussed in detai 1. The meaning of the equal sign (=) should be clarified. In algebraic notation, the formula X=X+ 1 is meaningless. HowevE~r, in BASIC (and most computer languages), the equal sign designates replacement rather than equality. Thus, the formula X=X+l is actually translated: "add one to the current value of X and storie the new resul t back in the same variable X"; whatever value has previously bE!en assigned to X will be combined with the value 1. An expression such as A=B+C instructs the computer to add the values of Bane: C and store the result in a thi.rd variable A; the variable A is not be!ing evaluated in terms of any previously assigned value, but only in t.erms of Band C. Therefore, if A has been assigned any value prior to i.ts use in this statement, the old value is lost; it is instead replc.ced by the value of B+C. Finally, the equal sign may be used in relational testing as illustrated in the previous example. 6.6 IMMEDIATE MODE Commands are available which allow Cassette BASIC to act as a calculator--that is, the user types an algebraic expression which is to be calculated and BASIC types back the result. This is called Immediate Mode since the user is not required to write a detailed program to calc:ulate expressions and equations, but can use BASIC to produce resul t:s immediately. The commands used in Immediate Mode are PRINT, LET and occasionally the FOR-NEXT combination. These are explained in the following paragraphs. 6.6.1 PRINT Command The PRINT command is of the form: PRINT expression BASIC is instructed to compute the value of the expre!:;sion and print the result on the console terminal. The expre!:;sion is a normal 6-6 arithmetic expression \-lhich may includ43 numbers, variables, arithmetic operators, and functions (discussed in Section 6.8.12). A string of text may also be printed (see Section 6.8.5--PRINT). For example: PRINT 1/Rf8 5.9604 6LJ E-08 6.6.2 LET Command Values may be assigned to variables by follows: use of the LET command as LET variable=expression The computer does not type anything in response to this command, but computes the expression and assigns the value to the variable. The variable may then be used in another ,computation or may be output using the PRINT command. For example: LET Pl=3.14159 PRINT Pl*4f2 50.26544 6.6.3 Looping PRINT and LET Commands It is possible to include PRINT and LE'T commands in a loop so that variables and results may be stored or printed in a series. Looping is accomplished by means of FOR-NEXT statements in which the FOR statement sets the limits of the loop and the NEXT statement increments the count by 1. The only restriction in Immediate Mode looping is that the command and the looping statements must appear on one line. This is accomplished by using the backslash (\) character to separate multiple statements on a line. (The backslash is produced on an LT33 or 35 Teletype by pressing the SHIFT and L keys simultaneously. Other types of terminals provide a separate key.) For example: Ll!.l P 1 =3.14159 FOR 1=1 TO 3\PR1NT Plf!\NEXT ! This combination will print the results of 3.14159 to and 3rd powers respectively. the 1st, 2nd, More information on looping in general is provided in Section 6.8.7. 6-7 6. 7 EXAMPLE RUN The following Example Run is included a·t this point as an illustration of Cassette BASIC's initial dialogue, the format of a BASIC program, the ease in editing and running it, and the type of output that may be produced. The user calls in the pr09ram AVER from cassette drive 1 and attempts to run it. Execution is ha.lted by a SYNTAX ERROR at line 30. The user lists the program, finds the mistake in line 30, and also notices a mistake in line 85. He corrects these errors by retyping the lines, and then reruns the program. After execution he saves the corrected program on drive 1 under the original name. Following sections cover the statements and prosrramming • commands used in • R BASIC USING RUN-TIME FILE I/O?(Y OR N)N NE\-] OR OLD-OLD OLD PROGRAM NAME-AVER UNITH(O-7):1 HEADY. RUN HOi·j MA0JY STUDENTS, HOt!) MANY GRADES PER STUDENT ?5,/.1 SYNTAX ERROR AT LINE 30 LIST 10 REM - PROGRAM TO TAKE AVERAGE OF 15 REM - STUDENT GRADES AND CLASS GHADES 20 PRINT "HOW MANY STlJDENTS, HO\·j MANY GHADES PER STUDENT "; 30 INPUT A,lB 40 LET 1=1 5v) FOR J=I T8 A 55 LET V=0 6(1} PHINT "STUDENT NUMnEH =";J 75 PBINT "ENTER GRADES" 76 LET D=J 80 FOR K=D TO D+(B-1) 81 02 (~5 INPUT G LET V=V+G NEXT L 90 LET V=V/B 95 PRINT "AVERAGE GRADE =";t.j 96 PRINT 99 LET Q =Q+V 1(1}0 NEXT J 101 102 103 1 (14 PRI NT PBINT "CLASS A.VER!'\GE =";Q/A pnlNT 1 4(~ END STOP BASIC READY. 30 INPUT A,B 85 NEXT K RUN HOW MANY STUDENTS, HOW MANY GRADES PER STUDENT ? 5, It STUDENT NUMBER = 1 ENT ER GRADES 778 786 ?88 774 A V ERA GE GRAD E = 8 1 • 5 STUDENT NUMBER ENTER GRADES =2 759 ?86 17'0 787 AVERAGE GRADE = 75.5 STUDENT NUMBER = 3 ENT ER GRAD E5 758 764 ?75 780 AVERAGE GRADE = 69.25 STUDENT NUMBER = 4 ENT ER GRADES 788 792 185 179 = 86 STUDENT NUMBER = 5 AVERAGE GRADE ENT ER GRAD ES ?6'0 ?78 ?85 1[50 AVEHAGE GRl\DE 75.75 CLASS AVERAGE READY. SAVE UNITH(O-7):1 READY. 6-9 6.8 BASIC STATEMENTS The statements described in this section are used in creating BASIC programs. These statements make up the body of tt.e program; they perform arithmetic calculations and input and output operations, and control the orde:r of program execution. 6.8.1 Statement. Numbers An integer number is placed at the beginning of each line in a BASIC program. BASIC executes the statements in a prograrr. in numerically consecutive order regardless of the order in which they have been typed. A recommended practice is to number lines by fives or tens, so that additional lines may be inserted in a program without the necessity of renumbering lines already present. (BASIC programs may be created using either the BASIC Editor as described here, or the CAPS-8 EDITOR. If the CAPS-8 EDITOR is used, the programmer must make certain to type his program in numerically consecutive order, as BASIC will not sort it in this case.) Multiple statements may be placed on a single line by separating each statement from the preceding statement with a backs lash (SHIFT/L). This feature is particularly useful since statement numbers require space in the symbol table; if unnE~cessary statement numbers are eliminated by use of the backslash, there will be more room for program storage. For example: 10 A=5'B=.2'C=3'PHINT "ENTER DATA" All of the statements in line 10 will be executed before BASIC continues to the next line. Only one statement number at the beginning of the entire line is necessary. However, it should be noted that program control cannot be transferred to a statement within a line, but only to the first statement of the line in which it is contained (see Section 6.8.9, Transfer of Control Statements). 6.8.2 Commenting the Program (REM) The REM or REMARK statement allows the programmer to insert comments or remarks into a program without thesE~ comments affecting execution. The BASIC compiler ignores everything on a line beginning with REM. The form is: (line number) REM (message) In the Example Run program, lines 10 ruld 15 are REM~RK statements describing what the program does. It is often useful to put the name of the program and information relating to its use at the beginning where it is available for future refE~rence. Remarks throughout the body of a long program will help later debugging by explaining the purpose of each :section of code wi thin t:he program. 6-10 6.8.3 Terminating the Program (END and STOP) The END statement (line 140 in the Example Run program), if present, must be the last statement of the entire program. The form is: (line number) END Use of the END statement is optional. of the program and BASIC prints: If executed, it signals the end READY. Variables and arrays are left in an unde:fined state, any values they have been assigned durin.g execution. thereby losing The STOP statement is used synonymously with the END statement to terminate execution, but while END occurs only once at the end of a program, STOP may occur any number of ti.mes. The format of the STOP statement is: (line number) STOP This statement signals that execution is to be terminated at that point in the program where it is encountered leaving variables in a defined state. (Variables will contain the values assigned when the statement is encountered.) 6.8.4 The Arithmetic statement (LET) The Arithmetic (LET) statement is probably the most commonly used BASIC statement. It causes a value to be assigned to a variable and is of the form: (line number) (LET) x = expression where x represents a variable, and the E~xpression is either a number, another variable, or an arithmetic expression. The word 'LET' is optional; thus the following statements are treated the same: LET A=Af8+10 A=A f8+10 LET C =F'/G C=F/G As mentioned earlier, relational opera1:ors may be used in a LET statement to assign a value to a variru)le depending upon the validity of a relationship. If the statement is FALSE, the value 0 is assigned to the variable; if TRUE, the value 1 if> assigned. For example: 100 A=1 105 8=2 110 C=A=B 120 D=A>8 130 E=A<>B 140 PRINT C,D,E 150 E\JO 6-11 Translated, this actually means "let C=l if A=B (O otherwise): let 0=1 if A>B (0 otherwise)" and so on. Thus, the values of C, 0, and E are printed as follows: RUN [21 READY. There is no limit to the number of rela1:ionships that may be tested in the statement. 6.8.5 Input/Output Statements Input/Output sta'tements allow the user t:o bring data into a program and output results or data at any time during execution. The console terminal keyboard, (LT33 Teletype reader and punch uni t:s, if present) , cassettes, and line printer are all available as I/O devices in Cassette BASIC. Statements which control their use are described next. READ and DATA READ and DATA statements are used to input data into a program. One statement is n4~ver used without thE! other. The form of the READ statement is: (line number) READ xl,x2, ••• xn where xl through xn represent variable names. For example: 1 [21 REA D A, B , C A,B, and C are variables to which values will be assignE~d. Variables in a READ statement must be separated by commas. READ statements are generally placed at the beginning of a program, but must at least logically occur before that point in the program wheJ::'e the value is required for some computation. Values which will be assigned to the variables in a READ statement are supplied in a DA~~A statement of the form: (line number) DATA xl,x2, ••• xn where xl through xn represent values. The values must be separated by commas and mus1: occur in the same order as the variables which are listed in the corresponding READ statement. A Dl~TA statement appropriate for t:he preceding READ statement is: 7 :) DA TAl , 2 , 3 Thus, after executing the READ statement, A=l, B=2, and C=3. 6-12 The DATA statement is usually placed at the end of a program (before the END statement) where it is easily accessible to the programmer should he wish to change the values. A READ statement may have more or fewE!r variables than there are values 1n anyone DATA statement. ThE! READ statment causes BASIC to search all available DATA statements in consecutive line number order until values are found for each variable in the READ. A second READ statement will begin reading values where the first stopped. If at some point in the program an attempt is made to read data which is not present or if the data is not separated by commas, BASIC will stop and print the following message on the console terminal: DATA ERROR AT LINE XXXX where XXXX indicates the line caused the error. number of the READ statement which RESTORE If it should become necessary to use the same data more than once in a program, the RESTORE statement will make it possible to recycle through the DATA statements beginning with the lowest numbered DATA statement. The RESTORE statement is of the form: (line number) RESTORE An example of its use follows: 15 READ B .. C .. D 55 RESTORE 60 READ E,F,G 100 END In this example, the READ statements in lines 15 and 60 will both read the first three data values provided in line 80. If the RESTORE statement had not been inserted before line 60, then the second READ would pick up data in line 80 starting with the fourth value. In recycling through data with a RESTORE statement, the programmer may use the same variable names the second time through the data, or not, as he chooses, since the values are being read as though for the first time. In order to skip unwanted values, the programmer may insert replacement (or dummy) variables. Consider: 6-13 1 REM - paOGRAM TO ILLUSTRATE USE OF RESTORE 20 READ N 25 PRINT "VJ\LTJES OF X ARE: ft 30 FOR 1=1 TO N 40 READ X 5'3 PRINT X, 60 NEXT 1 70 RESTORE 185 PRI NT 190 PRINT "SECOND LIST OF X VALUES'" 200 PRI NT "FOLLOW 1 NG RESTORE STAT Et'-lENT :" 210 FOR 1=1 TO N 220 READ X 230 PRI NT X., 240 NEXT I 250 DATA 4,1,2 2 51 DA T A 3, ,4 3'~0 END RU~ X ARE: 1 2 3 VALUES OF 4 SECOND LI ST OF X VALUES FOLLOWING RESTORE STATEMENT: 4 1 2 3 READY. The second time the data values are read, the variable X (line 220) picks up the value originally assigned to N in line 20, and as a result, BASIC prints: 4 2 3 To circumvent this, the programmer could insert a dummy variable (for example, 205 READ Z ), which would pick up and store the first value, but would not be represented in the PRINT statement. In this case the output would be t.he same each time through the list. INPUT The INPUT statement is used when data is to be supplied by the user from the console terminal keyboard while a program is executing, and is of the form: (line number) INPUT xl,x2, ••• xn where xl through xn represent variable names. For example: 25 INPUT A,B,C This statement will cause the program to pause during e:<ecution, print a question mark on the console terminal, and wait for the user to type three numerical values. The user must separate the values by commas; they are entered into the computer by pressing the RE'rURN key at the end of the list. 6-14 If the user does not insert enough values to satisfy the INPUT statement, BASIC prints another question mark and waits for more values to be input. When the correct number has been entered, execution continues. If too many values are input, BASIC ignores those in excess of the required number. 'rhe values are entered only when the user types the RETURN key. OPEN Input and output files may be stored on cassette, and may be accessed during run-time (providing the user has chosen the run-time I/O option during BASIC's initial loading dialogue). Before an I/O file is accessed however, the user must first open it via one of the following commands: (line number) OPEN "n:xxxx" FOR INPUT or (line number) OPEN "n:xxx:~" FOR OUTPUT where n represents the cassette drive numJer (O-7), and xxxx is any legal filename (6 characters or less, and optional extension of 3 characters or less). Input files are cre.ated either by using BASIC or the CAPS-8 EDITOR (see Section 6.8.6), .and must have been previously stored on cassette before being accessed. For example, the statement: 215 OPEN III :TEST.DAT" FOH I:\1PUT opens an input file named TEST.DAT on cassette drive 1. Only one input and one output file may be open at any time, and only one file--either input or output--may be open on a given cassette drive at one time. CLOSE The CLOSE statement is used to close a currently open output file, and is of the form: (line number) CLOSE Suceeding OPEN FOR INPUT statements will perform an automatic close on a previously open input file: however, the user should take note of the following cases: 1. If the user attempts to open an input file on a cassette which is currently open for output, BASIC will return an I 0 ERROR, as the same cassette drive cannot be open for both input and output at the saml~ time. 2. If the user has an input file open on a cassette, and is at its end-of-file (that i:;, a CTRL/Z has been detected), BASIC will allow him -to open an output file 6-15 on t:he same cassette, since the input file is theoretically "closed". However, if the u~:er has an input file open on a cassette and is not at its end-of-file, an I 0 ERROR will occur if he then tries to open an output file on the same cassette. (See Section 6.8.9, IF END#, for more information on BASIC's method of det:ecting an end-of-file.) 3. If the! user tries to open an output file and an output file is already open on any cassette, BASIC will return a "FIl,E OPEN ERROR": before opening a new output file, the current output file must be closed. A close is automatically performed on both open input and open output files by STOP, END and CHAIN statements, as well as by all errors detected at run-time. INPUT# Once an input file has been opened using the open statement, data can be called into a program using the INPUT# statement. The form of this statement is: (line number) INPUT# xl,x2, ••• xn where # signifies that the file is stored on cassette under the filename and drive number specified in the last "OPEN ••• FOR INPUT" statement: xl t,hrough xn represent variable names. When the BASIC program reaches the INPUT# statement du.ring execution, the data is automatically called into the program from cassette and execution continues. INPUT# statements and INPUT statements may be interspersed throughout a program. The input file need only be opened once before it is referenced. PRINT The PRINT stat,ement is used to output results comments, values of variables, or plot points console terminal. The format is: of computations, of a graph on the (line number) PRIN'r expression When no expression is indicated in the statement line, a blank line is output. For example: ?(15 DR I NT ?l(~ PRI:\IT Two blank lines will be output on the console terminal. By using certain kinds of expressions and the control characters colon and semicolon, the user can create fairly sophisticated formats. 6-16 In order to print out the results of a computation and the value of a variable, the user types the line number, PRINT, and the variable name{s) separated by a format control character (in this case, commas) as follows: 5 A=16\B=5\C=4 10 PRINT A,C+B,SQR(A) In BASIC, an output line is formatted into five columns (called print zones) of 14 spaces each. The control character comma causes a value to be typed beginning at the next available print zone. In the above example, the value of A, the sum of A+B, and the square root of A are printed in the first three print zones as follows: RUN 16 9 A statement such as in line number 10 in this next example: 5 A=2.3\B=21\C=156.75\D=1.134\E=23.4 10 PRINT A,B,C,D,E causes the values of the variables to be printed in using all five zones: RUN 2.3 the same format 1 .134 23.4 When more than five variables are listed in the PRINT sixth value begins a new line of output. statement, 21 156.75 the The PRINT statement may also be used to output a message or line of text. The desired message is simply placed in quotation marks in the PRINT statement as follows: 10 PRINT "THIS IS A TEST II when line printed: 10 i.s encountered during execution, the following is THIS IS A TEST A message may be combined with variable as follows: the result of a calculation or a 80 PRINT IIAMOUNT PER PAYMENT =",R Assuming R=344.96, when line 80 is encountered during results are output as: AMOUNT PER PAYMENT execution, the 344.96 If a number following a printed message is too long to be printed on a single line, the number is automatically moved to the beginning of the next line. It is not necessary to use the standard 5-zone format for output. The control character semicolon (;) causes the text or data to be output 6-17 immediately after the last character printed (separated from that character by a space and followed by another space). If neither a Thus both comma nor a semicolon is used, BASIC ,~ssumes a semicolon. of the following: 80 PRINT "AMOUNT PER PAYMENT ="R 80 PRINT "AMOUNT PER PAYMENT =";Ft result in: AMOUNT PER PAYMENT = 344.96 The PRINT statement can also cause a Gonstant to be printed on the console terminal. (This is similar to the PRINT command used in Immediate Mode.) For example: 10 PRINT 1.234~SQR(10014) causes the following to be output at 4;!xecution time: 1.234 100.07 Any algebraic expression in a PRINT s·tatement is evaluated using the current value of the variables. Nmru)ers are printed according to the format discussed in Section 6.3. The following example program illustrates the use of the control characters comma and semicolon in PRINT statements. The user may also wish to refer to Section 6.8.12 for information pertaining to three functions available for additional character control--TAB, PUT, and GET: 10 READ A~B~C 20 PRINT A,B~C~At2,Bt2,Ct2 30 PRINT 40 PRINT A;B;C;At2;Bt2;Ct2 50 DATA 4~5,6 60 END RUN 4 5 6 16 25 36 4 5 6 16 25 36 READY. Another use of the PRINT statement is to combine it. with an statement so as to identify the da·ta expected to be entered. example, consider the following progr.am: 6-18 INPUT As an 10 REM - PROGRAM TO COMPUTE INTEREST PAYMENTS 20 PRINT "INTEREST IN PERCENT"; 25 INPUT J 26 LET J=J/100 30 PRINT "AMOUNT OF LOAN"; 35 INPUT A 40 PRI NT "NUMBER OF YEARS"; 45 INPUT N 50 PRINT "NUMBER OF PAYMENTS PER YEAR"; 55 INPUT M 60 LET N=N*M 65 LET I=J/M 70 LET B=1 +1 75 LET R=A*I/(1-1/BtN) 78 PRINT 80 PRINT "AMOUNT PER PAYMENT =";R 85 PRINT "TOTAL INTEREST =";R*N-A 88 PRINT 90 LET B=A 95 PRINT" INTEREST APP TO PRIN BALANCE" 100 LET L=B* I 110 LET P=R-L 120 LET B=B-P 130 PRINT L"P .. B 140 IF B>=RGO TO 100 150 PRINT B*I .. R-B*I 160 PRINT "LAST PAYMENT ="B*I+B 200 END HUN INTEREST IN PERCENT?9 AMOUNT OF LOAN?2500 NUMBER OF YEARS?2 NUMBER OF PAYMENTS PER YEAR?4 AMOUNT PER PAYMENT = 344.9617 TOTAL INTEREST = 25~.6932 APP TO PRIN INTEREST 288.7117 56.25 295.2077 49.75399 301.8498 43.11182 308.6415 36.32019 315.5859 29.37576 322.6866 22.27508 329.947 15.01463 337.3708 7.590824 LAST PAYMENT = 344.9608 BALtlNCE 2211 •. 288 1916 •. 081 1614 •. 231 1305 •. 589 990. fl03 5 667.~117 337 .~1699 READY. As can be noticed in this example, the question mark is grammatically useful when several values are to be i.nput by allowing the programmer to formulate a verbal question which the input values will answer. 6-19 PRINT# The PRINT# statement is similar to t:he PRINT stab:!ment with the exception that data and messages are sent to the cur:rent output file on cassette rather than to the console terminal. Thl:! form of the statement is: (line number) PRINTf: xl, x2 , ••• xn where # signifiE:!s that the output will be sent to the cassette drive number and filename of the currently open output file, and xl through xn represent data variables. (The current open file iB determined by the OPEN FOR OUTPUT statement, as detailed earlier in 1::his section.) If the user attempts to save data on a full cassette, BASIC prints an error message and returns control to its editing phase. The data already output is lost, and the user will have to rerun his program using a different output cassette. COMMAS and NO COMMAS Data stored in an output file on cassette is often called later as input by another or the same program. (This is in fact the only method of passing data between segments of a chained program.) In order to be use~d as input, this data m.ust be in the sa.me format as it would appear if written in a DATA statement. Cassette BASIC provides two statements for formatting this output--COr.1MAS and NO COMMAS. In order to be used as data, individual values must be separated by commas; the COMMAS statement inserts a comma after eac:h item of data; (unless the COMMAS statement is inserted in the program prior to PRINT# statement, data will be output in the format illustrated eariier under the PRINT statement.) The form is: {line number> COMMAS A NO COMMAS stat:ement will set the format back to its original state. The COMMAS and NO COMMAS statements do not affect output on either the console terminal or line printer. The following example "OUT. OAT" , reads the console terminal. writes out four values in a file called values back into memory and prints them on the 10 OPEN "1:0iJT.DAT" FOn OUTPUT 15 COMMAS 20 PRINT' 1;2;3;4 30 CLOSE 40 OPF:N "1:0IJT.DAT I f FOR INPUT 50 INPUT# I~J~K~L 60 PR.INT I,J~K~L 73 END Output appears as follows: RUN 1 3 READY. 6-20 4 The COMMAS statement is not necessary if the user is only sending one value per line. The preceding example could have been coded as follows, with the same results: . 10 OPEN "1:0UT.DAT" FOR OUTPUT 20 FOR 1=1 TO 4 30 PRINT# I 40 NEXT I 50 CLOSE 60 OPEN "1:0UT.DAT" FOR INPUT 70 INPUTI I,J,K,L 80 PRINT I,J,K,L 90 END In this case the file OUT. OAT would appe,ar: 1 2 3 4 whereas in the first case it would appear as follows: The user must take care when inputting data from cassette files. example, if the file OUT. OAT is in the form: and the user attempts statement: to input these values using the For following the proper values for I, J, and K will he read, but the rest of the line will be lost as far as satisfying any future variables--just as it would be lost if these values were input from the console terminal. (Refer to the information concerning the INPUT statement in this section. ) LPT The LPT statement is used to generate output on the line one is available) and is of the form: printer (if (line number) LPT By inserting this statement anywhere in a program, all subsequent output, with the exception of error messages, will be printed on the line printer. The LPT statement is particularly advantageous for outputting large amounts of calculated data, as can be seen from this 6-21 and following examples: 100 110 120 130 140 LPT FOR F=30 TO 60 STEP 3 PRINT F"Ff2 NEXT F END huN 30 33 q00 1089 3& 129& 39 t 5tH 17&4 42 45 48 2025 2304 51 2&01 S4 291& 57 324q ~0 3~00 When the END statement is encountered in device is reset to the console terminal. the program, the output TTY OUT The console terminal may be placed under program control so that during execution of a program output may be sent alte:rnately between the console terminal and the line printe~r (if one is ava.ilable on the system) • Control is originally set with the console terminal. B:{ issuing the LPT statement discussed previously, all subsequent output can be sent to the line printer. To return control to the console terminal from within the program, the statement: (line number) T'I'Y OUT is inserted. (Cassette I/O always returns control to the last device indicated, so that the TTY OUT statement need only bl~ used when the line printer is involved.) The following program makes use of almost all the available I/O devices. The console terminal and line printer output is included. 5 HEM PROGRAM TO DEMONSTHATE 4LL 110 DEVICgS 1~ REM AVAILABLE IN CASSETTE BASIC 15 REM 20 PR I NT "PHOGHAM TO CALCfJLATE SOIJA,RES AND SOfJARE HOOTS" 25 PRINT 27 REM GET LOOP LIMITS FROM USER 30 PRINT "INprTT LOWER LIMIT" 35 I NPT]T L 40 PRINT "INpT]T TJPPEH LIMIT" 45 INPUT U 50 PR I NT "I Npr]T STEP" 55 I NprJT S 57 HEM CREATE A CASSETTE FILE OF SQIJARES OF Nr)MBERS 60 OPEN "1: snfJARE. DAT"FOR Of]TPI]T 6-22 65 LPT 66 RSM PRINT A F'OHM F~F:D ON LINEPRl:'<J1EH 70 T =prJT ( 12 ) 75 PH I NT "TABLE OF ;\JrJMBERS AND THE 1 R S()!JAHES" 80 PRINT 81 PHINT II X"," Xf2" [12 PRINT ~3 PRINT ~5 FOR X=L TO /J STEP S 90 PHINT x,xn~ 95 RF:M ALSO SF:ND S()fJARf.::S TO CASSF.TT~ FILE: 100 P~INT# Xn:~ H,5 NEXT X 1~6 CLOSE 110 T=prJT(l:l,) 111 TTY orJ1 112 PH I NT "TABLE OF SIJ'JAHES C OMDLETE" 113 LPT 115 PR I NT "TABLE OF ~\J;JM8ERS AND THE: I H 50! JARE ROOT S I I 12(71 OPE\} "I :SOi1AR~:.DAT"F'OR Il'JprJT 125 PRINT 126 P:'iINT 127 ~RINT " X"," SnR(X)" 128 PRINT 130 FOR X=L TO 'J STEP S 135 INP;JT# J 136 PRINT J,SOR(J) 140 i\lEXT X 150 T=P;JT( 1~) 155 TTY or)T 160 PRINT "PHOGHAM COMPLETED" 165 END H,uN PROGRAM TO CALCTJLATE SnrJARES AND S0rJARE ROOTS I \JDIJT LOWER LIMIT 11 I:'lprJT fJPPEH LIMIT 1591 INprJT STEP 71 TABLE OF' S();JARES COMPLETE 6-23 Ar~1,) TA8LE Of' MJtviBE.RS THE-If.( SQUARES )(-2 )( 1 2 " q :~ i1 \h ~ 2':5 3h (-. 1 8 49 q M1 1 V' 1?!0 49 2"0', 'i0 25~C1 ,.." )( ~QK(X) ~ 1 ? 3 9 1 f, 4 25 -~ ':' t- ,., 1.19 " bU b 51 t '1 v 1 9 t 9l ;.>4 v' 1 49 2 ':'r,'~ ') ~~ 6-24 NOTE If an LT33 Teletype i.s used as the console terminal and it includes a reader and punch, these devices may be used for I/O operations at any time; no special statement is required. To read in data from the reader, position the tape over the sprocket \t;rheel; when input is required, set the realder to START and the tape will begin reading in. To punch a tape, set the! punch to ON and all Teletype output will be punched on the punch. Using the! paper tape I/O devices is, in effect, t~he same as using the Teletype keyboard. Characters will be typed on the Teletype keyboard as tapes are being read or punched. 6.B.6 Creating Run-Time Input Files Data files stored on cassette and used for input during execution can be created either by use of BASIC itself or by use of the CAPS-B EDITOR. Using BASIC, the programmer creates a program which accepts values from the console terminal keyboard and then writes these onto the cassette as an output file. Data files consist of consecutive ASCII characters. If the useful data in a file is to end before the actual end-of-file, the last useful character must be followed by a CTRL/Z. (This character is inserted by BASIC when the user closes an output file. When later detected during input:, BASIC sets an end-of-file flag; the user can test an end-of-fiIE~ condition by using the IF-END# statement.) The COMMAS statement is uSE~d to produce the correct format for a data file when more than one value is on a single line. The following program illustrates one method of doing this: 5 REM - PROGRAM TO ACCEPT DATA FROM THE CONSOLE 10 REM - TERMINAL AND CREATE A. RUNTIME INPUT FILE 20 OPEN "0:RTIN.DAT" FO!={ OUTPUT 25 PRINT "INPUT A"B"C"D"; 30 INPUT A"B"C,D 35 COMMAS 40 PRINTH A"B"C"D 45 PRINT "INPUT FeI) FOR 1=1 TO 1~1" 50 DIM F( HD 52 REM - COMMAS NOT NEEDED SINCE t:~RRAY WILL 53 REM - BE OUTPUT ONE ELEMENT PER LINE 55 NO COMMAS 60 FOR 1=1 TO 10 70 PRINT "F("I")"; 7 5 I NP UT F ( I ) 80 PR I NT # F ( I ) 85 NEXT I 90 PRINT I I INPUT Vl"V2"Z" 95 INPUT Vl "V2" Z 97 REM CO~M.4S ARE NEEDED SINCE i} 1 " V2 AND Z 98 REM - \vILL BE OUTPUT ON THE SAt1E LI NE - 6-25 1 tHtJ COMMAS 105 PRINT# Vl,V2,Z 110 CLOST<': 115 END nUN S.AVE UNIT#(O··7) :0 READY. The CAPS-8 EDITOR can also be used to create an input file. The EDITOR first asks for input and output devices and filenames; then the user types the file using EDITOR commands and making sure the format is correct for BASIC. The same data file in the above example can be created using the EDITOR as follows: !..R EDI T *IN?UT FILE*Q0r~Jr FILE-0znfIN.DAT JLA 1.37,2.346,-13.267,-1.056 23 3.56 1 .436 38 9.026 23.1967 89 5Ll 12.467 -1 123,34567,789 !L 1.37,2.346,-13.267,-1.056 23 3.56 1.436 38 9.026 23.067 f59 54 12.467 -1 123,34567,789 JtE 6-26 6.8.7 Loops (FOR, NEXT and STEP) A loop is a set of instructions which are repeated over and over again, each time being modified in some way until a terminal condition is reached. FOR and NEXT statements define the beginning and end of a loop; STEP specifies an incremental value. The FOR statement is of the form: (line number) FOR v=xl TO x2 STEP x3 where v represents a variable name, and xl, x2, and x3 all represent formulas (a formula in this case means a numerical value, variable name, or mathematical expression). v is termed the index, xl the initial value, x2 the terminal value, and x3 the incremental value. For example: 15 FOR K=2 TO 20 STEP 2 This loop will be repeated as long as K is less than or equal to 20. Each time through the loop, K is incremented by 2, so the loop will be executed a total of 10 times. A variable used as an index in a FOR statement must not be subscripted, although a common use of loops is to deal with subscripted variables using the value of the index as the subscript of a previously defined variable (this is illustrated in Section 6.8.8, Subscripted Variables). The NEXT statement is of the form: (line number) NEXT v where v is the index of the FOR loop and signals the end of the loop. When execution of the loop reaches the NEXT statement, the computer adds the STEP value to the index and checks to see if the index is less than or equal to the .terminal value. If so, the loop is executed again. If the value of the index exceeds the terminal value, control falls through the loop to the following statement, with the value of the index equaling the value it was assigned the final time through the loop. (Note that this method of handling loops varies among other versions of the BASIC language.) If the STEP value is omitted, a value of +1 is assumed. (Since +1 is the usual STEP value, that portion of the statement is frequently omitted.) The STEP value may also be a negative number. The following example illustrates the use of loops. This loop is executed 10 times: the value of I is 10 when control leaves the loop. +1 is the assumed STEP value. 10 FOR 1=1 TO 10 20 NEXT I 30 PRINT I 40 END RUN 10 READY. 6-27 If line 10 had been: 10 FOR 1=10 TO 1 STEP -1 the value printed by the computer would be 1. As indicated earlier, the numbers used in the FOR statement are formulas; these formulas are evaluabed upon first encountering the loop. While the index, initial, terminal and STEP values may be changed within the loop, the value assigned to the initial formula remains as originally defined until the terminal condition is reached. To illustrate this point, consider the previous example. The value of I (in line 10) ca.n be successfully chang1ed as follows: 10 FOR 1=1 TO 10 15 LET 1=10 20 NEXT I The loop will only be executed once since the value 10 has been reached by the variable I and the terminal condition is satisfied. If the value of the counter variable is originally set equal to the terminal value, the loop will executE:! once, regardless of the STEP value. If the starting value is beyond 1:he terminal value, the loop will also execute only once. It is possible to exit from a FOR-NEXT loop without the index reaching the terminal value. This is known as a conditional transfer and is explained in Section 6.8.9. Control may only transfer into a loop which has been left earlier without beinq completed, ensuring that the terminal and STEP values are assigned. Nesting Loops It is often useful to have one or more loops within a loop. This technique is called nesting, and is allowed as long as the field of one loop (the numbered lines from the FOR statement to the corresponding NEXT statement, inclusivE~) does not cros:; the field of another loop. A diagram is the best way to illustrat.e acceptable nesting procedures: ACCEPTABLE NESTING TECHNIQUES UNACCEPTABIJE NESTING TECHNIQUES Two Level Nesting ' r~g~ ~ ~EXT FOR [NEXT -NEXT ~'OR ~ E'OR -NEXT NEXT 6-28 Three Level Nesting FOR OR r FOR l-NEXT FOR r [ l-NEXT NEXT NEXT -FOR ~ -FOR -FOR [ -NEXT -FOR 'NEXT -NEXT -NEXT A maximum of eight (8) levels of nesting' is permitted. limit will result in the error message: Exceeding that FOR ERROR AT LINE XXXX where XXXX is the number of the line in which the error occurred. 6.8.8 Subscripted variables In addition to single variable names, BASIC accepts another class of variables called subscripted variables. Subscripted variables provide the programmer with additonal computing capabilities for handling lists, tables, matrices, or any set of related variables. Variables are allowed one or two subscripts. A single letter forms the name of the variable, followed by one or two integers in parentheses, separated by a comma, indicating the place of that variable in the list. Up to 26 arrays are possible in any program (corresponding to the letters of the alphabet), subject only to the amount of memory space available for data storage. For example, a list might be described as A(I) where I goes from 1 to 5, as follows: A(l) ,A(2) ,A(3) ,A(4) ,A(5) This allows the programmer to reference each of the five elements in the list A. A two dimensional matrix A{I,J) can be defined in a similar manner, but the subscriped variable A can only be used once (i.e., A{I) and A{I,J) cannot be used in the same program). It is possible however, to use the same variable name as both a subscripted and an unsubscripted variable. That is, both A and A(I) are valid variable names for use in the same program. Subscripted variables allow data to be input quickly and easily, as illustrated in the following program (the index of the FOR statement in lines 20, 42 and 44 is used as the subscript): 10 REM - PROGRAM DEMONSTRATING READING REM - OF S!J8SCH I PTED VAR I ABLES 15 DIM A(5)IR(213) 18 PRINT "A(I) WHl-:RE A=1 TO 5;" 20 FOR 1=1 TO 5 25 READ A( I) 30 PH I ~T A ( I ) ; 35 NEXT I 11 38 PRINT 39 PRINT 40 PRINT "BC IIJ) 41 PRINT" 42 F' on I 1 TO 2 = WHl':HE 1=1 A'\lD J=1 TO ? ... TO 3:" 6-29 43 PRINT 44 FOR J=1 TO 3 48 HEAD B(IIJ) 50 PH 1 NT R ( 1 1 J) ; 55 NEXT J 56 '~EXT 1 60 DATA 112131415161718 61 DATA 811161514131211 65 END WJN A(I) WHERE A=1 TO 5; 1 ? 8( I, J) 3 4 wHERE: AND 6 R 7 7 '5 1=1 TO 2 : J=1 TO 3: 8 6 HP,ADY. DIM From the preceding example, it can be se,en that the use of subscripts requires a dimension (DIM) statement to define the maJ<:imum number of elements in the array. The DIM statement is of the form: (line number) DIM vl(nl), v2(n2,m2) where v indicates an array variable name and nand m are integer nwnbers indicati.ng the largest subscript value requi.red during the program. For example: 15 DIM A(6110) The first element: of every array is automatically assumed to have a subscript of zero. Dimensioning A(6,lO) sets up room for an array with 7 rows and 1.1 columns. This matrix can be thought of as existing in the following form: AO,O AO,l Al,O Al,l A2,O A2,1 AO,lO AI,lO A2,lO A6,O A6,1 ••• A6,lO and is illustrated in the following program: 6-30 10 REM - MATRIX CHECK PROGRAM 15 DIM A(6,10) 20 FOR 1=0 TO 6 22 LET A(I,0)=I 25 FOR J=0 TO 10 28 LET A(0,J)=J 30 P R I NT A ( I , J) ; 35 NEXT J 40 PRINT 45 NEXT I 50 END RUN 0 1 1 0 2 0 3 0 4 0 5 0 6 0 2 3 4 0 0 0 0 (~ (3 0 0 0 (1 0 0 0 0 0 0 0 0 5 0 0 0 6 0 0 7 0 0 0 0 (1 0 (3 0 0 (3 0 0 0 8 0 0 0 0 0 0 9 10 0 0 13 0 13 0 {~ 0 0 0 0 0 READY. Notice that a variable assumes a value of zero until another value has been assigned. If the user wishes to conserve memory space by not making use of the extra variables set up within the array, he should set his DIM statement to one less than necessary, i.e. DIM A{5,9). This results in a 6 by 10 array which may then be referenced beginning with the A (O,O) element. More than one array can be defined in a single DIM statement: 10 DIM A(20), 8(4,7) This dimensions both the list A and the matrix B. A number must be used to define the maximum size of the array. A variable inside the parentheses is not acceptable and will result in an error message by BASIC at run-time. The amount of memory not filled by the program will determine the amount of data the computer can accept as input to the program at anyone time. In some programs a TOO-BIG ERROR may occur, indicatinc;r that memory will not hold an array of the size requested. In that evemt, the user should change his program to process part of the datcL in one run and then chain to another section to process the rest (see Section 6.8.10). 6.8.9 Transfer of Control Statements Certain control statements cause the execution of a program to jump to a different line either unconditionally or as a result of some condition within the program. Looping is one method of jumping to a designated point until a condition is nlet. The following statements give the progranuner added capabilities in this area. 6-31 Unconditional Transfer (GOTO) The GOTO (or GO TO) statement is an unconditional statE!ment direct program <::ontrol either forward or back in a pro9ram. of the GOTO statement is: used to The form (line number) GOTO n where n represents a statement number. When the logic ()f the program reaches the GOT 0 statement, the statement(s) immediately following will not be executed: instead execution is transferred to the statement beginning with the indicated line number. The following program never ends: it does a READ, prints something, and jumps back to the READ via a GOTO statement. Ii: atempts to do this over and over until it runs out of data, which is an acceptable, though not advisable, way to end a program. 10 HEM - PROGHAM ENDING WITH ERROR 11 .REM - MESSAGE Wy~~ O~T OF DATA 20 HEAD X 25 PRINT "X="XI"XT2="XT2 30 GO TO 20 35 DATA 115110115120125 40 END HfJN X= X= X= X= X= 1 5 10 15 20 X= 25 Xt2= XT2= Xt2= Xt2= Xf2= Xf2= 1 25 10'1 225 400 f)~5 DATA ERROR AT LINE 20 Conditional Transfer (IF THEN and IF GOT 0) A program sometimes requires that two values be compared at some point; control of program execution may be directE!d to different procedures depending upon the result of the comparison. In computing, values are logically tested to see whether they are equal, greater than, less than another value, or possibly a combination of the three. This is accomplished by use of the relational operators discussed in section 6.5.3. IF THEN and IF GOTO statements allow the programmer to test the relationship between two formulas (variables, numbers, or expressions). Providing the relation.ship described in the IF statement is true at the point it is tested, c()ntrol will be transfered to the line number specified, or the indicated operation will be performed. The statements are of the form: (line number) IF vI <relation> v2 GOTO [or THEN] 6-32 x where vl and v2 represent variable names or expressions, and x represents a line number or an operation to be performed. The use of either THEN or GOTO is acceptable. The following two examples are equivalent (the value of the variable A is changed or remains the same dependin9 upon A's relation to B) : 100 IF A>B THEN 120 110 A=A t8-1 120 C=A/D 100 IF A<=8 THEN A=AtB-l 110 C=A/D IF ENOl The IF ENOl statement is used to verify an end-of-file during run-time input. The form of this statement is: condition (line number) IF ENOl THEN n IF ENOl instructs BASIC to perform a ch.~ck on the validity of the last INPUT I statement referencing the currently open input file; n represents a line number or operation to be performed. If an end-of-file (CTRL/Z) was detected during the last INPUTI statement, BASIC transfers control to the specified line number or performs the indicated operation. If an end-of-file was not detected, then no operation occurs. For example: 150 OPEN "1: VALUE" FOR INPUT 200 INPUT# A,B,C 210 IF END# THEN 530 215 LET X=SGNCA) 530 PRINT "INPUT FILE--NOT ENOUGH DATA" 535 STOP 6-33 In this example the programmer provides his own error message if there is an insufficient number of values for his variables. If there are two valid numbers remaining in the input file when stcLtement 200 is reached, then the variables A and Bwill receive valid input. When the program attempts to input a value for C, BASIC ~rill detect an end-of-file and return a value of zero for C. As it executes the IF END# statement, BASIC will note that it has ju~:t reached the end-of-file, and will transfer control to statement nun~er 530, as the user intended. However, assume that as line 200 is executed there is only one valid data value left in the input file. An end-of-file is detected this time when BASIC tries to read a value for B; B is set t~o zero. When BASIC attempts t:o continue reading a value for C, an EOF ERROR will be returned (see Section 6.12) and program execution will terminate since the user has tried to read past the end-of-file. A good way of circumventing this condition is to include both the INPUT# and the IF END# statements in a loop and input one value at a time. Using this method allows the programmer's own error message to be printed before BASIC is allowed to read past the end-of-file. 6.8.10 Program Chaining (CHAIN) Since Cassette BASIC allows at most only 2K words of memory for program storage, it is possible that a program may be t~oo large to fit in memory at one time. However, Cassette BASIC compen~:ates for this by allowing different segments of a program to be stored on cassette and called as needed. Although each program segment is restricted to 2K of memory, total program length is effectively unlimited. The form of the CHAIN statement is: (line number) CHAIN "n:XXXX" where n is the cassette drive number, and XXXX is the name of the file to be chained to. The CHAIN statement should be the last statement in the user's program. When BASIC transfers to the program specified in the statement, it removes the old program from memory. Data is not passed in memory during the chain, so the user should be careful to save any data he will need in an output file. (See Section 6.8.5--PRINT#.) The chain automatically closes any open output file, transfers control to the lowest statement number in t:he new program, and continues execution. For example, the following section of a program stores some values on an output cassette and chains to a file callE~d PART2: 450 OPEN "1.: DATA." FOR OUTPUT 4 55 COMMA.S 460 PRINT# B,C,D,G,H,Z 465 NO COMMAS 410 FOR 1=1 TO 10 415 PRINTH A( I) 480 NEXT I 485 CLOSE 490 CHAIN "1 :PART2" 6-34 data The values stored by this section of the program in the cassette file DATA can be read in by the second section of the program--PART2--and can continue to be used. PART2 might appear as follows: 1 DIM A(10) 5 OPEN "1: DATA" FOR INPUT 10 INPUT# B,C,D,G,H,Z 15 FOR 1=1 TO 10 20 INPUT/! A.(I) 25 NEXT I 6.8.11 Subroutines (GOSUB and RETURN) A subroutine is a section of code performing some required at more than one point in the program. I/O operation for a volume of data, a mathematical too complex for a user-defined function, or processes may best be performed in a subroutine. operation that is Often a complicated evaluation which is any number of other Subroutines are generally placed physically at the end of a program, usually before DATA statements, if any, and always before the END statement. Two statements are used exclusively in BASIC to handle subroutines; these are the GOSUB and RETURN statements. A program begins execution and continues until it encounters statement of the form: a GOSUB (line number) GOSUB x where x represents the first line number of the then transfers to that line. For example: subroutine. Control 50 GOSUB 2'2)0 When program execution reaches line 50, control transfers to line 200, and the subroutine is processed until execution encounters a RETURN statement of the form: (line number) RETURN The RETURN statement causes control to return to the statement following the GOSUB statement. Before transferring to the subroutine, BASIC internally records the next statement to be processed after the GOSUB statement; thus the RETURN statement is a signal to transfer control to this statement. In this way, no matter how many different subroutines are called, or how many times they are used, BASIC always knows where to go next. The following program demonstrates a simple subroutine: 6-35 1 REM - THIS PROGRAM ILLUSTRATES GOSUB AND RETURN 10 DEF FNA(X)=ABSCINTCX» 20 INPUT A.. B .. C 30 GOSUB 1 '~0 40 LET A=FNACA) 50 LET S=FNACB) 60 LET C =FNACC) 70 PRINT 80 GOSUS 1"0 90 STOP 100 REM - THIS SUBROUTINE PRINTS OUT THE SOLUTIONS 110 REM - OF THE EQUATION: ACXt2) + SCX) + C = 0 120 PRINT "THE EQUATION IS "A"*Xt2 + "B"*X + 130 LET D=B*B-4*A*C 140 IF D<>0 THEN 170 150 PRINT "ONLY ONE SOLUTION ••• X ="-B/C2*A) 160 RETURN 170 IF D<0 THEN 200 180 PRINT "TWO SOLUTIONS ••• X ="; 185 PRINT (-B+SQR(D»/(2*A)"AND X ="C-B-SQRCD»/(H*A) 190 RETURN 200 PRINT "IMAGINARY SOLUTIONS ••• X = cn; 205 PRINT ··B/C2*A)" .. "SQRC -D)/C2*A)") AND C"; 207 PRINT -B/C2*A) ...... -SQR( -D)/C2*A,)")" 210 RETURN 900 END nc RUN ?1 ... 5 .. -.5 THE EQUATION IS 1 *Xt2 + TWO SOLUTIONS ••• X = .5 AND X =-1 .5 *X THE EQUATION IS 1 *Xt2 I MAG I NARY SOLUT IONS. •• X = 0 *X + o .. 1 ) AND -.5 + + 0 .. -1 RFADY. Line 100 begins the subroutine. There are several places in which control may return to the main prog'ram, depending upon the flow of control through the various IF statements. The subrou1:ine is called from line 30 and again from line 80. ~hen control returns to line 90, the program encounters the STOP statement and execution is terminated. It is importan1: to remember that subroutines should gE!nerally be kept distinct from the main program. The last statemen1: in the main program should be a STOP or GOT 0 statement, and subroutines are normally placed following this statement. A useful practice is to assign dis tinc1:i ve line numbers to subroutines. For example, if the main program is numbered with line numb,ers up to 199, 1:hen 200 and 300 could be used as the first numbers of t,wo subroutines. Nesting Subroutines Nesting of subroutines occurs when one subroutine calls another subroutine. If a RETURN statement is encountered during execution of a subroutine, control returns to the statement follo\ling the GOSUB 6-36 which called it. From this point, it is possible to transfer to the beginning or any part of a subroutine, even back to the calling subroutine. Multiple entry points and RETURN statements make subroutines more versatile. The maximum level of GOSUB nesting is about ten (decimal) levels, which should prove more than adequate for all normal uses. Exceeding this limit will result in the message: GOSUB ERROR AT LINE XXXX where XXXX represents the line number where the error occurred. An example of GOSUB nesting follows. Execution has been stopped by typing a CTRL/SHIFT/P combination (see section 6.11.4, Stopping a Run), as the program would otherwise continue in an infinite loop. 10 REM - FACTORIAL PROGRAM USING GOSUB TO 15 REM - RECURSIVELY COMPUTE THE FACTORS 40 INPUT N 50 IF N>20 THEN 120 60 X=1 70 K=1 80 GOSUB 200 90 PRINT "FACTORIAL "N" ="X 110 GO TO 40 120 PRI NT "MUST BE 10 OR LESS" 130 GO TO 40 200 X=X*K 210 K=K+l 220 IF K<=N THEN GOSUB 200 230 RETURN 240 END RUN 12 FACTORIAL ?4 FACTORIAL 75 FACTORIAL 2 2 4 = 24 5 = 120 ? STOP. READY. 6.8.12 Functions BASIC defines several mathematical calculations for the programmer, eliminating the need for tables of trig' functions, square roots, and logari thms. These functions have a 3-1et.ter call name, followed by an argument, x, which can be a number, variable, expression, or another function. Table 6-1 lists the functions available in Cassette BASIC. Most are self-explanatory; those that; are not and are described in greater detail are marked with an asterisk. 6-37 Table 6-1 Cassette BASIC Functions Function Meaning SIN (x) Sine of x (x is expressed i.n radians) Cosine of x (x is expressed in radians) Tangent of x (x is expressE!d in radians) Arctangent of x (result is expressed in radians) e to the xth power (e=2.71E:282) Natural log of x (logex) Sign of x--assign a value Clf +1 if x is positive, 0 if x is zero, or -1 if x is negative Integer value of x Absolute value of x (I x I ) Square root of x (¥X) Random numbter Print next character at space x Get a character from input device Put a character on output device User-defined function User-coded function (machine language code) COS (x) TAN (x) ATN{x) EXP (x) LOG(x) *SGN (x) *INT (x) ABS(x) SQR(x) *RND (x) *TAB (x) *GET (x) *PUT (x) *FNA(x) *UUF (x) Sign Function (SGN(x» The sign function returns the value +1 if x is a positive value, 0 if x is zero, and -1 if x is negative. For example, SGN(3.42)=1, SGN(-42)=-1, and SGN(23-23)=O. The following example illustrates the use of this function: 10 REM - SGN FUNCTIO:-J EXAMPLE: 20 READ A,B 25 Pn I NT "t\ =" A, "B ="B 30 PRINT "SGNCA)="SGNCA),"SGNCB)="SGNCB) 40 PRINT "SGNCINTCA»="SGNCINTCA» 50 DATA -7.32, .44 6(3 END Integer Function (INT(x)} The integer function returns the value of the nearest integer not greater than x. For example, INT(34.67)=34. By specifying INT(x+.5) the INT function can be used to round numbers to the nearest integer; thus, INT(34.67+.5)=35. INT can also be used to round numbers to any given decimal place by specifying: INT(X*lOtD+.5)/lOtD where D is the number of program illustrates this typing a CTRL/SHIFT/P: decimal places desired. function; ~:!xecution has 6-38 The following been stopped by 10 REM - INT FUNCTION EXAMPLE 20 PRINT "NUMBER TO BE ROUNDED"; 3(1 I NPUT A 40 PRINT "NO. OF DECIMAL PLACES"; 50 INPUT D 60 LET B=INT(A*10fD+.5)/10fD 70 PRINT "A ROUNDED = "B 80 GO TO 20 90 END RUN NUMBER TO BE ROUNDED?55.65342 NO. OF DECIMAL PLACES?2 A ROUNDED = 55.65 NUMBER TO BE ROUNDED?78.375 NO. OF DEC I MAL PLAC ES?-2 A ROUNDED = 1(~0 NUMBER TO BE ROUNDED?67.89 NO. OF DECIMAL PLACES?-1 A ROUNDED = 70 NUMBER TO BE ROUNDED? STOP. READY. If the argument is a negative number, the value returned is the largest negative integer (rounded to the higher value) contained in the number. For example, INT(-23)=-23 but INT(-14.39)=-IS. Random Number Function (RND(x» The random number function produces a random number n which is in the range O<n<l. The numbers are not reproducible, a fact the programmer should keep in mind when debugging or checking his program. The argument x in the RND(x) function call can be any number, as that value is ignored. The following program illustrates the use of this function to generate a table of random numbers. 10 REM - RANDOM NUMBER EXA~PLE 25 PHI NT "RANDOM NUMBERS" 30 FOR 1=1 TO 30 40 PRINT RND(O), 50 NEXT I 60 END RUN RANDOM NUMBERS .7759228 .4857633 .6156673 .3796163 .9547609 .05280478 READY. .08069808 .4192038 .5921191 .2023254 .2890875 .3859534 .5008833 .1433537 .01170888 .7974058 .1416765 .8404774 6-39 .2790171 .08728769 .7411813 .9635064 .2482717 .5692836 .1661529 .2335427 .341708 .6043865 .2145417 .8514056 It is possible to generate random numbE:!rs over any range by using following formula: the (B-A) *RND(O) +A This produces a random number (n) in the range A<n<B. For example, in order to obtain random digits in the range 0<n<9, line 40 in the previous example is changed to read: 40 PRINT 9*RND(0)~ To obtain random integer digits, t:he INT functi·on is used in conjunction with the RND function (using the same values for A and B above) as follows: When the program is run, the results will look as follows: RUN RANDOM NUMBERS 4 1 8 2 8 0 READY. 5 0 3 4 7 7 8 7 0 7 1 0 1 8 8 7 8 7 8 5 8 4 2 5 Notice that the range has changed to O<=n<:9. This is because the INT function returns the value of the neare:st integer not qreater than n. Tab Function (TAB(n» The TAB function allows the user to position the printing of characters anywhere on the teleprinter (or line printE!r) line. Print positions can be thought of as being nu.mbered from 1 to 72 across the console terminal line (1 to 80 across the line printer line) from left to right. The form of this function is: TAB(n) where the argument n represents the position (from 1 to the total number of spaces available) in which the next character will be typed. For example, TAB(3) causes the character to be printed at position 3. Each time the TAB function is used, positions are cOlmted from the beginning of the line, not from the current position of the printing head. For example, the following statement: 10 PRINT "X ='';TAB(3);,,/,t;3.14159 will print the slash on top of the equal sign, as shown below: RUN X ~ 3.14159 6-40 The following is an example of the sort of graph with BASIC using the TAB function: that can be drawn 30 FOR X=0 TO 15 STEP .5 40 PRINT TAB(30+15*SIN(X>*EXP(-.I*X»;,,*n 50 NEXT X RUN * * * * * * * * * * * * * * * '" * '" * * * * * * * ** ** * * PUT and GET Functions (PUT(x) , GET (x» Cassette BASIC provides two additional functions, PUT and GET, to increase input/output flexibility on the console terminal or line printer. Using these statements, the programmer can "PUT" an ASCII character on the current output device, or "GET" a character from the current input device. (ASCII character codes are listed in Appendix A.) GET is of the form: GET (x) where the argument x is a dummy variable which may be any value. GET (x) will be assigned the decimal value of the ASCII code of the next character input on the current input device. For example, if the following statement appears in a program: 10 LET L=GET(0) 6-41 and the next character input is an M, the variable L will be the value 77(decimal). assigned PUT is of the form: PUT (x) where the argument x represents either the decimal valuE! of the ASCII code of the character to be output, or the characte~r itself. For example, the statement: 15 L=PUT(GET(V» will wait for a character to be read from the current ir..put device and then print it on the current output device. A statement. such as: 30 PRINT PUT(Q) will print the character typed as well as the decimal value of the ASCII code for that character. (Since both the cha,racter and the decimal value are typed, PUT and GET statements should not be used with cassette files.) NOTE If the user is inputting characters from paper tape via the paper tape reader on an LT33 Teletype, he should be careful to position the tape on the first character to be input. O,therwise blank tape may be entered, which is interpreted as a "BREAK" and stops a ru.nning program. The PUT function can also be used to format output. For example, to print a trig table on the line prin'ter with a heading and 50 data lines per page, the form feed character (12 decimal) can be "PUT" to the printer as follows: 100 LPT 110 GOSUB 1000 120 GOSUB 500 125 REM - SET UP TRIG TABLE 130 FOR J=0 TO 360 STEP .5 140 LET L=L+l 150 LET B=J/180*3.14 160 PRINT J,SINCB),COSCB),TANCB),ATNCB) 165 REM - PRINT 50 ENTRIES IN TABLE 170 IF L=50 THEN GOSUB 500 180 NEXT J 190 GOSUB 1000 200 GOSUB 1000 210 STOP 500 REM - PRINT HEADER 505 GOSUB 1000 510 PRINT 520 PRINT 530 PRI NT "ANGLE" I "s I NE" I"COSI NE" ,"TANGENT" I "ARCTANGENT" 540 PRINT 550 RETURN 1000 REM - PRINT FORM FEEDS TO ADVANCE PAPER 1005 X=PUT(12) 1010 L=0 1020 RETURN 1030 END 6-42 The beginning of the line printer output. from this program follows. The first page of the table continues through an angle of 24.5 degrees: then the header and the next 50 entries are printed on the next page, and so on until the values have been output (in steps of .5) for all angles through 360 degrees. ANGLE SINE COSINE TANGENT ARCTANGENT o o .. 5 1 1,5 2 1 o 8.722112E-01 .~H 14435& ,02616368 .03488181 .9998479 8,722444E-03 .01144621 " 2.5 .0435972Q ,052317..1945 ,06101763 3 3.5 ~ e .0&CJ12117 .((11784194 .081111&7 ,09579131 ,\044757 ,1131461 .1218019 ,1304&04 .139103 8.5 .1~7735 4.5 5 5.5 & 6.§ ., 7.5 .QQQqb2 .CJ9&92~5 ,018bb164 .99&198b ,08144408 ,995400CJ .9945274 .9935184 .9925537 .9914535 ,CJ902779 ,989027 ,1050506 ,1138174 .1227211 .131585 ,1404&81 .1493741 8.722001E .. 03 ,017442&8 ,02&1607 .03481474 .0435835 ,052285&4 .0&097986 ,0&966486 .07833935 .08700204 ,095651&& .10428619 ,1129067 .lc15095 ,1300944 .118&6 .147c052 .4554&45 ,4038923 ,QQQ6511 ,02611261.& ,9993915 ,CJ9904CJ2 ,CJ98b30CJ .0523811b ,99813b7 ,0&1131S4 ,CJ975&65 ,0bCJ89125 l4.5 .03490305 ,043&3878 ,12I9&2]99J FNA' Function (DEF FNA(x» In some programs it may be necessary to execute the same mathematical formula in several different p).aces.. Cassette BASIC allows the programmer to define his own function in the BASIC language and then call this function in the same manner as the square root or a trig function is called. Only one such user-defined function may be included per program. The function is defined once at the beginning of the program before its first use, and consists of a DEF statement in combination with a 3-letter function name, the first two letters of which must be FN. The format of the DE]~ FNA statement is as follows: (line number) DEF FNA (:1{) =formula (x) The A in the FNA portion of the statement may be any letter. The argument (x) has no significance; it is strictly a dummy variable but must be the same on each side of the equal sign. The function itself can be defined in terms of numbers, several variables, other functions, or mathematical expressions. For example: 10 DEF FNA(X)=Xt2+3*X+4 or 6-43 20 DEF FNC(X)=SQR(X+4)+1 The function: 10 DEF FNLCS)=St2 will cause the later statement: 20 LET R=FNA(4)+1 to be evaluated as R=17. The user-defined function can be a function of only one variable. User-Coded Function (UUF) The user-coded function is explained in detail in the nE!xt section. 6.9 IMPLEMENTING A USER-CODED FUNCTION (UUF) A special user-coded function is available in Cassette EASIC for the programmer who is familiar with the PD]?-8 instruction set and 27-bit mantissa floating-point format. BASIC's internal format is 27-bit, sign-magni tude mantissa floating-poin't; thus, all user-generated values must be in that format and all coding must be compatible with it. The user codes the function in the PDP-8 series machine language instructions, assembles it with the PALe Assembler, and loads the resulting binary file as an overlay to one of the existing functions (ATAN, LOG, etc.) Thus, while BASIC is running, this special function can be requested and used in a fashion analogous to the built-in BASIC functions. The user-coded function, if present, is specified in the BASIC program as: UUF(n) where n can be any BASIC expression. 6.9.1 Coding Formats Due to memory restrictions, the user-codE!d function must replace one or more of the existing Cassette BASIC functions. Table 6-2 lists the functions which may be overlaid and the areas of memory they occupy. Also listed is the transfer table address through whi.:h BASIC calls the given extended function. 6-44 Table 6-2 Function 1\ddresses Function Locations Occupied FNA ATN 5453-5546 6200-6271 5412-5452 5350-5406 5547-5572 SQR RND TAB ~rransfer Table Address 1131 1134 1137 1143 1147 The functions SIN, COS, and TAN are intE!rdependent, but all three may be deleted as follows: SIN COS TAN 5600-5674 1132 1133 1144 Almost a full page is freed by deleting FNA t~he following: 1131 1137 1147 5412-5572 SQR TAB For each function replaced by the UUF, the user must set the corresponding transfer table location to point to an erJ:-or routine so that accidental calls to that function will generate an error condition rather than a spurious call to the UUF. The user does this by inserting a statement such as the following in his UU1": *1143 6441 IT t\BL~ ADDRSSS F'OH R\JI) IPOI\JT€R TO SY\JfAX ERROH HO'JTINE To include a user-coded function, all conventions required for the PALC Assembler must be observed. The coding language is PDP-8 machine language code, but can include instructions in 1:he modified floating-point package, which is described later in this chapter in section 6.10. When floating-point statements are to be included in the program, it is necessary only to indicate the start of floating-point notation by including the following operator: FENTER immediately before the first floating-point statement:. floating-point coding is terminated by the operator: Similarly FEXIT immediately after the last floating-point statement. ThE!re can be as many sections of floating-point code as necessary in thE! program, but each must be delimited in this manner. 6-45 6.9.2 Floating-Point Format The floating-point format used by Cassette BASIC allocates three storage words i.n sign magnitude convention as follows (in sign magni tude convent.ion the sign bit rather than the mantissa, expresses the sign of the entire number): WORD 1 111111111 WORD 2 '---v---J~ t WORD 3 ill] 1111111111111 [111111111111 --------~~~------------------~ EXPONENT MANTISSA SIGN BIT Five memory locations are accumulator, as follows: used to represent the floating-point Table 6-3 Floating-Point Accumulator Location Name Value ACS 0024 Sign ACE 0025 Exponent (200 octal biased: i.e. the constant 200 is added to the exponent to make the range 0-377) ACl 0020 High order word AC2 0017 Mid order word AC3 0016 Low order word Contents All of BASIC' s mathematical operations a.re in floating--point format: therefore, if any temporary storage loc:ations are required by the UUF subroutine, they must specify three words. For example: 6.9.3 Incorporating Subroutines with UUF' When adding a user function, it becomes necessary to reference some of Cassette BASIC's subroutines at specific: times in the coding. Most 6f these calls are needed in order to preserve a compatible format throughout the system. The BASIC subroutines which rna:, be referenced are described below. (The complete BASIC symbol table .is included as Table 6-7 at the end of this chapter.) 6-46 BEGFIX If a value is to be returned to the acc'l:lIllulator as a :resul t of the user function, that value must be in normalized floatinq-point format. If floating-point arithmetic is used throughout the user function, then the valuE~ in the FAC (floati.ng-point accumulator) is in normalized floating-point format and need not be c:onverted. If fixed-point arithmetic is used anywhere in the func::tion, then the subroutine BEGFIX must be referenced before the value (::loating-point) is saved in ordE~r that the storage loca.tions are propel::-ly initialized to accept a floating-point value. Usingr this procedure, the five FAC locations are prepared accordingly. However, because 1:he value to be stored only requires 12 bits, a subse:quent DCA AC3 statement is sufficient. BEGFIX is located at 3760 and is called via a JMS instruction. ANORM If a fixed-point value is added to the F'AC, ANORM normalizes the FAC in order that it be in a format suitable for Casse"tte BASIC. The routine supplies the acceptable values for the location!; ACE, ACS, ACI and AC2. ANORM is assigned the location 4600. FIX To convert a value in the FAC to an integer, as wh~~n printing character, the subroutine FIX is called; it is located at 4744. a 6.9.4 Writing the Program A user-coded function must res~t one of Cassette BASIC's tables to recognize the function, otherwise, UUF is cons ide l::-ed to be an undefined function. The pointer is at location 1150; a statement such as the following is required: * 1150 UUr Procedures for loading a user-coded function are contained in 6.11.5. Examples of user-coded functions follow. Section 6.9.5 Examples of User-Coded Functions Example l--This program calculates squares and square series of values.. The BASIC program is as follows: 100 FOR A=33.1 TO 33.9 STEP 110 PHI~T A,f]TJF{A),SQR{A) 120 NEXT A 130 END .1 6-47 roots for a The user-coded function is: PALC-Vl 12/27/72 PA~E 1 I I~SER-CODED FUNCTION TO ISQUARES OF NUMBERS CALC~LATE I 01134 4435 20100 0200 601001 000101 6441 1134 6441 011150 1 1 501 62010 916200 016201 016202 (162013 (~6204 (162015 0'62016 062017 016210 62001 01010101 4435 2204 6203 0101010 5600 000101 010100 0100101 010101 3010101 ITHE FUNCTION LOADS INTO FIELD 01 IINTO THE AREA OCC~PIED RY THE 'ATN' IFTJNCT ION FENTER=4435 FST=20010 FWD=200 FMP=6@001 FEXIT=0I00101 SXERR=6441 *1134 SXERR ISO REFERENCES TO ATN WILL IYIELD AN ERROR *11501 lJfJF IDEF I NE fJfJF IN F'JNCT I ON TABLE *6200 iJfjF, I~ FENTER IINTO FLT.PT.PKG.-A IS IN FAC FST+FWD+X-. ISAVE A FMP+FWD+X-. FEXIT JMP I rJTJF IALL DONE X, 1};0;0 FIELD *301001 ITO START BASIC WHEN LOADED $ P~\LC-Vl I FENTER FEXIT FMP FST FWD SXERR :f]F 4435 0101001 600101 X 62(~6 200101 02001 6441 6~"J0I The output after execution is: H;I~ 33.1 33.2 33.3 33. LI 33.5 33.6 33.7 33.R 33.9 10195.61 1102.24 1108.89 1115.56 1122.25 112R.96 1135.69 1 14~. 4L, 1149.21 5.75326 5.761944 5.770615 5.779273 5. '187 91 R 5.796551 5.R~517 S.R13777 5.R22371 READY. 6-48 12/27/72 PAGF. 1-1 Example 2--The following program tests a student's ability to convert the octal value in the console switches to its decimal equivalent. Line 120 will set P equal to the decimal value of the setting. Line 130 determines if the correct answer wa,s typed: 100 PRINT '''WHAT DF.:CIMAL VAUJE DO 11 0 T~E S'JJITCHI<:S E0 i UIL?" I ~p rJT \J 120 LET P=fJiJF(0) 130 IF P=N THEN ?00 140 PRINT "TRY AGAIN" 150 GO TO 100 200 PHINT "'CORRECT" 300 END The user-coded function is: PALC-Vl 1~/2117~ PAllE I I IIJSER-CODED I'IJ'\ICT I ON TO READ THE CONSULE IS~ITCHES AND CU~VERT TO FLOATING POINT I ITHF: I"J:'-JCT I ON LOADS I "JTO l'I ELD lEBO 11 NTO THE AREA PREV I OIISLY OCCIIP IE: 0 BY ITHE • RND' I'IJNCT IO"'J-T'IE HANDOM ,\J:IMREH IliENERATOR I 0000 4435 0000 4000 2000 Pl200 3160 4600 0016 6441 1'1ELD 0 I'ENTER=4435 I'EXIT=~A~0 F'tID=400et I'ST=2000 nm=?0et REll1'1X=3160 ANOHM=4600 AC3=16 SXERR=644 ~ 01143 1143 6441 * 1143 SXERR 01150 1150 5350 *1150 lJIII' 'JlJI' , A 0HHH~ 05351 4156 JMS I (?J5352 7604 LAS 05353 3016 DCA 05354 05355 05356 05351 4151 5150 3760 00~1 3000 IDEI'INE 'JIll' IN I'IINCTION TARLE *5350 5350 0535~ 46~0 ISO REFERENCES ro H.\lO IWILL YIELD AN EHHOH 'JRElll'IX IPHEPARE FOR II"-.JTEGER VALJE IGET CONrE'\JTS 101' Sill • HEG. ISAVE IN LUW AC3 10RDER I'/\C IJANOlm /NOHMAL I ;:E IHET,JRN :1'11' JMS I JMP I '}BEGI' I X, BEllI' I X 'J/\NORM, ANOHM FIELD 1 ITO STAHT 'JP RASIC wHEN LOADED *3000 $ PALC-Vl 0016 AC3 ANORM 460~ BEGl'IX 37M 4000 FAD I'ENTF;R 4435 FEXIT 0000 201'J0 FST 0?00 FWD SXERR 6441 'JANOHM 5351 ']REG I' I 5356 5350 'JIJr 6-49 1~/21172 PAll!-: 1-1 An example of a run switches follows: in which 200 (oct.al) was set in the console RfJN WHAT DECIMAL VALUE DO THE SWITCHES EQUAL? 1120 TRY AGAIN WHAT DECIMAL VAL'JE DO THE SWITCHES EQrJAL? 1128 CORRECT READY. 6.10 FLOATING-POINT PACKAGE Information concerning the PDP-8 modifi.ed Floating-Point Package which the programmer will find useful in codi.ng a function follows. 6.10.1 Instruction Set The legal instructions in the modified Floating-Point Package used Cassette BASIC are explained in Table 6-4: Table 6-4 Floating-Point Instructions Meaning Instruction Value FST 2000 FLD :3000 FAD FSB 4000 5000 FMP 6000 FDV FJMP FENTER FEXIT 7000 1000 4435 10000 FWD 0200 BKWD 0600 FSNE FSEQ FSGE FSLT FSGT FSLE 0040 0050 0100 0110 0140 0150 Store the contents of the floating accumulator (Fl~C). The conten·t:s of the FAC are not: changed. Load FAC with contents of relative address. Add contents of relative address to FAC. Subtract contents of relative address from FAC. Multiply the contents of the FAC by the contents of the relative address. Divide FAC by contents of relative address. Floating-point ~,ump to relative address. Start floating-point code. Exit floating-point code. Return to PDP-8 code. Access a relative location in the forward direction. Access a relative location in the backward direction. Skip if FAC <> () Skip if FAC = 0 Skip if FAC => () Skip if FAC <0 Skip if FAC >0 Skip if FAC <= () 6-50 by The following instructions require indirect (and relative) addressing and therefore only address field 1. Their operation is the same as the corresponding direct instruction. Table 6-5 Relative Addresses Instruction Value Operation FSTI FLDI FAD I FSBI FMPI FDVI FJMPI 2400 3400 4400 5400 6400 7400 1400 Store Load Add Subtract Multiply Divide Jump 6.10.2 Addressing The Floating-Point Package uses relative addressin;J. Thus, all statements that address a location must include one of the operators FWD or BKWD plus a reference to the current location. Such a reference is generally in the form: op code instruction + FWD (BKWD) + LTEMP-. The operator FtoJD is used when the address of the location to be referenced is numerically greater than the current a:ldressj BKWD is used when the address of the location to be referenced is numerically less than the current address. LTEMP··. in conjunction with the FWD or BKWD operator defines the relative address of the location to be operated on (LTEMP) with respect to the current location. This relative displacement is then used by the Floating-Point Interpreter to access the contents of the three words at LTEMP. This can best be seen in an example: 4010 FAD+FHD+LTEMP-. The contents of that location which is (4063-4010) locations forward from the current address, (i.e. the contents of LTEMP) , are added to the FAC. Similarly: 152 FMP+BKWD+. -ALOe At line 152 the contents of FAC are mu11:iplied by the contents of the location that is (152-146) locations backward from the current address. 6-51 6.11 EDITING AND CONTROL COMMANDS Errors made while typing at the console: keyboard are ea.sily corrected. BASIC provides special commands to faci.litate the editing procedure. 6.11.1 Erasing Characters and Lines (SHIFT/O" RUBOUTS, NO RUBOUTS, J!~TMODE) There are two methods available for eralsing a charactel:' or series of characters one at a time. Typing a SHIFT/O causes the deletion of the last character typed and echoes as a back arrow (+) on the LT33 (or 35) Teletype, or as an underscore (-) on most other console terminals. One character is deleted ealch time the key is typed. The RUBOUT key (or DELETE key on some t~erminals) may also be used deletion of characters one at a time providing the command: for RUBOUTS has been typed on the keyboard before the editing is done. This command enables the RUBOUT key to be used and must be typed each time a new program is in memory. If the use!r has neglected to type this command, he may not use the RUBOUT key. A later command 'of: NO RUl30UTS disables the key for use. For example: 10 LEE .. r A=10*B The user types a B instead of T and immediately noticeEJ the mistake. He may type SHIFT/O (or RUBOUT key, if enabled) once ·to delete the B, (and as many times more as characters, including spacl~s , are to be deleted). After the correction is made, he may continue typing the line. The typed line enters the comput~er only when thl~ RETURN key is pressed. Before that time. any number of correction:; can be made to the line. When the RETURN key is typed, the line is input as: Notice that spaces, as well as printin9 characters, may be erased. The user may era.se an entire line (provided the RETURN key has not been typed) by typing the ALTMODE key (ESCAPE key on ,some keyboards). BASIC echos back: 6-52 DELETED at the end of the line to indicate that t:he line has been removed. The user continues as though it were a new line. If ·the RETURN key has already been typed, the user may still correct the line by simply typing the line number and retyping the line correctly. He may delete the line by typing the RETURN key immediately after the line number, thus removing both the line number and line from his pro:Jram. If the line number of a line not needing correction is accidentlally typed, the SHIFT/O or RUBOUT key may be used to delete the number(s) ; the user may than type in the correct numbers. Assume t:~e line: 10 IF A>5 GOTO 230 is correct. types: The programmer intends to insert a line 15, but instead 10 LET He notices the mistake and makes the correction as follm.,s: 10 LET~~~~~5 LET X=Z-3 Line 10 ·remains unchanged, and line 15 is entered. Following an attempt to run a program, error messages may be output on the console terminal indicating illeqal characters or formats, or other user errors in the program. Mos t ,arrors can be corrected by typing the line number (s) and correc·tion (s) and then rerunning the program. As many changes or corrections as desired may be made before runs. 6.11.2 Listing a Program (LIST, LIST and LPT) An indirect program or data can be listed on the active output by typing the command: device LIST followed by the RETURN key. listed. The entire program (or data) will be A part of a program may be listed by typing LIST followe~d by a line number. This causes that line and all following lines in the program to be listed. For example: LIST 100 will list line 100 and all remaining lines in the program. 6-53 The LIST command may be used in conjunction with the follows: 1,PT command as This will list the current program on the line printer. Control reset to the console terminal after the listing is completed. is LPT LIST 6.11.3 Running a. Program (RUN, RUN and LPT) After a BASIC program has been typed and. is in memory, i t is ready be run. This is accomplished by simply typing the command: to RUN followed by the RETURN key. The program will begin execution. If errors are encountered, appropriate «~rror messages will be typed on the keyboard; otherwise, the program will run to completion, printing whatever output was requested. When the END statement is reached, BASIC stops execution and prints: READY. The line printer, if available, can be used in RUN command, as follows: conjunction with the LPT RUN After this command is issued, all output: during program execution is di verted from the console terminal to the line print'~r, eliminating the need of inserting the LPT statement within the program. The output device is reset to the console tE~rminal after ex,~cution. 6.11.4 Stopping a Run (CTRL/C, CTRL/O, CTRL/SHIFT/P, BRE;AK) To stop a program during execution or to return to the Keyboard Moni tor at any time, type a CTRL/C (by pressing the CTRC, key and the C key simultaneously). This causes the current operation to be aborted immediately and the Cassette Keyboard Monitor to be :re-bootstrapped from the System Cassette. The cormnand CTRL/O (produced by typing the CTRL and 0 keys simultaneously) is used to stop teleprinter output temporarily. The program will con1:inue to execute but out.put will not be printed unless an error occurs or unless BASIC is wai.ting for a comma.nd or for data from an input sta.tement. In the latter case, the console terminal is the expected input device. This feat.ure is particularly useful for programs that print lengthy introductions and then request a user-specified parameter. Typing CTRL/O after the proqram is started will cause BASIC to bypass printing the introduction and wait until 6-54 the parameter is specified, thereby savi.ng the time required to print the message. A second CTRL/O will resume output. NOTE For most programs that do not wait for input from the terminal, processing of the program after an initi.al CTRL/O will be completed before a second CTRL/O can be typed. Thus, it is vel~ possible for no output to be printed rather than the anticipated partial output. Certain terminals (such as Teletype models LT33 and 35) are equipped with a BREAK key which may be used in Cassette BASIC to interrupt program execution. Pressing the BREAK kE!y causes a halt in execution and a return to the BASIC Editor for mOrE! commands. For those systems containing terminals not equipped with the BREAK feature, the same result can be produced by pressing the CTRL, SHIrT, and P keys simultaneously. 6.11.5 Loading a User-Coded Function A user-coded function is created using the CAPS-8 EDITOR; it is assembled using PALC. The resulting binary file is loaded with BASIC using the Monitor Run or Load commands as follows: .R BASIC, drive #::Eilename or .L BASIC, drive #::Eilename Assume a user-coded function called UUF.BIN is stored on cassette drive 3. Assume also that the file UUF.BIN has been coded so as to include the correct starting address for BASIC. The user runs BASIC loading the function as follows: .R. BASIC,UUF The starting address for BASIC is included in the program and coded as follows: r~ I ELD *31.100 $ The new function may now be used in any files the user \o.i'ishes to and run. 6.11.6 Erasing a Program in Memory (SCRA'TCH) The command: SCRATCH 6-55 edit or SCR is provided to allow the programmer to clear his storage area, deleting any commands or a program which may have been previously entered, and leaving a clean area in which to work. If the storage area is not cleared before entering a new program, lines from previous programs may be executed along with tht:! new program, causing errors or misinformation. The SCRATCH command eliminates all old statements and numbers and should be used before any new programs are read into memory or created at the keyboard. Note that the SCR command does not clear the program name. If the user wishes to create a new program wi 1:h a new name, he should use the NEW cormnand which also performs a SCRA~~CH. 6.11.7 Renaming a Program (NAME) The user may change the name of the program in memory by command: issuing the NAME BASIC responds by asking: PROGHA~1 NEW NAME- The user specifies a new filename (and extension, if desired). This changes the name of the program without. affecting its image in memory. All subsequent references to the progra.m must use this new name. 6.11.8 Saving cl Program (SAVE) Once the user has created or edited a program, he may ~lant to save the new version on a cassette for later use. He does this by typing: SAVE BASIC asks: U~IT #(0-7): to which the user responds with the number of the cassette drive on which he wishes the program to be stored. The program is saved under its current name--that is, the name used in BASIC's initial dialogue, or its new name if the NAME command has been used to change it. (If the filename is the same as one already present on the cassette, the old file is replaced by *EMPTY in the directory and the new file is 6-56 written onto the cassette.) After the program has been still in memory and may be RUN or edited further. saved, it is Attempting to save a program on a full c::assette causes BASIC to return to the editing phase; the user must save the program on another cassette. If the user does not specify a name for his program in the initial dialogue (by responding with an AL~~ MODE to the NEW PROGRAM NAME request), the program will be saved under the assigned name NONAME.BAS. If the user SCRATCHes a program, creates another program without assigning a name to it by use of the NEW or NAME commands, and then attempts to save it, it will be saved lmder the name of the last program which was in memory, possibly deleting that program if saved on the same drive. 6.12 CASSETTE BASIC ERROR MESSAGES BASIC checks all commands before executing them. If for some reason it cannot execute a command, BASIC indicates this by typing one of the following error messages and the number of the line in which the error occured. The form is: ERROR MESSAGE AT :LINE XXXX Table 6-6 lists execution. the errors BASIC chlecks for and reports before Table 6-6 Cassette BASIC Error Messages .Meaning Message ARGUMENT ERROR A function has been argument; for example: CHAIN ERROR A cassette error occurred while doing program chaining; the user should not attempt to run the program in memory again. DATA ERROR There were no more items in the data list. EOF ERROR An attempt was made to read past the end-of-file during run-t:ime input. Program execution terminates and control returns to the Keyboard Monitor. EXPRESSION ERROR One of BASIC's internal lists overflowed to E~valuate an while attempting expression. FILE NAME ERROR A mistake or illegal character was found in the user's specification of a cassette drive # or file name in either a CHAIN or an OPEN statement. 6-57 given an SQR(-l) illegal Table 6-6 Cassette BASIC Error Messages (Cont'd) Message l-1eaning FILE OPEN ERROR The user attempted to open a run-time output fi Ie when one was alre,:ldy open, or a hardware error occurred. FOR ERROR FOR loops were nested too deeply. FUNCTION ERROR The user attempted to call which had not been defined. GOSUB ERROR Subroutines were nested too I 0 ERROR The user attempted to do run··time input and output to the same casBette at the same time. IN ERROR A cassette error occurred whilE~ attempting a function de~~ply. to carry out an OLD command or while doing run-time input. LINE TOO LONG A line of more than 80 characters was entered; BASIC ignores the whole line and waits for the user to enter a new line. LINE # ERROR A GOTO, GOSUB, or nonexistent line. LOOKUP ERROR BA..SIC could not find a run-time input file on the drive specified. NEXT ERROR FOR and NEXT statements were not paired. NO FILES ERROR The user attempted to do run-time file I/O wi thout first specifying so dUI'ing BASIC's initial dialogue. OUT ERROR An error (probably end-of-tape) occurred while doing cassette output either during a SAVE or during run-time outpu.t. If the error occurred during a SAvE, the user should retry the SAVE to a. different cassette. If the error occurred during run-time output, he should re-run his program using a different cassette for output. RETURN ERROR A RETURN statem.~nt was issued under control of a GOSUB. SUBSCRIPT ERROR A subscript has been used which is outside the bounds defined in the DIM statement. 6-58 IF referenced a properly when not Table 6-6 Cassette BASIC Error Messages (Cont'd) Message Heaning SYNTAX ERROR A command did not correspond to the language syn1:ax. Common examples of syntax errors are misspelled commands, unmatched parentheses, and other typographical errors. Reference to an undefined UUF will also produce this diagnostic. TOO BIG, LINE IGNORED The combination of program size and number of variables exceeds the capacity of the computer. Reducing one or the other may help. Otherwise, the user must break his program into parts and chain them together. A large number of DATA statements might be put into a run-time input file. The following programming errors are not reported by Cassette BASIC, but instead are used in the computation as specified. They are included here for the programmer's reference. 1. Attempting to use a number in .::I. computation which is too large for BASIC to handle will produce a result which is meaningless. 2. Attempting to use a number in a computation which is too small for BASIC to handle will result in the value zero being used instead. 3. Attempt.ing to divide by zero will produce a result which is mean.ingless. 6.13 CASSETTE BASIC SYMBOL TABLE Table 6-7 lists the Cassette BASIC symbols and their values. This information is useful when writing user-coded functions. 6-59 Table 6-7 Cassette BASIC Symbol Table IPI)P-81f: CASSf:.TTE DASIC PAI.8-V8 AHCLJEF 1763 CliJSF: AHS ACE. b4d5 LLO:;EO 11 7 rt: ~~"25 l;MSwCH V'17b AC~J 4417 C~t\MST r~452 AC f, ACl AC? ~~24 CtJCLI'< 01.41 15 rA 2 ~71 CNt.R~ Vl5~1 V1 r~ 1 7 V"J01 b CNTFNn 7 06~:' (,. ~~ r L0 71.4rJi7 li~71 L~~ 1 LOZ V1134 AC~ A[Hi h> ES ALGr-LP tH.lhb ALLOC 146~ 314 ~, ALL3 ALTMOO 2~ht 4~S4 ALl AMATCH 6'50-' 12/27/72 DVI_OOP ';)245 h40~j fALl ~61.4tl CTklCK CTt-:ZI1P l..VILLlO r;, t 1 ~ FA'rNAX b2"' ~ \·'~"52 ') VJ?' c' fArNC 6.s:.s7 1 At K th7~ f- A'r f\;CJ h34~ FATNCl 6304 FArNC2 b3~7 FATNC3 b31? IT 6731 E Cl"i () 70C'3 EOIT 241(1 EI'.iIJ 2400 E~I)LIN 57102 E1\I)NM 733? EH)NUM 3321 EI\I)POL S743 6404 F. f'.-r E R EOFAO 4526 E(;F~TN 6650 E fJ'r R 0060 ERI~OR 4136 Ev ,~L 1000 E. \J '~L G0 10~14 EXI:'CUT 0213 EXIT 2'u~7 C/\(10 AhGERR 7;;~7 AR~L(1C w~~: _~ LOI"iE u~ ~~2~ AI-'l 44(7,2 LOS "f:lh L (l.~ T '"' R 1 "J 1 )( 7143 Exp bV'l0V'1 tXPGno ';)?42 4hkll?) ASKAGI'I 11.5':1 ~vH'~ E:.xPL("lN 5764 6 2v;~) ATi" ATf-.-,HIG 6265 AT~LOl·J 6220 L.~LF h531 Ex flUK ~2b5 l..RLFU 13257 LF<'LF-I-I~ b? _",7 CTI-\LC '1't ATI\~,PT P-A(JCHN 7 ~~ b 4 R~ f.\I-'Ol1.! k:'!7..,1J l..T!-iLCJ 7604 LT .... LZI f,6~t! fx'rLOC 0?~4 FAI) "vH:~ eI FAOEXT 1314 FAD! 4 4 ~:H1 t~t" w0 S l.4 '; ~~ 2 ~TLINf: Rf.l~~rX b4':l1 .3 7 b r" r'''l> LJ hHful< (;1 f:, r,1 ~, ~Sj(IP 27 y:, 6"2" FEXPF 6067 6061 FEXPU 6064 FHER 511 7 FILALT 0367 FILNAM 0600 FILt\JR 1356 FILl 0606 FINDIT 0560 FINOLU 056b fIOER 7135 fIx 4744 FIXEXI 4773 FIXITLJ 5200 f-IXLIN 2135 FIXLUP 4750 FIXUP 5143 FJMP U1~0 14QlV1 FJMPI F JUMP' 1130 FLU 3Vl~0 FLU! 3400 FLOGCl 6172 FLOGC2 6153 FLOGC3 615b FLOGC4 6161 FMP 61tH~rll fMPT 64V'1~ FMTENF 5121 I-MT1 '5123 FMT2 'le1S1 FMT3 5126 FN '5453 FNE~R 5172 I)IA, I~ 1301 CouELO V10V"4 CC'LUMN c;,13", LOi'i CK ??77 l..()I"IMAS 617:; LOI"1r-:UN 3377 (. (h"o/\( 1 123 COI\i!H 13b7 ANC1~M PAGE 51 i} A ~'!vl~~ FATNCH 6342 UFlfxP (1043 u[CFRA ~:S43 ur:t~f:~ VJ 5 3~; FEXPI F's ... 7 \.3 \('? KliFf;NO h?0~ HlJF5T b \~ V-' ~~ lin- 1~75 FATNC~ 631'1 FNE)(IT 12~((1 rAi"I 1~~\ L·FLETE "'~~1 lJrVCOl"i 1354 ~; I I.J I hi 3i!'21 Ult..dNl 't:?~ u.TLJIT 517b L./ 1 bl. UP ~'~5 7 FATNCS b~~(.1 F"ATNCb 63~3 FOR FORCT FOROON FORERR FORLIM FORLIS FORSTE FORVAR FOUNt) FPAOO 0415 9J065 0663 0':)03 0721 5744 0'724 r: AP;';' E T 2~blJ CASP\) hbl.:J CAS [j U T 6 I;;';!' CC/\;TR ~1~4 ~ CGtT bb':ll CHAlN -f !,~.3 , CI1A"':Nt ,~1V' ~ 1 (I-" tol-.'r.',,- (()~4 , CrtCKIN 23'14 .J Tf'1 f..~7tJ. L, I i'l F- L A "Alii 34 LIVLP 4/05 01V~Tt ~3U1 h J ,/IV', U 01 T ~4 U t2a., 3S~? UrliJ[N .3 ~'1 C .5 C ~-1 "JI·' S .5 ~ 65 ChRr:ET o iJ 1 I Cl'> hf< AI<. ,-<SIJ4 CKCTRL 4 1 Il~ UOI\( S \<J PII.P.) Vl b 5v: r~" f- 11 C h~: hi f.i C to r-: r; r U(l:'CRT 3Vl1.&2 UClfZER t,57b uPrL~(, "~34? U(.'i 1 '1~~2 r'- b? '.:l r:LE:A~V 24b'-l r! T x 'JOU nT r. r:L~v ~1~l'~ li I-' I 1 1-,6"'7 CLOS ~l '(15f-· -':'1.:'1 I C~ 7 y~ I FAlNC7 6326 FA"rNC~ 6331 FA'rNCg 6334 FATNS)( 62/2 FA'rNT f-.21b FA'r!'IlTT b301 FU:rGIT 3335 FDV Fe) \11 Ft.~JTE:~ 7 0~:H~ 7400 4435 rt746 Ft ~n< f- t:.)( I T ei ~ 1I.1 ~) F l:)( PC 1 6k172 Fl:.l(PC2 607') rt )(f-lC3 b 1 ~j0 6-60 Fi:-. )(j-lC1.4 b 1 k.' 3 Ft \(PC~ Fr.l(I-'Cb b 111 61~1, F~Anl)R FPOlv fPOOIT FPFLAG FPGOTO FPJMP ":-PJur1P FPLAC FPLOOP fPMUL ~454 ~57b 4456 '1"~ 014 4661 4237 ?llS4 4273 4317 4214 4351 42(112 1.453V1 Table 6-7 Cassette BASIC Symbol Table (Cant 'd) /POP-8/E CASSETTE BASIC FPNOAD FPOPEw FPPGl FPSKIP FPSTO FPSUB FPT PALB .. V8 427~ GETOPR 1~12 4305 4227 4314 4322 ~fTuNI ~240 t.+4~3 42~v1 FPTE.MP 457~ FPT~ QJ0bl FPZ01V ~n .$6 Ff.>INP 1243 FRINP1 12b1 FRr-.JDX 5tl04 FROUT 13(?\? GETVAR el303 GE fl~ D ~177 bLum") 2711 GNt.XT V'lbel7 GObOTH 0534 ('OLI5T 5764 t"n5UB bOTSTE ~b34 '-'OUT 0(t1,;:)0 bfJff< FSf.f: v.J'0~ l1Rd FSGT F5INC1 1i'14~ (j~lJELA 7244 vH-j6d 7?23 7??1 ';:) 7 1 ~~ GSdEND 'i777 LtSdPTi-i (il163 GSSl 1555 GSS2 lS~b bToKlP 1722 rSINC~ ,;:)124 F S PJC I 573? ~Tt:.MfJ TJ ~1P 0442 GTJ",Pl 0~20 I.JTPTR 003b rlAf 0~37 HALF C1I451 HIGHwO 4333 HLOOP ?b77 2; 31 ""LO~l HLP 4163 FsTI 24ft1 0 ""J...lr~ FTANT1 FTt-NT2 FU~,jT AB FUPRCl F v. f) 5677 F'Xxf>FX GALT r.UJMi? fit T GE:TAf)D GtTbLK r;r T CH 5" b? v12C~ blll(l3 HNtJL~ JEt"<iol 2~V1? GtTL.~t ?,t)jl IF 410~ I SIT 1 4422 I5L1T ~127 ISSDMl:. 1643 ISU,"1IN 1010 ITSDE~ 3513 ITS(')P .$217 ITSl:. 32~3 ITSUP 1220 ITSP 3270 IUNIT 6660 JtlPtNT 37rt7 JISDIG 3344 JMATtH 277ft JPUTCH Vl763 JUST0 3142 JuST0F 3152 Jl.JST0P 31:>') 3137 JUST1 JlJST2 3141 KbUIN 0421 KHI>INP 762b t< ~ Uf E r~ b762 KbUt-ST b137 bbh3 1Ft 04~3 If;l\lOk'E ? 13 'f Gf:.TLIN ISITLI h~00 v1 (-1 ~i 1 ~573 ISI'TFU U es "":163 lA~lLES 21?3 ..L A1\lno f.,76lJ .l.AJ 1251 .I.C~5E:.P 5157 lrUUNl "'un2 11:.(TL.C 0235 Gr. T C!-ik iti" 12 Gt:.TCio( 0712 GtT1l 0f?7r:; 11~r:; r,ETJ ISlJIG l.;I 7lJ4? 1557 1 4 ,>. ~I\ 1 ., C:' l1 , ?(W ~551 10~aM IOUN1T IPNOPE ISOI:'F2 727v) F S It\JM4 5735 FSli\JOK 5h57 FSlf'-lZ ~ 7 Li)') F S r r~ Z Z 5 "/1 ~ FSIN10 '=>b41 ~, 1 5 V) F5Lt:FSlf 01 1 V1 F S~jf.. f?\~) ~ 0 FSQ .... X 5407 2~0~ FST ':t" 02 11 j 1 ISITDF ll\iSERT l.?OTITl 7210 (1~? 1 G010 6010P~ 1202 l"OlSS 1~; 71 ,;:)0~0. FSINr.6 '::J"' (: 7 ISOIM 1 S I 'r 4007 7316 2027 2025 6434 4136 0227 1301 4024 3511 6532 1472 4564 IN~H(T5 5400 5716 ~272 INPUT It-..T Ir-.wDTM 21tH ~7(il INP'rN 72~7 '-'01 IT FSB FSHI FSEO FsI~C4 0434 4034 4076 0553 (;(llEt--1P C"V,55 f-!-<~TNE FSI/l.IC3 II\;LOOP INLLJPF INPLUP INPPTR INPSET I~PLJTN ~507 12/27/72 ('1372 I(EPTR (£;(1)77 Kf,Yv.U ~231 Klt;NOR 1b7b lMMEL) 115~ 1~1Mr:DA KM2vl0 0(1)12 .P~ 115S 343(11 KMLW04 l~JCHN " 40.3 KI;HH1~ 2170 2167 H~LJ r. v l"-liJF'tl HiLH-:x2 J. [\ILClM fJ, 131 (,)~, 117105 Kb201 LAStk'1-< 6612 LtH: t; I N 5622 LtRR 335~ 14 ~W15 4~17 7 6-61 PAGE 51-1 LET 0304 LETDO 0205 \..ETTER 3445 \..Fx\..UP 2331 \..HA\..f 30&7 LIMIT 1600 LINBUF 5551 \..INENO 0054 LINFIX 2326 3600 LIST LISTAL 3610 LIST\..U 3612 L15T50 3611 L1ST2 3636 LIST3 3655 LIST4 3661 LISTS 3676 LITRAL 3123 LJMS 7255 LKER 1312 LKERR ~~30 LLSOUT 7400 LNOEND 3626 LC1ADtD 4123 LOCCTR 0045 LOCTEM 0671 LCCTMP 1671 LeG 6114 LCGACE 6165 LCGFwD 6164 LC'GOK W 6167 Ql3Ql6 LOOK LOOKER 7310 LOOKUP 7002 L(iWLOC 2166 LFTOUT 7347 LLiKERR 0326 LLiNIT 0332 LLiP 34f.14 LUPF '1430 L l~ LUP 3b64 M ~\ YZER 4612 MEIRE AK 7b05 M[NDLI 0e141 MENDPD 2361 M(iOL IS 0720 M(;SHEN 0527 M::NUS 1316 Ml.BEGI 0171 Ml.END vH 72 Ml.IN~U 0'140 Mr~ SON E 0736 MONITR 0100 MORElJI 647~ MOREIN 4[(1()j0 Table 6-7 Cassette BASIC Symbol Table IPUP-81E:. LA~;5I:TTE f~ASIC PAl.b-v8 12/27/72 MrJ ki fRO 1620 N(jTHE.R ov 0~13 I"1(lVt. c!. (J ~-I 7 NOll(lfiU (}I3t'\5 01;1 NO T r"IOW 1776 010V,Vj 3271 01 1 01 :l0 21 7 1 3547 0506 ,.,iClVLUP 212t: MF~INT ~) v.l c::5 MPY ':i~?1 MpvLUP Li')5? MrJ A r·1UL 1C,~1 hU r 5(;;('1 ~437 NOlrxT ;>236 NOTVAk' 1 1 "'? N(lTX1V1 ~23h N(l r YI:: T h71J1 Nf-..,YMTA v1~53 o1 t~ o 1 t~2 It.J21 MSlbf-l 4~.s3 t"ll x'( 1 T 5173 MUlCLk' 4.,11 MUlfo:XfJ 3367 I\IIIL J M 1201/1 01 jr ULx Tt. .33 .. 0 1\ U 1'1 f."\ l) F 5335 01llJ~ NlJl":Cr~K C1172b ~1 M lJ LX 1 33/1 MLiSTRE 4""'6 l'~lc.;HAN r~ r t- ~!D OL5 o 1 ,~ n 1 LH~ A 1 e2~' 1 , c; ~ ~J A til ~n22 I\iAMCHK 0fo1~1 I\JIi,UlMS 3124 LHCO 4435 Vr,AS~Foi 257q ~aMf 1037 (.lee o 1 t~0H 5205 23'::17 ft:i1261 2772 15b2 ~35b ~-'62 2745 5144 3352 01 i' 7 [} 1 j' I ~ ~027 02 02 ~, ~H1b4 oi' ~)[,,, l{j153 02C'1J0A 3353 1151 "I A MI:: ~ ~H~32 UCLJUNT NA~1L OC id216 uEt-.'P UIP "1 Ii 1 7~~ 1 021.~ 335'?J 5344 0175 uJl.JMtJ 0215 ~174 (J 2~) Oc: "1 3 1366 3"17t1 I\iCTI-ILl b72S ~761 o c1~' 6 2 NF ~.! 10lJ7 I\;t it.JCHA 2h2? ULv 127b 1057 I\i t ~'JI i 0 U L l) I) (J 10~t? lilliI'!: U; ULtJMtS ;> (~~ 3 02£11{} 0~"1 11 11 02 i3 ULLH1P [.Jl ~17 02~i5 OLIJ~ 11171 VI (.11147 02~)~B 5145 511J6 5153 b575 U"It:.lll M nH,l O~6k1 0~12 u"'tSs 1~73 02 j' UH.• v 1 3.312 3345 5147 LJ07b00 'i4~2 03v'" 1 01:'2 l\;E:.wLIN 2fo1(i'6 Nt: ~"r<1E. S 11 U" ~·~O';J I\;I:XT ~H:. ~ T t R N~~rG ~'b / 3 2757 1\;1:.)' T v A ~HI.3 7 N~Mt.S 051<' 7 N~CiPEN b3b5 Nt-i1 1~43 LJ "II:. '" NQRLIMP 1J633 00/736 2324 ~UCHNG UPi.JONE f'J(len!'''' OI-'l:. 3C)4V.l 6l -/6 t-.i(.IC'OMM v1 327 NOC~ 4G'15h Nn"II:;L~ 3104 N[J~JZER 5~14 NnPARE 1032 NClPC~ 2~20 1 31 4 f"OPE N(1RLFT b423 NORMf-:lJ 522vl I\IORMIT 52"-'7 NORUHO 5574 t-- ()SS1 1457 NO~S2 1452 NOT 3~26 NOTbAD 2153 Nort-'IG 4620 ,..JUTCR 3~23 NOTEM 6~26 t-.iOTFUL 6712 1 L 02~i6A o3l~ 2771 1152 03i'37b 0776 0~i'55 1273 031' 7 ~0/3 04 0156 2777 OiH' a 4~!14 1153 04 ;:~ 31Vj3 04f~0fc:l 3102 04c~13 1154 05tl(.10 5347 0046 06~~03 01 0074 o7 ~HlJ 1272 OHH1G1A 2565 07~H~0B 3473 07~n 7 1275 o 1 ~)20 5150 07~i45 4777 (JPtN ~575 (JPtN1 12C11~ UPt:.RAN 0075 OprljERk ~115 036 031'34 1203 0030 1354 uPUTAB 7016 UPS IM'l26 uPuT(; 7147 UPl Vl0?3 OPd 0022 (JP3 0021 (JTt.MP 1271 UTEMPI 7012 UTHER 3000 UUNIT 6760 OUPSET 1Vl26 OUll>EV (71133 OUrD2 ""132 UUTNUM 5f!.100 uUrOK 1332 6-62 (Cont I d)_ O/~i7eJ b456 07~)77 4577 PAGE 51-2 07600 07603 07610 076i~0A 4.345 2774 5345 0754 2765 33Q!6 0140 2610 6544 3472 2775 3075 3346 3116 '1056 3743 4743 01f,0 3101 2325 0761 3 ~17 b 1274 3077 3351 5151 0057 5152 51'i4 5346 1561 3547 4742 U76408 07b73 077 07700 (J77'?J6A U770bC 07715 07725A 077258 07737 07740 07741 07143 07745 07153 017b2 07763A 077b3H 07764A 07764A 07764C 07766 07770 07771 07772 07773 U7774 07"176 PACN PAD 0~47 PADDON ~741 PAK8UF 0763 PAL1 0146 PANO~M 0144 PA~GER 0fc:l47 PARI 0145 PAsseR 0474 PBAR~O 2773 PBEGFI 1773 PCCUNT 0744 PCHKFI 0161 PCLOS 0143 PCOMMA 0273 PCQwT 0137 0036 PDL. PDLIST 5703 PEDIT 0122 PENON 0271 PENDNM 0365 PERMS\' 5111 PERROR 0101 Table 6-7 Cassette BASIC Symbol Table (Cont'dl IPPF-8/E: CAsSt:TTf f~ A S rc PALb-VA PH~~w ~, I L.l1 PPl()(fO 1.162 PlhL.lc.1 "" .... VAL vJ1 v., ~ (,11 ~i 5 PIo(c.~~T l'JI:RROF< 1':) 7 1 ?,315 Pt-).'p F 1"1 f\d,) I p ~ 1X 1£1612 PKt.St.:.T 1i113h P!-! 1 t" i) L ~3ri12 t-IR i "ICn ?30b v) 1 1 ~~ PI<' P~NE[..lR 554b pp 11\' H A 226~) ~F~.'L(JO 451~ P('E.TAf) ~H.,4 P (~E:. Tt3 L 011 7 PR 1 ~\jr)U PR 1 ~J SE PPJN'T p l~ t, T C t.. t-iRINTC f?2C'J7 ~r).I:CU ':,,776 ~tJ.s2 pr,ETLI ¥) 1 e 6 P (, tTL I"( 31'~ 2 Pl~t T n~ LOr. I-' ~( 11\1 n~ ~J L, f:' T V A l0 11 S PC,iJL T S 81b2 p (, ell (' P ~, 1 11 F R 1 "11 2 ?fJ27 ? 32v.l ,.)'~ b.~ ~R.l.I\)VM .~h51 Ph'LOOP ~~ PTr"T "~If-. ~f.(f\1 ~24:3 ~l~ITL ~~ 1 7 ~~ I-' ~~ LJ GN A 1114 ~Lr'rGI ~\ 1 I ~'I I-'P~,ut;f.( 37?? PLtTno ~1 ? ~~ " Pr.( 'I EMP VlV'(~2 PU: TTE. 310[,1 P L 1r·· 1 T c'~hb P L I~, H U ~ 037 F L I ~,F I vl l I;) 7 ~LlST 2') "111 PLrT~A 33':!u ') "I ·f .., P L lJ(.~ PPfXRE 3720 ?4b3 PSAvt: P ':) t, t ~ 161b F'~L.(lLJP ~12(/! ~'SYHTA r;W'i£? t;570 PTABF-L C;~71 PNOTNO 257 ~~ P T~\ rll E i!.77b fH:.N 5~~ PTt,1(T ~ 10v) i-'TUfiIG 3V1~1 4L.1:5U 0121 0. 1 12 POLJ1NU PF-ASSC PPllLIS 0127 PPER~1S 21)72 PPFLOn 47,,1 P~FORl 17bl.; Pf-'INT PPop PPRINl b0b~ 011b PP~INU vj! 25 01~) 7 PPUSH 0HJ6 PPUTCH ~~33 14~~ R1IOME 31VJ3 '::1573 RuN 2457 RUNC i=456 RLJAO ~'S 1 Of.' i-' 'r A t1 0 E P(;P,3 ~TBUF ~LJNIN 1171 p ~~ O~. BL 0124 POIP 41hh POP POPERA 3121 0433 6661 ~MLE:FT 6413 f.(NI) 5353 Rf\OJMP 5350 f.(lBfN() 1~0~ PUNlUP 2472 P,....E~lI (,:1 L1/J 4 RIGHT RIP 15h~ ~lri12 01.,S ~10 3 5 .HHl 01?3 rS)l.E:Ii(R PNLJ"'tlU b70v.! t-l~)T IeK 3770 , '~114 P(jA[)[) 13~2 PSr-ACE ~srnv~ 131~ ~hALF 5b75 P t-1tj I..: E A ;'J.3 o,(~ P ~,p Y ')155 P t-I rl f' 6 ':i1';,h PLIJ~ ~t:.Uf'ER n ] ~s(,rpl 0135 RfStT1 7072 RtSTOR .3771 RI:Tt\lE~ 0713 j.(tTU~N 0677 P ~ 1 f\1 T x 37~2 217L.1 Ph'l";LJM 374') 1.': 11 7 :~ ~~ 7 7 1 RtjS~'JCH [..ltMPAC 3043 PR 1 r>1 T G 2 t~06 ?2?4 t-iP If\IH'' 73?2 ~'~LY (JM I( ~ELATt:. ?112 PI r. r,' (II-< v-i722 RCtH~ 6763 Io?E:AO 1622 Io<tAOIT 6664 Io(tADLO 12046 ~t:ADV 6525 r r~r: X ??l.~ ~U~~NOT i-'IJ~t:.RF C;St.1'i PU~H 2362 PUTCOF 7~14 PIJrCH ~7t.11 PUfEk 7V~~ I-'l.' T J 3~50 ~51£:l4 2550 2521 2544 1000 2401 SCtiMUR 1656 SCRATL 2445 SCR~T1 StARCH SETINe St:.TSGN S('N SIMPLV SIN SJUMP S . . IPIT SKPSVM SLASH SLOOP SL.SHTM SNUMFL SPACER SPLEFT SGEXIT P \·n·, F: RE 06L.17 P)(FORL CtJ55 ., PXL.INb 3744 PXXCRL 3117 PXXFlJF ?571 P)(XExI 312v.'l P)!XLIT 3122 j.I)(ATI1E 2567 PZI:.f.<DO 251~ RljN2 IN RLJN2LU f.(uN2NO SAVE SAVE:.1 0' 654~ 6-63 PAGE 51-3 1?/27/72 ~332 lh~7 0200 4512 0726 3465 ~624 0241 0471 2762 1332 2675 1337 el06b 1163 0142 5450 S(~LOOP S(~R S !;ERR S :,F I X S~) 0 Nt:. s:n wo s'r 5435 5412 11;)63 4/75 0336 ~33" 3~0~ S'r AR 1327 S'; AR 1 H 3vH?10 s'r I CKI 6L.130 S 'rOBUF 0747 S 'r (J P 2401 5" ORCH ~7ri1L.1 S "OVAR 0333 S\·JP 7~21 S)(E~ 0~51 6441 TIUj 5547 TJ' BlH: S 6375 TI'd () 0 63'50 TJ'BFLG 2343 TI,BL 3652 Sl(ER~ Tn~rHP 2~h0 5000 TJ'N TBE.GFI 5572 TEMP 0~e!3 TEMPS 31~2 TEN 0000 THESKI 1353 Tl.SOuT 7402 P1P 0V'J31 TOOlaN 5162 TPRINT 6$76 HIALUP 2131 TFIANSF 2126 HI VAG I 5131 H!VAL 0270 TFI VAL T 0271 THVOLO 3075 HIVSTE 0626 7024 T" V0 TrVOUT 1350 TUtHG 1173 T~I I DTH 2355 T~IOL F 3557 T~IO 5S 1074 0: TPAK 3~46 T"QUE5 1145 UDOPER 1363 UGH1 3561 0004 U..IMS U~IOPER 1321 U~IOERF 4645 U~I I T 0012 UPARRO 6457 Table 6-7 Cassette BASIC Symbol Table (Cont'd) /PDP"'8/t RASIC CA~S~TTE P~~L8"'V8 12/27172 UPARRX S140 xXGOSU 5321 )c)( TAN UPAJ.<Rr? ~nbS ~)(L-iOTO 5300 X):TEXT ~540 )()( THEN 5305 )0: TO 51b5 X):TTVO 5437 )( ):ljNAR 5542 tlSERFN 1 to, 1 ., XXGT 5147 liTEM 0411 xXIF 5312 UTEMl lJUJMP lIUJMS UULlJMS 0021 XXlNPT 5332 .. ~lNPU 5337 VA~ 040Cll 0401 0416 0335 VA~TEM 055~ V~rHIN 3r:,2~ VS(;HLU 3414 v SC ~HJO 3511 62~0 X)(1..0t; '5~1~ b60~ ~YL~T 544". 'i145 1.>101 E MP 1012 x ~: L. T wORO ~il.Zl5e XYHINU 5114 1,.,1 F,.. b613 Xf){E:CU ~tq4 ~534 X(~TSIT 7115 AX N A~' ;..VNAMI: ). );r~COM )( r,I"1~ T 1 VI r; j 3 x YNF. 553"-" ')447 513il '<G~LJS'T 72"10 A,XNEw 5525 )rlSIT "11? 4 1. X I" E. )( T 5326 'Xl~111 ilj') .. >:NRU~ 5467 >: t-" l):, T 12"(7 )( l'-iUST 1 ~1541 .l.Xl,JIH 0V1~5 XXC![)2 0i(1~b ~~1:.(;2 o ~111 X)(U[)3 0~0.1 XH,[!C 001~ xxuL.IJ 5~?2 'tk'PLT 0(11 1 x XUPl-.'" 51bl ))(AbS '?c :~ XXU~~ ~412 )(XATN '2~1 ).XUIJTP 5u?2 S11e' ';)(~~LS 5260 ~)(I'"LUS Y)(C~At\I c:,u27 X'J(~RIN ~2bl XXCl.OS 51~~ l.){tJRl\Jl ~)(CLSE. SLl1":! X)(PUl c..262 ')242 Xxr.(JMA )'XCUMM 5iJ~" X)(t-(t1RA ~lS1 )()( CU·" S 2~:; 1 >')(I'<EA() b .~)I' k E 1'1 53hf. )()(C~LF 't?~b x f.: A T A 5/Jki2 "157 ":S"' X)(k'ETf..< x )( 1< tJ LJ l<)(kSTU "344 ~). (·fF S312 X)(DIM X xt, (, ;.3';)5 ,,)(~Ut< 5e>34 5361 54 he ':i135 X)(I'<UN t.,';:iIi1':i XlCtL ':i1lH'! A.'I.~AV 5~11 lcxENG 5434 ,406 Y.v~AVf': r,':i13 AY~r.Joo/ ., ':i lit' ')~4t X"'~Elvl! 51.,3 x xr- [)/ ;14j )\. 1 ~ (,~J t;??6 y,E)l.IT 5'j~l.l A~.)IN 5237 ~ It F. :d:i Xx~LA3 " 1 ?~, ):~rtNl ;215 ,543 X)( Fr\J 517f- ~'(~T~~ '(~F(JR 531~ X)(~TtP 511b ';1 7 1 )( )( (j F. S1~7 ~xr,f..T ')245 X)(:'TUP lIxlAM 'i2SI/) ~ }',;FNDI\, x): F(lF 5253 0010 ZCNTLO 7147 Zt.ROON 5142 ZtRO 0150 lFlxtx 4767 X): UUF x10 XXL.ET 5274 "xLIS r;~02 xXL.IST 5476 )(XLli0 ';545 Vi Al T 2O :O:UPAk 5122 .(XINT 5231 XXLbRA 5163 xXLE 5124 If; AJ TR /0. x~HJh' 5204 ~2~~! ~351 6-64 PAGE 51-4 CHAPTER 7 USING CAPS-8 COOT Using COOT, the programmer can run his binary program on the computer, control its execution, and make alterations to his program by typing at the Teletype keyboard. COOT occupies any four pages of core, in the same field, that the user desires. The user may change the location of these four pages of core by reassembling the source. If the user program resides in the first few pages of memory, then COOT should be loaded in the upper pages of memory, and vice versa. The user progrc~ cannot occupy (overlay) any location used by COOT, including the breakpoint locations (locations 4, 5, and 6 on page zero). 7.1 FEATURES COOT features include location examina1:ion and modification: octal core dumps to the Teletype using 1:he word search mechanism: and instruction breakpoints to return control to COOT (breakpoints). The user's program can run with interrupts on. COOT may reside in any field, not necessarily the same as the user's field. The breakpoint is one of COOT's most uSE~ful features. When debugging a program, it is often desirable to allow the program to run normally up to a predetermined point, at which the programmer may examine and possibly modify the contents of the aecumulator (AC) , the link (L), or various instruction or storage locations within his program, depending on the results he finds. To cicCOITlplish this, COOT acts as a monitor to the user program. The user decides how far he wishes the program to run and COOT inserts an instruction in the user's program \~hich, when encountered, causes control to transfer back to COOT. COOT immediately preserves in designated storage locations the con1:ents of the LINK and AC at the break. It then prints out the location at which the break occurred, as well as the contents of the LINK and AC at that point. COOT will then allow examination and modification of any location of the user's program (or those locations containing the AC and L). The user may also move the breakpoint and request that COOT continue running his program. This will cause COOT to reB tore the AC and L, execute the trapped instruction and continue in the user's program until the breakpoint is again encountered or the program is terminated normally. 7-1 7•2 USING COOT When the programmer is ready to start de:bugging a new program computer, he should have at the console: at the 1. A binary copy of the new program on a cassette. 2. A complete octal/symbolic program listing. 3. A binary copy of the COOT program (previously assembled so as not to interfere with the user's program). RUN P ROG, CODT The binary of COOT must be the automatically begins in CODT. 7.2.1 last file to be run. Execution Commands SLASH(/)--OPEN PRECEDING LOCATION The location examination character (/) causes the location addressed by the octal number preceding the slash to be opened and its contents printed in octal. The open location can then be modified by typing the desired octal number and closing t:he location. Any octal number from 1 to 4 digits in length is a legal input. Typing a fifth digit is an error and will cause the entire m{~ification to be ignored and a question mark to be printed by COOT. Typing / with no preceding argument causes the latest named location to be opened (again). Typing 0/ is interpreted as / with no argument. For example: 400/6046 400/6046 2468? 400/6046 l2345? /6046 The memory field referenced is that field specified by the location in CODT symbolically referenced by F. For example, if the contents of F were 20, then the command 423/ would examine location 423 in memory fiE!ld 2. 7-2 RETURN--CLOSE LOCATION If the user has typed a valid octal nwru)er, after the content of a location is printed by COOT, typing the RETURN key causes the binary value of that number to replace the oriqinal contents of the opened location and the location to be closed.. If nothing has been typed by the user, the location is closed but the content of the location is not changed. For example: 400/6046 400/6046 2345 /2345 6046 Typing another conunand example: location 400 is unchanged location 400 is changed to contain 2345. replace 6046 in location 400. will 400/6046 401/6031 2346 400/6046 401/2346 also close an opened register. For location ,100 is closed and unchanged and 401 is opened and changed to 2346. LINE FEED--CLOSE LOCATION, OPEN NEXT LOCATION The LINE FEED key has the same effect CiS the RETURN KEY, but, in addition, the next sequential location is opened and its contents printed. For example: 400/6046 0401/6031 1234 0402/5201 location 400 is closed unchanged and 401 is opened.. User types change, 401 is closed containing 1234 and 402 is opened. SEMICOLON--CLOSE LOCATION, AND UNOBTRUSIVELY OPEN NEXT LOCATION The SEMICOLON key has the same. effect as the LINEFEED key except that the location and contents of the nf~xt sequential location are not printed. Therefore, 400/6046 3211; 4162; 5000 has the same effect as 400/6046 3211 401/6031 4162 402/5201 5000 This makes it convenient for the user locations. ito t (SHIFT/N) --CLOSE LOCATION, TAKE CONTENTS OPEN SAME change AS several MEMORY sequential REFERENCE AND The up arrow (circumflex) will close an open location just as will the RETURN key. Further, it will interprf~t the contents of the location as a memory reference instruction, open the location referenced and print its contents. For example: 7-3 404/3270t 0470/0212 0000 + 3270 symbolically is "DCA, this page, relative location 70," so COOT opens location .170. (SHIFT/O) CLOSE LOCATION, OPEN INDIRECTLY The Back arrow (or underscore) will close·the currently open location and then interpret its contents as the address of the location whose contents it is to print and open for modification. For example: 365/5760t 0360/0426+ 0426/5201 nnnnG--TRANSFER CONTROL TO USER AT LOCA~rION nnnn Clear the AC then go to the location sp4~cified before the G (in the field specified by F). All indicators and registers will be initialized and the breakpoint, if any, will be insert~d. Typing G alone will cause a jump to location ~. nnnnB--SET BREAKPOINT AT USER LOCATION nnnn Instructs COOT to establish a breakpoin·t at the location specified before the B (in the field specified by F). If B is typed alone, COOT removes any previously established breakpoint and restores the original contents of the break location. A breakpoint may be changed to another location, whenever COOT is in control, by simply typing nnnnB where nnnn is the new location. Only one breakpoint may be in effect at one time; therefore, requesting a new breakpoint removes any previously existing one. A restriction in this regard is that a breakpoint may not be set on any of the floating-point instructions which appear as arguments of a JMS. For example: TAD DCA JMS FAOO Breakpoint legal here. Breakpoint illegal here. A breakpoint may not be set on a CIF instruction, nor on an instruction which is meant to be ,executed between a CIF and its corresponding JMP or JMS instruction. A breakpoint may not be set on a memory references an auto-index register. reference instruction which A breakpoint may not be set on a two-word EAE instruction, nor may be set on any of the following instructions: 7-4 it SKON ION IOF The breakpoint (B) conunand does not make ,the actual excha.nge of COOT instruction for user instruction, it only sets up the mechanism for doing so. The act,ual exchange does not occur until a "g'o to" or a "proceed from breakpoint" command is executed. When, during execution, the user's program encounters the location containing the breakpoint, control passes immediately to COOT (via location 4, 5, and 6). The C (AC) and C (L) at t.he point of interruption are saved in special locations accessible to COOT. The user's data field is stored in location 0 and his instruction field is stored in locati.on F as well as internally by COOT. The user instruction that t:he breakpoint was replacing is restorec; before the address of the trap and the content of the LINK and AC are printed. The restored instruction has not been executed at this time. It will not be executed until the "proceed from breakpoint" command is given. Any user location, including those containing the stored AC and Link, can now be modified in the usual manner. The breakpoint can also be moved or removed at this time. An example of breakpoint ITERATE LOOP ••• ". usage follows the section "CONTINUE AND A--OPEN C(AC) When the breakpoint is encountered the C(AC) and C(L) are saved for later restoration. Typing A after having encountered a breakpoint opens for modification the location in which the AC was saved and prints its contents. This location may now be modified in the normal manner (see Slash) and the modification w'ill be restored to the AC when the "proceed from breakpoint" conunand is given. Similarly, other key locations in COOT ma.y be examined and modified as follows: L--OPEN CONTENTS OF LOCATION L (LINK) F--OPEN CONTENTS OF LOCATION F D--OPEN CONTENTS OF LOCATION 0 (USER' S Dl~TA FIELD) 7-5 NOTE Whenever any of the locations A, L, F, 0, M are referenced, COlDT automatically sets the value of F to be the field of COOT. C--PROCEED (CONTINUE) FROM A BREAKPOINT Typing C, after having encountered a brc:!akpoint, causes COOT to insert the latest specified breakpoint (if an~r>; restore the contents of the AC and Link; execute the ins tructi()n trapped by the previous breakpoint; and transfer control back to the user program at the appropriate location. The user program then runs until the breakpoint is again encountered. Regardless of the value of P, the C co~nand resumes program execution at the precise spot where it had been previously stopped. The user's data field is first set to that specified by location o. NOTE If a trap set by COOT is not encountered while COOT is running the object (user's) program, the instruction which causes the break to occur will not be removed from the user's program. nnnnC--CONTINUE AND ITERATE LOOP nnnn TIMES BEFORE BREAK The programmer may wish to establish thE! breakpoint at some location within a loop of his program. Since loops often run to many iterations, some means must be available to prevent a break from occurring each time the break locati()n is encountered. This is the function of nnnnC (where nnnn is an ()ctal number). After having encountered the breakpoint for the first time, this command specifies how many additional times the loop is t() be iterated before another break is to occur. The break opE!rations have been described previously in the section on the B command. Gi ven the following program, which inCrE!aSeS the value of the AC by increments of 1, the use of the breakpoint command may be illustrated. 7-6 *200 0200 7300 CLA CLL 0201 1206 A" TAD ONE 0202 2207 B,. ISZ CNT 0203 5202 JMP B 0204 5201 JMP A 0205 7402 HLT 0206 0001 ONE,l 0207 0000 CNT ,0 0201 A B 0202 CNT 0207 ONE 0206 020lB 200G 0201 (0;0000 C 0201 (0;0001 C 0201 (0;0002 4C 0201 (0;0007 COOT has been loaded and started. A breakpoint is inserted at location 0201 and execution stops here showing the AC in:,-tially set to 0000 and the link O. The use of the Proceed command (C) executes the program until the breakpoint is again en.countered (afte:::- one complete loop) and shows the AC to contain a value of 0001. Aga.in execution continues, incrementing the AC to 0002. At this point, 1:he command 4C is used, allowing execution of the loop to continue 4 more times {following the initial encounter} before stopping at the breakpoint. The contents of the AC have now been incremented to 0007,. M--OPEN SEARCH MASK Typing M causes COOT to open for modification the location containing the current value of the search mask and print its contents. Initially the mask is set to 7777. It may be changed by opening the mask location and typing the desired value after the value printed by COOT then closing the location. LINE FEED--OPEN LOWER SEARCH LIMIT The word immediately following the mask :;torage location contains the location at which the search is to begin. Typing the LINE FEED will open for modification the first location after the mask, and its contents will be printed. Initially, the lower search limit is set to 0001. It may be changed by typing the desired lower limit after that printed by CODT, then closing the location. 7-7 LINE FEED--OPEN UPPER SEARCH LIMIT The next sequential word contains the l()cation with which the search is to terminate. Typing the LINE FEED key to close the lower search limit causes the upper search limit to be opened for modification and its contents printed. Initially, the upper search limit is the beginning of COOT itself, 7000 (1000 for low version). It may also be changed by typing the desired upper search limit after the one printed by CODT, then closing the location with the RETURN key. nnnnW--WORD SEARCH The command nnnnW (where nnnn is an octCll number) will cause COOT to conduct a search of a defined section ()f core, using the mask and the lower and upper limits which the user has specified, as indicated above. The searching operations arE! used to determine if a given quantity is present in any of the locations of a particular section of memory. The search is conducted as follows: CODT masks the expression nnnn which the user types preceding the Wand saves the·result as the quantity for which it is searching. CODT then masks each location within the user's specified limits with C(M) and compares the result to the quantity for which it is searching. If the two quantities are identical, the address and the actual unmasked contents of the matching location are printed and the search continues until the upper limit is reached. The search occurs in the memory field specified by F. A search never alters the contents of any location. For example: Search location 3000 to 4000 for all ISZ instructions regardless of what location they refer to (i.e. search for all locations beginning with an octal 2). FOOlO M7777 20 7000 7453/0001 3000 7454/7000 4000 2000W 0200/2467 3057/2501 3124/2032 7. 3 Set the field to 2 Change thE~ mask to 7000, open lower search limit. Change thE~ lower limit to 3000, open upper limit. Change thE! upper limit to 4000, close location. ISZ the search for Initiate instructi()ns. These are 4 ISZ instructions in this section of core. ILLEGAL CHARACTERS Any character that is neither a valid c()ntrol character nor an octal digit, or is the fifth octal digit in a sequence, causes the current line to be ignored and a question mark printed. For example: 7-8 7.4 7.4.1 4:? 4U? COOT opens no location. 0406/4671 67K /4671 COOT ignores modification cmd closes location 406. ADDITIONAL TECHNIQUES TTY I/O-FLAG COOT automatically notes the status of the TTY flag after encountering a breakpoint and restores it after performing a CONTINUE.o 7.4.2 Interrupt Program Debugging COOT executes an IOF when a breakpoint is encountered. (It does not do this when more iterations remain in an nnnnC command.) This is done so that an interrupt will not occur when COOT prints the breakpoint information. COOT thus protects itself against spurious interrupts and may be used safely in debugging programs that turn on the interrupt mode. COOT restores the int:errupt facility to its former state when it resumes execution. ' 7.4.3 Octal Dump By setting the search mask to zero and typing W, all locations (in field F) between the search limits will be printed on thl~ Teletype. 7.4.4 Indirect References When an indirect memory reference instruction is enc=>untered, the actual address may be opened by typing t and + (SHIFT/N and SHIFT/O, respectively). 7.5 ERRORS The only legal inputs are control charac1:ers and octal digits. Any other character will cause the charactE~r or line to be ignored and a question mark to be printed by COOT. Typing G alone is an error. It must be preceded by an address to which control will be transferred This will elicit no question mark also if not preceded by an address, but will cause control be transferred to location O. 7-9 7.6 7.6.1 OPERATION ANO STORAGE Storage Requirements - CAPS-8 System COOT can be run in a standard CAPS-8 system and requires 1000 (octal) core locations and three locations (4,5,6) on page zero of every field which uses a breakpoint. COOT is page-relocatable. The source tape can be re-origined to the start of any memory page except page zero and assembled to reside in the four pages following that location, assuming they are all in the same memory bank. 7.6.2 Programming Notes Summary COOT must begin at the start of a memory page (other than and must be completely contained in one memory field. The user's program must not use or reference occupied or used by COOT and vice versa. any page core zero) locations Breakpoints are fully invisible to "open location" cOJ'TUllands; however, breakpoints may not be placed in locations which the user program will modify in the course of execution or th€~ breakpoint will be destroyed. If a trap set by COOT is not encountered by the breakpoint instruction will not be removed. user's The user may type CTRL/C at any time to return to the (assuming his program did not destroy CAPS-8). 7-10 program, CAPS-8 the Monitor 7.7 COMMAND SUMMARY nnnn/ Open location designated by the octal nnnn. / Reopen latest opened location. RETURN key Close previously opened location. LINE FEED key Close location and open the one for modification. t(SHIFT/N) +- (SHIFT /0) number next sequential Close location. and allO\~ modification of the next location. immediate Close location, take contents of that location as a mE!mory reference ilnd open it. Close location, open indirectly. Illegal character Current line typed by user is types: ? (CR/LF) • nnnnG Transfer program control to location nnnn. nnnnB Establish a breakpoint at location nnnn. B Remove the breakpoint. A Open for modifiGation the location in which the contents of the AC were stored when the breakpoint was encountered. L Open the location storing the link. C Proceed from a breakpoint. nnnnC Continue from a breakpoint and iterate past the breakpoint llnnn times before interrupting the user's p:rogram at the breakpoint location. M Open the search mask. ignored, COOT LINE FEED key Open lower search limit. LINE FEED key Open upper search limit. nnnnW Search the portion of core as d.efined by the upper and low-er limits for t.he octal value nnnn. F Open location F. o Open location D. 7-11 CHAPTER 8 CAPS-8 UTILITY PROGRAM 8.1 INTRODUCTION The CAPS-8 Utility Program (UTIL) allows: the user to take files stored on paper tape and transfer them to cassette, using either the high-speed or low-speed reader. The Ut:ility Program will transfer both ASCII and BINARY files. 8.2 CALLING AND USING THE UTILITY PROGF~ To call the utility Program from the sys:tem cassette, the user types: .R UTIL/OPTIONS in response to the dot (.) printed by the Keyboard Moni 1:or. 8.2.1 Utility Program Options There are two options available for use: with the Utility Program~ these options are discussed in Table 8-1. (Options usaqe is explained in Chapter 2, Sec::tion 2.4.3.) Table 8-1 Utility Program Options Meaning Option /H The /H option. is used to designate the high-speed rea.der as the input: device. Note that the high-speed reader in the default input device. That is, if no option is specified the program aSSUmE!S that the high-speed reader is the input device. /L The /L option is used to designate low-speed reader as the input device. 8-1 the 8.2.2 Input and Output Specifications Before indicating the input and output devices to be used in the file transfer, the user must ensure that the proper reader is ready and that the cassette the file is to be copied onto is write-enabled. When this has been done, the user is ready to begin the file transfer. After UTIL has been called from following: the system cassette, it asks the MODEThe user responds with a single character (A or B) to indicate whether the file being put on the cassette is ASCII or BINARY. OUTThe user responds by typing the drive number the output cassette is mounted on and the name of the output file to be put onto it, i.e., 3 :FOO. In B mode, • BIN is the default e~:tension. After these two queries have been answere!d UTIL prints the following: t The user responds by typing any character; this response starts the file transfer. (If /L had been typed, the user merely turns on the low-speed reader.) 8.3 UTILITY PROGRAM ERROR MESSAGES Errors which occur during the utility Program operation may be of two types: User errors and cassette errors. User errors may be corrected with the appropriate action as detailed in Table 8-2. Cassette errors normally require the user to use another cassette to complete the copy operation. Control does not return to the Keyboard Monitor when a Utility Program error occurs. The USE!r may use CTRL/C to return to the Monitor if he cannot correct the indicated error. Table 8-2 Utility Program Error Messages Jl.!eaning Message UNIT n NOT READY There is either no cassette on the cassette drive specified or no such drive exists. OUTPUT ERROR ON UNIT n An output error has occurred on the cassette drive specified. The user should try the transfer operation using another cassette. Or perhaps, the user tried to write data when the write prote1ct tab of the cassette on the drive specified was write-locked. 8-2 ENTER ERROR ON UNIT n An error occurrl:!d whi Ie trying to open a new cassette file. UNIT n FULL There was not enough room on the cassette. CLOSE ERROR ON UNIT n An error occurred during a close operation. INPUT ERROR In binary mode, the paper tape reader stopped or ran out o:E tape before a checksum was encountered. CHECKSUM ERROR In binary mode, the checksum did not agree; probably a hard~"are read error. Try again. Whenever an error occurs, the program writes a open cassette if possible. 8-3 new sentinel on the CHAPTER 9 BOOT BOOT is used to make it convenient to bootstrap from one system to another, or from. one device to another by typing commands on the keyboard. BOOT can run conveniently from CAPS-8 and other monitor systems, i.e., OS/8 and COS-300. 9.1 OPERATING PROCEDURES To run BOOT from CAPS-8 the user types: .R BOOT the system will respond by typing a slash, at which time the user responds with the device mnemonic. If an illegal mnemonic is typed, the system types "NO" and prints a slash to allow the user to try again. In this case, the user can type RUBOUT to erase a line and try again. If a legal mnemonic was given, but the system configuration does not include the corresponding device (or thE~ device is not ready), the bootstrap may hang. The following is a list of legal mnemonics: Mnemonic Device !3~stem or Comments CA TA8E cassette CAPS-8 DK Any disk (RF08, DF32, RK8E, RK8) OS/8, COS-300 DL LINCtape DIAL-V2, DIAL-MS DM RF08 or DF32 Disk Monitor DT Any tape (TC08, T08E, LINCtape) OS/8, COS-300 LT LINCtape OS/8, COS-300 PT PT8E Papertape Loads BINLDR into field 0 9-1 Mnemonic Device §:ystem or Comments RE RK8E disk OS/8, COS-300 RF RF08, DF32 disks OS/8, COS-300 RK RK8 disk OS/8, COS-300 TD TD8E DECtape OS/8, COS-300 TY TC08 DECtape unit 4 Typeset Bootstrap types BOOT's version number TC TC08 DECtape OS/8, COS-300, Disk monitor, DEC library system, and others Zeroes core (field 0) ZE If the device mnemonic is followed by a period, the program will load the correct bootstrap into core and then halt. Hitting continue branches to the bootstrap. Example: .R BOOT LDT The preceding bootstraps onto a DECtape system (on DECtape unit ~). The underlined characters were typed by the computer. 9-2 APPENDIX A. ASCII CHARACTER SET Character A B C D E F G H I J K L M N 0 P Q R S T U V W X y Z 0 1 2 3 4 5 6 7 B 9 B-Bit Octal 7-Bit Octal 301 302 303 304 305 306 307 310 311 312 313 314 315 316 317 320 321 322 323 324 325 326 327 330 331 332 260 261 262 263 264 265 266 267 270 271 101 102 103 104 105 106 107 110 III 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 260 261 262 263 264 265 266 267 270 271 Character ! " # $ % & ( ) * + . / < = > ? @ [ \ ] t + Le alde r /Tr ai Ie r BELL TAB LINE FEED FORM CARRIAGE RETURN CTRL/Z SPACE RUB OUT BLANK A-I B··Bit Octal 7-Bit Octal 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 272 273 274 275 276 277 300 333 334 335 336 337 200 207 211 212 214 215 232 240 377 000 241 242 243 244 245 246 247 250 251 252 253 254 255 256 257 272 273 274 275 276 277 133 134 135 136 137 240 APPENDIX B ERROR MESSAGE N~D COMMAND SUMMARIES The following summaries are provided for the user's convenience: they are grouped in alphabetical order according to the Sys;tem Program to which they pertain. As these are only summaries the USE!r is referred to the appropriate chapters for details. KEYBOARD MONITOR (Chapter 2) Error Messages Meaning Message BAD COMMAND The user has failed to follow the correct syntax for Monitor commands. FILE NOT FOUND The Monitor could not locate the file (or files) specified. IO ERROR ON UNIT n An I/O error has occurred on the cassette unit drive spec!ified. The user should try the I/O transfer specifying another cassett:e. UN IT n NOT READY There is no cassette on the unit drive specified, or no such drive exists. UNIT n WRITE I..oCKED The user t,ried to write data when the wri te prc1tect tab of the cassette on the drive specified was wJ:ite-Iocked. Conunands Explanation Conunand DATE Allows thE~ user to enter the month, day, and year. This date is then represented in directory listings. DELETE Causes thE! file named in t.he command line to be deleted from the cassette drive specified. DIRECTORY Causes a cassette line. B-1 directory specified listing in the of the command KEYBOARD MONITOR (Con't) Command Explanation LOAD Instructs the Monitor to load the file{s) specified in the command line. (The correct starting address is then set in the switch register and execution is started by pressing CONTinue .l REWIND Causes the cassette on the drive specified to be rewound to its beg inning .' RUN Instructs the Monitor to load and execute t:he file{s) specified in the command line. VERSION Causes the version number of the currently in use to be Monitor printed on the console terminal. ZERO Causes deletion of all files following the filename specified in the command line. If no filename is indicated, all files are deleted and the sentinel file is moved to the beginning of the cassette. EDITOR (Chapter 3) Error Messages Error codes are printed iD the form of the following: ?ntC where n represents one Code Meaning o The EDITOR failed in reading from a device. An error occurred in the device handler; most likely a hardware malfunction. I The EDITOR failed in writing onto a hardware device; generally a malfunction. 2 A file close error occurred. output file could not be closed. A question mark (?) may appear any time syntax error. B-2 the EDITOR encounters The a In addition, the! EDITOR contains the following error me:ssage: Message UNIT HAS OPENED FILE Meaning Two files cannot be open on the cassette at the same time:. same Corranands Corranand Meaning A Append text from the keyboard to whatever is present in the text buffer. B List the number of available locations in the text buffer. C Change the text of a or lines. D Delete the specified linE! (s) from the buffer. E output the current buffer and transfer all input to the output file; close the output file. F Find the next occurrence of the string currently being sE~arched for. G Get and list the next line which a label a.ssociated with :L t. has I Insert text before a in the text buffer. line J Initiate an inter-buffer search for a character string. K Kill the! buffer; rese': the text buffer pointers so tha': there is no text in the buffer. L List enti.re contents (or specified lines) of the text buffl~r on console terminal. M Move specified lines from one place in the text to another, deleting the old occurrence of the text. N Write the current buffer to the indicated output file, kill the buffer and read the next logical page from the input file. B-3 memory specified specified line EDITOR (Con I t) Command Meaning P Write the specified buffer. Q Immediate end-of-file. Q causes text buffer to be output to output file and the file closed. R Read from the specified input device and append the new text to the current contents of the buffer. S Search for the character specified. V List the entire text buffer (or only specific lines) on the line printer. Y Skip to a logical page in the input file, without writing any output. $ Perform a search for string of characters. ... entire lines) text to buffer (or the output a the the specified • = or /= or /: List the current line number (.=) or list the last line number in the text buffer (/=). > List the next line in the text buffer on the console terminal. < List the previous line in the buffer on the console terminal. LINE FEED Key List the next line in the text buffer on the console terminal. text SYSCOP (Chapter 4) Error Messages Meaning Message INPUT ERROR ON UNIT n An input e.rror has UNIT n NOT READY There is no cassette on the unit drive specified, or no such drive exists. occurred on the cassette unit specified. The user should try the copy operation using another cassette. B-4 SYSCOP (Con' t) Message Meaning UNIT n WRITE LOCKED The user tried to write data when the write protect tab of the cassette on the drive specified was write-locked. OUTPUT ERROR ON UNIT n An output error has occurred on the cassette unit specified. The user should try the copy operation using another cassette. PALC (Chapter 5) Error Messages Explanation Error Code BE Two PALe overlapped. DE Internal tables Fatal error. An error ,..ras detected when trying have to read or write a device. OF Device full. IC Illegal character. The character ignored and assembly continues. ID Illegal redefinition of The symbol retains definition. IE Illegal equals. An equal used in the wrong context. II ~llegal IP Illegal pseudo-oPe A pseudo-op was used in the wrong context or with incorrect syntax. IZ The Illegal page zero reference. found was in an pseudo-op Z instruction which did net refer to page zero. The Z is igncred. PE Current non-zero page attempt w.as made to: indirect. reference was made. 1. Override a instruction B-S An a is symbol. its old sign was off-page e~ceeded. An with an literal PALC (Con't) Error Code Meaning 2. Override an literal instruction with a 3. Use more literals than the assembler allows on that page PH Phase error. Either no $ appeared at the end of the program, or < and > in condi tionall pseudo-ops did not match. RD Redefiniti.on. A permanent symbol has been defin.ed with =. The new and old definition.s do not match. The redefinition is allowed. SE Symbol ta.ble exceeded. Too many symbols have been defined for the amount of memory available. UO Undefined origin. symbol ha.s occurred statement. An in undefined an origin US Undefined symbols. A symbol has been processed during pass 2 that was not defined before the end of pass 1. ZE Page 0 exceeded. Same as with reference to page O. PE except BASIC (Chapter 6) Error Messages Meaning Message an illegal SQR(-l) • ARGUMENT ERROR A function was given argument; for example: CHAIN ERROR A cassette error occurred while doing program chaining. DATA ERROR There were no more items in the list. EOF ERROR The user attempted to read past the end-of-file during run-time input. EXPRESSION ERROR One of BASIC's internal lists overflowed while attempting to evaluate an expression. B-6 data BASIC (Con't) Message Meaning FILE NAME E.RROR A mistake was found in the user's specificat:ion of a cassf~tte drive # or filename in either a CHAIN or an OPEN s ta tE!men t. FILE OPEN E.RROR The user attempted to ope:l a run-time output file when one 'rlas already open, or a hardware error occurred. FOR ERROR FOR loops were nested too deeply. FUNCTION ERROR The user attempted to call a function which had not been defined. GOSUB ERROR SubroutinE!s were nested too deeply. I 0 ERROR The user attempted to do run-time input and output to the same cassette at the same time. IN ERROR A casseti:e attemptinq command ()r input. LINE TOO LONG A line greater than 80 characters in length was typed; BASIC ignores the line and ''lai ts for a new one to be entered. LINE # ERROR A GOTO, GOSUB, or IF statement referenced a nonexistent line. LOOKUP ERROR BASIC could not find a run-time input file on the drive specified. NEXT ERROR FOR and NEXT statements properly paired. NO FILES ERROR The user attempted to do run-time file I/O without first specifying so during BASIC's initial dialogue. OUT ERROR An RETURN ERROR A RETURN statement was issued not under control of a GOSUB. error occurred while to carry out an OLD while doing run-time were not error (probably end-of-tape) occurred while doing cassette output either during a SAVE or during run-time output. B-7 when BASIC (Con't) Message Meaning SUBSCRIPT ERROR A subscript was used which was outside the bounds defined in the DIM statement '. SYNTAX ERROR A command did not correspond to the language syntax, or an undefined UUF was referE:mced. TOO BIG, LINE IGNORED The combination of program size number of variables exceeded capacity of the computer. and the Statements Statement Meaning CHAIN Link to nE~xt user program. CLOSE Close open output file. COMMAS Output data values to a cassette inserting a comma between each value. DATA Set values for a READ. DEF Define a function. DIM Dimension subscripted variables. END Signals the end of program execution. FOR-TO-STEP Set up a program loop; increment the counter by a value specified using STEP. GOSUB Transfer control to a subroutine. GOTO Transfer control to the line number specified in the command line. IF-ENDI-THEN Transfer control (or perform an operation) depending upon the validity of the last INPUTI statement. IF-GOTO IF-THEN Transfer control (or perform an operation) depending upon the relationship between variables specified in the command line. B-8 Statement Meaning INPUT Input values terminal. INPUT # Input values from a data file. LET Assign a value to a variable. LIST List program (or specific console terminal. lines) on LIST# List program (or specific line print1er. lines) on LPT Send output to the line pI'inter. NAME Rename the program in memory. NEW Specify a new program name. NEXT Continue a program loop until terrninatin9 value is reached. NO COMMAS Terminate outputting of commas. NO RUBOUT Disable the RUBOUT command. OLD Call saved program from ca.ssette into memory. OPEN FOR INPUT/OUTPUT Open a fille on cassette for input output. PRINT Print values or specified text on the console terminal. PRINT# Output values to a data file. READ Read value::; from a data list. REM Insert remarks program. RESTORE Reset value. RETURN Return from a subroutine to the body of thl3 program. RUBOUTS Allow the 'Use of the delete characters. RUB OUT key to SAVE Save the program in memory cassette to be specified. on the B-9 DAT}~ from or value the console a or comments in to original i t.s the main BASIC (Con' t) Statement Meaning thE~ SCR Delete STOP Transfer control statement. TTY OUT Return out:put to the console terminal (after using LPT). current program in memory. to the Functions Function Meaning SIN (x) COS (x) Sine of x Cosign of x Tangent of x Arctangent: of x Exponential value of x Natural log of x Sign of x Integer value of x Absolute'value of x Square root of x Generate a random number Print character at space x Get character from input device Put character on output device User-defined function User-coded function TAN (x) ATN (x) EXP (x) LOG (x) SGN (x) INT (x) ABS (x) SQR(x) RND (x) TAB (x) GET (x) PUT (x) FNA (x) UUF (x) B-IO END APPENDIX C PALC PERMANENT SYMBOL TABLE The following are the most commonly used elements of the PDP-8 instruction set and are found in the pennanent symbol table within the PALC assembler. For additional information on these instructions and for a description of the symbols used when programming other, optional, I/O devices, see THE SMALL CO~)UTER H~~DBOOK, available from the DEC Software Distribution Center. (All times are in microseconds and respresentative of the PDP-8/E.) Mnemonic Code Operation Time Memory Reference Instructions AND TAD ISZ DCA JMS JMP 0000 1000 2000 3000 4000 5000 Logical AND Two's complement add Increment and skip if Deposit and clear AC Jump to subroutine Jump Mnemonic Code Operation ~:ero 2.6 2.6 2.6 2.6 2.6 1.2 Sequence Group 1 Operate Microinstructions (1 (::ycle = 1.2 microseconds) NOP lAC RAL RTL RAR RTR CML CMA CLL CLA BSW 7000 7001 7004 7006 7010 7012 7020 7040 7100 7200 7002 No operation Increment AC Rotate AC and link Rotate AC and link Rotate AC and link Rotate AC and link Complement link Complement AC Clear link Clear AC Swap Bytes in AC C-l lef1: one lef1: two right one right two 3 4 4 4 4 2 2 1 1 4 Mnemonic Code Operation Sequence Group 2 Operate Microinstructions (1 cycle) HLT OSR SKP SNL SZL SZA SNA SMA SPA 7402 7404 7410 7420 7430 7440 7450 7500 7510 Halts the computer Inclusive OR SR with A.c Skip unconditionally Skip on nonzero link Skip on zero link Skip on zero AC Skip on nonzero AC Skip on minus AC Skip on positive AC (zero is positive) 3 3 1 1 1 1 1 1 1 Combined Operate Microinstructions CIA STL GLK STA LAS 7041 7120 7204 7240 7604 Complement and increment AC Set link to 1 Get link (put link in AC, bit 11) Set AC to -1 Load AC with SR MQ Microinstructions MQL MQA CAM SWP ACL 7421 7501 7621 7521 7701 Load MQ from AC, then clear AC Inclusive OR the MQ with AC Clear AC and MQ Swap AC and MQ Load MQ into AC Internal lOT Microinstructions SKON ION IOF SRQ GTF RTF SGT CAF 6000 6001 6002 6003 6004 6005 6006 6007 Skip if interrupt ON, and turn OFF Turn interrupt processor on Disable interrupt processor Skip on interrupt request Get interrupt flags Restore interrupt flags Skip on greater than flag Clear all flags C-2 2,3 1,2 1,4 2 2,3 Mnemonic Code Operation Keyboard/Reader (I cycle) KSF KCC 6031 6032 KRS KRB 6034 6036 KCF KIE 6030 6035 Skip on keyboard/reader flag Clear keyboard/reader flag and AC; set reader run Read keyboard/reader buffer (static) Clear AC, read keyboard buffer (dynamic), clear keyboa.rd flags Clear keyboard/reader AC 11 to keyboard/reader interrupt enable F.F. Teleprinter/Punch (I cycle) TSF TCF TPC TLS 6041 6042 6044 6046 TFL TSK 6040 6045 Skip on teleprinter/pun.ch flag Clear teleprinter/punch flag Load teleprinter/punch and print Load teleprinter/punch, print, and clear teleprinter/punch fla.g Set teleprinter/punch flag Skip on printer or keyboard flag Line Printer (I cycle) LSF LCF LSE LPC 6661 6662 6663 6664 LIE LLS 6665 6666 LIF 6667 Skip on character flag Clear character flag Skip on error Load printer buffer; print on full bufj:er or control character Set program interrupt flag Clear line printer flag, load character and print Clear program interrupt flag Cassette (I cycle) KCLR KSDR KSEN KSBF KLSA 6700 6701 6702 6703 6704 KSAF KGOA 6705 6706 KRSB 6707 Clear all Skip on data flag Skip on error Skip on ready flag Load status A from AC 4-11, clear AC, load a-bit complement of status A Skip on any flag or error Assert the contents of status A, transfer data if read or write Read status B into AC 4-11 C-3 Mnemonic Code Operation Memory Extension Control, Type MC8/E (1 cycle) CDF CIF RDF RIF RIB RMF CDI 62Nl 62N2 6214 6224 6234 6244 62N3 Change to data field N Change to instruction field N Read data field Read instruction field Read interrupt buffer Restore memory field Change to data field and instruction field N PSEUDO-OPERATORS The following is a summary of the PALC assembler pseudo-operators and a brief description of their fun.ctions. Detailed information concerning these pseudo-ops is contained in Chapter 5. DECIMAL OCTAL FIELD I Z EXPUNGE FIXTAB PAGE XLIST IFDEF IFNDEF IFZERO IFNZRO FIXMRI ENPUNCH NOPUNCH ZBLOCK EJECT TEXT Causes all following nurrhers to be interpreted as decimal. Causes all following nurrhers to be interpreted as octal. Causes a field setting. Represents indirect addressing. Denotes a page zero reference. Deletes the entire permanent symbol table. Appends presently define!d symbols to the permanent symbol table. Resets the location counter to the next page. Suppresses listing while continuing assembly; a second XLIST continues listing. If the symbol is defined, the code within brackets is assembled. If the symbol is not defined, the code within brackets is not assemblE!d. If the expression is zero, the code within brackets is assembled. If the expression is not zero, the code within brackets is not assemble~d. Defines a memory reference instruction. Resumes binary output after NOPUNCH. Continues assembling code but stops binary output. Reserves words of memory. Causes the listing to jump to the top of the next page. Allows a string of text characters to be entered. C-4 APPENDIX D SYSTEM DEMONSTRA~ION RUN The following example run, in which the: user creates a binary and listing file from an ASCII source file, illustrates Cl typical use of the CAPS-8 System. The machine output is coded by lettE!rs in the left margin which correspond to the textual explanations found following the run • • DA 01/041';7 3 ~DI A 01104113 FILE MA r H .BIN 1 21 11 112 • DA T V2 .z .!,n ;JALC -IN;JUI fo'iLES ..!2:TE~r.t-'AL B *" -=BINAnl' Jo'iLE * -=LIST TO ~Lfir LIS STArt! US L2 61.1 +01001 KCLR-6700 6'7210 6701 6702 6'703 3~e'2 401Zlrt'l .400{(J 10210 12216 6704 6706 6703 5204 7264 START, TAD CRCCHK, TAD L260 KLSA KGOA KSBF ROCOO, JMP .-1 L260, CML STA RAL b7~4 us Q14000 042101 04002 040213 040214 04005 04006 KCLR.~700 KSDR ro 6701 KSEN-67-02 I<SBF-f,703 !('LSA=6704 KSAF-6705 KGOA-6706 KR5S-6707 65w-7002 LOC-3602 6705 6'706 67e;7 70Q!,2 C PALe-V1 J 5 0-1 01/04/73 PAGE 1 us C 04007 041211121 0412111 0000 7610 3211 ~4012 3b3~ 0t1013 0412114 04015 0401" 04V'l17 04020 04021 1212'5 671214 6106 0/HJ22 c 04023 0 04e.24 n t 04025 041Zl2b 0412127 0IJ030 04t'l31 0412132 04(7l33 i n u e d r/ENS LOOP, SKP CLA DCA • DCA I PTR TAD ROCOO KLSA I(GOA 67~1 KSOR 521b JMP .-l·...f;WAIT FOR DATA FI.AG B5w 7~02 743121 163b 7022 363b 7420 ~ZL TAD I PTR CML BSw DCA I PTR SNL lSZ PTR ISZ KNT JMP LOOP STA eLL RTL 2236 c(J35 5?15 734b 7v.'102 85w KNT (rHH'35 3235 52vH 77$7 KNT, (7.14036 35~7 PTf<, LGC-23 04031 1730 M5C6, -50 ~412!34 OCA J"'P CRCCI1I< " 737 $ KCLR=b700 CReCH/( 40(iJ 1 I<NT 4!t:135 Lec LOOP 36i.;,j2 4CJ!15 Lt?b('l 4006 4057 4036 4005 M5~ PT~ Rueoa 51 A~T 4'lltH:" D .!oK ED II E { I"OAP U.I'O STA. ft.,c.. It *INP01 FILE-2:TEST.~AL *OUTPur FILE-l:TEsr.PAL D-2 .!s, , L ,s TAttT , F TAD t-:rl0 '.5 ~TAHT, TAD Mh\50 .!. 7L G Kl)\,sEN H ( .1.. 55 ILOAD INTO STA. HEG. A KL5A ..1$l 11 L I { J ( JMrJ • -1 JMP .-1 I WA I T F OK .!.. S DA TA F LA G IWAIT FOR DATA FLAG iE .!.,rt ,.;ALC/N - INPuT ii'l LE5 .!1 :rEST .tJAL .i.. -BINAril' FILE ~:rE.sr.BIN -LIS!' TO ~TT" K BINAril' FILE ON uNIT 2 BINAHl' FILE CLOSED CRCCHK KNT LOC LOOP L260 M50 PTQ RDCOO START 4001 4035 3602 4015 4006 403,7 403,6 40105 40V'1(~ L D-3 A The Keyboard Monitor is loaded and the DAte command is used to indicate the current date. The user requests a directory listing of cassette drive 1: he decides to zero the directory, thereby deleting all files present on the cassette. B PALC is called from the System Cassette. The input file, TEST. PAL, is stored on cassette drive 2. The user decides to specify as output only a listing on the line printer. Two errors are flagged by the assembler and printed on the console terminal during its second pass. C The listing is printed on the line printer. The user then marks this listing with appropriate corrections and insertions. D PALC prints a tC: the user makes sure that the System Cassette is still mounted on drive 0 and then types a tc to cause control to return to the Monitor. E The Editor is next called from the System Cassette so that the errors in the file TEST.PAL may be corrected. The input is again drive 2, and the output file will be sent to the previously zeroed cassette on drive 1. F The R command brings in the first page of text and the intra-buffer search is used to find the first error. This misspelling is corrected using the single character search command and the rubout character. G The next mistake occurs 7 lines :further in the listing: the incorrect character is found and corrected. The line is also listed to make sure the correction was made properly. H The user inserts a comment in thl~ 5th line forward from this line by skipping ahead 5 lines, searching for the A, and then adding the comment to the line. r The intra-buffer search is used to locate the next correction: a tab is inserted between the I and the tab already present. J The file is closed. K The user calls PALC again, specifying the edited file on drive 1 as the input. The IN option is used to obtain only a listing of the symbol table: the binary :file is output to drive 2, and the symbol table is listed on the console terminal. L After assembly, PALC prints tC and waits while the user makes sure the System Cassette is mounted on drive O. He then types tc and control returns to the Monitor. The user deletes the first input file (the uncorrected TEST. PAL) from the cassette on drive 2 to complete his session. D-4 APPENDIX E MONITOR SERVICES Included in this Appendix is information the user needs if he intends to create files using the PAL machinE~ language or re ference system device handlers. E.I MONITOR MEMORY MAP The CAPS-8 Keyboard Monitor occupies the following memory locations; if the user's program does not overwrite these areas of memory, the routines they contain will be available for use fran within his program and the Monitor may be restar1:ed after execution. (Section E.2 provides more information concerning these routines.) Table E-I Monitor ME~mory Map Contents Address FIELD 0 7400 7600 LPT and Console Terminal Handlers Bootstrap, KBD Handler, Interrupt Routine FIELD 1 5200-6200 6200 6400 6600 7000 7200 7400 7600 Keyboard Monitor and Conunands WAIT and part o:E Cassette HANDLER CLOSE and ENTER Cassette HANDLER LOOKUP UTIL and part o.f Cassette HANDLER Binary Loader Buffer E.2 MONITOR SERVICE UTILITY SUBROUTINES program to the routine The user may direct his subroutines providing otherwise destroyed. Table: E-2 of the following utility not been overwritten or Utili ty Subroutines and Locatior..s Address Name Location LPOCHR 07400 Service This routine is used t:o print a character on the line printer. The calling sequence is: E-l Table E-2 Address Name Utility Subroutines and Locations (Cont'd) Location Service COF (current field) CIF 0 TAD character JMS I (LPOCHR The character in bits 5-11 of the AC is added to the line printer ring buffer to be printed. TTOCHR 07402 This rout.ine is used to print a character on the console terminal. The calling sequence is: COF (current field) CIF 0 TAD character JMS I (TTOCHR The character in bits 5-11 of the AC is added to the teleprinter ring buffer to be printed. (The character will not print if ECHO is off at the time, but can be designated as a "must print" character by turning AC bit 3 on. This causes the character to force ECHO on.) LPPUTP 07404 This address contains the next free location in the line printer buffer. LPGETP 07405 LPGETP contains the previous location which was output in line printer buffer (never a pointer). LPCHCT 07406 This location contains the number of line printer interrupts yet to be expected. ECHO 07407 If this address contains -1, ECHO is off (no ECHO); if it is set to 0, ECHO is on. TTSIZ 07410 This address contains the length of the teleprinter ring buffer (number of characters it can hold). TTPUTP 07411 contains TTPUTP location in the buffer. TTGETP 07412 This address contains the last location 'which was output in the teleprinter buffer (never a pointer). E-2 the next free teleprinter output Table E-.2 Utility Subroutines clnd Locations (Cont' d) Address Name Location Service TTCHCT 07413 TTCHCT c::ontains the teleprinter interrupts expected. LPSIZ 07414 This location contains one less than the length of the line printer ring buffer (number of characters it can hold -1). MONRES 07415 l.fONRES is the location in field 0 which can be branched to in order to res tart the Keyboard Moni tor in memory (assuming the Keyboard Monitor has not been destroyed). Control jumps from this location to the routine MON. 07600 Branching to this location causes a complete reboots trap of the Keyboard Monitor from the System Cassette on drive O. If an I/O error occurs or if the cassette on drive 0 does not contain the file MONTOR.BIN, the system waits for the user to mount a good Sysb~ Cassette; typing a CTRL/C will then reboots trap. KBDFLG 07601 If this location contains a non-zero number, i 1: signifies that a character (other than CTRL/O or BREAK) was typed on 1:he keyboard and has not yet been read. It is lost if a second character gets typed before the previous one is read. KBDIN 07602 This location contains the last character typed on the keyboard. (Here BREAK and CTRL/O do count.) BREAK 07603 This locat.ion contains a 1 if a BREAK has not been used; 0 if it has. CTRLCJ 07604 If this location is 0, then whenever CTRL/C is typed, the Monitor will branch to 07600 and bootstrap (after the current cassette operation finishes). If not 0, then when the current cassette operation finishes, control is transferred (with interrupts on) to this location in field O. Set this to point to MONRES if the Kl:!yboard Monitor has not been destroyed. E-3 number yet to of be Table E-2 Address Name KBDCHR Utility subroutines and Locations (Cont'd) Location Service 07605 Same as 07600. 07626 This routine reads a character from the keyboard. It waits for KBDFLG to be non-ZE~ro, then zeroes it and returns the contents of KBDIN in the AC. The calling sequence is: CDF (current) CIF 0 JMS I (KBDCHR DISMIS 07645 The system branches to this to dismiss an interrupt. INTRPT 07657 The interrupt routine begins at address. LPBUFR 07731 LPBUFR is the start of the default line printer ring buffer (initially of length 2). TTBUFR 07734 TTBUFR is the start of the default teleprinter ring buffer (initially of length 30). MONSTART 15200 Branching to this location starts the Monitor, assuming that the entire Monitor is still in memory. The routine waits for TTY and LPT then resets buffers to defaults and empties them. Sets CTRLCT to point to MONRES. Sets ECHO on and sets BREAK to 1. Notes cassettes as not being in llse. MON 15201 This routine restarts the Monitor but does not do any of above. 15400 Starting at this location also restarts the Monitor and resets locations that may be in a temporary state if t:he Monitor has been stopped (e.g., by hitting STOP) prematurely. 16200 This rout:ine waits for the last cassette operation (if there was one) to complet:e. The calling sequence is: WAIT E-4 location this Table E-2 Address Name Utility Subroutines and Locations (Cont'd) Location Service CDF (current) CIF 10 JMS I nvAIT <error return> <normal return> If an error return is taken, bit 0 may be on and bits 4-11 will contain the conten1ts of status register B at the time of error. This routine should be c::alled sometime after every call to HANDLER. CINUSE 16273 a 0, If this location contains means cassettes are ready; 1 cassettes are in use; means -1 cassettes had an error in a previous operation. BSTATE 16274 This location contains the status of register B at termination of cassette operation. CLOSE 16400 Calling this subroutine terminates an output fille and writes a n.ew sentinel file at the end of the cassette. The calling sequence is: TAD (UNIT CDF (current field) CIF 10 JMS I (CLOSE <error return> < normal return> The error return is taken only if an end-of-tape is encounterec~ before the sentinel file is successfully written. BACK 16402 This routine positions the cassette so that the header record of the current file may be written over. The calling sequence (field 1 only) is: JMS I (BACK < error return> <normal return> ENTER 16404 Calling this subroutine opens a new calling ~?he file on a cassette. sequence is: E-5 Table E-2 Address Name Utility Subroutines and Locations (Cont'd) Location Service TAD (UNIT CDF (current field) CIF 10 JMS I (ENTER <error return> <normal return> where UNI~? is the cassette unit drive number. Before making this call, the user must set up the new filename in an in-core header record known as the SINCH. ENTER automatically puts the date and record size into the SINCH for the user. (The SINCH format is described in section E.4). The INCH is destroyed. HANDLER 16600 This routine calls the system cassette handler which is resident and will be used by all system programs. The handler routine is also available to any user who does not load over it. Before calling this handler, the user must ensure that the cassette is correctly positioned. See also LOOKUP, ENTER, and CLOSE. The calling sequence is: CDF (current field) CIF 10 TAD (UNIT JMS I (HANDLER ARGl (function control word) ARG2 (buffer address) <error return> <normal return> The unit number is left in the AC. Only bits 8-11 are used (units 0-17 octal). However, to specify unit 0, at least one other bit (of bits 0-7) must be on.. It is more convenient, therefore, to leave the unit number as a character in the AC (0-9 would be 60-71). A real l2-bit 0 in the AC means use the previous unit. (The initial un,i t is 0.) The function control following form: word Bit 0: 0 means read 1 means write Bits 6-8: field of buffer Other bits are ignored. E-6 has the Table E-2 Address Name Utility Subroutines ruld Lcoations (Cont'd) Location Service The length of the record (in 8-bit bytes) must have been previously stored in location BSIZE. The specified record size must be between I and 377. LOOKUP and ENrER return with BISZE set to 200 (:>ctal), the usual record size. If an error return is made, the AC bits 4-11 specify the ,:::ontents of status re<Jister B when the error occurred. These bits are summarized below: bit 4: bit 5: bit 6: bit 7: bit 8: bit 9: bit 10: bit 11: CRC/block error timing error EOT/BOT EOF drive empty rewind write lock ou 1: ready Bit 0 of the AC will be a 1 if the error occurred on the previous handler callI as opposed to the current handler call. This is because the! handler will wait (by calling W),.IT} if it is called while it is alrea.dy in use. The user can manually wai t for thE! cassette operation t,o be completed by calling WAIT. If an error occuru, bit 0 of the AC will always be on in this case. The user ~a.y check to SE!e if the handler ~s in use without waiting by interrogating the location CINUSE. Non-zero means that the handler is in use. Two successive calls to HANDLER should not be made uithout an intervening call to WAIT. BSIZE 17000 This location record size. LOOKUP 17002 Calling this subroutine positions a cassette at a specified file to be read. The calling sequencE~ is: E-7 contains the current Table E-2 Address Name utility Subroutines and Locations (Cont'd) Service Location TAO (UNIT COF FROMFLO CIF 10 JMS I (LOOKUP COF (filenamefld) ptr to filename <error return> <not found return> <found return> UNIT represents the cassette unit drive number. The header is put in the INCH. The filename consists of 11 consecutive ASCII characters. UTIL 17200 This routine allows the user to specify that a utility operation be performed. The user must be familiar with the hardware specifications as described in the TU60 CASSETTE TAPE TRANSPORT MAINTENANCE MANUAL (DEC-OO-TU60-DA) to understand what these operations do and what conditions cause errors. The calling sequence is: COF n CIF 10 TAD (UNIT JMS I (UTIL utility code <error return> <normal return> The following are legal utility codes; all other codes are illegal. 10 30 40 50 70 OPTl OPT2 OPT3 17400 17401 17402 rewind backspace file gap write file gap backspace block gap skip to file gap switch option characters (e.g., IA) stored as 36 bits for A-Z, 0-9 as shown in diagram in Figure E-l. E-8 Table E-2 Utility Subroutines a.nd Locations (Cont'd) Addres s Narne Location Service OPT 1 A B C 0 E F G H I J K L OPT 2 M N 0 P Q R 5 T U V W X OPT 3 y Z 0 1 2 3 4 5 6 7 8 9 Figure E-1 switch Option Characters SINCH 17403 See ENTER. DATE 1753117540 These locations contain 8 characters representing the da1:e (e. g. , 01/22/73). INCH 17600 See LOOKUP. E.3 RING BUFFERS Ring buffers must be located in upper core (4000-7777) of field O. They consist of one or more buffer segments, each one of which consists of two or more consecutive locations (the last one pointing to the next segment). The last segment points to the first one. Ring buffers can be changed by System Programs. Figure E-2 Ring Buffers E-9 E.3.l Modifying the Ring Buffers The initial ring buffer supplied by the Monitor consists of one buffer segment of length LPSIZE (TTSIZE) not counting the pointer. The first location is called LPBUFR (TTBUFR) and the last location is called LPBFND (TTBFND). The value LPSIZE-l (TTSIZE) is stored in the location LPSIZ (TTSIZ). The buffer is initially empty. The next location free in the buffer is pointed to by LPPUTP (TTPUTP) and the previous location which has already been output is known as LPGETP (TTGETP). Both these locations point only to positive words, never to negative pointers. LPCHCT (TTCHCT) is the ones complement of the number of characters left in the buffer to be output if I/O is still in progress. (Specifically, it is the number of flags which have yet to come up.) LPCHCT (TTCHCT) is zero (0) if there is no output in progress. To enlarge the ring buffer, wait until LPCHCT (TTCHCT) is zero. Then set LPBFND (TTBFND) to point to the start of the buffer and have the end of the buffer point to LPBUFR (TTBUFR). Change LPSIZ (TTSIZ) to be the length of the buffer (length -1 in case of LPSIZ) not counting pointer words. Interrupts may be on while this is done providing no LPT (TTY) I/O is initiated. E.4 HEADER RECORD FILE STRUCTURE All files the user creates must begin with a header record (40 octal bytes long), followed by 200 octal byte long records. The structure of a header record is as follows: Table E-3 Header Record Structure Bytes (octal) Description 1-6 Filename; may consist of any alphabetic character or digit and is padded with spaces on the right. 7-11 Filename extension; see Table 2-1 for recommended extension names. 12 File type; maintained by the system for its convenience and for standard compatibility. File types are: 1 2 12 ASCII file Standard DEC Binary File Bad file (Specified for deleted files) Refer to Section 2.2.1 these file types. for an explanation all of 13-14 File record length; always has the value 0,200 (i. e., 200) for compat.abili ty with standards. 15 File sequence number (not used). E-IO Table E-3 Header Record Structure (Cont'd) Bytes (octal) Description 16 Header continuation byte; always O. 17-24 ASCII date stored as dd rnm yy, or 6 s,paces if no date was specified when the file was saved. This is the creation date of the file. 25 File version number. are automatically EDITOR. 26-40 Not used. E-ll New files are version 0 and incremented by the CAPS-8 E.5 CAPS-8 BOOTSTRAPS The CAPS-8 Hardware Bootstrap is used to load the Cassette Keyboard Monitor into memory. This bootstrap is stored in the computer in read-only-memory so that it is always available for use. Pressing the sw switch on the computer console causes this bootstrap to be executed; it calls the program C2BooT.BIN into memory from the System Cassette. The CAPS-8 Hardware Bootstrap is comprised of the following instructions, included here for the user's information: PALe-V1 ICAS~FrTt SYSTEM el/04/73 1 HOOTST~AP I COPVkIGHT / iJ I (, 1 TAL t Q l' 1 F .'1 t tH COR P 0 RAT ION r'1 A Y I\i A ~ L', HAS ~ • ll! 1 7 '5 4 I PAGE lq7~ I 1ST A r< T '" "J G L () C II 1 I 0 (\j ( I\; 0 j.( MAL LV): 1ST At-. .( 1 i'J G L [) CAT I UN F (J f.{ C) SIB: b 7 ~~ lil ,c;CL~=b71.0 ~ 7 v'l K S I) "' ,,7 Co:,? "" S t t'-! : fo, "' C" 2- e J'.L' l, ~5rjF=hh~3 KLSA=b704 ~ 7 :i:;c" "SAF=67Vl,:) K (~ a A= 6 IV' b bh'7 7 (~162 K~5B=hI07 3~~'2 LqC=.sb~2 '" b~ v) * "HHH:l IPUP-8/E, -8/F, AND -b/M ONLY ILOCA1ION WHERE ScCONDA~V I~OOTST~AP REALLY G~TS LOADED CjS\'ll=7'~Il)t? IF!)Etr40(l;0. 1;>31 STArn, v'4V1V11 1 ~~ ~j f:. C~Cr.t1K, r! ~ (l ,I,? b7'Ot.:. KLSA ~J\ 4 i1 ~~ 3 b 7 ~: ... KGUA us~ TAD f'/j ':) VI TAD L2b0 I<S~F ~IJ ~):'I4 67~3 04005 52v.'4 kOCOIJ, 0400b 7?b~ L2h.(!1, ;'17 K S E. ~\I 04,,111 b 7l~2 I~, pl 3211 04·7112 .sh36 DCA I PTk' 04013 04014 1?~1.j b701J. l'Au kDCOD ""LSA 04yi 10 j 777 =b "/ 0 1 f::. 1 . .;4 b711.l~ ~4r ~ {1 ill 0 Jf"1P .-1 Ci"IL STA RAL CLA DCA • <*~~777;CLL> IINITIALIlE PULSE CLEARS THE LINK ICI"IAN('E READ CRC COOt (6) TO IwtWI~O <1> [BIN] ILOAO RtAu CRC CODE INTO STATUS II'{EGISTER A [JMP I START] IFI~ST TIMf: THROUGH, LINK MUST I tH: 1 HE f~F.: IINITIATf. THE OPE~ATION (READ IC~C OR ~EWINO UR FRWD FILE GAP) IREAOV? It\iO, \'IAIT IstT L=l ANU AC= A HALT (7776) IANY f:RROR8? I t'-J 0 SKP E-12 IHALT ON ANV tRROR tXCEPT FOR IREwIND OR FRwO FILE GAP ICAN'T ALLOW 'TAD I PTR' LATER ITO AFFtCT LINK IGET CODE ~OR READ (0) ILOAO INTO STATUS REGISTER A LOIJP, KGOA 1214015 b7~fo, 04e.1h b7?Jl KSOR 04017 Q'l4020 04v.:21 5216 743Vl JMP .-1 HSw SZL 0lHl?2 1,,36 7(122 TAD 1 PT~ CML HSw 04V123 H~02 ICA5StTlt SYST~M IFIRST TIME STORES 113 INTO MEMORY I(a-BIT COMPLIMENT OF RDCOO) lorHER TIMES ~EAOS ONE 6-61T IS"TE OF PAIR /NE:w DATA WORD REA)Y? INO, wAlT IMOVE b-tHT BYTE T1 H.O. Ae /wHICH 6-tHT BYTE JF THE PAIR? 12f'.W. SO ADO IN 1ST BYTE IS~IAP BACt( AGAIN. SET LINK TO ~nUT51kAP ~ 1/ 04 I 73 PAL C- V 1 P ~, GEl .. 1 IINDICATE NEXT ~YT~ ISTORt BACK INTO MEMORY I A Ri:. wf. 0 aNt. LOA 0 I ~I G BOT H b .. BIT rIl4~i:i" 3f.36 uCA I PTj.( itluV,'.?5 7 q;n, S~L 0q~~?f, (!fJ_"h ISZ PTR fJ,4l27 lSi ~NT Cilqjl3~~ 223'-; 5215 JMP LOOP rilu~31 "3~b STA eLL RTL II:3VTE~? '047:32 0~0~3 lYE S, SOP 0 I NT T0 ~I EXT IHUMP COUNTtR W0 R0 IREITi:.RAH:: IsET b~~ I C; ~".' ;;> M EMaR v AC=7~11 LJ C A '"' t~ T I S ETC aUN T T 0 ALL. CI w REA 0 1 NG A BYTE RECORD JMP CHCCHK IGO CHECK THE CRC rl 5 1 I 0 ~ ~ ESC 0 MPLIM E. NT 0 F' N UMtj E R 0 F IhYTES TO L.OAD LOC-2~ IMEMORY LOCATION TO BEGIN LOAD AT -~0 lelA SPA SZL UUlIN t t3 i ~~ AR Y L U A05 Ii I N A~ Y r I L ES 1 "i TOM E M0 R Y • :S" j':5 121210 ~q ~~" u 5?'V.l (·"4(1 _~5 77 :S I /C. t-lT , 04L'; ~~6 y::;~ 7 Plrt, rJ:4,7}~ ., 7., .S [,1 M~0, / T 1"'1 J:" I'( IIf bt~INS bY lOAOING A RECORn OF SIZE 40, I T1"'1 t: t\J Cn N TJ. j\! U t: S Tn L. 0 Al) sue r. i:. S :) I v ERE COR 0 ~, IT~I~ ~PUr.lSS I (L n l, t. I JON 5 EACH 0 F 5 I ZE UNTIL IT DESTROYS ITSELF. REP L. ACE. D B Y J 1>1 P I (b t N ] CO~TINUE5 A r\l f) 4 ~ i 0 1 ARE. StCOl\l)ARY bUOlSTi'<AP. 4 v'I ~--l 0. /f'.v 1 He I T ~, t F 1 k S T "'1 t: M() k V L0 CAT I 0 '" ~ t: F 0 F< E A NEw C~, SSE. TTERE COR I) I I S k t. A f) I ~~ I S L (J A Ij E (j wIT H A RAN IJ 0 M VAl UE (1 7 3) • I S I.' eLf: S S 1 V t: ~'i 0 f.< D~ ARt. L. 0 A 0 t: 0 WIT H THE 1 2 .. ~, I T QUA N TIT Y, wH~kE A A~D d ARE SUCCESSIVE b~8]T 8VTES ~ROM CASSETTE ~ECOHO. I 1\' r A : I J i\j GL E. ~ ~ I-Je) h- I) SGt. i LUA 0 ED 1 F THE: CAS S F. TTEe 0 NTAINS 11~0~+n, /l~E I H - .3 1. 1 / l' H f fi Y TI:.. S 1\ ~ C t:. N H I:. A I) t IRE GIN i\I I ~,I b (A (" i) A ~ n \AI h t: r~ "" l) f 1 H t. II () UE 5 ) HAP P E. N wH t: r-.I ' LOA DIN G ,. LOA UI N G' T~i E 0 Rr GI "I AT THE. k E C [) to: l) • E-13 ICASSETT~ SYSTEM bOUTSTRAP PALC-Vi CRCCIofK 4i(:W 1 t<NT 4~3S LOC 3b02 LOOP 4~15 L 2 b i?I 4 0 vjf;) M50 4037 PTR 4030 RDCOO 40frj5 STA~T 40~0 E-14 01/04/73 PAGE 1~2 C2BOOT.BIN is the bootstrap which loads the Keyboard Monitor into memory. It is stored on the System Cassette and is comprised of the following instruc:tions: PAGE 1 / .)t:I... ON[)A~1( 60UT" ri-<AF / CO~YHIG~r I u 1 i; I 1 ,\ L t r~ LI I P t.1 t. ~~ T / ttAO-u\i'tu, / S.ki. ~1~S~. [(H~ P (H( AT I 0 II; 101/';)14 =7 ;iI,/)C! 7 fh·jc fi S"J " 1 ii1 1 ",StiR:hlVl h7!"il "'.-; l'l F-" =" 6 7 ",d I V' 1 KSHF:67C'1j b7 ;/1~ :o\LSA=6/V1u h 7 (i:~ K.t;,OA=6/~~b ~ 1~:J 7 lY/~ 1'\~::-;e=6/(/jl fJ(')PUI\JCh * _~ h. \~ d ti~f-lLJNr:H oil S., vi 2 7,3" ~J :s (1 V, Ct' 4 72 ..1':) .~ t1 I !'~ , q 7 1 ~ ~i3 (13 ~:l ') .s~3(1 1.13" VJ b .L~1i~':'i ITsFLn, 11 S OK (i, SIA IJ C 1\ b~: I'd~ T TAu IIC14 QCA ll)FV1 !-LU GRL, /ASSvMf:S OkIGIN ALwAYS APPEARS FIELD St.T1IN(; /AFTEf( (113':<·1'7 7 ?'Hi' i1 ~ ~ 10 :~.3 ~17 l}e A V'I.$"" 1 1 C1:S b 1 2 42'L~ V'J:Sbl.3 71 1. C JMS t.;ETbvT !iSlA! elL kTt-? I ~ 'S:,;? Sit.. ?I:~o14 I :,hJ c' bTNl.UR, r-UOL, STA ()t-?l!tS~ 0:s.,1'=' ~~y; JMP Ii'l~hlb 7 '='1 '" SPA /;;1T 4=0 ~n~ 1 7 c~~.~7 JSl urH,S'·J II~ (~'5b20 ., r~l/j·l ~:S~21 77;;J~ 1\1 ., ~~ ~j v.l , SPE:C /hll NOP 1;"~~~2,) 7 1 '/~ 4 elL kAl 331;:;" [) C 1\ T tI"l JMS 6F.TdYT 1~~1"I24 4 () ,~'~ ~.~o25 :~ -~ ~.? b 13C.~t- fAD H:{vI 2.s":'7 ISZ OR6S~: ~1:S 10, ~ I ~2~0~ JI-1P lr~ORt; l~ ~~.30 I /.H~1? 3 7 i.:i'-, 1i1.3~3.3 2 hj~ b 2 vj 1 ~~3t'>34 ':J r? '.) -, ~~_~"52 [tJ363~ 7 'i\~ ~l IJl~6 36 Sj(()~ ;,j ~~ _~ 7 7 :.1):1':) vn6"'0 02;2 :.1 1 ;i1 \~12 ~n~41 ?Ij£'u(t ':>? ({il.l :HZi,1 2317 ~n~~5 52/4 v)3~~b 131 1 ('n~~? ~!l:~-:,~3 FlD, /COM"INE HLT DCA I ORe:; ISZ ORG CO~~" ~PtC, GfTIH T, CUf' V1 Jf.,P bI"'LOR ~MA' JMP RTL ANn N7V100 t1 S ~j JMP ITSFLO "ISZ JMIoJ TAO l"lOf\i GR"NT RDt:n'TE X 2b~' E-IS (T \~ 0 ORIGIN I<AL ~1 j ~ (I 3 ~U"31 4=1 IORJGIN wORD COMMA"'!,)) P~l.C-V1 :, -, ,):" .:.. ~ ~ ~ " ... t ... r,? ;." ") I \ 7 : '::J "7 !,' ~ft., ' , ,lJ " .) ~ (' "-.')n .S ... ., ~ _ f-, ,/1 <, .., ... 1 "'~ '2 ~ c~ ~...,!-) " ."~' n oJ ,', <, "" ;1 ., , ., .' ,.., r",,,-... "'I ;."I 'j ,..., ; 1 ~/i _ v , ,<' 'I 7 ? ,.' :) "" ~C" : .~ r\ll) SZ.,l , .1", ~ ..d~ ~ J"h \? r A.l) l 12 I '1 I t '"' 1 ~2 ? Sll .~ 0 , , t., .' ,) J~"\I"' ",:, -- .. ; ) ",', It, .-1 " [~fJ A .. ') II ~ oj') l l, J ""P ~,~ Ii ,j ~1 "; T '"'. Su~ ... !\ ." 7 ~ 1 b Ii'. II" )I?~':,~ I'\L,sA C' ,"':' / I X IJ v.i V 'r! llql ,,(;()4 I ,;~ ~ '! 1 rj~7 1 'J ~ '"' :,; ,q ;J " 'A '2'f:J CA 1.1 h I ;;'t~r.T I A ~i :.'." ,.... i ... 1 ., r F ,-' T, :, ,~ ~ .J Mr-J I~ r 1 5 ~ I. r 1~t 7 I 7 '-+ t l~sr ,\I () 1 r,; ~ T l~L ~?"'" \ oX eLI< til T j "':'ir .-1 jMP "",,,,;4 1 ! " ·-11 ! ~., " .<\ ~ !" :;,dF ,'. 1 , .'. .1",S \\r,U~ ... ,-1...., 1 ~.' ~ ~ :-\ '-:, A + .' .... ., ., ~ 1 , .... PAGE 1-1 'i •~1 l; r T b Y r P I ., IL()CATI[)i~ 3701 IPI-(IMA~'f l.()AI)Ek 15 ~KIPPED t.~.pur.cr- " .~ 1 \ ~ 2 r- ,.... 1 " v,,'o ! I' ~ (~ .) 1 , 14 ::, I ~. !.l ,~ ,<' 7 :, r:' " r) :~ , <, C l)t L J to 1 !'} ~IMI"' 1 .+1 '-; 2 ,) ;,~ p ") LJ "'I'; , :';,'11,,", T ~ .~ , V' r' ,~ I \/ I I);'" l~ ~.' , 11 (: ~ ~ !I 7 1 r) . ,: ~ \ ' : : ~ ,i~. 2vl~l ~\ ~ i 1 1 ~,~ o:'l {j t:'hCII \:,,57';:> 1I~:5 7 1 ~ \~ 2 i'l ,,2b/i, ,'( ? 7 (~ , 17 ."., X '( '/ :5 , , /7,57 V~71~ i+'~ 3 t" X";;J T , ~~).3 ':i ;,137 1 " ~15 I 1 h VI ~ 7 1 1 4',' j~ )( ~ f r< , l~ ~j _~ ,... 4 \'~..:J 2 X 4 ~\ 'lt~, 4 ~~\.~? Sf.' lO.. ~j I , Ii, , 'I 14 x777 ... , I '1 l7 i- 1 f' -; I 7 '-'4 -1 ;" :5 ., ;~} '!~ '.:..'3"? 1 ,·1 ~ , 2. ? /. 3 7 2 5 2/.1 , / ~ ,j \/' J,. ,,, ~"' , 7 ~11'·1 V; '~ j ,/: rd::jF, I v.l , ;l),'024 TAU ["3725 DCA /StT UP PRIMARY IF-"Uq RtUSE x17.51 1 xK1\;T E-16 ~OOT5TRAP tjy PAGE 1 ... 2 SECON0ARV ROOTSTf(AP / ).PTI< OCA I TAO >;3211 UCA 1 ~t.l1.l11 V'37i!b ftj7?7 [~3 7 3(J1 3715 ~1 3 7 3 1 "'2:~ "\~13~ 5211 )(.3211, 3211 1/:3733 0jl34 4 iii 1 1 X4~i1!, 4011 c,,~nvH) 3~0)2 [i'.~ ;101 .,,, i/' (11 l.~~~ ~7j~ .} MP I FO~ LOCATION 4011 ~ESt:::T ZtSLOCK 1'00~- • 1'31f\J .1 MP I • -1 vHh.)~ /A "DCA ." IMUST t~O IN OCTAL ~0 u., (' PA[';E H 1 j\ b I .s~tIl2 la. P 1'1 .s b it) I ell r ~l .s~:d.5 1 FIFfsT -~ ,~ FLU .s '" .s 11\ FliCJL r;t. 1 en'T j;"l.d (.; ~ i( ~, 1 IT~rLlj 3612 ~ 11 7 .s.., it) J~ jo,,'lI:' JTS(Hc'b KSolF b 7 "'1 .'1 [j, 57;<2 ;\JlJ r I- S 1 ~J 1 •. ~ ,:' ~~ .3~h~ 5h2v i.J f'( : ; ~ I r'""I-:;,,,,,,1 j 'I.) 7 ~ ~J '"" Y T t. ;;, t". ~r. T Sh I.~ S~) tC T f-, ',~ Y,..: "i T x (: /" ':1 2. 1',1 '<:5 --: 1 1 X'+ ,~'/"2 '( 4 ~ 1 1 'Y. l"7 k.' it~ V'::; .~ 72.3 "fo,y~ S' .;J.., ~ i 1 .,. .s 1 , .:oj 37 1\1 j I 1 1 .5 , 1 ;~ 31 .~2 :s I 1';' 5 7 3:~ ~q ?? I I _~ 7 .5 I , ~ .; ., I II~ :5 72·' V. E-17 1-3 APPENDIX :F ASSEMBLY INSTRUCTIONS CAPS-8 source programs are supplied on DECtape. These sources are assembled with PAL 8 and copied to cassette with PIPe. To build the CAPS-8 system cassette with PIPC, the user must load tt.e OS/8 cassette handlers as described in USING AND LOADING YOUR NEW OS/8 CASSETTE HANDLERS (DEC-S8-UCASA-A-D). The follo'V1ing instructior..s may be used to assemble the sources, print source listings, and create the CAPS-8 system cassette on drive O• • rl ~ALtS *C2BOOTITE~P<C2Boor .H CkEF *IEMt-' • rl tlAU~ *MONTOHITEMP<CASMON .H CHEF *rEZVirJ .rl PAU~ *~¥~COPITE~~<S¥SCO~ .H CHEF *TEl'Y'J-l .ft PAL8 *EDI IC ITEtw'jp <EDI IC .h. CriEf' *TEft':,P .H rJAL8 *PALC I TEMP <PALC .H CHEF *TE~P .H PALS *CBASICITEM~<CBASIC/K .rl PIrJ *LPT: <TEMP. LS .ft PIPC *CSA0:</Z *CSA0:C2BOOT<C2BOOT/8 *CSA0:MONTOH<MONTOH/8 *CSA0:S¥SCOP<S¥SCOP/8 *CSA0:EDITC<EDITC/B *CSA0:PALC<PALC/8 *CSA0:CBASIC<C8ASIC/B *TT't':<CSA0:/L F-l INDEX Addressing, BASIC, 6-51 Alteration of text, 3-12 ALTMODE Key, 6-52 in BASIC, in Editor, 3-7 AND, Boolean, 5-15 Angle brackets, left/right Editor, 3-7 PALC, 5-19 ANORM subroutine, BASIC, 6-47 Append command, Editor, 3-9 Arithmetic operators, BASIC, 6-4 Arithmetic statemen·t, BASIC, 6-11 Arrays, BASIC, 6-29 maximum number, 6-28 maximum size, 6-30 ASCII character set, A-I ASCII format files, 2-1 Assembler output, P.ALC, 5-32 Assembly instructions, CAPS-8, F-l Autoindexing, PALC, 5-23 Cassette directory listing, 2-1 filE!, 1-4 format, 1-4 handler, E-6 mnemonic code, PALC, C-3 mounting/dismountinq, 1-4, 1-5 Cassette, BASIC, 6-1 CHAIN statement, BASIC, 6-33 Changing text, Editor, 3-12 Characters, ASCII, A-I CTRL, 2-4 Editor special, 3-4 Monitor switch option, E-lO PALC, 5-5 PALC special, 5-17 Character searches, Editor, 3-16 Character string search, Editor, 3-15, 3-17, 3-19 CLOSE statement, BASIC, 6-15 Coding formats, BASIC, 6-44 BASIC language, 1-2, 6-1 Coding practices, PALe, 5-32 arithmetic statements, 6-1 CODT, 7-1 additional techniques, 7-9 calling, 6-2 co~nands, 7-2 to 7-8 editing and control commands, 6-52 co~nand summary, 7-11 error messages, 6-57 ERRORS, 7-9 error message summary, B-6 fea·tures, 7-1 example run, 6-8 illegal characters, 7-8 floating point package, 6-50 indirect references, 7-9 functions summary, B-lO interrupt program debugging, 7-9 immediate mode, 6-6 octal dump, 7-9 numbers, 6-2 operation and storage, 7-9 statements, 6-10 pro9ramming dates, 7-10 statement summary, B-8 storage requirement~s, 7-10 symbol table, 6-59 TTY I/O-FLAG, 7-9 variables, 6-3 using, 7-2 BEGFIX subroutine, BASIC, 6-47 Colon (:), 3-7 Binary format files, 2-1 Command format, Editor, 3-8 Binary output, controlling PALC, Command mode, Editor, 3-4 5-28 Commands BKWD statement, BASIC, 6-51 BASIC, 6-6 Boolean AND, 5-15 Edi tor summary, B-· 3 Boolean inclusive OR, 5-15 keyboard monitor summary, B-1 Bootstraps, E-13 COMMA.S statement, BASIC, 6-20 BOOT PROGRAM, 9-1 Comma used as format control BOOT, 9-1 character, 6-17 Legal Mnemonics, 9-2 Comme:nting the program, BASIC, 6-10 Brackets, Comments, PALC, 5-7 angle 5-19 Conditional assembly pseudo-operators, square ([]), 2-4 PALC, 5-28 BREAK command, BASIC, Condi.tional delimite::-s, PALC, 5-19 Conditional transfer, BASIC, 6-28, Calling 6-32 BASIC, 6-1 Console terminal output, PALC, 5-2 Editor, 4-1 Control characters, BASIC, 6-17 PALC, 5-1 Control commands, BASIC, 6-52 4-1 System Copy, Controlling PALC binary output, 5-28 CAPS-8 Cassette, Slge cassette Conventions of systen, 2-1 4-3 Carriage return, «» «», X-I Corrections, Keyboard Monitor, 2-3 Creating run-time input files, BASIC, 6-25 CTRL/C Editor, 4-3 BASIC command, 6-54 CTRL characters, 2-4 CTRL keys, Editor, 3-5, 3-7 CTRL/O command, BASIC, Current line counter, Editor, 3-6 Current location counter, PALC, 5-10 DATA statement, BASIC, 6-12 DAte command, 2-7 DECIMAL pseudo-op, PALC, 5-24 Default device, PALC, 5-2 DEF statement, BASIC, 6-43 DElete command, Keyboard Monitor,2-8 Deletion of page, Editor, 3-14 Deletion of text, 3-12, 3-13 Delimiters, PALC conditional, 5-11 Delimiting character, PALC, 5-6 Device, default, PALC, 5-2 Device handlers, 2-11 Devices, I/O, 2-2 DIM statement, BASIC, 6-30 Direct assignment statement, PALC, 5-12 DIrectory command, 2-7 options, 2-8 Directory of system cassette, 2-1 Dismounting a cassette, 1-5 Editor, 3-21, 3-22 summary, B-2 Keyboard Monitor, 2-12 summary, B-1 PALC, 5-34 summary, B-5 System copy, 4-3 summary, B-4 E-type notation, 6-2 Example programs, BASIC, 6-8 Expansion of text, Editor, 3-12 Exponential format, 6-2 Expressions, PALC, 5-14 EXPUNGE pseudo-op, PALC, 5-29 Extended memory, PALC, 5-27 Extensions of filenames, 2-2 FAC function, BASIC, 6-47 FENTER statement, BASIC, 6-45 FEXT statement, BASIC, 6-45 FIELD pseudo-op, PALC, 5-25 Field of nesting loops, 6-28 File formats, 2-1 File gap, 1-4 File header record, 1-4 Filenames, 2-2 Files, multiple input, Editor, 3-2 Files, transferring individual, System Copy, 4-1 File types, E-l1 FIX subroutine', BASIC, 6-47 FIXMRI pseudo-op, PALC, 5-29 FIXTAB pseudo-op, PALC, 5-29 Floating-Point format, 6-46 normalized, 6-47 Floating-point package, 6-45, 6-50 FNA function, BASIC, 6-43 Form Feed Editor, 3-5 PALe, 5-7 ~ormat control characters, BASIC, 6-17 Formats for BASIC numbers, 6-2 Formats of files, 2-1 FOR-NEXT loop, BASIC, 6-27 exiting from, 6-28 FOR statement, BASIC, 6-27 Function addresses, BASIC, 6-45 Function control word, E-6 Functions. BASIC, 6-37 summary, B-10 Editor, 3-4 user coded BASIC, 6-44 FWD statement, BASIC, 6-51 Editing and control commands, BASIC, 6- 52 Editor calling, 3-1 character searches, 3-16 commands, 3-8, 3-12 command summary, B-3 demonstration run, 3-23 error messages, 3-21, 3-22 error message summary, B-2 operating modes, 3-4 text collection, 3-15 EJECT pseudo-op, PALC, 5-30 End of file, PALC, 5-26 End of pass, PALC, 5-19 END statement, BASIC, 6-11 ENPUNCH pseudo-op, PALC, 5-28 Entering text strings, PALC, 5-27 Equal sign (=) BASIC, 6-6 Editor, 3-7 Erase (CTRL/U), Editor, 3-5 Erasing a program in memory, BASIC, 6-55 GET function, BASIC, 6~41 Errors, Keyboard Monitor loading,2-3 Getting on-line, 2-1 Errors in Programming, BASIC, 6-59 GOSUB nesting, maximum level, 6-37 Error recovery, Editor, 3-5 GOSUB statement, BASIC, 6-35 Error Messages, GOTO statement, BASIC, 6-3.2 BASIC, 6-57 summary, B-6 X-2 Hardware bootstrap (MI8-E), 1-1 Hardware component!:~, 1-2, IFDEF pseudo-op, PALC, 5-28 IF END# statement, BASIC, 6-3.4 IF GOTO statement, BASIC, 6-32 IFNDEF pseudo-op, PALC, 5-28 IFNZRO pseudo-op, PALC, 5-28 IF THEN statement, BASIC, 6-32 IFZERO pseudo-op, PALC, 5-28 Illegal symbolic addresses, PALC, 5-10 Immediate mode, BASIC, 6-6 Implementing a user-coded function, BASIC, 6-44 Incorpora ting subrcmtines with UUF, BASIC, 6-46 Incremental value, BASIC, 6-27 Index in FOR statement, BASIC,6-27 Indirect addressin9, PALC, 5-20, 5-24 Initial value in FOR statement, BASIC, 6-27 Input commands, Editor, 3-9 Input file extensions, PALC, 5-1 Input files, creation of, BASIC, 6-25 Input specifications, Editor, 3-2 PALC, 5-1 System Copy, 4-2 INPUT statement, BASIC, 6-14 INPUT# statement, BASIC, 6-16 Input/output devices, 2-2 Input/output statements, 6-12 Input/output transfer micro- instructions, PALC, 5-2 3 Insert command, Editor, 3-14 Instructions, PALC ,. 5-6, 5- 30 Instruction set, Bl~SIC, 6- 50 Interactive progra~~ing language, BASIC, 6-1 Integer number format, BASIC, 6-2 Inter-buffer character string search, Editor, 3-19 Internal format, BASIC, 6-44 Internal symbol representation for PALC, 5-13 lhtra-buffer character string search, Editor, 3-17 INT function, BASIC, 6-38 INT(x) , integer function, BASIC, 6-3 8 I/O designations, 2-5 lOT microinstructions, PALC, C-2 Keyboard monitor, 1-1, 1-2 commands, 2-5 command summary, B-1 error messages, 2-12, B-1 loading and using, 2-3 memory map, E-l services, E-l X-3 Keyboard reader mnemonic code, PALC, C-3 Keys, special Editor, 3-5, 3-6, 3-7 Labels, PALC, 5-6 Lang·uage, interactive programming, (BASIC), 6-1 Leader-trailer tape, 1-3 Left angle bracket «), Editor, 3-7 LET command, BASIC, 6-7 LET statement, BASIC, 6-11 Levels of nesting, maximum, 6-29 LINE! FEED key, Editor, 3-6 Line! printer listin9, Editor, 3-11 Line! Printer mnemonic code, PALC, C-3 Line printer output, PALC, 5-3 Link generation and storage, PALC, 5-30 LIST and LPT command, BASIC, 6-54 LIS,]~ command, BASIC, 6-53 List: commands, Editor, 3-10 List:ing a program, :3ASIC, 6-53 List: of arrays, BAS IC, 6-28 Literals, assigning PALC, 5-18 Load command, 2-7 Loading keyboard monitor, 2-3 Local symbolic addr1asses, PALC, 5-9 Loops, 6-27 LPT and RUN commands, BASIC, 6-54 LPT statement, BASI<:::, 6-21 Matrices, BASIC, 6-29 Maximum level of GOSUB nesting, BASIC, 6-37 Memory extension control, PALC, C-4 Memory map, Monitor, E-l Memory reference instructions, PALC, 5-2 0, C-l Microinstructions, PALC, 5-21, C-l, C-2 MI8-E hardware bootstrap, 1-1 Monitor, see Keyboard Monitor Mounting a cassette, 1-5 MOVE~ text, Edi tor, 3-15 MQ microinstructions, C-2 Mu11:iple files, 2-6, 2-7 Editor input, 3-2 Mul t.iple input cassettes, PALC, 5-3 Multiple statements, BASIC, 6-10 Mul·tistatement lines, PALC 5-8 NAME command, BASIC, 6- 56 Nested parentneses, BASIC 6-5 Nes-ting, level of GOSUB, BASIC, 6-37 Nesting, Levels of, 6-28, Nesting loops, 6-2f Nesting procedures, 6-28 Nesting subroutines, 6-36 NEW statement, BASIC, 6-2 NEx'r statement, BAEIC, 6-27 NO COMMAS statement., BASIC, 6-20 NOPUNCH pseudo-op, PALC, 5-28 Normalized Floating-Point format, BASIC, 6-47 NO RUBOUTS command, BASIC, 6-52 Numbers in BASIC, 6-2 in PALC, 5-9 of statements, BASIC, 6-10 Numbers, version, 3-3 Octal pseudo-op, PALC, 5-24 OLD statement, BASIC, 6-2 OPEN statement, BASIC, 6-15 Operands, PALC, 5-7 Operate microinstructions, PALC, 5-21, 5-22, C-l, C-2 Operating modes, Editor, 3-4 Operators, BASIC arithmetic, 6-4 PALC, 5-14, 5-15 relational, 6-11 Options, PALC, 5-5 OR, Boolean inclusive, 5-15 Order of execution of BASIC statements, 6-10 Output commands, Editor, 3-10 Output file extensions, PALC, 5-2 Output file, Editor, 3-3 Output specifications Editor, 3-2 PALC, 5-2 System Copy, 4-2 PAUSE pseudo-op, PALC, 5-26 Permanent symbols, PALC, 5-9 Permanent symbol table, altering PA.LC, 5-29 PRINT command, BASIC, 6-6 Print positions, BASIC, 6-40 PRINT statement, BASIC, 6-16 PRINT# statement, BASIC, 6-20 Print zones, 6-17 Priority of operations, BASIC arithmetic, 6-4 Programming errors, BASIC, 6-59 Program Assembly Language for Cassette, see PALC Program chaining, BASIC, 6-34 Program preparation, PALC, 5-32 Program storage, BASIC, 6-1 Pseudo operators, PALC, 5-24 summary, C-4 PUT function, BASIC, 6-42 Radix control, PALC, 5-24 Read command, Editor, 3-10 Reader record file structure, E-ll READ statement, BASIC, 6-12 Real format, BASIC, 6-2 Record, file header, 1-4 Relational operators, BASIC, 6-11 Relative addressing, BASIC, 6-51 REMARK statement, BASIC, 6-10 Renaming a program, BASIC, 6-56 RETURN key, Editor, 3-5 RETURN statement, BASIC, 6-35 Return to command mode, Editor, 3-5 Page deletion, 3-14 Reserving memory, PALC, 5-27 Page format, PALC, 5-29 Resetting location counter, PALC, PAGE n pseudo-op, PALC, 5-26 5-26 Page zero addressing, PALC, 5-24 RESTORE statement, BASIC, 6-13 PALC (Program Assembly Language for Rewind button, 1-6 Cassette), 1-2 REwind command, 2-10 assembler output, 5-32 Right angle bracket (», Editor, 3-7 calling, 5-1 Ring buffers, E-IO coding practices, 5-31 RND(x) function, BASIC, 6-39 character set, 5-5 RUBOU'1~ command, BASIC, 6-52 delimiting character, 5-6 Rubout key, 2-3, 3-5 error codes and conditions, 5-33, Run command, 2-6 5-34 RUN command, BASIC, 6-54 error message summary, B-5 Running a BASIC program, 6-54 format effectors, 5-7 Run-time input file creation, BASIC, instructions, 5-20 6-·25 link generation and storage, 5-30 Run-time output files, BASIC, 6-15 numbers, 5-9 options, 5-5 permanent symbol table, C-l SAVE command, BASIC, 6-56 program preparation, 5-32 Saving a program, BASIC, 6-56 pseudo-operators, 5-24 SCRATCH command, BASIC, 6-55 statements. 5-6 Search for character, Editor, 3-16 symbols, 5-9 Search for character string, Editor, Parentheses in BASIC, 6-5 3-13, 3-15, 3-17, 3-19 Pass 1, PALC, 5-1, 5-3 Semicolon used as BASIC format control Pass 2, PALC, 5-1, 5-3 character, 6-17 Pass 3, PALC, 5-4 X-4 Sentinel file, 1-4 Service utility subroutines, Monitor, E-l SGN(x) function, BASIC, 6-38 SHIFT/O command, BASIC, 6-52 Single character search, Editor,3-l6 Sign bit, BASIC, 6-46 Skip command, Editor, 3-15 Slash (/) symbol, Editor, 3-6 Software components, 1-2 Spaces, BASIC, 6-5 Special characters ,. PALC, 5-17 Specification options, 2-5 Square brackets ([]), 2-4 Statement numbers, BASIC, 6-10 Statement summary, BASIC, B-8 Statements, PALC, 5-6 direct assignment:, 5-12 Statement terminators, PALC, 5-7 STEP value, BASIC, 6-27 Stopping a run, BASIC, 6-54 STOP statement, BASIC, 6-11 String search termination, Editor, 3-20 Subroutines, Monitor service utility, E-l Subroutines, BASIC" 6-35 Subscripted variables, BASIC, 6-29 Subscripts, BASIC, 6-30 Suppress listing, PALC, 5-27 Switch option characters, E-10 Symbolic addresses illegal in PALC, 5-10 Symbolic Editor, 1·-2, 3-1 SYmbolic instructions, PALC, 5-13 Symbolic operands, PALC, 5-13 Symbols, PALC, 5-9 Symbol table, BASIC, 6-59 PALC, 5-11 Syntax error, Editor, 3-22 System cassette, 1-4 directory, 2-1 System conventions, 2-1 System Copy (SYSCOP), 1-2 calling, 4-2 error messages, 4-4 error message summary, B-4 example, 4-3 options, 4-2 System demonstrati()n run, 0-1 System programs, 2--1 TAB function, BASIC, 6-40 Tabulation (CTRL/TABJ, Editor, 3-7 Tabulations, PALC, 5--7 Teleprinter/Punch mnE~monic code, PALC, C-3 Terminal value in BASIC loop, 6-27 Terminating assembly .. PALC, 5-34 Terminating string sE~arch, Editor, 3-20 Terminating the BASIC program, 6-11 Text collection, Edi t:or, 3-15 Text mode, Editor, 3--4 TEXT pseudo-op, PALC .. 5-27 Text transfer commands, Editor, 3-11 Transfer of control statements, BASIC 6-31 Transferring individual files, System Copy, 4-1 Transition between modes, Editor, 3-4 TTY OUT statement, Bl~SIC, 6-22 TU60 dual cassette unit, 1-5 Uncondi tional transfE~r, BASIC, 6-32 Underlining in exampJ.es, 1-6 User-coded functions examples of BASIC, 6-47 User-defined symbols PALC, 5-9 Using cassette, BASIC, 6-1 Utility codes, E-9 UTILITY PROGRAM, 8-1 error messages, 8--2, 8-3 options, 8-1 UTIL, 8-1 j' j' Varia.bles, BASIC, 6-3 subscripted, 6-29 Version command, 2-10 Version numbers, Edit.or, 3-3 Write protect tabs, :L-3 Writing the program, BASIC, 6-47 X-5 XLIs'r pseudo-op, PALe, 5-27 Zero command, Keyboard Monitor, 2-9 Zeroing output file, 4-2 Cassette Programming DEC-8E-OCASA-B-D ~;ystem Users Manual READER'S COMMENTS NOTE: This form is for document comments only. Problems with software should be reported on a Software Problem Repcrt (SPR) form (see the HOW TO OBTAIN SOF~:WARE INFORNATION page) . Did you find errors in this manual? If so, specify by page. Did you find this manual understandable, usable, and wel.l-organized? Please make suggestions for jrnprovement. Is there sufficient documentation on associated system programs required for use of the software described in this manueLl? If not, what material is missing and where should it be placed? Please indicate the type of user/reader that you most nearly represent. o Assembly language programmer o Higher-level language programmer o Occasional programmer (experienced) o User wit:h little programming experience o Student programmer o Non-pr09ramrner interested in computer concepts and capabilities Name Date ______________ Organization Street _____________________.___________________ City _______________________________________ State ______ Zip C ______________________ or Country odE~ If you do not require a written reply, please check here. 0 .------------------------------------------------------------Fold lIere------------------------------------------------------------ .----------------------------------------------- Do Not Tear - Fold lIere and Staple ----------------------------------------------- FIRST CLASS PERMIT NO. 33 MAYNARD, MASS. BUSINESS REPLY MAIL NO POSTAGE STAMP NECESSARY IF MAILED IN THE UNITED STATES Postage will be paid by: ~lImllDmD Software Communications P. O. Box F Maynard, Massachusetts 01754 HOW TO OBTAIN SOFTWARE INFORMATION SOFTWARE NEWSLETTERS, MAILING LIST The Software Communications Group, located at corporate h'aadquarters in Maynard, publishes newsletters and Software Performance S'lmmaries (SPS) for the various Di9i tal products. Newslet.ters are published monthly, and contain announcements of new and revised software, programming notes, software problems and solutions, and documentation corrections. Software Performance Summaries are a collE~ction of existing problems and solutions for ,a given software system,. and are published periodically. For information on the distribution of these documents and how to get on the software newsletter mailing list, write to: Software Communications P. O. Box F Maynard, Massachusetts 01754 SOFTWARE PROBLEMS Questions or problems relating to Digital"s software should be reported to a Software Support Specialist. A specialist is located in each Digital Sales Office in the United States.. In Europe, software problem reporting centers are in the following cities. Reading, England Paris, France The Hague, Holland Tel Aviv, Israel Milan, Italy SoJLna, Sweden Geneva, Switzerland Munich, West Germany Software Problem Report (SPR) forms are available from the specialists or from the Software Distribution Centers cited below. PROGRAMS AND MANUALS Software and manuals should be ordered by title and order number. In the United States, send orders to the nearest distribution center. Digital Equipment Corporation Software Distribution Center 146 Main Street Maynard, Massachusetts 01754 Diqital Equipment Corporation Software Distribution Center 1400 Terra Bella Mountain View, California 94043 Outside of the United States, orders should be directed to the nearest Digital Field Sales Office or representative. USERS SOCIETY DECUS, Digital Equipment Computer Users Society, maintains a user exchange center for user-written programs and technical application information. A cata.log of existing programs is available. The society publishes a periodical, DECUSCOPE, and holds technical seminars in the United States, Can.ada, Europe, and Australia. For information on the society and membership application forms, write to: DECUS Digital Equipment Corporation 146 Main Street Maynard, Massachusetts 01754 DECUS Di9ital Equipment, S.A. 81 Route de l'Aire 1211 Geneva 26 Switzerland
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies