Digital PDFs
Documents
Guest
Register
Log In
DEC-11-XPTSA-B-D
2000
280 pages
Original
23MB
view
download
Document:
Paper Tape Software Handbook
Order Number:
DEC-11-XPTSA-B-D
Revision:
Pages:
280
Original Filename:
DEC-11-XPTSA-B-D%20PDP-11%20Paper%20Tape%20Software%20Handbook.pdf
OCR Text
PDP-11 Paper Tape Software Handbook Order No. DEC-11 -XPTSA-8-D . 1 PDP-11 Paper Tape Software Handbook Order No. DEC-11-XPTSA-B-O digital equipment corporation · maynard, massachusetts First Printing, April 1970 Revised: March 1971 January 1972 February 1973 June 1975 April 1976 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a license and may be used or copied only in accordance with the terms of such license. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright(§) 1970,1971,1972,1973,1975,1976 by Digital Equipment Corporation 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 are trademarks of Digital Equipment Corporation: DIGITAL DEC PDP DECUS UNIBUS COMPUTER LABS COMTEX DDT DECCOMM 7/77-34 DECsystem-lO DECtape DIBOL EDUSYSTEM FLIP CHIP FOCAL INDAC LAB-8 DECsystem-20 MASSBUS OMNIBUS OS/8 PHA RSTS RSX TYPESET-8 TYPESET-IO TYPESET..;"ll CONTENTS Page CHAPTER 1 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1-1 1.1 1.2 1.2.1 1. 2.2 1. 2 ~ 3 1. 2.4 1.2.S 1.3 1. 3.1 1.3.2 1. 3.3 1. 3.4 1.4 1. 4.1 1. 4.2 1.4.3 1. 4.4 loS 1.6 1.7 1. 7.1 1. 7.2 1. 7.3 1. 7.4 1. 7.S 1. 7.6 1. 7.7 1. 7.8 1. 7.9 CHARACTER SET STATEMENTS Label Operator Operand Comments Format Control SYMBOLS Permanent Symbols User-Defined Symbols Direct Assignment Register Symbols EXPRESSIONS Numbers Arithmetic and Logical Operators ASCII Conversion Mode of Expressions ASSEMBLY LOCATION COUNTER RELOCATION AND LINKING ADDRESSING . Register Mode Deferred Register Mbde Autoincrement Mode Deferred AutoincrementMode Autodecrement Mode Deferred Autodecrement Mode Index Mode Deferred Index Mode Immediate Mode and Deferred Immediate (Absolute) . Mode Relative and Deferred Relative Mode~ Table of Mode Forms and Codes (6-bit(A) format only ~ see Section 1.7.12) Instruction Forms ASSEMBLER DIRECTIVES· .TITLE .GLOBL Program Section Directives (.ASECT and .CSECT) .EOT • EVEN • END 1-2 1-2 1-3 1-3 1';"4 1-4 1-4 1-S 1-S 1-S 1-6 1-6 1-7 1-8 1-8 1-8 1-9 1-10 1-11 1-12 1-12 1-13 1-13 1-13 1-14 1-14 1-14 1-14 1. 7.10 1.7.11 1. 7 .12 1.8 1. 8.1 1. 8.2 1. 8.3 1. 8.4 1. 8. S 1.8.6 1.8.7 1. 8.8 1. 8.9 1. 8 .10 1.8.11 1. 8 .12 • WORD . BYTE .ASCII .RADSO .LIMIT Conditional Assembly Directives iii I-IS 1-lS 1-16 1-17 1-18 1-18 1-18 1-19 1-20 1-20\. 1-20 1-20 1-:-21' 1,;..2L. 1-22·· 1-'-23 ' 1';"23 CONTENTS (CONT.) Page CHAPTER 1.9 1. 9.1 1. 9.2 1.9.3 1. 9.4 1. 9.5 1. 9.6 1.9.6.1 1:9.6.2 ,1. 9.6.3 1.10 1.11 OPERATING PROCEDURES Introduction Loading PAL-lIS Initial Dialogue Assembly Dialogue Assembly Listing Object Module Output Global Symbol Directory Text Block Relocation Directory ERROR CODES SOFTWARE ERROR HALTS 1-24 1-24 1-24 1-24 1-28 1-30 1-30 1-30 1-31 1-31 1-31 1-32 2 WRITING PAL-11A ASSEMBLY LANGUAGE PROGRAMS 2-1 2.1 2.2 2.2.1 2.2.2 2.2.3 2.2 .. 4 2.2.5 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.4 2.4.1 2.4.2 2.4.3 2.5 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 CHARACTER SET STATEMENTS Label Operator Operarid Comments Format Control SYMBOLS Permanent Symbols User-Defined Symbols Direct Assignment Register Symbols EXPRESSIONS Nuinbers Arithmetic and Logical Operators ASCII Conversion ASSEMBLY LOCATION COUNTER ADDRESSING Register Mode Deferred Register Mode Autoincrement Mode Deferred Autoincrement Mode Autodecrement Mode Deferred Autodecrement Mode Index Mode Deferred Index Mode Immediate Mode arid Deferred Immediate (Absolute) Mode Relative and Deferred Relative Modes Table of Mode Forms and Codes (6-bit (A) format only - see Section 3.7) INSTRUCTION FORMS ASSEMBLER DIRECTIVES .EOT • EVEN • END • WORD • BYTE • ASCII OPERATING PROCEDURES Introduction Loading PAL-11A 2-2 2-2 2-3 2-3 2-3 2.6.10 2.6.11 2.7 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.9 2.9.1 2.9.2 iv "2-4 2-4 2-5 2~5 2-5 2-5 2-6 2-7 2-7 2-8 2-8 2-8 2-9 2-10 2-10 2-10 2-11 2-11 2-11 2-11 2-12 2-12 2-13 2-13 2-14 2-15 2-15 2-16 2-16 2-16 2-17 2-17 2-17 2-17 2-18 CONTENTS (CONT.) Page 2.9.3 2.9.4 2.9.5 2.10 CHAPTER CHAPTER 2.11 Initial Dialogue Assembly Dialogue Assembly Listing ERROR CODES SOFTWARE ERROR HALTS 2-18 2-23 2-24 2-25 2-26 3 LINK-llS LINKER 3-1 3.1 3.1.1 3,.1. 2 3.1. 3 3.2 3.2.1 3.2.2 3.2.3 3.3 3.3.1 3.3.1.1 3.3.2 3.3.2.1 3.3.2.2 3.3.2.3 3.3.2.4 INTRODUCTION General Description Absolute and Relocatab1e Program Sections Global Symbols INPUT AND OUTPUT Object Module Load Modules Load Map OPERATING PROCEDURES Loading and Command String Operational Cautions Error Procedure and Messages Restarting Non-Fatal Errors Fatal Errors Error HALTs 3-1 3-1 3-2 3-2 3-3 3-3 3-4 3-5 3-5 3-6 3-7 3-7 3-7 3-7 3-8 4 EDITING THE SOURCE PROGRAM 4-1 4.1 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.3 4.3.1 4.3.1.1 4.3.1.2 4.3.1.3 4.3.1.4 4.3.1.5 4.3.1.6 4.3.2 4.3.2.1 4.3.2.2 4.3.2.3 4.3.3 4.3.3.1 4.3.3.2 4.3.4 4.3.4.1 4.3.4.2 4.3.4.3 COMMAND MODE AND TEXT MODE COMMAND DELIMITERS Arguments The Character Location Pointer (Dot) Mark Line-Oriented Command Properties The Page Buffer COMMANDS Input and Output Commands Open Read List and Punch Next Form Feed and Trailer Procedure with Low-Speed Punch Commands to Move Dot and Mark Beginning and End Jump and Advance Mark Search Commands Get wHole Commands to Modify the Text Insert Delete and Kill Change and Exchange OPERATING PROCEDURES Error Corrections Starting Restarting 4-1 I 4.4 I 4.4.1 4.4.2 4.4.3 v I 3~3 4-2 4-2 4-2 4-3 4-3 4-3 4-4 4-4 4-4 4-4 4-5 4-5 4-6 4-6 4-6 4-6 4-6 4-7 4-7 4-7 4-7 4-8 4-8 4-9 4-9 4-10 4-10 4-11 4-11 CONTENTS (CONT.) Page CHAPTER CHAPTER 4.4.4 4.4.5 4.5 Creating a Paper Tape Editing Example SOFTWARE ERROR HALTS 4-11 4-12 4-17 5 DEBUGGING OBJECT PROGRAMS ON-LINE 5-1 5.1 5.1.1 5.1. 2 5.2 5 •.2.1 5.2.1.1 5.2.1.2 5.2.1.3 5.2.1.4 5.2.1.5 5.2.1.6 5.2.2 5.2.2.1 5.2.2.2 5.2.3 5.2.4 5.2.4.1 5.2.4.2 5.2.5 5.2.6 5.3 5.3.1 5.3.1.1 5.3.1.2 5.3.1.3 5.3.2 5.3.3 5.3.4 5.4 5.5 5.5.1 5.5.2 5.5.3 5.5.4 5.6 5.6.1 5.6.2 5-1 5-1 5-2 5-3 5-4 5-4 5-4 5-5 5-5 5-5 5-6 5-6 5-6 5-7 5-7 5-8 5-8 5-9 5-9 5-10 5-10 5-10 5-11 5-11 5-11 5-11 5-12 5-12 5-13 5-14 5-14 5-14 5-18 5-19 5-20 5-20 5.6.3 INTRODUCTION ODT-ll and ODT-lIX ODT's Command Syntax COMMANDS AND FUNCTIONS Opening, Changing, and Closing Locations The Slash U) The LINE FEED Key The Up-Arrow (t) The Back-Arrow (+) Accessing General Registers 0-7 Accessing Internal Registers Breakpoints Setting the Breakpoimt (niB) Locating the Breakpoint($B) Running the Program(niG and-niP) Searches Word Seach(niW) Effective Address Search(niE) Calculating Offsets(niO) ODT'S Priority Level($P) ODT-IIX Opening, changing and Closing Locations Open the AddressedLocation(@) Relative Branch Offset(» Return to Previous Sequence«) Calculating Offsets(niO) Breakpoints Single-Instruction Mode ERROR DETECTION PROGRAMMING. CONSIDERATIONS Functional Organization Breakpoints Search Teletype Interrupt OPERATING PROCEOURES' Linking Procedures (LSI-II Systems Only) Loading Procedures (non-LS'I-ll Systems Only) Starting and Restarting 6 LOADING AND DUMPING MEMORY 6-1 6.1 6.1.1 6.1. 2 6.1. 3 6.1.4 6.1. 5 6.1. 6 6.1.6.1 PAPER TAPE BOOTSTRAPS BM792-YAPaper Tape Bootstrap ROM BM873-YA Bootstrap Loader ROM LSI-II Firmware Paper Tape Bootstrap M9301-YB Bootstrap Loader M9301-YA Bootstrap Loader Other Bootstrap Loaders Loading the Loader into Core 6-2 6-2 6-2 6-3 6-3 6-4 6-4 6-5 vi 5-20 5-21 CONTENTS (CONT • ) Page 6.1.6.2 6.1.6.3 6.2 6.2.1 6.2.2 6.2.3 6.3 6.3.1 6.3.1.1 6-6 6-8 6-10 6-11 6-11 6-13 6-14 6-14 6.3.2 6.3.3 Loading Bootstrap Tapes Bootstrap Loader Operation THE ABSOLUTE LOADER Loading the Loader into Core Using the Absolute Loader . Absolute Loader Operation CORE MEMORY DUMPS Operating Procedures Using DUMPAB on Systems without Switch Registers Using DUMPAB and DUMPTT on Systems with Switch Registers Output Formats . Storage Maps 7 INPUT/OUTPUT PROGRAMMING 7-1 7.1 7.1.1 7.1.2 7.1. 3 7.2 7.2.1 7.2.2 7.3 7.3.1 7.3.2 7.3.3 7.3.3.1 7.3.3.2 7.3.3.3 7.3.3.4 7.3.4 7.4 7.4.1 7.4.2 7.4.3 7.4.4 7.5 7.5.1 7.5.2 7.5.3 7.5.4 7.5.5. 7.5.6 7.5.7 7.5.8 7.5.9 7.6 7.6.1 7.6.2 7.7 7.8 7.9 7.9.1 7.9.2 7.9.3 INTRODUCTION UsingIOX with the LSI-II Processor Using IOX with Unibus PDP-II Processors IOX Interrupt and Trap Vectors THE DEVICE ASSIGNMENT TABLE Reset Initialization BUFFER ARRANGEMENT IN DATA TRANSFER COMMANDS Buffer Size Mode Byte Status Byte Non~Fata1 Error Codes (Octal). Done Bit End-Of;';'Medium Bit End-Of-FileBit Byte Count MODES Formatted ASCII Unformatted ASCII Formatted Binary Unformatted Binary DATA TRANSFERS Read Wr~te . Device Conflicts In Data Transfer Commands Waitr (Wait, Return) Waitr vs. Testing the Buffer Done Bit Single Buffer Transfer6n One Device Double Buffering Readr (Real-time Read) Writr (Real-time Write) REENABLIN<;i THE READER AND RESTARTING Seek . Restart FATAL ERRORS EXAMPLE OF PROGRAM USING IOX IOX INTERNAL INFORMATION Confltct Byte/Word Device Interrupt Table (DIT) Device Status Table (DST) 7-1 7-3 7-3 7-3 7-3 7-4 7-4 7-4 7-5 7-5 7-6 7-6 7-7 7-7 7-7 7-8 7-8 7-8 7-10 7-10 7-11 7-11 7-11 7-12 7-12 7-13 7-13 7-14 7-15 7-15 7-16 7-16 7-16 7-16 7-17 7-17 7-19 7-19 7-20 7-21 6.3.1.2 CHAPTER vii 6-15 6-16 6-17 6-17 CONTENTS (CONT.) Page 7.9.4 7.9.5 7.9.5.1 7.9.5.2 7.9.5.3 Teletype Hardware Tab Facility Adding Devices To lOX Device Codes Table Modification Interrupt Routines 7-21 7-21 7-21 7-22 7-23 CHAPTER 8 FLOATING POINT MATH PACKAGE OVERVIEW 8-1 CHAPTER 9 PROGRAMMING TECHNIQUES 9-1 9.1 9.1.1 9.1. 2 9.1. 3 9.1. 4 9.1.4.1 9.1.4.2 9.1.4.3 9.2 9.3 9.3.1 9.3.2 WRITING POSITION .INDEPENDENT CODE Position Independent Modes Absolute Modes Writing Automatic PIC Writing Non-Automatic PIC Setting Up The Stack Pointer Setting Up A Trap or Interrupt Vector Relocating Pointers LOADING UNUSED TRAP VECTORS CODING TECHNIQUES Altering Register Contents Subroutines 9-1 9-2 9-3 9-3 9-4 9-4 9-4 9-5 9-5 9-6 9-6 9-7 APPENDIX A ASCII CHARACTER SET A-I APPENDIXB PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER B-1 B.l B.2 B.3 B.3.1 B.3.2 B.3.3 B.3.4 B.3.5 B.3.6 B.3.7 B.3.8 B.4 B.5 B.6 APPENDIX C C.l C.2 C.3 C.3.1 C.3.2 C.3.3 C.3.4 C.3.5 C.3.6 TERMINATORS B-1 ADDRESS MODE SYNTAX B-2 INSTRUCTIONS B-2 Double Operand Instructions OP A,A B-4 Single Operand Instructions OP A B-4 Rotate/Shift B-5 Operation Instructions Op B-5 Branch Instructions Op E Where -128 10 «E-.-2)/2<127 10 B-6 Subroutine Call JSR ER,A B-7 B-7 Subroutine Return Extensions for the LSI-II Version Of PAL-lIS B-7 ASSEMBLER DIRECTIVES B-8 ERROR CODES B-IO B-ll INITIAL OPERATING PROCEDURES PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C-l SPECIAL CHARACTERS ADDRESS MODE SYNTAX INSTRUCTIONS Double-Operand Instructions Op A,A Single-Operand Instructions Op A Rotate/Shift Instructions Op A Operate Instructions Op Trap Instructions Op or OpE Where 0~E~3778 Branch InstructionsOp E where -128 10 ~ (E-.-2)/2~12710 C-l C-2 C-3 C-4 C-4 C-5 C-5 C-6 viii C-7 CONTENTS (CONT • ) Page C.3.7 C.3.S C.4 C.S C.6 Subroutine Call Op ER, A Subroutine Return Op ER ASSEMBLER DIRECTIVES ERROR CODES INITIAL OPERATING PROCEDURES C-7 C-S C-S C-S C-9 TEXT EDITOR, ED-ll D-l INPUT/OUTPUT COMMANDS POINTER-POSITIONING COMMANDS SEARCH COMMANDS COMMANDS TO MODIFY THE TEXT SYMBOLS GROUPING OF COMMANDS OPERATING PROCEDURES Loading Storage Requirements Starting Initial Dialogue Restarting D-l D-2 D-2 D-2 D-3 D-3 D-4 D-4 D-4 D-4 D-4 D-4 DEBUGGING OBJECT PROGRAMS ON-LINE, ODT-ll AND ODT-llX E-l SUMMARY OF CONTENTS E-l LOADING AND DUMPING CORE MEMORY F-l THE BOOTSTRAP LOADER Loading The Bootstrap Loader THE ABSOLUTE LOADER CORE MEMORY DUMPS F-l F-l F-3 F-4 INPUT/OUTPUT PROGRAMMING, lOX G-l INSTRUCTION SUMMARY PROGRAM FLOW SUMMARY FATAL ERRORS G-l G-l G-2 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-ll H-l OTS ROUTINES NON-OTS ROUTINES ROUTINES ACCESSED VIA TRAP HANDLER H-2 H-7 H-7 APPENDIX I TAPE DUPLICATION I-I APPENDIX J ASSEMBLY AND LINKING INSTRUCTIONS J-l SYSTEMS WITHOUT SWITCH REGISTERS IOX/IOXLPT Assembling lOX Assembling IOXLPT Linking lOX and IOXLPT ODTllX J-l J-l J-l J-l J-l J-l APPENDIX D D.l D.2 D.3 D.4 D.S D.6 D.7 D.7.l D.7.2 D. 7.3 D.7.4 D.7.S APPENDIX E E.l APPENDIX F F.l F.l.l F.2 F.3 APPENDIX G G.l G.2 G.3 APPENDIX H H.1 H.2 H.3 J.l J .l.1 J.l.l.l J.l.l.2 J.l.l.3 J .l.2 ix CONTENTS (CONT.) Page J.1.2.l J.1.2.2 J.1. 3 J.1.3.l J.1.3.2 J.1. 4 J.1.4.l J.1.4.2 J.1. S J.1.S.l J.1.S.2 J.2 J.2.l J.2.2 J.2.3 J.2.4 J.2.S J.2.6 Assembling "ODTllX Linking ODTllX ED-II Assembling ED-II Linking ED-II PAL-llS Assembling PAL-lIS Linking PAL-lIS, LINK-lIS Assembling LINK-lIS Linking LINK-lIS SYSTEMS WITH SWITCH REGISTERS Assembling PAL-llA Assembling ED~ll ODT-ll/ODT-llX Assembling IOX/IOXLPT Assembling and Linking PAL-lIS Assembling and Linking LINK-lIS J-l J-2 J-2 J-2 J-2 J-2 J-2 J-3 J-3 J-4 J-4 J-S J-S J-6 J-6 J-7 J-8 J-ll APPENDIX K STANDARD PDP-II ABBREVIATIONS K-l APPENDIX L CONVERSION TABLES L-l OCTAL-DECIMAL INTEGER CONVERSIONS POWERS OF TWO SCALES OF NOTATION 2 x In-Decimal 10±n In Octal n Log 2 and 10 In Decimal Addition and Multiplication, Binary and Octal Mathematical Constants In Octal L-l L-S L-6 L-6 L-6 L-6 L.l L.2 L.3 L.3.l L.3.2 L.3.3 L.3.4 L.3.S APPENDIX M APPENDIX N N.l N.2 N.3 INDEX L-6 L-7 NOTE TO USERS OF SERIAL LA30 AND 600, 1200, AND 2400 BAUD VTOS'S M-l USING THE ABSOLUTE LOADER ON PDP-II'S WITHOUT SWITCH REGISTERS N-l LSI-ll M930l-YB BOOTSTRAP LOADER M930l-YA BOOTSTRAP LOADER N-l N-3 N-4 Index-l CONTENTS (CONT . ) Page FIGURES FIGURE 5-1 6-1 6-2 6-3 6-4 F-l F-2 F-3 F-4 Communication and Data Flow Bootstrap Loader Instructions Loading and Verifying the Bootstrap Loader Loading Bootstrap Tapes Into Core The Bootstrap Loader Program Loading and Verifying the Bootstrap Loader Loading Bootstrap Tapes into Core Loading with the Absolute Loader Dumping Using DUMPAB or DUMPTT 5-15 6-4 6-7 6-8 6-9 F-2 F-3 F-5 F-6 TABLES TABLE 1-1 2-1 Instruction Operand Fields Instruction Operand Fields xi 1-17 2-14 CHAPTER 1 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER PAL-lIS Assembly (Program Assembly Language for the PDP-II, Relocatable, Stand Alone Version) enables you to write source (symbolic) programs using letters, numbers, and symbols which are meaningful to you. The source programs,generated either on-line using the Text Editor (ED-II), or off-line, are then assembled into object modules which are processed by the PDP-II linker, LINK-lIS. LINK-lIS produces a load module which is loaded by the Absolute Loader for execution. Object modules may contain absolute and/or relocatable code and separately assembled object modules may be linked with global symbols. The object module is produced after two passes through the Assembler; an optional third pass produces a complete octal/symbolic listing of the assembled program. This listing is especially useful for documentation and debugging purposes. ThLs chapter not only explains how to write PAL-lIS programs but also how to assemble the source programs into object modules. All facets of the assembly language are explained and illustrated with many examples, and the chapter concludes with assembling procedures. In explaining how to write PAL-lIS source programs, it is necessary, especially at the outset, to make frequent forward references. Therefore, we recommend that you first read through the entire chapter to get a "feel" for the language, and then reread the chapter, this time referring to appropriate sections as indicated, for a thorough understanding of the language and assembling procedures. Some notable features of PAL-lIS are: 1. Selective assembly pass functions. 2. Device specification for pass functions. 3. Optional error listing on the teleprinter. 4. Double buffered and concurrent I/O (provided by IOXLPT). 5. Alphabetized, formatted symbol table listing. 6. Relocatable object modules. 7. Global symbols for linking between object modules. 8. Conditional assembly directives. 9. Program Sectioning Directives. The PAL-lIS Assembler requires 8K of memory and provides for about 900 user-defined symbols (see Section 1.3.2). In addition, it allows a line printer to be used for program listing and/or symbol table listing. 1-1 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER The following discussion of the PAL-lIS Assembly Language assumes that you have read the PDP-II Processor Handbook with emphasis on tqose sections which deal with the PDP-II instruct jon repertoire, forrrt-el>ts, and timings -- a thorough knowledge of these is vital to efficient assembly language programming. 1.1 CHARACTER SET A PAL-lIS source program is composed of symbols, numbers, expressions, symbolic instructions, assembler directives,-argument separators, and line terminators written using the following ASCII) characters. 1. The letters A through Z. (Upper and lower case letters are acceptable, although upon input, lower case letters will be converted to upper case letters.) 2. The numbers 0 through 9. 3. The characters . and $. systems use.) 4. The separating or terminating symbols: % # @ carriage return 1.2 ; (These characters are " tab space + line feed reserved for & form feed STATEMENTS A source program is composed of a sequence of statements, where each statement is on a single line. The statement is terminated by a carriage return character which must be immediately followed by either a ~ine feed or form feed character. Should a carriage return character be present and not be followed by a line feed or form feed, the Assembler will generate a Q err.or (Section 1.10), and that· portion of the line following the carriage return will be ignored. Since the carriage return terminator is a required statement terminator, a line feed or form feed not immediately preceded by a carriage return will have one inserted by the Assembler. It should be noted that, if the Editor (ED-II) is being used to create the source program, a typed carriage return (RETURN key) automatically generates a line feed character. A statement may be composed of. up to four fields which are identified by their orde~ of appearance and by specified terminating characters as explained below and summar ized in Appendix .B. The four fields are: Label Operator Operand Comment The label and <;::omment fields are optional. The operator and operand fields are inter-dependent -- either may be omitted depending upon the contents of the other. ) ASCII stands for American Standard Code for Information Interchange. 1-2 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.2.1 Label A label is a user-defined symbol (see Section 1.3.2) which is assigned the value of the current location counter. This value may be either absolute or relocatable depending on whether the location counter value is absolute or relocatable. In the latter case, the final absolute value is assigned by the Linker, i.e., the value + the relocation constant. A label is a symbolic means of referring to a specific location within a program. If present, a label always occurs first in a statement and must be terminated by a colon. For example, if the current location is absolute 100 the statement: ABCD: MOV A,B will assign the value 100 to the label ABCD so that subsequent reference to ABCD will be to location 100 In the above case if the location counter were relocatable the~ the final value of ABCD would be 100 +K, where K is the location of the beginning of the relocatable section in which the label ABCD appears. More than one label may appear within a single label field; each label within the field will have the same value. For example, if the current location counter is 100 I multiple labels in the statement: ABC: $DD: MOV A,B A7.7: will equate each of the three labels ABC, $DD, and A7.7 with the value 100 ($ and . are reserved for system software). The error code M (multiple definition of a symbol) will be generated during assembly if two or more labels have the same first six characters. 1.2.2 Operator An operator follows the label field in a statement, and may be an instruction mnemonic or an assembler directive (see Section 1.8 and Appendix B). When it is an instruction mnemonic, it specifies what action is to be performed on any operand(s) which follows it. When it is an assembler directive, it specifies a certain function or action to be performed during assembly. The operator may be preceded only by one or more labels and may be followed by one or more operands and/or a comment. An operator is legally terminated by a space, tab, or any of the following characters: # + " @ line feed % & form feed carriage return The use of each character above will be explained in this chapter. Consider the following examples: MOV -...j A,B MOV@A,B "'I (TAB) terminates operator MOV ;@ terminates operator MOV i When the operator stands alone without an operand or comment, it is terminated by a carriage return followed by a line feed or form feed character. 1-3 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.2.3 Operand An operand is that part of a statement which is operated on by the operator -- an instruction mnemonic or assembler directive. Operands may be symbols, expressions, or numbers. When multiple operands appear within a statement, each is separated from the next by a comma. An operand may be preceded by an operator and/or label, and followed by a comment. The operand field is terminated by a semicolon when followed by a comment, or by a carriage return followed by a line feed or form feed character when the operand ends the statement. For example, LABEL: MOV GEORGE"BOB iTHIS IS A COMMENT where the space between MOV and GEORGE terminated the operator field and began the operand field; the comma separated the operands GEORGE and BOB; the semicolon terminated the operand field and began the comment. 1.2.4 Comments The comment field is optional and may contain any ASCII character except null, rubout, carriage return, line feed or form feed. All other characters, even those with special significance are ignored by the AsSembler when used in the comment field. The comment field may be preceded by none, any, or all of the other three fields. It must begin with the semicolon and end with a carriage return followed by a line feed or form feed character. For example, LABEL: iTHIS IS A $1.00 COMMENT CLR HERE Comments do not affect assembly processing or program execution, but they are useful in program listings for later analysis, checkout or documentation purposes. 1.2.5 Format Control The format is controlled by the space and tab characters. They have no effect on the assembling process of the source program unless they are embedded within a symbol, number, or ASCII text; or are used as the operator field terminator. Thus, they can be used to provide a neat, readable program. A statement can be written: LABEL:MOV(SP)+,TAGiPOP VALUE OFF STACK or, using formatting characters it can be written: LABEL: MOV (SP)+,TAG jPOP VALUE OFF STACK which is much easier to read. Page size is controlled by the form feed character. A page of n lines is created by inserting a form' feed (CTRL/FORM keys on the keyboard) after the nth line. If no form feed is present, a page is automatically terminated after 56 lines. 1-4 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.3 SYMBOLS There are two types of symbols J permanent and user-defined. Both are stored in the Assembler's symbol table. Initially, the symbol table contains the permanent symbols, but as the source program is assembled, user~defined symbols are added to the table. 1.3.1 Permanent Symbols Permanent symbols consist of the instruction mnemonics (see Appendix B.3) and assembler directives (see Section 1.8). These symbols are a permanent part of the Assembler's symbol table and need not be defined before being used in the source program. 1.3.2 User-Defined Symbols User-defined symbols are those defined as labels (see Section 1.2.1) or by direct assignment (see Section 1.3.3). These symbols are added to the symbol table as they are encountered during the first pass of the assembly. They can be composed of alphanumeric characters, dollar signs, and periods onlyp again $'s and. 's are reserved for system software. Any other character is illegal and, if used, will result in the error message I or QU (see Section 1.10). I is a low priority error which may be flagged as QU first. The following rules also apply to user-defined symbols: 1. The first character must not be a number. 2. Each symbol must be unique within thefLrst six characters. 3. A symbol may be written with more than six legal characters but the seventh and subsequent characters are only checked for legality, and are not otherwise recognized by the Assembler. 4. Spaces and tabs must not be embedded within a symbol. A user-defined symbol may duplicate a permanent symbol. The value associated with a permanent symbol that is also user-defined depends upon its use: 1. A permanent symbol encountered in the operator associated with its corresponding machine op-code. field is 2. If a permanent symbol in the operand field is also user-defined, its user-defined value is associated with the symbol. If the symbol is not found to be user-defined, then t.he corresponding machine op-code value is associated with the symbol. User-defined symbols are either internal or global. All symbols are internal unless they are explicitly typed as global with the .GLOBL assembler directive (see Section 1.8.2). Global symbols are used to provide links between object modules. A global symbol which is defined (as a label or by direct assignment) in a program is called an entry symbol or entry point. Such symbols may be referred to from other object modules or assemblies. A global symbol which is not defined in the current assembly is called an external symbol. Some other assembly must define the same symbol as an entry point. 1-5 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.3.3 Direct Assignment A direct assignment statement associates a symbol with a value. When a direct assignment statement defines a symbol for the first time, that symbol is entered into the Assembler's symbol table and the specified value is associated with it. A symbol may be redefined by assigning a new value to a previously defined symbol. The newly assigned value will replace the previous value assigned to the symbol. The symbol takes on the relocatable or absolute attribute of the defining expression. However, if the defining expression is global, the defined symbol will not be global unless previously defined as such (see Section 1.4). The general format for a direct assignment statement is: symbol = expression. The following conventions apply: 1. An equal sign (=) must separate expression defining the symbol. the symbol from the 2. A direct assignment statement may be preceded by a label may be followed by a comment. and 3. Only one symbol can be defined by anyone statement. 4. Only one level of forward referencing is allowed. direct assignment Example of two levels of forward referencing (illegal): x Y Y Z Z 1 X and Yare both undefined throughout pass 1 and will be listed on the teleprinter as such at the end of that pass. X is undefined throughout pass 2, and will cause a U error message. Examples: A=l ;THE SYMBOL A IS EQUATED WITH THE VALUE 1 B='A-l&MASKlOW ;THE SYMBOL B IS EQUATED WITH THE EXPRESSION'S ;VAlUE E: D=3 MOV livABLE ;THE SYMBOL D IS EQUATED WITH 3. THE ;LABELS C AND E ARE EQUATED WITH THE ;NUMERICAl MEMORY ADDRESS OF THE MOV ;COMMAND 1.3.4 Register Symbols c: The eight general registers of the PDP-II are numbered 0 through 7. These registers may be referenced by use of a register symbol; that is, a symbolic name for a register. A register symbol is defined by means of a direct assignment, where the defining expression contains at least one term preceded by a % or at least one term previously defined as a register symbol. In addition, the defining expression of a register symbol must be absolute. For example: 1-6 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER ;DEFINE RO AS REGISTER 0 ;DEFINEDR3 AS REGISTER 3 ;DEFINE R4 AS REGISTER 4 ;DEFINE "THERE" AS REGISTER 2 It is important to note that all register symbols must be defined before they are referenced. A forward reference to a register symbol will generally cause phase errors (see Section 1.10). The % may be used in any expression thereby indicating a reference to a register. Such an expression is a register expression. Thus~ the statement: CLR %6 will clear register 6 while the statement: CLR 6 will clear the word at memory address 6. In certain cases a register can be referenced without the use of a register symbol or register expression. These cases are recognized through the context of the statement and are thoroughly explained in Sections 1.7.11 and 1.7.12. Two obvious examples of this are: ;THE FIRST OPERAND FIELD MUST ALWAYS ; DE A F~EG I STEF~ CI... F~ 1.4 X en ;ANY EXPRESSION ENCLOSED IN ( ) MUST DE ;A REGISTER. IN THIS CASE? INDEX REGISTER EXPRESSIONS Arithmetic and logical operators (see Section 1.4.2) may be used to form expressions. A term of an expression may be a permanent or user-defined symbol (which may be absolute, relocatable or global), a number, ASCII data, or the present value of the assembly location counter represented by the period (see Section 1.5). Expressions are evaluated from left to right. Parenthetical grouping is not allowed. Expressions are evaluated as word quantities. The operands of a .BYTE directive (Section 1.8.8) are evaluated as word expressions before truncation to the low-order eight bits. The evaluation of an expression includes the evaluation of the mode of the resultant expression~ that is, absolute, relocatable or external. The definition of the modes of ~xpression are given below in Section 1.4.4. A missing term, expression or external symbol will be interpreted as O. A missing operator will be interpreted as +. The error code Q For (Questionable syntax) will be generated for a missing operator. example, A + -100 ;OPERAND MISSING will be evaluated as A + 0 - 100, and TAG ! LA 177777 will be evaluated as TAG ;OPERATOR MISSING LA+177777. 1-7 PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER The value of an external expression will be the value of the absolute part of the expression; e.g., EXT+A will have a value of A. This will be modified by the linker to become EXT+A. 1.4.1 Numbers The Assembler accepts both octal and decimal numbers. Octal numbers consist of the digits 0 through 7 only. Decimal numbers consist of the digits 0 through 9 followed by a decimal point. If a number contains an 8 or 9 and is not followed by a decimal point, the N error code (see Section 1.10f will be printed and the number will be interpreted as decimal. Negative numbers may be expressed as a number preceded by a minus sign rather than in a two's complement form. Positive numbers may be preceded by a plus sign although this is not required. If a number is too large to fit into 16 bits, the number is truncated from the left. In the assembly listing the statement will be flagged with a Truncation (T) error. Numbers are always considered to be absolute quantities (that is, not relocatable). 1.4.2 Arithmetic And Logical Operators The arithmetic operators are: + indicates addition or a positive numhe.r indicates subtraction or a negative number The logical operators are: indicates the logical AND operation & indicates the logical inclusive OR operation AND 0 0 1 1 1.4.3 & 0 & 1 & 0 & 1 OR = 0 = 0 = 0 =1 0 0 1 1 ! ! ! ! 0 1 0 1 = 0 = 1 = 1 = 1 ASCII Conversion When preceded by an apostrophe, any ASCII character (except null, rubout, carriage return, line feed, or form feed) is assigned the 7-bit ASCII value of the character (see Appendix A). For example, 'A is assigned the value lOIS' When preceded by a quotation mark, two ASCII characters (not including null, rubout, carriage return, line feed, or form feed) are assigned the 7-bit ASCII values of each of the characters to be used. Each 7-bit value is stored in an S-bit byte and the bytes are combined to form a word. For example "AB will store the ASCII value of A in the low-order (even) byte and the value of B in the high-order (odd) byte: l-S PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER B's value high-order byte 102 -- -- low-order byte 101 I o o 100 001 4 = A's value --.. -- -- --------..---.-~ --.. 001 1 "AB=041101 I 000 001 o 1 ASCII text is always absolute. 1.4.4 Mode of Expressions The mode of an expression may be absolute, relocatable or external defined below: as A term of an expression is absolute, relocatable or external depending on whether its definer (i.e., number, symbol, etc.) is absolute, relocatable or external. Numbers, permanent symbols and generated data are always treated as absolute. An absolute expression is defined as: 1. Absolute term (one whose value is defined at assembly preceded optionally by a single plus or minus sign, or 2. Relocatable expression minus a relocatable term, or 3. Absolute expression followed by an operator absolute expression. followed time) by an A relocatable expression is defined as: .1. Relocatable term (one whose value is time), or· not known until 2. Relocatable expression followed by an followed by an absolute expression, or 3.- Absolute_ express.ion.followed by a~.plus oper-ator f_ollowed by a relocatable express.ion. arithmetic link operator An external expression is defined as: 1. External term program), or (one whose value is defined 2. External expression followed by followed by an absolute term, or an arithmetic 3. Absolute expression followed by a plus operator an external expression. In the following examples: ABS is an absolute symbol, REL is a relocatable symbol,· EXT is an external symbol. 1-9 outside the operator followed by PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER Examples: The following are valid expressions: EXT + ABS ;External expression REL+REL-REL ;Relocatable expression ABS+REL-REL & ABS ;Absolute expression The following are illegal expressions: EXT+REL REL+REL ABS-EXT 1.5 ASSEMB'LY LOCATION COUNTER The period (.) is the symbol for the assembly location counter. (Note difference of Program Counter. ~PC. See Section 1.7.) When used in the operand field of an instruction, it represents the address of the first word of the instruction. When used .inthe .operand field of an ,assembler directive, it represents'the a'ddress of the current byte or word. For example, A: MOV#: .,RO ;.refers to location A, ;i.e., the address of the ;MOV instruction (#: is explained in Section 1.7.9.) At the beginning of each assembly pass, the Assembler clears the location counter. Normally, consecutive memory locations are assigned to each byte of object data generated. However, the location where the object data is stored may be changed by a direct assignment altering the location counter: .=expression Similar to other symbols, the location counter symbol "." has a mode associated with it. However, the mode cannot be external. Neither can one change the existing mode of the location counter by using a defining expression of a different mode. The mode of the location counter symbol can be changed by the the .ASECT or .CSECT directive as explained in Section 1.8.3. use of The expression defining the location counter"must not contain references or symbols that vary from one pass to another. forward Examples: .ASECT .=500 ;SET LOCATION COUNTER TO ABSOLUTE 500 MOV .+10,COUNT ;THE LABEL FIRST HAS THE VALUE 500 ;(OCTAL) .+10 EQUALS 510 (OCTAL), THE ;CONTENTS OF LOCATION 510 (OCTAL) WILL _BE DEPOSITED IN LOCATION COUNT. + ::::~520 ;THE ASSEMBLY LOCATION COUNTER NOW ;HAS A VALUE OF ABSOLUTE 520 (OCTAL), 1-10 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER SECOND: MOV .,INDEX ;THE LABEL SECOND HAS THE VALUE 520 ;(OCTAL), THE CONTENTS OF LOCATION 520 ;THAT IS, THE BINARY CODE FOR ;INSTRUCTION ITSELF, WILL BE DEPOSITED tIN LOCATION INDEX. <.cnECT ;nET LOCATION COUNTER TO RELOCATABLE .::::.+20 ;20. THIF~D : ;THE LABEL THIRD HAS THE VALUE OF ; F~ELOCf~TABLE 20. • WDFm () Storage area may be reserved by advancing the location counter. For example, if the current value of the location counter is 1000, the direct assignment statement .=.+100 will reserve 100 bytes of storage space in instruction will be stored at 1100. 1.6 the program. The next RELOCATION AND LINKING The output of the relocatable assembler is an object module which must be processed by the PDP-II Linker, LINK-lIS, before loading and execution. The Linker essentially fixes (i.e., makes absolute) the values of external or relocatable symbols and creates another module (load module) which contains the binary data to be loaded anq executed. To enable the Linker to fix the value of an expression the assembler issues certain directives to the Linker together with the required parameters. In the case of relocatable expressions the Linker adds the base of the relocatable section (the location in memory of relocatable 0) to the value of the relocatable expression provided by the Assembler. In the case of an external expression the value of the external term in the expression is determined by the Linker (since the external symbol must be defined in one of the other object modules being linked and adds it to the value of the external expression provided by the Assembler. All instructions that are to be modified as described above will be marked by a single apostrophe in the assembly listing. Thus the binary text output will look as follows for the given examples: 0()~:506~3.' CLF~ EXTEF~NAL (~:;) ;VALUE OF EXTERNAL nYMBOL ;AnSUMED ZERO~ WILL BE ;MODIFIED BY THE LINKER. 000000 ()O~506~:).' CI..J~ EXTEF~NAI...Ni (~3) eLI:;: I:;:EI... DCATf~BLE (5) OO()OOt.l O()~::j06~3' OO()04() 1-11 ;ASSUMING WE ARE IN THE ;ABSOLUTE SECTION AND ITHE VALUE OF RELOCATABLE tIS RELOCATABLE 40 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.7 ADDRESSING The Program Counter (register 7 of the eight general registers) always contains the address of the next word to be fetched; i.e., the address of the next instruction to be executed, or the second or third word of the current instruction. In order to understand how the address modes operate and how they assemble, the action of the Program Counter must be understood. The key rule is: Whenever the processor implicitly uses the Program Counter to fetch a word from memory, the Program Counter is automatically incremented by two after the fetch. That is, when an instruc~ion is fetched, the PC is incremented by two, so that it is pointing to the next word in memory; and, if an instruction uses indexing (see sections 1.7.7, 1.7.8 and 1.7.10), the processor uses the Program Counter to fetch the base from memory. Hence, using the rule above, the PC increments by two, and now points to the next word. The following conventions are used in this section: 1. Let E be any expression as defined in Section 1.4. 2. Let R be a register expression. This is any expression containing a term preceded by a % character of a symbol previously equated to such a term. Examples: I~O ._. %0 F~ :L .... R<H-:I. 1~2 -- l+%:L ;GENERAL REGISTER 0 ;GENERAL REGISTER 1 ;GENERAL REGISTER 2 3. Let ER be a register expression or an expression in the range o to 7 inclusive. 4. Let A be a general address specification which produces a 6-bit mode address field as described in a PDP-II Processor Handbook. The addressing specifications, A, may now be explained in terms of E, R, and ER as defined above. Each will be illustrated with the single operand instruction CLR or double operand instruction MOV. 1.7.1 Register Mode The register contains the operand. Format: R Example: RO=%O CLR RO ;DEFINE RO AS REGISTER 0 ;CLEAR REGISTER 0 1-12 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.7.2 Deferred Register Mode The register contains the address of the operand. Format: @R or (ER) Example: CLR@F~l or CU~(1 ) 1.7.3 ;CLEAR THE WORD AT THE ;ADDRESS CONTAINED IN ;REGISTER 1 Autoincrement Mode The contents of the register are incremented immediately used as the address of the operand. Format: after being (ER)+ Examples: (RO>t (ROt3>t CLR CLR CLR ;CLEAR WORDS AT ADDRESSES ;CONTAINED IN REGISTERS 0,3, AND 2 'AND INCREMENT REGISTER CONTENTS ;BY TWO. (2)+ NOTE Both JMP and JSR instructions using mode 2 (non-deferted autoincrement mode), execute differently on different PDP-II processors. Avoid use of these instructions with mode 2 addressing. Double operand instructions of the addressing f.o.rm %R, (R) + or %R, -(R) wbere' the· source and destination registers are the same, give different results on different PDP-II processors, and should be avoided. 1.7.4 Deferred .Autoincrement Mode, The register 'containsthe' pointer to the address of .the operand. contents of the register are incremented after being used. Format: @(ER)+ Example: CLR @(3)t ;CONTENTS OF REGISTER 3 POINT ;TO ADDRESS OF WORD TO BE CLEARED ;BEFORE BEING INCREMENTED BY TWO 1-13 " The PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.7.5 Autodecrement Mode The contents of the register are :decremented before being used as address of the operand (see note in Section 1.7.3). Format: the -(ER) Examples: CLR -(RO) 9DECREMENT CONTENTS OF REGISTERS CLR -(RO+3) ;0, 3 AND 2 BEFORE USING CLR -(2) 9AS ADDRESSES OF WORDS TO BE CLEARED 1.7.6 Deferred Autodecrement Mode The contents of the register are decremented before being used as pointer to the address of the operand. Format: the @-(ER) Example: ;DECREMENT CONTENTS OF REG. 2 9BEFORE USING AS POINTER TO ADDRESS ;OF WORD TO BE CLEARED. 1.7.7 Index Mode Format: .E(ER) ~. The value of an expression Eis stored as the second or third word of the instruction. The effective address is calculated as the value of E plus the contents of register ER. The value E is called the base. Examples: 1.7.8 CLRX+2(Rl) 9EFFEGTIVE ADDRESS IS X+2 PLUS ;THE CONTENTS OF REGISTER 1 CLR -2(3) 9EFFECTIVE ADDRESS IS -2 PLUS 9THE CONTENTS OF REGISTER 3 Deferred Index Mode An expression plus the contents of a register gives the pointer to the address of the operand. F6rmat: @E(ER) Example: CLR @14(4) ;IF REGISTER 4 HOLDS 100, AND LOCATION ;114 HOLDS 2000, LOC.2000 IS CLEARED. 1-14 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.7.9. Immediate Mode .and Deferred Immediate (Absolute) Mode The immediate mode allows the oper~nd itself to be stored as the It is assembled as an second or third word of the instruct.ion. autoincrement of register 7, the pc. Format:· ,'4/:E Examples: . MOV :1J:100,RO MOV :ft:X,RO ;MOV~ AN OCTAL 100 TO REGISTER 0 THE VALUE OF SYMBOL X TO ;REGISTER O. . ~MOVE The operation of this mode is explained as follows: The statement MOV 4/:100,R3 assembles as two words. These are: 012 703 00 0 1 0 0 Just b~fore this instruction is fetched and executed, the pc points to the fir~t word of the instruction. The processor fetches ~he first word and increments the pc by two. The source operand mode is 27 (autoincrement the PC). Thus the PC is used as a pointer to fetch the operand (the second word of the instruction) before being incremented by two, to point to the next instruction. If the #E is preceded by @, E specifies an absolute address. 1.7.10 Relative and Deferred Relative Modes Relative mode is the normal mode for memory references. Format: E Examples: CU';: 100 MOV X,y ~CLEAR LOCATION 100 ;MOVE CONTENTS hF LOCATION X TG HJJCATION Y. This mode is assembled as Index mode, using 7, the PC, as register. The base of the address calculation, which is stored in second or third word of the instruction, is not the address of operand. Rather, it is the number which, when added to the becomes the address of tbe operand. Thus, the· base is X-PC. operation is explained as follows: the the the PC, The If the statement MOV lOO,R3 is assembled at absolute location 20 the assembled code is: then Location 20: Location 22 01670 3 o 0 0 054 The processor fetches the MOV instruction and adds two to the PC so that it points to location 22. The source operand mode is 67~ that is; indexed by the PC . . To.pick up the base, the processor fetches the word. pointed to by the PC~nd adds two to the PC. The PC now points to location 24. To calculate the address of the source operand, the base is added to the designated register. That is, BASE+PC=54+24=100, the operand address. 1-15 PAL~llS ASSEMBLY LANGUAGE AND ASSEMBLER Since the Assembler conside~s "." as the address of the first word the instruction, an equivalent statement would be of MOV 100 -.- 4(PC),R3 This mode is called relative because the operand address is calculated relative to the current pc. The base is the distance (in bytes) between the operand and the current pc. If the operator and its operand are moved in memory so that the distance b~tween the operator and data remains constant, the instruction will operate correctly. If E is preceded by @ the expression's value is address of the operand. 1.7.11 Table of Mode Forms Section 1.7.12) and Codes the (6-bi~(A) pointer to the format only ~ see Each instruction takes at least one word. Operands of the first six forms listed below, do not increase the length of an instruction. Each operand in one of the other modes, however, increases the instruction length by one word. None of these Iorms increases the instruction leng'th. Form Mode Meaning R Register Register deferred @-(ER) On In 2n 3n 4n 5n . Autoi-ncrement deferred Autodecrement Autodecrement deferred Form Mode Meaning E(ER) @E(ER) :JI:E @#E 6n Index Index deferred Immediate Absolute memory reference Relative Relative deferred reference @R or· (ER) (ER) + @(ER)+ ';"fER) Any of these forms adds a word to the instruction length. E @E ~AutoincIement 7n 27 37 67 77 Notes: 1. An alternate form for @R is (ER). is equivalent to @O(ER). However, the form @O(ER) 2. The form @:JI:E differs from the form E in that the second or third word of the instruction contains the absolute address of the operand rather than the relative distance between the operand and the PC. Thus, the statement CLR @:JI:100 will clear location 100 even if the instruction is moved from the point at which it was assembled. The Assembler is not particular about left and right and dangling + and signs in address fields. The following are some examples of incorrect syntax that assemble as indicated, without an error indication. 1-16 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER Form Assembles As: Form Assembles As: (R2)A A- (R2) A(Rw)+ +(R2) A.(R2) A(R2) or A-O(R2) A(R2) (R2)+ (R2)@ (R2)A A(R2)+B - (R2) @ A(R2) A+B (R2) 1.7.12 Instruction Forms The instruction mnemonics are given in Appendix B. This section defines the number and nature of the operand fields for these instructions. In the table that follows, let R, E, and ER represent defined in Sections 1.4 and 1.7 and let A be specification of the forms: E @E R @R or (ER) + @(ER)+ - (ER) E (ER) #E (R) expressions as a 6-bit address @ -(ER) @ E(ER) @ :fI:E Table 1-1 Instruction Operand Fields Instr.uction Example Form MOV (R6)+, ;@Y CLR-(R2) HALT BR X+2 BLO .-4 Double. :6,p.arand Singl'eOp-erand OPERATE Branch Qp ·AiA Qp .A OP Op E Subroutine Call Subroutine Return EMT/TRAP where -128«E-.-2)/2<127 JSR ER,A RTS ER Op or Op'E where O<E<377 JSR PC,SUBR RTS PC EMT EMT 31 The branch instructions are one word instructions. The high byte contains the op code and the low byte contains an 8-bit signed offset (7 bits plus sign) which specifies the branch addre~s relative to the PC. The hardware calculates the branch address as follows: 1. Extend the sign of the offset through bits 8-15. 2. Multiply the result by 2. than a byte offset. 3. Add the result to the PC to form the final branch address. This creates a word offset rather The Assembler performs the reverse operation to form the byte offset from the specified address. Remember that when the offset is added to the PC, the PC is pointing to the word following the branch instruction; hence the factor -2 in the calculation. Byte offset Since PC = (E-PC)/2 truncated to eight bits. = .+2, we have Byte offset = (E-.-2)/2 truncated to eight bits. 1-17 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER NOTE It is illegaltd branch to a lOcation specified as an external symbol, or to a relocatable symbol when within. an absolute section, or to an absolute symbol when within a relocatable section. The EMT and TRAP instructions do not use the _low-order byte' of the word. This allows information to be transferred to the trap handlers in the low-order byte. If EMT or TRAP is followed by an expression, the value is put into the low-order byte of the word~ However, if the expression is too big(>377 S ) it is truncated to eight bits ~nd a Truncation (T) error occurs. Do not try to micro-progr~m the condition cod~ operators (see Appendix B, B.4). This makes sense in the PDP-II hardwarep however, the current PAL-lIS Assembler does not support this capability. Thus: CLC!CLV results in a Q error (see assembled as CLC. Appendix B, B.5) and the statement is Expressions in the Assembler 'do, however, allow logical operators and the use of instruction mnemonics. Thus, the proper ways to write the above statement: ; 0 F' f.H' af"Ji.:I (:If • warm ; Ol"'erand of d(f!fal..llt ; DF·e r'i~nd fJf defi31..11t .WORD CLC! +CLC!CLV !CLC!CLV 1.S .WORD .WORD ASSEMBLER DIRECTIVES Assembler directives (sometimes called pseudo-ops) direct the assembly process and may generate data. Assembler directives may be preceded bya label and followed by a comment. The assembler directive occupies the operator field. Only one directive may be placed in anyone statement. . One or more operands may occupy the operand field or it may be void -- allowable ~perands vary from directive to directive. . 1.S.1 .TITLE The .TITLE directive is used to name the object module. The name is assigned by the first symbol following the directive • If there is no . TITLEstatement the default name 'assigned is ~MAIN. ". II 1. S • 2 . GLOBL The .GLOBL directive is used to declare a symbol as bei~g global. It may be an entry symbol, in which case i t i s defined in the program, or it may be a external symbol, in which case it should be defined in another program which will be linked with this program by the linker. The form of the .GLOBL directive is .GLOBL NAMA, NAMB, .•. ,NAMN I-IS PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER NOTE A symbol cannot be declared global by defining' it as a global,expression in a direct assignment statement. If an illegal character is detected in the operand field of a .GLOBL statement, an error message is not generated; and the Assembler may ignore the remainder of the statement. Thus:. GLOBL A,B,@C,D as~embles without error as: .GLOBL A,B 1.8.3 Program Section Directives (.ASECT and~CSECT) The relocatable assembler provides for two program sections, an absolute section declared by an .ASECT directive and a relocatable section declared by a .CSECT directive. These directives therefore enable the programmer to specify that parts of his program be assembled in the absolute section and others in a relocatable section. The scope of each directive extends until a directive to the contrary is given. The Assembler initially starts in the relocatable section: Thus, if the first statement of a program were A: .ASECT the label "A" would be a relocatable symbol which is assigned the value of relocatable zero. The absolute value of A will be calculated by the Linker by adding the value of the base of the relocatable section. Example: A: X: '. ASECT .::::1000 CL.R X .CBECT JMP A .END ;ASSEMBLER IN ABSOLUTE SECTION 9PC = 1000 ABSOLUTE ;A = 1000 ABSOLUTE 9ASSEMBLE IN RELOCATABLE SECTIO~ ;x=o RELOCATABLE The absolute and/or relocatable section may be discontinued (by ~witching to the alternate section) and,then continued where they left off by using another .ASECT or .CSECT statement. Example: .CBECT .wmm 0,;J,,2 .ASECT .WORD 0,l.,2 .CSECT .WORD 0 .END ;ASSEMBLE[I AT RELOCATABLE 0, 2 and 4 .; ASSEMBLED AT ABSOLUTE 0, 2 and 4 9ASSEMBLED AT RELOCATABLE 6. If a label is defined twice, first in an absolute section and then in a relocatable section, the symbol will be relocatable but its value will be as defined in the absolute section. },-19 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1. 8.4 .EOT The .EOT directive indicates the physical End Of Tape though not. the logical end of the program. ,If the .EOT is followed by a single line feed or form feed, the Assembler will still read to the end of the tape, but will not process anything past the .EOT directive. If .EOT is followed by at least two line feeds or form feeds, the Assembler will stop before the end of the tape. Either case is proper, but it should be understood that even though it appears as if the Assembler has read too far, it actually hasn't. I f a .EOT is embedded in a tape, and more information to be assembled follows it, .EOT must be immediately followed by at least two line feeds or form feeds. Otherwise, the first line following the .EOT will be lost. Any operands following a .EOT directive will be ignored. The .EOT directive allows several physically separate tapes to be assembled as one program. The last tape should be terminated by a .END directive (see Section 1.8.6) but may be terminated with • EDT (spe .END emulation in Section 1.9.4). 1. 8. 5 . EVEN The .EVEN directive ensures that the assembly location counter is even by adding one if it is odd. Any operands following a .EVEN directive will be ignored. 1. 8.6 '. END The .END directive indicates the logical and physical end of the source program. The .END directive may be followed by only one operand, an expression indicating the prog,r,aIIl's tr,ansfer addresa. At loadct±me, the load module wEI be loaded and program execution will begin at the transfer address indicated by the .END directive. If the address is not specified, the loader will halt after reading in the load moduler 1. 8.7 • WORD - The .WORD assembler directive may have one or more operands', separated by commas. Each operand is stored ina word of the object program. If there is more than one operand, they are stored in successive words. The operands may be any legally formed expression. For example, .:::::1.420 SAL~-::O .WORD 177535,.+4,SAL ;STORED IN WORDS 1420, 1422 AND ;1424 WILL BE 177535, 1426, AND 0 Values exceeding 16 bits length. wil~ be truncated 1-20 from the left, to word PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER A .WORD directive followed by one or more void operands separated commas will store zeros for the void operands. For example, .=1430 .WORD ,5, by ;ZERO, FIVE, AND ZERO ARE STORED ;IN WORDS 1430, 143~, AND 1434 An. operator field left blank will be interpreted as the . WORD directive if the operand field contains one or more expressions. The first term of the first expression in the operand field must not be an instruction mnemonic or assembler directive unless preceded by a +, or one of the logical operators, ! or &. For example, .::::440 LABEL: +MOV,LABEL ;THE OP-CODE FOR MOV, WHICH IS 010000, ;IS STORED IN LOCATION 440. 440 IS ;STORED IN LOCATION 442. Note that the default .WORD will occur whenever there is a leading arithmetic or logical operator, or whenever a leading symbol is encountered which is not recognized as an instruction mnemonic or assembler directive. Therefore, if an instruction mnemonic or assembler directive is misspelled, the .WORD directive is assumed and errors will result. Assume that MOV is spelled incorrectly as MaR: MaR A,B Two error codes can result: A Q will occur because an expression operator is missing between MaR and A, and a U will occur if MaR is undefined. Two words will be generated; one for MaR A and one for B. 1. 8.8 .BYTE The .BYTE assembler directive may have one or more operands separated by commas. Each operand is stored in a byte of the object program. If multiple operands are specified, they are stored in successive bytes. The operands may be any legally formed expression with a result of 8 bits or less. For example, SAM:=:5 • :::410 • BYTE 48.,SAM ;STORED IN LOCATION 410 WILL BE ;060 (THE OCTAL EQUIVALENT OF 48) • ;IN 411 WILL BE'005 • If the expression has a result of more than 8 bits, it will be truncated to its low-order 8 bits and will be flagged as a Terror. If an operand after the .BYTE directive is left void, it will be interpreted as zero. For example, • """420 • BYTE , , ;ZERO WILL BE STORED IN ;BYTES 420, 421 AND 422 • If the expression is relocatable, a warning flag, A, will be given. 1.8.9 .ASCII The .ASCII directive translates strings of ASCII characters into their 7-bit ASCII codes with the exception of null, rubout, carriage return, line feed and form feed. The text to be translated is delimited by a character at the beginning and the end of the text. The delimiting character may be any printing ASCII character except colon and equal sign and those used in the text string. The 7-bit ASCII code generated for each character will be stored in successive bytes of the object program. For example, 1-21 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER .=500 .ASCII IYESI .ASCII 15+3/21 ;THE ASCII CODE FOR Y WILL BE ;STORED IN 500~ THE CODE FOR E ;IN 501, THE CODE FOR S IN 502. 9THE DELIMITING CHARACTER OCCURS 9AMONG THE OPERANDS. THE ASCII ;CODES FOR 5 , + , AND 3 ARE ;STORED IN BYTES 503, 504, AND ;505. 21 IS NOT ASSEMBLED. The .ASCII directive may be terminated by any legal terminator except for and .• Note that if the text delimiter is also a terminator, the leading text delimiter can also serve as the .ASCII directive terminator. For example, .ASCII IABCDI • ASCII+ABCD+ 1.8.10 9THE SPACE IS REQUIRED ;BECAUSE I IS NOT A TERMINATOR. 9NO SPACE IS REQUIRED • .RAD50 PDP-II system programs often handle symbols in a specially coded form caled "RADIX 50" (this form is sometimes referred to as "MOD40"). This form allows 3 characters to be packed into 16 bits; therefore, any symbol can be held in two words, the form of the directive is: .RAD50 /CCC/ The single operand is of the form /CCC/ where the slash (the delimiter) can be any printable character except for = and:. The delimiters enclose the characters to be converted which may be A through Z, 0 through 9, dollar ($), dot (.) and space ( ) . If there are fewer than 3 characters they are considered to be left-justified and trailing spaces are assumed. Any characters following the t~ailing delimiter are ignored and no.error results. Examples: .RAD50 IABCI .RAD50 IABI .1:;:AD~50 I I ;PACK ABC INTO ONE WORD ;PACK AB (SPACE) INTO ONE WORD; ;PACK 3 SPACES INTO ONE WORD The packing algorithm is as follows: A. Each character is translated into indicated in the following table: Character (SPACE) A-Z $ 0-9 its RADIX 50 equivalent as RADIX 50 Equivalent (octal) o 1-32 33 34 36-47 Note that another character can be defined for code 35. B. The RADIX 50 equivalents for characters 1 through 3 (Cl,C2,C3) are combined as follows: RESULT=((Cl*50)+C2)*50+C3 1-22 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.8.11 .LIMIT A program often wishes to know the boundaries of the relocatable code. The .LIMIT directive generates two words into which the linker puts the low and high addresses of the relocated code. The low address (inserted into the first word) is the address of the first byte of code. The high address is the address of the first free byte following the relocated code. These addresses will always be even since all relocatable sections are loaded at even addresses and if a relocatable section consists of an odd number of bytes the linker adds one to the size to make it even. 1.8.12 Conditional Assembly Directives Conditional assembly directives provide the programmer with the capability to conditionally include or not include portions of his source code in the assembly process. In what follows, E denotes an expression and S(i) denotes a symbol. The conditional directives are: .IFZ .IFNZ .IFL .IFLE .IFG .IFGE .IFDF .IFNDF E E E E E E S (1 ) S (1) iIF E=O iIF E*O iIF E<O iIF E~IO i IF E>O ;IF E~O [ I , &] S (2) [1,&] ... [1,&] S(N) [ I , &] S (2) [1,&] ..• [1,&] S(N) (I =OR, &=AND) If the condition is met, all statements up to the matching .ENDC are assembled. Otherwise, the statements are ignored until the matching .ENDC is detected. In the above,.IFDF and .IFNDF mean "if defined" and "if undefined" respectively. The scan is left to right, no parentheses permitted. E"xample: .IFDF S!T&U Means assemble if either S or T defined and U is defined is .IFNDF T&LJ!S Means assemble if both T and U undefined or if S is undefined are General Remarks: An errored or null expression takes the default value 0 for purposes of the conditional test. An error in syntax, e.g., a terminator other than ;, I, &, or CR results in the undefined situation for .IFDF and .IFNDF, as does an errored or null symbol. All conditionals must end with the .ENDC diIective. Anything in the operand field of .ENDC is ignored. Nesting is permitted up to a depth of 127 Labels are permitted on conditional directives, but the scan is purely l"eft to right. For example: A: .IFZ 1 . ENDC A is ignored. A: .IFZ 1 .ENDC A is entered in the symbol table. 1-23 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER If a .END is encountered while inside a satisfied conditional, a Q flag will appear, but the .END directive will still be processed normally. If more .ENDC's appear than are required, Q flags appear on the extras. 1.9 1.9.1 OPERATING PROCEDURES Introduction The Assembler enables you to assemble an ASCII tape containing PAL-II statements into a relocatable binary tape (object module). To do this, two or three passes are necessary. On the first pass, the Assembler creates a table of user-defined symbols and their associated values, and a list of' undefined symbols is printed on the teleprinter. On the second pass the Assembler assembles the program and punches out an absolute binary tape and/or outputs an assembly listing. During the third pass (this pass is optional), the Assembler punches an absolute binary tape or outputs an assembly listing. The symbol table (and/or a list of errors) may be output on any of these passes. The input and output devices as well as various options are specified during the initial dialogue (see Section 1.9.3). The Assembler initiates the dialogue immediately after being loaded and after the last pass of an assembly. 1.9.2 Loading PAL-lIS PAL-lIS is loaded by the Paper Tape Software Absolute Loader. Note that on systems with hardware switch registers, the start address of the Absolute Loader must be in the Switch Register when loading the Assembler. This is because the Assembler tape has an initial program which clears all of core up to the address specified in the Switch Register, and jumps to that address to start loading the Assembler. 1.9.3 Initial Dialogue After being loaded, the Assembler prints its name and version and then initiates dialogue by printing on the teleprinter *S meaning "What is the Source symbolic input device?" The be .J H L T response may use Low-speed reader (.Jdenotes typing the RETURN key) meaning High-speed reader meaning Low-speed reader meaning Teleprinter keyboard The device specification is terminated, as is all typing the RETURN key. user response, by If an error is made in typing at any time, typing the RUBOUT key will erase the immediately preceding character if it is on the current line. Typing CTRL/U will erase the whole line on which it occurs. 1-24 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER After the *S question and response, the Assembler prints: *B meaning "What is the Binary output device?" The responses similar to those for *S: H L ./ to *B are meaning High-speed punch meaning Low-speed punch meaning do not output binary tape (./denotes typing the RETURN key) In addition to I/O device specification, various options may be chosen. The binary output will occur on the second pasS unless /3 (indicating the third pass) is typed following the H or L. Errors will be listed on the same pass if /E is typed. If /E is typed in response to more than one inquiry, only the last occurrence will be honored. It is strongly suggested that the errors be listed on the same pass as the binary output, since errors may vary from pass to pass. If both /3 and /E are typed, /3 must terminated by typing the RETURN key. precede /E. Examples: The response is *B L/E Binary output on the low-speed punch and the errors on the teleprinter, both during the second pass. *B H/3/E Binary output on the high-speed punch and the errors on the teleprinter during the third pass. *B The RETURN key alone will cause Assembler to omit binary output the After the *B question and response, the Assembler prints: *L meaning "What is the assembly Listing output device?" The response *L may be: L H T P .J to meaning Low-speed punch meaning High-speed punch meaning Teleprinter meaning Line Printer meaning do not output listing (.Jdenotes typing RETURN) After the I/O device £pecification, pass and error list options similar to those for *B may be chosen. The assembly listing will be output on the third pass unless /2 (indicating the second pass) is typed following H, L, T, or P. Errors will be listed on the teleprinter during the same pass if /E is typed. If both /2 and /E are typed, /2 must precede /E. The response is terminated by typing the RETURN key. Examples: *L L/2/E Listing on low-speed punch and errors on teleprinter during second pass. *.L H Listing on high-speed punch pass *L ~uring The RETURN key alone will cause Assembler to omit listing output. 1-25 third the PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER After the *L ,question and response, the final question is the teleprinter: printed on *T meaning "What is the symbol Table output device?" The device specification is the same as for *L question. The symbol table will be output at the end of the first pass unless /2 or /3 is typed in response to *T. The first tape to be assembled should be placed in the reader before typing the RETURN key because assembly will begin upon typing RETURN to the *T question. The /E option is not a meaningful response to *T. Example *T Symbol table output end of third pass. T/3 on teleprinter Typing the RETURN key alone will the Assembler to omit symbol output. *T at cause table The symbol table is printed alphabetically, three symbols per line. Each symbol printed is followed by its identifying characters and by its value. If the symbol is undefined, six asterisks replace its value. The identifying characters indicate the class of the symbol; that is, whether it is a label, direct assignment, register symbol, etc. The following examples show the various forms. ABCDEF R3 DIRASM XYZ R6 LABEL 001244 %000003 177777 ****** %****** ****** (Defined Label) (Register Symbol) (Direct Assignment) (Undefined direct assignment) (Undefined register symbol) (Undefined label) Generally, undefined symbols and external symbols will be listed as undefined direct assignments. Multiply-defined symbols are not flagged in the symbol table printout but are flagged wherever they are used in the program. If the symbol is relocatable or global or will be followed by an R, a G or both. both, the symbol's value It is possible to output both the binary tape and the assembly listing on the same pass, thereby reducing the assembly process to two passes (see Example 1 below). This will happen automatically unless the binary device and the listing device are conflicting devices or the same device (see Example 2 below). The only conflicting devices are the teleprinter and the low-speed punch. Even though the Assembler deduces that three passes are necessary, the binary and listing can be forced on pass 2 by including /2 in the responses to *B and *L (see Example 3 below). Example 1. *S *B *L *T Runs 2 passes: H H P T High-speed reader High-speed punch Line Printet Teleprinter Example 2. Runs 3 passes: H H H T High-speed reader High-speed punch High-speed punch Teleprinter 1-26 PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER Example 3. Runs 2 passes: H H/2 H/2 T High-speed reader High-speed punch on pass 2 High-speed punch on pass 2 Teleprinter Note that there are several cases intermixed with ASCII output: where the binary output can be listing to a. *B *L H/2 H/2 Binary and listing to punch on pass 2. b. *B L/E Binary to low-speed punch and error teleprinter (and low-speed punch). c. *B *L L/2/E T/2 Binary, error listing, and listing to low speed punch. The object module so generated is acceptable to the Linker as long as there are no CTRL/A characters in the source program. The start of ~very block on the binary tape is indicated by a 001 and the Linker 19nores all information until a 001 is detected. Thus, all source and/or error messages will be ignored if they do not contain any CTRL/A characters (octal 001). If a character other than those mentioned is typed in reponse to a question, the Assembler will ignore it and print the question again. Example: *S *B *B H Q High-speed reader Q is not a valid response The question is repeated If at any time you wish to restart the Assembler, type CTRL/P. If the low-speed reader is the source input device, turn it off before typing CTRL/P. When no passes are omitted or error options specified, performs as follows: the Assembler PASS 1: Assembler creates a table of user-defined symbols and their associated values to be used in assembling the source to object program. Undefined symbols (not including external globals) are listed on the teleprinter at the end of the pass. The symbol table is also listed at this time. If an illegal location statement of the form .=expression is encountered, the line and error code will be printed out on the teleprinter before the assembly proceeds. An error in a location statement is usually a fatal error in the program and should be corrected. PASS 2: Assembler punches the object module, and prints the pass and undefined location statements on the teleprinter. error count PASS 3: Assembler prints or punches the assembly program listing, undefined location statements, and the pass error count on the teleprinter. 1-27 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER The functions of passes 2. and 3 will occur simultaneously on pass 2 if the binary and listing devices are different, and do not conflict with each other (the low-speed punch and teleprinter conflict). Furthermore, if the binary object module is not requested, the listing will be produced on pass 2. . The following table summarizes the initial dialogue questions: PRINTOUT INQUIRY *S *B *L *T What What What What is is is is the input device of the Source symbolic tape? the output device of the Binary object tape? the output device of th~ assembly Listing? the ·output deviqe of the symbol Table? The following table summarizes the legal responses: CHARACTER RESPONSE INDICATED Teleprinter keyboard Low-speed reader or punch High-speed reader or punch Line Printer Pass 1 Pass 2 Pass 3 Errors listed on same pass (not meaningful response to *S or *T) Omit function (except in response .to *S). T L H P II 12 13 IE ./ Typical examples of complete initial dialogues: For minimal PDP-II configuration: *S *B L LIE *L *T T T Source input on low-speed reader Binary output on low-speed punch errors during same (second) pass Listing on teleprinter during pass 3 Symbol table on teleprinter at end of pass 1 For a PDP-II with high-speed IIO devices: 1.9.4 *S *B H *L *T ./ HIE T/2 Source input on high-speed reader Binary output on high-speed punch errors during same (second) pass No listing Symbol table on teleprinter at end of pass 2. Assembly Dialogue During assembly, the Assembler wiil pause to print on the teleprinter various messages to indicate that you must respond in some way before the assembly process can continue. You may also type CTRLIP, at any time, if you wish to stop the assembly process and restart the initial dialogue, as mentioned in the previous section. When a .EOT assembler directive is read on prints the tape, the Assembler and pauses. Our ing this pa"use, the next tape is placed in the reader, and RETURN is typed to continue the assembly. 1-28 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER If the specified assembly listing output device is the high-speed punch and if it is out of tape, or if the device is the Line Printer and is out of paper, the Assembler prints on the teleprinter and waits for tape or paper to be placed in the device. Type the RETURN key when the tape or paper has been replenished; assembly will continue. Conditions causing the EOM? are: HSP messages for an assembly listing device LPT No power No tape No power Printer drum gate open Too hot No paper There is no EOM if the line printer is switched off-line, although characters may be lost for this condition as well as for an EOM. If the binary output device is the high-speed punch and if it of tape, the Assembler prints: The assembly process is aborted and again. the When a .END assembler directive is read on prints: initial the dialogue tape, the is is out begun Assembler END ? and and the for pauses. During the pause the first tape is placed in the reader, the RETURN key is typed to begin the next pass. On the last pass, .END directive causes the Assembler to begin the initial dialogue the next assembly. If you are starting the binary pass and the binary is to be punched on the low-speed punch, turn the punch on before typ.ing the RETURN key for starting the pass. The carriage return and line feed characters will be punched onto the binary tape, but the Linker will ignore them. If the last tape ends with a .EOT, the Assembler may be told to emulate a .END assembler directive by responding with E followed by the RETURN key. The Assembler will then print END ? and wait for another RETURN before starting the next pass. EOF? END ? Example: E...J Note that forcing a .END in this manner causes the error counter to be incremented by one. 1-29 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.9.5 Assembly Listing PAL-lIS produces a side-by-side assembly listing of symbolic source statements, their octal equivalents, assigned addresses, and error codes, as follows: EELLLLLL OOOOOOASSS ...•... S 000000 000000 The E's represent the error field. The L's represent the address. The a's represent the object data in octal. The SiS represent the source statement. "A" represents a single apostrophe which indicates that either the second, third or both words of the instruction will be modified by the Linker. While the Assembler accepts 72 characters per line on input, the risting is reduced by the 16 characters to the left of the source statement. The above represents a three-word statement. The second and third words of the statement are listed under the command word. No addresses precede the second and third words since· the address order is sequential. The third line is o~itted for a two-word statement~ third lines are omitted for a one-word statement. both· second and For a .BYTE directive, the object data field is three octal digits. For a direct assignment statement, the value of the defining expression is given in the object code field although it is not actually part of the code of the object program. The .ASECT and .CSECT directives cause the current value of the appropriate location counter (absolute or relocatable) to be printed. Each page of the listing is headed by a page number (octal). 1.9.6 Object Module Output The output of the assembler during the binary object pass is an object module which is meaningful only to the linker. What follows gives an overview of what the object module contains and at what stage each part of it is produced. The binary object module consists of three main types of data block: a) Global symbol directory b) Text blocks c) Relocation Directory (GSD) (TXT) (RLD) 1.9.6.L Global Symbol Directory - As the name suggests, the GSD contains a list of all the global symbols together with the name of the object module. Each symbol is in Radix-50 form and contains information regarding its mode and value whenever known. The GSD is created at the start of the binary object pass. 1-3Q ,PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER 1.9.6.2 Text Block - The text blocks consist entirely of the binary object data as shown in the listing. The operands are in the unmodified form. 1.9.6.3 Relocation Directory - The RLD blocks consist of directives to the Linker which may reference the text block preceding the RLD. These directives control the relocation and linking process. Text and RLD blocks are constructed during the binary object pass. Outputting of each block is done whenever either the TXT or RLD buffer is full and whenever the location counter needs to be modified. 1.10 ERROR CODES The error codes printed beside the octal and assembly listing have the following meanings: symbolic code in the Error Code Meaning A Addressing error. An address within the instruction is incorrect. Also may indicate a relocation error. B Bounding error. Instructions or word data are being assembled at an odd address in memory. The location counter is updated by +1. D Doubly-defined symbol referenced. Reference was made to a symbol which is defined more than once. I Illegal character detected. Illegal characters which are also non-printing are replaced by a? on the listing. L Line buffer overflow. Extra characters (more than 72 ) are ignored. M Multiple definition of a label. A label was encountered which was equivalent (in the first six characters) to a previously encountered label. N Number containing 8 or 9 has decimal point missing. P Phase error. A label's definition or from one pass to another. Q Questionable syntax. There are missing arguments or the instruction scan was not completed or a carriage return was not immediately followed by a line feed or form feed. R Register-type error. An invalid use of or reference to a register has been made. S Symbol table overflow. When the quantity of user-defined symbols exceeds the allocated space available in the user's symbol table, the assembler outputs the current source line with the S error code, then returns to the initial dialogue. 1-31 on value a line varies PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER , T Truncation error. A number generated more than 16 bits of significance or an expression gener?ted more than 8 bits of significance during the use of the .BYTE directive. U Undefined symbol. An undefined symbol was encountered during the evaluation of an expression. Relative to the expression, the undefined symbol is assigned a value of zero. 1.11 SOFTWARE ERROR HALTS PAL-lIS loads all of its unused trap vectors with the code .WORD .+2,HALT so that if the trap does occur, the processor will halt in the second word of the vector. The address of the halt, displayed in the console address register, therefore indicates the cause of the halt. Address of Halt (octal) Meaning 12 16 Reserved instruction executed Trace trap occurred Power fail trap EMT executed 26 32 A halt at address 40 indicates an IOXLPT detected error. (displayed in the console lights) contains an identifying code: Code in RO 0 1 2 3 4 5 RO Meaning Illegal memory reference, SP overflow or illegal instruction. Illegal lOX command. Slot number out of range. Device number illegal Referenced slot not INITed. Illegal Data Mode • . IOXLPT also sets Rl as follows: If the error code is 0, Rl contains the PC at the time of the error. If the error code is 1-5, Rl points to some element in the lOT argument list or to the instruction following the argument list, depending on whether IOXLPT has finished decoding all the arguments when it detects the error. 1-32 CHAPTER 2 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS' PAL-IIA (Program Assembly Language for the PDP-II's Absolute Assembler) enables you to write source (symbolic) programs using letters, numbers, and symbols which are meaningful to you. The source programs, generated either on-line using the Text Editor (ED-II), or off-line, are then assembled into object programs (in absolute binary) which are executable by the computer. The object program is produced after two passes through the Assembler; an optional third pass produces a complete octal/symbolic listing of the assembled program. This listing is especially useful for documentation and debugging purposes. This chapter explains not only how to write PAL-IIA programs but also how·· to assemble the source programs into computer-acceptable object programs. All facets of the assembly language are explained and illustratea with many examples, and the chapter concludes with assembling procedures. In explaining how to write PAL-IIA source programs it is necessary, especially at the outset, to make frequent forward references. Therefore, we recommend that you first read through the entire chapter to get a "feel" for the language, and then reread the chapter, this time referring to appropriate sections as indicated, for a thorough understanding of the language and assembling procedures. Some notable features of PAL-IIA are: 1. Selective assembly pass functions 2. Device specification for pass functions 3. Optional error listing on Teletype 4. Double buffered and concurrent I/O (provided by IOX) 5. Alphabetized, formatted symbol table listing The PAL-IIA Assembler is available in two versions: an 8K version. a 4K version and The assembly language applies equally to both versions. The 4K version provides symbol storage for about 176 user-defined symbols, and the 8K version provides for about 1256 user-defined symbols (see Section 2.3). In addition, the 8K version allows a line printer to be used program listing and/or symbol table listing. lpAL-llA is not currently available for PDP-II systems without registers. 2-1 for the switch WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS The following discussion of the PAL-IIA Assembly Language assumes that you have read the PDP-II Processor Handbook, with emphasis on those sections which deal with the PDP-II instruction set, formats, and timings a thorough knowledge of these is vital to efficient assembly language programming. 2.1 CHARACTER SET A PAL-IIA source program is composed of symbols, numbers, expressions, symbolic instructions, assembler directives, arguments separators, and line terminators written using the following ASCII l characters. 1. The letters A through Z. (Upper and lower case letters are acceptable, although upon input, lower case letters will be converted to upper case letters.) 2. The numbers 0 through 9. 3. The characters. 4. The separating or terminating symbols: : = % # @ ( ) , carriage return 2.2 and $ (reserved for system software). " I tab + _ '" ! space line feed form feed STATEMENTS A source program is composed of a sequence of statements, where each statement is on a single line. The statement is terminated by a carriage return character and must be immediately followed by either a line feed or form feed character. Should a carriage return character be present and not be followed by a line feed or form feed, the Assembler will generate a Q error (Section 2.10) and that portion of the line following the carriage return will be ignored. Since the carriage return is a required statement terminator, a line feed or form feed not immediately preceded by a carriage return will have one inserted by the Assembler. It should be noted that, if the Editor (ED-II) is being used to create the source program (see Section 4.4.4), a typed carriage return (RETURN key) automatically generates a line feed character. A statement may be composed of up to four fields which are identified by their order of appearance and by specified terminating characters as explained below and summarized in Appendix B. The four fields are: Label Operator Operand Comment The label and comment fields are optional. The operator and operand fields are interdependent -- either may be omitted depending upon the contents of the other. ASCII stands for American Standard Code for Information Interchange. 2-2 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS 2.2.1 Label A label is a user-defined symbol (see Section 3.3.2) which is assigned the value of the current location counter. It is a symbolic means of referring to a specific location within a program. If present, a label always occurs first in a statement and must be terminated by a colon. For example, if the current location is 100(octal), the statement ABCD: MOV A,B will assign the value 100(octal) to the label ABCD so that subsequent reference to ABCD will be to location 100(octal). More than one label may appear within a single label field; each label within the field will have the same value. For example, if the current location is 100, multiple labels in the statement ABC: $DD: A7.7: MOV A,B will equate each of the three labels ABC, $DD, and A7.7 with the value 100(octal). ($ and are reserved for system software.) The error code M (multiple definition of a symbol) will be generated during assembly if two or more labels have the same first six characters. 2.2.2 Operator An operator follows the label field in a statement, and may be an instruction mnemonic or an assembler directive (see Appendix B). When it is an instruction mnemonic, it specifies what action is to be performed on any operand(s) which follows it. When it is an assembler directive, it specifies a certain function or action to be performed during assembly. The operator may be preceded only by one or more labels and may be followed by one or more operands and/or a comment. An operator is legally terminated by a space, tab, or any of the following characters. # + @ line feed " % & form feed carriage return The use of each character above will be explained in this chapter. Consider the following examples: MClV AvB MmJ@A,B i~(TAB) terminates operator MOV i@ terminates operator MOV When the operator stands alone without an operand or comment, it is terminated by a carriage return followed by a line feed or form feed character. 2.2.3 Operand An operand is that part of a statement which is operated on by the operator -- an instruction mnemonic or assembler directive. Operands may be symbols, expressions, or numbers. When multiple operands appear within a statement, each is separated from the next by a comma. 2-3 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS An operand may be preceded by an operator and/or label, by a comment. and followed The operand field is terminated by a semicolon when followed hy a comment, or by a carriage return followed by a line feed or form feed character when the operand ends the statement. For example, LABEL: MOV GEORGE,BOB ;THIS IS A COMMENT where the space between MOV and GEORGE terminated the operator field and began the operand field; the comma separated the operands GEORGE and BOB; the semicolon terminated the operand field and began the comment. 2.2.4 Comments The comment field is optional and may contain any ASCII character except null, rubout, carriage return, line feed or form feed. All other characters, even those with special significance are ignored by Assembler when used in the comment field. The comment field may be preceded by none, any, or all of the other three fields. It must begin with the semicolon and end with a carraige return followed by a line feed or form feed character. For example, LABEL: CLR HERE iTHIS IS A $1.00 COMMENT Comments do not affect assembly processing or program execution, but they are useful in program listings for later analysis, checkout or documentation purposes. 2.2.5 Format Control The format is controlled by the space and tab characters. They have no effect on the assembling process of the source program unless they are embedded within a symbol, number, or ASCII text; or are used as the operator field terminator. Thus, they can be used to provide a neat, readable program. A statement can be written LABEL:MOV(SP)+,TAGjPOP VALUE OFF STACK or, using formatting characters it can be written LABEL: MOV (SP)+,TAG ;POP VALUE OFF STACK which is much easier to read. Page size is controlled by the form feed character. A page of n lines is created by inserting a form feed (CTRL/FORM keys on the keyboard) after the nth line. If no form feed is present, a page is terminated after 56 lines. 2-4 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.3 SYMBOLS There are two types of symbols, permanent and user-defined. Both are stored in the Assembler's symbol table. Initially, the symbol table contains the permanent symbols, but as the source program is assembled, user-defined symbols are added to the table. 2.3.1 Permanent Symbols Pe'rmanent symbols consist of the instruction mnemonics (see Appendix B.3) and assembler directives (see Section 2.8). These symbols are a permanent part of the Assembler's symbol table and need not be defined before being used in the source program. 2.3.2 User-Defined Symbols User-defined symbols are those defined as labels (see Section 2.2.1) or by direct assignment (see Section 2.3.3). These symbols are added to the symbol table as they are encountered during the first pass of the assembly. They can be composed of alphanumeric characters, dollar signs, and periods only; again, dollar signs and periods are reserved for use by the system software. Any other character is illegal and, if used, will result in the error message I (see Section 2.11). The following rules also apply to user-defined symbols: 1. The first character must not be a number . .2. Each .symbol must be unique within the first s.ixcharacters. 3. A symbol may be written with more than six legal characters but the seventh and subsequent characters are only checked for legality, and are not otherwise recognized by the Assembler. 4. Spaces and tabs must not be embedded within a symbol. A user-defined symbol may duplicate a permanent symbol. The value associated with a permanent symbol that is also user-defined depends upon its use: 2.3.3 1. A permanent symbol encountered in the operator associated with its corresponding machine op-code. field is 2. If a permanent symbol in the operand field is also user-defined, its user-defined value is associated with the symbol. If the symbol is not found to be user-defined, then the corresponding machine op-code value is associated with the symbol. Direct Assignment A direct assignment statement associates a symbol with a value. When a direct assignment statement defines a symbol for the first time, that symbol is entered into the Assembler's symbol table and the specified value is associated with it. A symbol may be redefined by assigning a new value to a previously defined symbol. The newly assigned value will replace the previous value assigned to the symbol. 2-5 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS The general format for a direct assignment statement is symbol expression The following conventions apply: I. An equal sign (=) must separate expression defining the symbol. the symbol from the 2. A direct assignment statement may be preceded by a label may be followed by a comment. and 3. Only one symbol can be defined by anyone statement. 4. Only one level of forward referencing, is allowed. direct assignment Example of the two levels of forward referencing (illegal): x Y Y Z Z 1 X and Yare both undefined throughout pass 1 and will be listed on the printer as such at the end of that pass. X is undefined throughout pass 2, and will cause a U error message. Examples: A ..• :I. ;THE SYMBOL A IS EQUATED WITH THE VALUE :I. B 'A,,· :1. &MASI\LOW ;THE SYMBOL B IS EQUATEP WITH THE EXPRES;GION'B VAL.UE. D :::: :3 ;THE GYMBOL D IB EQUATED WITH 3. THE ;LABELG C AND E ARE EQUATED WITH THE ;NUMERICAL MEMORY ADDRESS DF THE MOV ; COM1'iAND • c~ E: 2.3.4 11DV :H::I.? ABLE Register Symbols The eight general registers of the PDP-II are numbered 0 through 7. These registers may be referenced by use of a register symbol, that is, a symbolic name for a register. A register symbol is defined by means of a direct assignment, where the defining expression contains at least one term preceded by a % or at least one term previously defined as a register symbol. F~O::::%O R3:::: I:;: 0 +3 f~4:::::I.+%:3 THEF~E::::%2 ;DEFINE RO AS REGIGTER 0 ;DEFINE R3 AS REGIGTER 3 ;DEFINE R4 AS REGISTER 4 ;DEFINE "THERE" AS REGIBTER 2 It is important to note that all register symbols must be defined before they are referenced. A forward reference to a register symbol will generally cause phase errors (see Section 2.10). 2-6 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS The % may be used in any expression thereby indicating a reference to a register. Such an expression is a register expression. Thus, the statement CLR %6 will clear register 6 while the statement CLR 6 will clear the word at memory address 6. In certain cases a register can be referenced without the use of a register symbol or register expression. These cases are recognized through the context of the statement and are thoroughly explained in Sections 2.6 and 2.7. Two obvious examples of this are: JSR CLR 2.4 ;THE FIRST OPERAND FIELD MUST ;ALWAYS BE A REGISTER. X(2) ;ANY EXPRESSION ENCLOSED IN ;() MUST BE A REGISTER. IN ;THIS CASEp INDEX REGISTER 2. EXPRESSIONS Arithmetic and logical operators (see Section 2.4.2) may be used to form expressions. A term of an expression may be a permanent or user-defined symbol, a number, ASCII data, or the present value of the assembly location counter represented by the period. Expressions are evaluated from left to right. Parenthetical grouping is not allowed. Expressions are evaluated as word quantities. The operands of a .BYTE directive (Section 2.8.5) are evaluated as word expressions before truncation to the low-order eight bits. A missing term or expression will be interpreted as O. A missing operator will be interpreted as +. The error code Q (Questionable syntax) will be generated for a missing operator. For example, A + -100 will be evaluated as A + ;OPERAND MISSING a - 100, and TAG! LA 177777 ;OPERATOR MISSING will be evaluated as TAG! LA+177777. 2.4.1 Numbers The Assembler accepts both octal and decimal numbers. Octal numbers consist of the digits a through 7 only. Decimal numbers consist of the digits a through 9 followed by a decimal point. If a number contains an 8 or 9 and is not followed by a decimal point, the N error code (see Section 2.10) will be printed and the number interpreted as decimal. Negative numbers may be expressed as a number preceded by a minus sign rather than in a two·s complement form. Positive numbers may be preceded by a plus sign although this is not required. If a number is too large to fit into 16 bits, the number is truncated from the left. In the assembly listing the statement will be flagged with a Truncation (T) error. 2-7 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.4.2 Arithmetic and Logical Operators The arithmetic operators are: + indicates addition or a positive number indicates subtraction or a negative number The logical operators are defined and illustrated below. indicates the logical AND operation & indicates the logical inclusive OR operation AND 2.4.3 OR o&0 = 0 o o o 0&1 o o 1 = 1 1 & 0 o 1 o 1 1 & 1 = 1 1 1 1 ASCII Conversion When preceded by an apostrophe, any ASCII character (except null, rUbout, carriage return, line feed, or form feed) is assigned the 7-bit ASCII value of the character (see Appendix A). For example, 'A is assigned the value 101(octal). When preceded by a quotation mark, two ASCII characters (not including null, rubout, carriage return, line feed, or form feed) are assigned the 7-bit ASCII values of each of the characters to be used. Each 7-bit value is stored in an 8-bit byte and the bytes are combined to form a word. For example, "AB will store the ASCII value of A in the low-order (even) byte and the value of B in the high-order (odd) byte: high-order byte B I S value = o 1 low-order byte 1 2 o o--------~-100 001 001 000 o "AB 2.5 4 1 o 1 -1 = A's value 001 1 041101 ASSEMBLY LOCATION COUNTER The period (.) is the symbol for the assembly location counter. (Note difference of Program Counter. . = PC. See Section 2.6.) When used in the operand field of an instruction, it represents the address of the first word of the instruction. When used in the operand field of an assembler directive, it represents the address of the current byte or word. For example, 2-8 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS AI MOV •• ,RO I. REFERS TO LOCATION A, I.E., ITHE ADDRESS OF THE MOV INSTRUCTION (# is explained in Section 2.6.9). At the beginning of each assembly pass, the Assembler clears the location counter. Normally, consecutive ~emory locations are assigned to each byte of object data generated. However, the location where the object data is stored may be changed by a direct assignment altering the location counter . . =expression The expression defining the period must not contain forward references or symbols that vary from one pass to another. Examples: .=500 FIRST: MOV .+10,COUNT ITHE LABEL FIRST HAS THE VALUECOCTAL) l.tl0 EQUALS 510COCTAL). THE CONTENTS 10F THE LOCATION 510COCTAL) WILL BE DE;POSITED IN LOCATION COUNT. ITHE ASSEMBLY LOCATION COUNTER NOW IHAS A VALUE OF 520(OCTAL). .~520 SECOND: MOV .,INDEX ITHE LABEL SECOND HAS THE VALUE 520(OCTAL). ITHE CONTENTS OF LOCATION 520(OCTAL), ITHAT IS, THE BINARY CODE FOR THE IINSTRUCTION ITSELF, WILL BE DEPOSITED lIN LOCATION INDEX. Storage area may be reserved by advancing the location counter. For example, if the current value of the location counter is 1000, the direct assignment statement .=.+100 will reserve 100(octal) bytes of storage space in next instruction will be stored at 1100. 2.6 the program. The ADDRESSING The Program Counter (register 7 of the eight general registers) always contains the address of the next word to be fetched; i.e., the address of the next instruction to be executed, or the second or third word of the current instruction. In order to understand how the address modes operate and how they assemble (see Section 2.6.11), the action of the Program Counter must be understood. The key rule is: (PC) to Whenever the processor implicitly uses the Program Counter fetch a word from memory, the Program Counter is automatically incremented by two after the fetch. That is, when an instruction is fetched, the PC is incremented by two, so that it is pointing to the next word in memory; and, if an instruction uses indexing (see Sections 2.6.7, 2.6.8, and 2.6.10), the processor uses the Program Counter to fetch the base from memory. Hence, using the rule above, the PC increments by two, and now points to the next word. 2-9 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS The following conventions are used in this section: a. Let E be any expression as defined in Section 3.4. b. This is any expression Let R be a register expression. containing a term preceded by a % character or a symbol previously equated to such a term. Examples: RO Rl R2 %0 RO + 1 1 + %1 iGENERAL REGISTER 0 ; GENERAL REGISTER 1 iGENERAL REGISTER 2 c. Let ER be a register expression or an expression in the range 0 to 7 inclusive. d. Let A be a general address specification which produces 6-bit address field as described in the PDP-II Handbook. a The addressing specification, A, may now be explained in terms of E, R, and ER as defined above. Each will be illustrated with the single operand instruction CLR or double operand instruction MOV. 2.6.1 Register Mode The register contains the operand. Format: R Example: 2.6.2 RO = %0 CLR RO iDEFINE RO AS REGISTER 0 iCLEAR REGISTER 0 Deferred Register Mode The register contains the address of the operand. Format: @R or (ER) Example: Cl Y' CI...F~ 2.6.3 (:J.) ;CLEAR THE WORD AT THE ;ADDRESS CONTAINED IN ; F~EG I STEF~ :J.. Autoincrement Mode The contents of the register are incremented immediately used as the address of the operand. l after being ~a. Both JMP and JSR instructions using mode 2 may increment the register before or after its use, depending on what PDP-II processor is being used. This mode should be avoided. b. In double operand instructions of the addressing form %R, (R)+ or %R,-(R) where the source and destination registers are the same, the results may be different when executed on different PDP-II processors. The use of these forms should be avoided! 2-10 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS (ER) + Format: Examples: CLR CLR CLR 2.6.4 (ROH (ROt3)t (2)+ ;CLEAR WORDS AT ADDRESSES ;CONTAINED IN REGISTERS 0, 3, AND 2 AND ;INCREMENT REGISTER CONTENTS ilBY TWO. Deferred Autoincrement Mode The register contains the pointer to the address of the operand. contents of the register are incremented after being used. Format: The @(ER)+ Example CLR 2.6.5 @(3)t ;CONTENTS OF REGISTER 3 POINT ilTO ADDRESS OF WORD TO BE CLEARED ;BEFORE BEING INCREMENTED BY TWO Autodecrement Mode The contents of the register are decremented before being used as address of the operand. 1 Format: the - (ER) Examples: --(RO) - ( ROt3 ) CLR -(2) CLR CLF~ 2.6.6 ilDECREMENT CONTENTS OF REGilISTERS 0, 3, AND 2 BEFORE USING ilAS ADDRESSES OF WORDS TO BE CLEARED Deferred Autodecrement Mode The contents of the register are decremented before being used as pointer to the address of the operand. Format: the @-(ER) Example: . CLI:;; 2.6.7 @·-(2) ;DECREMENT CONTENTS OF REG. 2 ilBEFORE USING AS POINTER TO ADDRESS ;OF WORD TO BE CLEARED Index Mode Format: E(ER) The value of an expression E is stored as the second or third word of the instruction. The effective address is calculated as the value of E plus the contents of register ER. The value E is called the base. 1 'See previous footnote. 2-11 WRITING. PAL-llA ASSEMBLY LANGUAGE PROGRAMS Examples: 2.6.8 CLR Xt2(R1) ;EFFECTIVE ADDRESS IS Xt2 PLUS ;THE CONTENTS OF REGISTER 1 CLR -2(3) ;EFFECTIVE ADDRESS IS -2 PLUS ;THE CONTENTS OF REGISTER 3 Deferred Index Mode An expression plus the contents of a register gives the pointer to the address of the operand. Format: @E(ER) Example: CLR @14(4) 2.6.9 ;IF REGISTER 4 HOLDS 100, AND LOCA;TION 114 HOLDS 2000, LOC. 2000 IS ;CLEARED Immediate Mode and Deferred Immediate (Absolute) Mode The immediate mode allows the operand itself to be stored as the It is assembled as an second or third word of the instruction. autoincrement of register 7, the PC. Format: #E Examples: MOV $100, RO ;MOVE AN OCTAL 100 TO REGISTER 0 MOV IX, RO ;MOVE THE VALUE OF SYMBOL X TO ;REGISTER 0 The operation of this mode is explained as follows: The statement MOV #IOO,R3 assembles as two words. o I 2 7 0 3 o 0 0 I 0 0 These are: Just before this instruction is fetched and executed, the PC points to the first word of the instruction. The processor fetches the first word and increments the PC by two. The source operand mode is 27 (autoincrement the PC). Thus, the PC is used as a pointer to fetch the operand (the second word of the instruction) before being incremented by two, to point to the next instruction. If the #E is preceded by @, E specifies an absolute address. 2-12 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS 2.6.10 Relative and Deferred Relative Modes Relative Mode is the normal mode for memory references. Format E Examples: CLI:;: :LOO ~CLEAR MOV X,Y ;MOVE CONTENTS OF LOCATION X TO PLOCATION Y LOCATION :LOO This mode is assembled as Index Mode, using 7, the PC, as register. The base of the address calculation, which is stored in second or third word of the instruction, is not the address of operand. Rather, it is the number which, when added to the PC. becomes the address of the operand. Thus, the base is X operation is explained as follows. the the the PC, The If the statement MOV 100,R3 is assembled assembled code is: the at location 20, then . Location 20: o 1 6 703 Location 22: o 0 0 054 The processor fetches the MOV instruction and adds two to the PC so that it points to location 22. The source operand mode is 67; that is, indexed by the PC. To pick up the base, the processor fetches the word pointed to by the PC and adds two to the PC. The PC now points to location 24. To calculate the address of the source operand, the base is added to the designated register. That is, Base + PC = 54 + 24 = 100, the operand address. Since the Assembler considers . as the address of the the instruction, an equivalent statement would be MOV first word of 100-.-4(PC) ,R3 This mode is called relative because the operand address is calculated relative to the current PC. The base is the distance (in bytes) between the operand and the current PC. If the operator and its operand are moved in memory so that the distance between the operator and data remains constant, the instruction will operate correctly. If E is preceded by @, the expression's value is the address of the operand. 2.6.11 Table of Mode Section 3.7) Forms and pointer to the Codes (6-bit (A) format only - see Each instruction takes at least one word. Operands of the first six forms listed below do not increase the length of an instruction. Each operand in one of the other forms however, increases the instruction length by one word. Form R None of these @R or (ER) ( (ER) + forms increase the instruction @(ER)+ length. - (ER) @-(ER) Mode Meaning On Register Register n deferred Autoincrement Autoincrement deferred Autodecrement Autodecrement deferred In 2n 3n 4N 5N 2-13 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS Any of these forms adds a word to the instruction length E (ER) @E(ER) #E @#E 6n 7n 27 37 E @E 67 77 Index Index deferred Immediate Absolute memory reference Relative Relative deferred reference Notes: 2.7 1. An alternate form for @R is (ER). equivalent to @O(ER). However, the form @(ER) is 2. The form @#E differs from the form E in that the second or third word of the instruction contains the absolute address of the operand rather than the relative distance between the operand and the pc. Thus, the statement CLR @#100 will clear location 100 even if the instruction is moved from the point at which it was assembled. INSTRUCTION FORMS The instruction mnemonics are given in Appendix B. This section defines the number and nature of the operand fields for these ihstructions. In the table that follows, let R, E, and ER represent expressions as defined in Section 3.4, and let A be a 6-bit address specification of the forms: E @E R @R or (R) (ER)+ @(ER)+ -(ER) @-(ER) E(ER) @E(ER) #E @#E Table 2-1 Instruction Operand Fields Instruction Form Example Double Operand Op A,A MOV (R6)+,@Y Single Operand Op A CLR - (R2) Operate Op HALT Branch Op E BR BLO X+2 .-4 where -128 ~(E-.-2)/2~127 Subroutine Call JSR ER,A JSR PC,SUBR Subroutine Return RTS ER RTS PC EMT/TRAP Op EMT or Op E EMT 31 where O!>E!>.377 (octal) 2-14 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS , The branch instructions are one word instructions. The high byte contains the op code and the low byte contains an 8-bit signed offset (7 bits plus sign) which specifies the branch address relative to the PC. The hardware calculates the branch address as follows: a) Extend the sign of the offset through bits 8-15. b) Multiply the result by 2. than a byte offset. c) Add the result to the PC to form the final branch address. This creates a word offset rather The Assembler performs the reverse operation to form the byte offset from the specified address. Remember that when the offset is added to the PC, the PC is pointing to the word following the branch instruction; hence the factor -2 in the calculation. Byte offset Since PC = = (E-PC)/2 truncated to eight bits. .+2, we have Byte offset = (E-.-2)/2 truncated to eight bits. The EMT and TRAP instructions do not use the low-order byte of the word. This allows information to be transferred to the trap handlers in the low-order byte. If EMT or TRAP is followed by an expression, the value is put into the.low-order byte of the word. However, if the expression is too big (>377(octal)) it is truncated to eight bits and a Truncation (T) error occurs. 2.8 ASSEMBLER DIRECTIVES Assembler directives (sometimes called pseudo-ops direct the assembly process and may generate data. They may be preceded by a label and followed by a comment. The assembler directive occupies the operator field. Only one directive may be placed in anyone statement. One or more operands may occupy the operand field or it may be void allowable operands vary from directive to directive. 2.8.1 .EOT The .EOT directive indicates the physical End-of-Tape though not the logical end of the program. If the .EOT is followed by a single line feed or form feed, the Assembler will still read to the end of the tape, but will not process anything past. the .EOT directive. If .EOT is followed by at least two line feeds or form feeds, the Assembler will stop before the end of the tape. Either case is proper, but it should be understood that even though it appears as if the Assembler has read too far, it actually hasn't. If a .EOT is embedded in a tape; and more information to be assembled follows it, .EOT must be immediately followed by at least two line feeds or form feeds. Otherwise, the first line following the .EOT will be lost. Any operands following a .EOT directive will be ignored. The .EOT directive allows several physically separate tapes to be assembled as one program. The last tape is normally terminated by a .END directive (see Section 3.8.3) but may be terminated with .EDT (see .END emulation in Section 3.9.4). 2-15 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.8.2 . EVEN The .EVEN directive ensures that the assembly location counter is even by adding one if it is odd. Any operands following a .EVEN directive will be ignored. 2.8.3 .END The .END directive indicates the logical and physical end of the source program. The .END directive may be followed by only one operand, an expression indicating the program's entry point. At load time, the object tape will be loaded and program execution will begin at the entry point indicated by the .END directive. If the entry point is not specified, the Loader will halt after reading in the object tape. 2.8.4 . WORD The .WORD assembler directive may have one or more operands, separated by commas. Each operand is stored in a word of the object program. If there is more than one operand, they are stored in successive words. The operands may be any legally formed expressions. For example, , :::::1.420 SAL::::O ,WORD :l.77535 •• t4,SAL ;STORED IN WORDS :1.420, :1.422, AND ;:1.424 WILL BE :1.77535, :1.426, AND O. Values exceeding 16 bits will be truncated length. from the left, to A .WORD directive followed by one or more void operands separated commas will store zeros for the void operands. For example, . , :::::1.4JO ,WOFW .~5, word by PZERO, FIVE, AND ZERO ARE STORED ;IN WORDS :1.430. :1.432, AND :1.434. An operator field left blank will be interpreted as the .WORD directive if the operand field contains one or more expressions. The first term of the first expression in the operand field must not be an instruction or assembler directive unless preceded by a +, -, or one of the logical operators! or &. For example, • ::::440 LABEL: tHOV,LABEL ;THE OP-CODE FOR HOV, WHICH IS 010000, ;IS STORED IN LOCATION 440. 440 IS ;STORED IN LOCATION 442. Note that the default .WORD will occur whenever there is a leading arithmetic or logical operator, or whenever a leading symbol is encountered which is not recognized as an instruction mnemonic or assembler directive. Therefore, if an instruction mnemonic or assembler directive is misspelled, the .WORD directive is assumed and errors will result. Assume that MOV is spelled incorrectly as MaR: MaR A,B Two error codes can result: a Q will occur because an expression operator is missing between MOR and A, and a U will occur if MOR is undefined. Two words will be generated; one for MaR A and one for B. 2-16 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.8.5 . BYTE The .BYTE assembler directive may have one or more operands separated by commas. Each operand is stored in a byte of the object program. If multiple operands are specified, they are stored in successive bytes. The operands may be any legally formed expression with a result of 8 bits or less. For example, SAM=5 .=410 • BYTE 48.,SAM ;STORED IN LOCATION 410 WILL BE ;060 (THE OCTAL EQUIVALENT OF 48) • ;IN 411 WILL BE 005. If the expression has a result of more than 8 bits, it will be truncated to its low-order 8 bits and will be flagged as a Terror. If an operand after the .BYTE directive is left void, it will be interpreted as zero. For example, .=420 .BYTE , , 2.8.6 ;ZERO WILL BE STORED IN ;BYTES 420, 421 AND 422. .ASCII The .ASCII directive translates strings of ASCII characters into their 7-bit ASCII codes with the exception of null, rubout, carriage return, line feed, and form feed. The text to be translated is delimited by a character at the beginning and the end of the text. The delimiting character may be any printing ASCII character except colon and equal sign and those used in the text string. The 7-bit ASCII code generated for each character will be stored in successive bytes of the object program. For example, .=500 .ASCII IYESI ;THE ASCII CODE FOR "Y" WILL BE ;STORED IN 500, THE CODE FOR "E" ;IN 501, THE CODE FOR as" IN S02 • • ASCII 15t3/21 ;THE DELIMITING CHARACTER OCCURS ;AMONG THE OPERANDS. THE ASCII ;CODES FOR as", "to, AND "3" ARE ;STORED IN BYTES 503, 504, AND ;505. 21 IS NOT ASSEMBLED. The ASCII directive must be terminated by a space or a tab. 2.9 2.9.1 OPERATING PROCEDURES Introduction The Assembler enables you to assemble an ASCII tape containing PAL-IIA statements into an absolute binary tape. To do this, two or three passes are necessary. On the first pass the Assembler creates a table of user-defined symbols and their associated values, and a list of undefined symbols is printed on the teleprinter. On the second pass the Assembler assembles the program and punches out an absolute binary tape and/or outputs an assembly listing. During the third pass (this pass is optional) the Assembler punches an absolute binary tape or outputs an assembly listing. The symbol table (and/or a list of errors) may be output on any of these passes. The input and output devices as well as various options are specified during the initial dialogue (see Section 3.3.9). The Assembler initiates the dialogue immediately after being loaded and after the last pass of an assembly. 2-17 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.9.2 Loading PAL-IIA PAL-IIA is loaded by the Absolute Loader (see Chapter 6 for operating procedures) . Note that the start address of the Absolute Loader must be in the Switch Register when loading the Assembler. This is because the Assembler tape has an initial portion which clears all of core up to the address specified in the Switch Register, and jumps to that address to start loading the Assembler. 2.9.3 Initial Dialogue After being loaded, the the teleprinter: Assemb~er initiates dialogue by printing on meaning "Whpt is the Source symbolic input device?" The be: response may *S H meaning High-speed reader L meaning Low-speed reader T meaing Teletype keyboard If the response is T, the source program must be typed at the terminal once for each pass of the assembly and it must be identical each time it is typed. The device specification is terminated, as is all typing the RETURN key. user response, by If an error is made in typing at any time, typing the RUBOUT key will erase the immediately preceding character if it is on the current line. Typing CTRL/U will erase the whole line on which it occurs. After the *S question and response, the Assembler prints: *B meaning "What is the Binary output device?" The responses similar to those for *S: H meaning High-speed punch L meaning Low-speed punch ~ meaning do not output binary tape ( --" denotes typing the RETURN key) to *B are In addition to I/O device specification, various options may be chosen. The binary output will occur on the second pass unless /3 (indicating the third pass) is typed following the H or L. Errors will be listed on the same pass if /E is typed. If /E is typed in response to more than one inquiry, only the last occurrence will be honored. It is strongly suggested that the errors be listed on the same pass as the binary output, since errors may vary from pass to pass. If both /3 and /E are ,typed, /3 must precede /E. The response is terminated by typing the RETURN key. Examples: 2-18 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS *BL/E Binary output on the low-speed punch and the errors on the the teleprinter, both during the second pass. *B Binary output on the high-speed punch and the errors on the teleprinter; both during the third pass. H/3/E Typing just the RETURN key will Assembler to omit binary output. cause the meaning "What is the assembly Listing output device?" The response *L may be: to After the *B question and response, the Assembler prints: *L L meaning Low-speed punch (outputs a tab as a tab-rubout) H meaning High-speed punch T meaning Teleprinter (outputs a tab as multiple spaces) P meaning line Printer .J meaning do not output listing (-/ denotes typing the RETURN key) (8K version only) After the I/O device specification, pass and error list options similar to those for *B may be chosen. The assembly listing will be output to the third pass unless /2 (indicating the second pass) is typed following H, L, T, or P. Errors will be listed on the teleprinter during the same pass if /E is typed. If both /2 and /E are typed, /2 must precede /E. The response is terminated by typing the RETURN key. Examples: *L L/2/E Listing on low-speed punch and errors on teleprinter during second pass. *L H Listing on high-speed punch during third pass. *L ..J The RETURN key alone will cause the Assembler to omit listing output. After the *L question and response, the final question is the teleprinter: printed on *T meaning "What is the symbol Table output device?" The device specification is the same as for the *L question. The symbol table will be output at the end of the first pass unless /2 or /3 is typed in response to *T. The first tape to be assembled should be placed in the reader before typing the RETURN key because assembly will begin upon typing the RETURN key in response to the *T question. The /E option is not a meaningful response to *T. Example: *T T/3 Symbol table output on teleprinter at end of third pass. *T ..J Typing just the RETURN key will cause the Assembler to omit the symbol table output. 2-19 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS The symbol table is printed alphabetically, four symbols per line. Each symbol printed is followed by its identifying characters and by its value. If the symbol is undefined, six asterisks replace its value. The identifying characters indicate the class of the symbol; that is, whether it is a label, direct-assignment, register symbol, etc. The following examples show the various forms: ABCDEF = = R3 DIRASM XYZ 001244 (Defined label) %000003 (Register symbol) 177777 (Direct assignment) ****** (Undefined direct assignment) R6 = %****** (Undefined register symbol) LABEL = ****** (Undefined label) Generally, undefined symbols (including undefined direct assignments. labels) will be Multiply-defined symbols are not flagged in the symbol table but they are flagged wherever they are used in the program. listed as printout It is possible to output both the binary tape and the assembly listing on the same pass, thereby reducing the assembly process to two passes (see Example 1 below). This will happen automatically unless the binary device and the listing device are conflicting devices or the same device (see Example 2 below). The only conflicting devices are the teleprinter and the low-speed punch. Even though the Assembler deduces that three passes are neceSsary, the binary and listing can be forced on pass 2 by including /2 in the responses to *B and *L (see Example 3 below). Example l . Runs 2 passes: *S H High-speed reader *B H High-speed punch *L P Line Printer *T T Teleprinter Example 2. Runs 3 passes: *S H High-speed reader *B H High-speed punch *L H High-speed punch *T T Teleprinter Example 3. Runs 2 passes: *S H High-speed reader *B H/2 High-speed punch on pass 2 *L H/2 High-speed punch on pass 2 *T T Teleprinter 2-20 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS Note that there are several cases intermixed with ASCII output: where the binary a. *B *L H/2 H/2 Binary and listing to punch on pass 2 b. *B L/E Binary to low-speed punch and error listing to teleprinter (and low-speed punch) c. *B *L L/2/E T/2 Binary, error listing, and listing to low-speed punch. output can be The binary so ge~erated isloadable by the Absolute Loader as long as there are no CTRL/A characters in the source program. The start of every block on the binary tape is indicated by a 001 and the Absolute Loader ignores all information until a 001 is detected. Thus, all source and/or error messages will be ignored if they do not contain any CTRL/A characters (octal 001). If a character other than those mentioned is typed in response to a question, the Assembler will ignore it and print the question again. Example: *S H High-speed reader *B Q Q is not a valid response *B The question is repeated If at any time you wish to restart the Assembler, type CTRL/P. When no passes are omitted or error options specified, performs as follows: the Assembler PASS 1: Assembler creates a table of user-defined symbols and their associated values to be used in assembling the source to object program. Undefined symbols are listed on the teleprinter at the end of the pass. The symbol table is also listed at this time. If an illegal location statement of the form .=expression is encountered, the line and error code will be printed out on the teleprinter before the assembly proceeds. An error in a location statement is usually a fatal error in the program and should be corrected. PASS 2: Assembler punches 'the object tape, and prints the pass error count and undefined location statements on the teleprinter. PASS 3: Assembler prints or punches the undefined location statements, the teleprinter. assembly program listing, and the pass error count on The functions of passes 2 and 3 will occur simultaneously on pass 2 if the binary and listing devices are different, and do not conflict with each other (low-speed punch and Teleprinter conflict). 2-21 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS The following table summarizes the ini Hal dialogue questions: Printout Inquiry *S What is the input device of the Source symbolic tape? *B What is the output device of the Binary object tape? *L What is the output device of the assembly Listing? *T What is the output device of the symbol Table? The following table summarizes the legal responses: Character Response Indicated T Teletype keyboard or printer L Low-speed reader or punch H High-speed reader or punch P Line Printer /1 Pass 1 /2 Pass 2 /3 Pass 3 /E Errors listed on same pass (not meaningful in response to *S or *T) ./ Omit function (8K version only) Typical examples of complete initial dialogues: For minimal PDP-II configuration: *S L Source input on low-speed reader *B L/E Binary output on low-speed punch Errors during same (second) pass *L T Listing on teleprinter during pass 3 *T T Symbol table on teleprinter at end of pass 1 For a PDP-ll with high-speed I/O devices: *S H Source input on high-speed reader *B H/E Binary output on high-speed punch, Errors during same (second) pass. No listing *L *T T/2 Symbol table on teleprinter at end of pass 2 2-22 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.9.4 Assembly Dialogue During assembly, the Assembler will pause to print on the teleprinter various messages to indicate that you must respond in some way before the assembly process can continue. You may also type CTLR/P, at any time, if you wish to stop the assembly process and restart the initial dialogue, as mentioned in the previous section. When a .EOT assembler directive is read on prints: the tape, the assembler EOF ? and pauses. During this pause, the next tape is placed in the reader, and RETURN is typed to continue the assembly. If the specified assembly listing output device is the high-speed punch and if it is out of tape, or if the device is the Line Printer and is out of paper, the Assembler prints on the teleprinter: EOM ? and waits for tape or paper to be placed in the device. Type the RETURN key when the tape or paper has been replenished; assembly wil continue. Conditions causing the EOM? are: message for an assembly listing device HSP LPT No power No power No tape Printer drum gate open Too hot No paper There is no EOM if the line printer is switched off-line, although If characters may be lost for this condition as well as for an EOM. the binary output device is the high-speed punch and if it is out of tape, the Assembler prints: EOM ? ~ The assembly process is aborted and again. the When a .END assembler directive is read on prints: initial the dialogue tape, the is begun Assembler END ? and pauses. During the pause the first tape is placed in the reader, and the RETURN key is typed to begin the next pass. On the last pass, the .END directive causes the Assembler to begin the initial dialogue for the next assembly. If you are starting the binary pass and the binary is to be punched on the low-speed punch, turn the punch on before typing the RETURN key for starting the pass. The carriage return and line feed characters will be punched onto the binary tape, but the Absolute Loader will ignore them. 2-23 WRITING PAL-llA ASSEMBLY LANGUAGE PROGRAMS If the last tape ends with a .EOT, the Assembler may be told to emulate a .END assembler directive by responding with E followed by the RETURN key. The Assembler will then pr-int: END ? and wait for another RETURN before starting the next pass. EOF? END ? Example: E NOTE When a .END directive is emulated with an E response to the EOF? message, the error counter is incremented. To avoid incrementing the error counter, place a paper tape containing only the line .END in the reader and press the RETURN key instead of using the E response. 2.9.5 Assembly Listing PAL-llA produces a $ide-by-side assembly listing of symbolic source statements, their octal equivalents, assigned absolute addresses, and error codes as follows: EELLLLLL 000000 888 •••••• 8 000000 000000 The E's represent the error field. The L's represent the absolute address. The O's represent the object data in octal. The S's represent the source statement. While the Assembler accepts 72(decimal) characters per line on input, the listing is reduced by the 16 characters to the left of the source statement. The above represents a three-word statement. The second and third words of the statement are listed under the command word. No addresses precede the second and third word since the address order is sequential. The third line is omitted for a two-word statement; third lines are omitted for a one-word statement. both second and For a .BYTE directive, the object data field is three octal digits. For a direct assignment statement, the value of the defining expression is given in the object code field although it is not actually part of the code of the object program. Each page of the listing is headed by a page number. 2-24 WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.10 ERROR CODES The error codes printed beside the octal and assembly listing have the following meanings: Error Code symbolic code in the instruciton is Meaning A Addressing error. incorrect. B Bounding error. Instructions or word data are being assembled at an odd address in memory. The location counter is updated by +1. D Doubly-defined symbol referenced. Reference was ,symbol which is defined more then once. I Illegal character detected. Illegal also non-printing are replaced by a ? characters which on the listing. are L Line buffer overflow. Extra characters on a line (more 72(decimal)) are ignored. than M Multiple definition of a label. which was equivalent (in the previously encountered label. N Number containing 8 or 9 has no decimal point. P Phase error. A label's definition or value varies pass to another. Q Questionable syntax. There are missing arguments or the instruction scan was not completed or a carriage return was not immediately followed by a line feed or form feed. R Register-type error. An invalid use of register has been made. S Symbol table overflow. When the quantity of user-defined symbols exceeds the allocated space available in the user's symbol table, the assembler outputs the current source line with the S error code, then returns to the initial dialogue. T Truncation error. A number generated more than 16 bits of significance or an expression generated more than .8 bits of significance during the use of the .BYTE directive. U Undefined symbol. An undefined symbol was encountered during the evaluation of an expression. Relative to the expression, the undefined symbol is assigned a value of zero. An address 2-25 within the made to a A label was encountered first sit char~cters) to a or from reference one to a WRITING PAL-IIA ASSEMBLY LANGUAGE PROGRAMS 2.11 SOFTWARE ERROR HALTS PAL-IIA loads all unused trap vectors with the code . WORD .+2,HALT so that if the trap does occur, the processor will halt in the second word of the vector. The address of the halt, displayed in the console address register, therefore indicates the cause of the halt. In addition to the halts which may occur in the vectors, the standard lOX error halt at location 40 may occur (see Chapter 7). Address of Halt Meaning 12 Reserved instruction executed 16 Trace trap occurred 26 Power fail trap 32 EMT executed 40 lOX detected error See Appendix B for summaries of PAL-IIA features. 2-26 CHAPTER 3 LINK-llS LINKER 3.1 INTRODUCTION 3.1.1 General Description LINK-lIS (stand alone) is a PDP-II system program designed to link and relocate programs previously assembled by PAL-lIS. The user can separately assemble the main program and each of its various subroutines without assigning an absolute load address at assembly time. The binary output of assembly (called an object module) is processed by LINK-lIS to: 1. Relocate each object mo'dule and assign absolute addresses. 2. Link the modules by correlating global symbols defined in one module and referenced in other modules. 3. Print a load addresses. 4. Punch a load module which can subsequently be loaded (by Absolute Loader) and executed. map which displays the assigned absolute the Seme of the advantages of using PAL-lIS and LINK-lIS are: 1. The program is divided into segments (usually subroutines) which are assembled separately. If an error is discovered in one segment, only that segment needs to be reassembled. The new object module is then linked with the other object modules. 2. Absolute addresses need not be assigned at assembly time. The Linker automatically assigns absolute addresses. This keeps programs from overlaying each other. This also allows subroutines to change size without influencing the placement of other routines. 3. Separate assemblies allow the total number of exceed the number allowed in a single assembly. 4. Internal symbols (symbols which are not global) need not be unique among object modules. Thus, naming rules are required only for global symbols when separate programmers prepare separate subroutines of a single program. 5. Subroutines may be provided for general use in object form to be linked into the user's program. 3-1 symbols to module LINK-llS LINKER LINK-lIS is designed to run on an 8K PDP-II with an ASR-33. A PCll (high. speed paper tape reader and punch) and an LPll (line printer) may be used if available. The PCll significantly speeds up the linking process. An LPll provides a fast device for the loa'tl map listing. 3.1.2 Absolute and Relocatable Program Sections A program assembled by PAL-lIS may consist of an absolute program section, declared by the .ASECT assembler directive, and a relocatable program section, declared by the .CSECT assembler directive. (If a program has neither an .ASECT or .CSECT directive, the assembler implicitly assumes a .CSECT directive.) The program and data in the absolute section are assigned absolute addresses as specified by the location counter setting statements (.=x). The Linker assigns absolute addresses to the program and data in the relocatable section. Addressses are normally assigned such that the relocatable section is at the high end of memory. The assignment of addresses may be influenced by command string options (see Section 3.3.2). The Linker appropriately modifies all instructions and/or data necessary to account for the relocation of the control section. as LINK-lIS can handle object modules containing named control (relocatable) sections as generated by PAL-llR. However, PAL-lIS can create only the unnamed control section (which has the special default name of 6 blanks) and the absolute section (with the special name . ABS.). The unnamed control section is internal to each object module. That is, every object module may have an unnamed control section (each with the name 6 blanks) but the Linker treats them independently. Each is assigned an absolute address such that they occupy mutually exclusive areas of memory. Named control sections, on the other hand, are treated globally. That is, if different object modules each have control sections with the same name, they are all assigned the same absolute load address and the size of the area reserved or loading of the section is the maximum of the sizes of each section. Thus, named control sections allow the sharing of data and/or programs among object modules. This is very similar to the handling and function of labelled COMMON in FORTRAN IV. A restriction of LINK-lIS is that the name of a control section must not be the same as the name of a global entry symbol, as this results in multiple definition errors. 3.1.3 Global Symbols Global symbols provide the links for communication between object modules (or assemblies). Global symbols are created with the .GLOBL assembler directive~ Symbols which are not global are called internal, symbols. If the global symbol is defined (as a label or direct assignment) in an object module it is called an entry symbol, and other object modules may reference it. If the global symbol is not defined in the object module it is an external symbol. It is assumed to be defined (as an entry symbol) in some other object module. As the Linker reads the object modules it records all the global symbol definitions and references. It then modifies the instructions and/or data that reference the global symbols. 3-2 LINK-lIS LINKER 3.2 INPUT AND OUTPUT 3.2.1 Object Module Input to LINK-lIS is the object module. This is the output of PAL-lIS (or any other program which can create an object module). The Linker reads each object module twice; that is, it is a two-pass processor. On pass 1, the Linker reads each object module to gather enough information to assign absolute addresses to all reloc~table sections and absolute values to all globals. This information appears in the global symbol directory (GSD) of the object module. On pass 2, the Linker reads all of each object module and produces the load module (see Section 3.2.2). The data gathered on pass 1 guides the relocation and linking process on pass 2. 3.2.2 Load Modules The normal output of the Linker is a load module which may and run. be loaded A load module consists of formatted binary blocks holding absolute load addresses and object data as specified for the Paper Tape System Absolute Loader and the PDP-II Disk Monitor. The first few words of data are the communications directory (COMD) and have an absolute load address equal to the lowest relocated address of the program. The absolute loader loads the COMD at the specified address but the program subsequently overlays it. l The disk monitor loader expects the COMD and loads it where the monitor wants it. The end of the load module is indicated by a TRA block; that is, a block containing only a load address. The byte count in the formatted binary block is 6 on this block; on all other blocks the byte count is larger than 6. The TRA (transfer address) is selected by the Linker to be the first even transfer address seen. Thus, if four object modules are linked together and if the first and second had a .END statement, the third had a .END A and the fourth had a .END B, the transfer address would be A of module three. lThe overlaying of the COMD by the relocated program is a trick to allow the Absolute Loader to handle load modules with a COMD. However, a problem arises if a load module is to be loaded by the absolute loader and either of the following conditions exists: a. The object modules used to construct contained no relocatable code; or the b. The total size of the relocatable code is (decimal) bytes (the size of the COMD). load less module than 20 In either case, there is not enough relocatable code to overlay the COMD which means the COMD will load into parts of memory not intended to be altered by the user. The COMD's load address, selected by the Linker in the above cases, is such that it will be up against the current top of memory (see *T .option in section 3.3.1). If the top happens to be very low, the Linker does not allow the COMD to be loaded below address 0; it loads it at O. 3-3 L~NK-llS 3.2.3 LINKER Load Map The load map provides several types of information concerning the load module's make-up. The map begins with an indication of the low and high limits of the relocatable code and the transfer address. Then there is a section of the map for each object module included in the linking process. Each of these sections begins.with the module name followed by a list of the control sections and the entry points for each control section. For each control section, the base of the section (its low address) and its size (in bytes) is printed to the right of the section name (enclosed in angle brackets). Following each section name is a list of entry points and their addresses. After all information has been printed for each object module, any undefined symbols are listed. Note that modules are loaded such that if modules A, Band C are linked together, A is lowest and C is highest in memory. The format is quite self-explanatory as can be seen from the following example: LOAD MAP TRANSFER ADDRESS,: 037434 LOW LIMIT: 037406 HIGH LIMIT: 037460 ********** MODULE MODt SECT I ON ENTRY <,0 ABS.> > < X3 X4 X5 X7 ADDRESS SIZE 000000 .000000 037406 000044 037452 037440 037450 037430 ********** MODULE MOD2 SECTION ,ENTRY < > Xl X2 ADDRESS SIZE 037452 000006 037452 037452 ********** ********** UNDEFINED REFERENCES X6 PASS 2 * 3-4 LINK-llS LINKER 3.3 3.3.1 OPERATING PROCEDURES Loading and Command String The Linker is loaded by the Absolute Loader and is self-starting. It uses a simple command dialogue which allows the object module, load module and load map devices to be specified. During pass 1 and pass 2, the Linker asks for each object module individually. Operation begins by the linker typing its name and version. This followed by the input option printed as *I~. The responses are: ...J is Read object module from HSR. Read object module from HSR. Read object module from LSR. H./ L...J The input option is followed by the output option *O/:'. are: ../ The responses Punch load module on HSP. Punch load module on HSP. Punch load module on LSP. H./ L...J LINK-llS asks i f a load map is desired by typing *M/:'. The legal responses are ..J for no map, T../ or H...,.) or P../for a map on the teleprinter, high-speed punch, or line printer, respectively. The next two options concern the placement of the relocated object program in memory. The standard version of the Linker assumes it is linking for an 8K machine. It relocates the program such that it is as high as possible in 8K but leaves room for the Absolute and Boot Loaders. These assumed values may be changed by altering parameters HGHMEM (highest legal memory address +1) and ALODSZ (number of bytes allocated for Absolute Loader and Boot Loader) and reassembling the Linker. The user may control where a program is relocated to with the *T and *B options. After the option *T~ has been typed, the user may respond as follows: Relocate so that program is up against the current top of memory. If the top has not been changed, then the top is the assembled-in top (HGHMEM-ALODSZ). The standard assumption is 16272 decimal (16384-112) or 37460 octal. N is an octal number a new top address. (unsigned) which defines If a new top is specified, the *B option is suppressed. After the option *B~ has been printed the user may respond as follows: Use current top of memory. N../ N is an unsigned octal number which defines the bottom address of the program. That is, a new top of memory is calculated so that the bottom of the program corresponds with N. Once a top of memory has been calculated (by *T or *B), that value used until it is changed. 3-5 is LINK-llS LINKER LINK-lIS indicates the start of pass one by typing PASS 1. The input is requested by the Linker, one tape at a time, by typing *~. The legal responses are: Read a tape and request more input. List all undefined globals on the and request more input. teleprinter End of input. If there are undefined globals, list them on the teleprinter and request more input. Otherwise print the load map, if requested, and enter pass-2. C...J End of input. Assign 0 to any undefined globals, print the load map (if requested), and enter pass 2. The Linker indicates the start of pass 2 by typing PASS requests each input tape as in pass 1. 2. It then A carriage return is the only useful response to * on pass 2. The modules must be read on pass 2 in the same order as pass 1. When the the load last module has been read the Linker automatically finishes module and restarts itself. Leader and trailer are punched on the load module. If the LSP is being used for the load module output, it should be turned on before pass 2 begins. Thus, turn it on before typing E...Jor c-l The echo of these characters (and the load map, if printed on the TTY) is punched on the load module but may be easily removed since leader is punched on the load module. In any case, ASCII information in a load module is ignored by the Absolute and Disk Monitor loaders. However, the LSP can be turned on while leader is being punched (after the linker has typed PASS 2) to keep the load map, etc., from being punched onto the tape. Note: On all command string options, except for *T and *B, the linker examines only the last character typed preceding the carriage return. Thus, ABCDEFGH...J is equivalent to H-l 3.3.1.1 Operational Cautions ~ The Linker does not give a warning if a program is linked so low in memory that it goes below address O. However, this case is easily seen by examining the low and high limits which are always printed (on the load map or on the teleprinter). The Linker reads object modules until an end of medium is detected. Object modules from the DEC Program Library contain a special checksum at the end of the tape which must be removed before they are linked. Failure to remove this checksum can result in fatal Linker errors. 3-6 LINK-lIS LINKER 3.3.2 Error Procedure and Messages p ) is used for two 3.3.2.1 Restarting - CTRL/P (symbolized as purposes by LINK-II. If a Ap is typed while a load map is being printed, the load map is aborted and the Linker continues. A Ap typed at any other time causes the Linker to restart itself. A 3.3.2.2 1. Non-Fatal Errors Non-unique object module name - this error is detected during pass 1; an error message is issued and the module is rejected. The message is: ?MODULE NAME xxxxxx NOT UNIQUE The Linker then asks for more input. 2. Load map device EOM - this error allows the user to fix the device and continue or abort the map listing. The Linker prints: ?MAP DEVICE EOM. TYPE (CR) TO CONTINUE Any response, terminated by .J or ~ causes the continue. A t p causes the map to be aborted. 3. Linker to A byte relocation error - the Linker tries to relocate link byte quantities. However, relocation usually·fails linking may fail. Failure is defined as the high byte of relocated value (or the linked value) not being all zero. such a case, the value is truncated to 8 bits and following message is printed: and and the In the ?BYTE RELOC ERROR AT ABS ADDRESS xxxxxx. The Linker automatically continues. 4. If the object modules are not read in the same order on pass 2 as pass 1, the Linker indicates which module should be loaded next by typing: ?LOAD xxx xxx NEXT! The linker then asks for more input. 5. Multiply-Defined Globals - this error message during pass 1: results in the following ?xxxxxx MULTIPLY DEFINED BY MODULE xxxxxx. The second definition is ignored and the Linker continues. 3.3.2.3 Fatal Errors - Each of the following errors causes the indicated error message to be printed and the Linker to be restarted. 1. Symbol Table overflow - the message is: ?SYMBOL TABLE OVERFLOW - MODULE xxxxxx, SYMBOL xxxxxx 3-7 LINK-llS LINKER 2. System Errors - this class of errors prints: 1SYSTEM ERROR xx where xx is an identifying number as follows: Number Meaning 01 Unrecognized symbol table entry was found. 02 A relocation directory references a global name which cannot be found in the symbol table. 03 A relocation directory contains a location counter modification command which is not last. 04 Object module does not start with a GSD. 05 The first entry in the GSD is not the name. 06 An RLD references a section name which cannot be found. 07 The TRA specification non-existent module name. references a 08 The TRA specification non-existent section name. references a 09 An internal jump table index is out of range. 10 A checksum module. II An object module binary. block is too (more than 64 decimal words of data). 12 A device error occurred on output device. error occurred on the the load module object big module All system errors except for numbers 10 and 12 indicate a program failure either in the Linker or the program which generated the object module. Error 05 can occur if a tape is read which is not an object module. 3.3.2.4 Error HALTs - LINK-lIS loads all of its unused with the code: . WORD trap vectors .+2, HALT so that if the trap occurs, the processor halts in the second word of the vector. The address of the halt, displayed in the console lights, therefore indicates the cause of the halt. 3-8 LINK-llS LINKER 3.3.2 Error Procedure and Messages p) 3.3.2.1 Restarting - CTRL/P (symbolized as is used for two purposes by LINK-II. If a Ap is typed while a load map is being printed, the load map is aborted and the Linker continues. A Ap typed at any other time causes the Linker to restart itself. A 3.3.2.2 1. Non-Fatal Errors Non-unique object module name - this error is detected during pass 1; an error message is issued and the module is rejected. The message is: 1MODULE NAME xxxxxx NOT UNIQUE The Linker then asks for more input. 2. Load map device EOM - this error allows the user to fix the device and continue or abort the map listing. The Linker prints: 'i'MAP DE\) I CE EOM. TYPE (CR) TO CONTINUE Any response, terminated by ~ or + causes the continue. A t p causes the map to be aborted. 3. Linker to A byte relocation error - the Linker tries to relocate link byte quantities. However, relocation usually fails linking may fail. Failure is defined as the high byte of relocated value (or the linked value) not being all zero. such a case, the value is truncated to 8 bits and following message is printed: and and the In the 'i'BYTE RELOC ERROR AT ABS ADDRESS xxxxxx. The Linker automatically continues. 4. If the object modules are not read in the same order on pass 2 as pass 1, the Linker indicates which module should be loaded next by typing: ?LOAD xxx xxx NEXT! The linker then asks for more input. 5. Multiply-Defined Globals - this error message during pass 1: results in the following 1xxxxxx MULTIPLY DEFINED BY MODULE xxxxxx. The second definition is ignored and the Linker continues. 3.3.2.3 Fatal Errors - Each of the following errors causes the indicated error message to be printed and the Linker to be restarted. 1. Symbol Table overflow - the message is: 1SYMBOL TABLE OVERFLOW - MODULE XXXXXX9 SYMBOL xxxxxx 3-7 LINK-lIS LINKER 2. System Errors - this class of errors prints: ?SYSTEM ERROR xx where xx is an identifying number as follows: Number Meaning 01 Unrecognized symbol table entry was found. 02 A relocation directory references a global name which cannot be found in the symbol table. 03 A relocation directory contains a location counter modification command which is not last. 04 Object module does not start with a GSD. 05 The first entry in the GSD is not the name. 06 An RLD references a section name which cannot be found. 07 The TRA specification non-existent module name. references a 08 The TRA specification non-existent section name. references a 09 An internal jump table index is out of range. 10 A checksum module. 11 An object module binary block is too (more than 64 decimal words of data). 12 A device error occurred on output device. error occurred on the the load module object big module All system errors except for numbers 10 and 12 indicate a program failure either in the Linker or the program which generated the object module .. Error 05 can occur if a tape is read which is not an object module. 3.3.2.4 Error HALTs - LINK-lIS loads all of its unused with the code: . WORD trap vectors .+2, HALT so that if the trap occurs, the processor halts in the second word of the vector. The address of the halt, displayed in the console lights, therefore indicates the cause of the halt. 3-8 LINK-lIS LINKER Meaning Address of HALT (octal) Reserved instruction executed. Trace trap occurred. Power fail trap. ~MT executed. 12 16 26 32 A halt at address 40 indicates an IOXLPT detected error. (displayed in the console lights) contains an identifying code: Meaning Code in RO 0 1 2 3 4 5 RO Illegal memory reference, SP overflow or illegal instruction. Illegal lOX command. Slot number out of range. Device number illegal. Referenced slot not INIT ed. Illegal data mode. IOXLPT also sets Rl as follows: If the error code is 0, Rl contains the PC at the time of the error. If the error code is 1-5, Rl points to some element in the lOT argument list or to the instruction following the argument list, depending on whether IOXLPT has finished decoding all the arguments when it detects the error. 3-9 CHAPTER 4 EDITING THE SOURCE PROGRAM The PDP-II Text Editor program (ED-II) enables you to display your source program (or any text) on the teleprinter, make corrections or additions to it, and punch all or any portion of the program on paper tape. This is accomplished by typing simple one-character commands on the keyboard. The Editor commands can be grouped according to function: 1. input/output; 2. searching for strings of characters; 3. positioning the current character location pointer; 4. inserting, deleting, and exchanging text portions. All input/output functions are handled by lOX, the PDP-II Input/Output Executive (see Chapter 7). 4.1 COMMAND MODE AND TEXT MODE Whenever ED-II prints an * on the teleprinter, you may type a command to it. (Only one command per line is acceptable.) The Editor is then said to be in Command Mode. While most commands operate exclusively in this mode, there are five ED-II commands t.hat require additional information in order for the commands to be carried out. The Editor goes into Text Mode to receive this text. Should a nonexistent command be typed or a command appear in incorrect format, ED-II prints a? This is followed by an * at the beginning of a new line indicating that the Editor is in Command Mode. Editor processing begins in Command Mode. When you type a command, no action occurs until you follow it by typing the RETURN key (symbolized as..) ). If the command is not a text-type command, typing the RETURN key initiates the execution of the command and ED-II remains in Command Mode. However, if the command is a text-type command (Insert, eXchange, Change, Get, or wHole), typing the RETURN key causes the Editor to to into Text Mode. At this time you should type the text to be operated on by the command. This can include the non-printing characters discussed below, as well as spaces and tabs (up to eight spaces generated by the CTRL/TAB keys). Note that typing the RETURN key always causes the physical return of the Teletype print element to the beginning of the line, and automatically generates a line feed, thereby advancing the carriage to a new line. In Text Mode, the RETURN key not only serves these 4-1 EDITING THE SOURCE PROGRAM mechanical functions, allowing you to continue typing at the beginning of a new line, but at the same time it enters a carriage return and line feed character into the text. (A carriage return not followed by a line feed cannot, therefore, be entered from the keyboard.) RETURN and LINE FEED are both counted as characters and can be edited along with the printing characters (as can the form feed, discussed in Section 4.2.5). When you wish to terminate Text Mode and reenter Command Mode, you must type the LINE FEED key symbolized as ~ ). A typed LINE FEED is not considered to be part of the text unless it is the first character entered in Text Mode. 4.2 COMMAND DELIMITERS 4.2.1 Arguments Some ED-II commands require an argument to specify the particular portion of text to be affected by the command or how many times to perform the command. In other commands this specification is implicit and arguments are not allowed. The ED-II command arguments are described as follows: 1. n stands for any number from 1 through 32767 (decimal) may, except where noted, be preceded by a + or If no sign precedes n, n is assumed to be a positive number. Where an argument is acceptable, its absence argument of 1 (or -1 if a - is present). implies an The role of n varies according to the command with is associated. which it 2. 0 refers to the beginning of the current line. 3. @ refers to a marked Section 4.2.3). 4. / (designated) character location (see refers to the end of text in the Page Buffer. The roles of all arguments are explained corresponding commands which qualify them. 4.2.2 and further with the The Character Location Pointer (Dot) Almost all ED-II commands function with respect to a movable reference point, Dot. This character pointer is normally located between the most recent character operated upon and the next character and, at any given time, can be thought of as "where the Editor is" in your text. There are commands which move Dot anywhere in the text, thereby redefining the "current location" and allowing greater facility in the use of the other commands. 4-2 EDITING THE SOURCE PROGRAM 4.2.3 Mark In addition to Dot, a secondary character pointer known as Mark also exists in ED-II. This less agile pointer is used with great effect to mark or "remember" a location by moving to Dot and conditionally remaining there while Dot moves on to some other place in the text. Thus, it is possible to think of Dot as "here" and Mark as "there". Positioning of Mark, which is referenced by means of the argument @, is discussed below in several commands. 4.2.4 Line-Oriented Command Properties ED-II recognizes a line as a unit by detecting a line terminator in the text. This means that ends of lines (line feed or form feed characters) are counted in line-oriented commands. This is important to know, particularly if Dot, which is a character location pointer, is not pointing at the first character of a line. In such a case, an argument n does not affect the same number of lines (forward) as its negative (backward). For example, the argument -1 applies to the character string beginning with the first character following the second previous end-of-line character and ending at Doti argument +1 applies to the character string beginning at Dot and ending at the first end-of-line character. If Dot is located, say, in the center of a line, notice that this affects 1-1/2 lines back or 1/2 line forward, respectively: Example of List Commands -lL and +lL: Text CMPB ICHAR,#033 BEQ $ALT CMPB ~CHAR' #175 BNE PLACE Dot is here 4.2.5 Command Printout *-lL BEQ $ALT CMPB I CHAR'#~Dot remains *+lL ~here The Page Buffer The Page Buffer holds the text being edited. The unit of source data that is read into the Page Buffer from a paper tape, is the page. Normally a page is terminated, and therefore defined, by a form feed (CTRL/FORM) in the source text wherever a page is desired. (A form feed is an acceptable Text Mode character.) Overflow, no-tape, or reader-off conditions can also end a page of input (as described in Section 4.3.1.2). Since more than one page of text can be in the buffer at the same time, it should be noted that the entire contents of the Page Buffer are available for editing. 4-3 EDITING THE SOURCE PROGRAM 4.3 COMMANDS 4.3.1 Input and Output Commands Three commands are available for reading in a page of text. The Read command (Section 4.3.1.2) is a specialized input command; the Next command (Section 4.3.1.4) reads in a page after punching out the previous page; and the wHole command (Section 4.3.3.2) reads in and punches out pages of text as part of a search for a specified character string. Output commands either list text or punch it on paper tape. The List command causes specified lines of text to be printed at the terminal so that they may be examined. Paper tape commands (Next and wHole also perform input) provide for the output of specified pages, lines, form feeds (for changing the amount of data that constitutes a given page), and blank tape. Note that the process of outputting text does not cause Dot to move. 4.3.1.1 Open - The Open command (0) should be typed whenever a new tape is put in the reader. This is used when the text file being edited is on more than one paper tape. Note also that if the reader is off at the time an input command given, turning the reader on must be followed by the Open command. is 4.3.1.2 Read - One way of getting a page of text into the Page Buffer so that ~ can be edited is the Read (R) command. The R command causes a page of text to be read from either the low-speed reader or high-speed reader (as specified in the starting dialogue, Section 4.4.2), and appended to the contents (if any) of the Page Buffer. Text is read in until either: 1. A form feed character is encountered; 2. The page buffer is 128 characters from being filled, or a line feed is encountered after the buffer has become 500 characters from being filled; 3. The reader is turned off, or runs out of paper tape command, Section 4.3.1.1). Following execution of an R command, Dot and Mark are located beginning of the Page Buffer. (see Open at the A 4K system can accommodate about 4000 characters of text. Each additional 4K of memory provides space for about 8000 characters. NOTE An attempt to overflow the storage area causes the command (in this case, R) to stop executing. A? is then printed, followed by an * on the next line indicating that a command may be typed. No data is lost. 4-4 EDITING THE SOURCE PROGRAM 4.3.1.3 List and Punch - Output commands List (L) and Punch (P) can be described together, as they differ only in that the device addressed by the former is the terminal, and the device addressed by the latter is the paper tape punch. Dot is not moved by these commands. nL nP Lists } Punches the character string beginning at Dot and ending with the nth end-of-line -nL -nP Lists Punches } the character string beginning with the first character following the (n+l)th previous end-of-line and terminating at Dot OL OP Lists Punches } the character string beginning with the first character of the current line and ending at Dot @L @P Lists Punches } the character string between Dot and the Marked location /L Lists Punches } the character string beginning at Dot and ending with the last character in the Page Buffer /P In addition to the above List commands, there are three special List commands that accept no arguments. The current line is defined as the line containing Dot, i.e., from the line feed (or form feed) preceding Dot to the line feed (or form feed) following Dot. v Lists the entire line containing Dot < Same as -lL. If Dot is located at the beginning of a line, this simply lists the line preceding the current line > Lists the line following the current line Examples: TEXT CMPB ICHAR,#033 BEQ $ALT CMPB/CHAR,#175 BNE LACE PRINTOUT COMMANDS v < > CMPB BEQ CMPB BNE Dot remains here. Dot is here. 4.3.1.4 Next - Typing nN punches out the entire contents of the Page Buffer (followed by a trailer of blank tape if a form feed is the last character in the buffer), deletes the contents of the buffer, and reads the Next page into the buffer. It performs this sequence n times. If there are fewer than the n pages specified, the command is executed for the number of pages actually available, and a? is printed out. Following execution of a Next, Dot and Mark are located at the beginning of the Page Buffer. 4-5 EDITING THE SOURCE PROGRAM 4.3.1.5 Form Feed and Trailer - F Punches out a Form feed character and four inches tape of blank nT Punches out four inches of Trailer (blank) tape n times 4.3.1.6 Procedure with Low-Speed Punch - If the low speed punch is the specified output device (see Section 4.4.2), the Editor pauses before executing any tape command just typed (Punch, Form feed, Trailer, Next, wHole). The punch must be turned on at this time, after which typing the SPACE bar initiates the execution of the command. Following completion of the operation, the Editor pauses again to let you turn the punch off. When the punch has been turned off, typing the SPACE bar returns ED-II to Command Mode. 4.3.2 Commands to Move Dot and Mark 4.3.2.1 Beginning and End - B Moves Dot to the Beginning of the Page Buffer E Moves Dot to the End of the Page Buffer and /A below) 4.3.2.2 (see also /J to the Jump and Advance- nJ Jumps Dot forward past n characters -nJ Moves Dot backward past n characters nA Advances Dot forward past n ends-of-lines beginning of the succeeding line -nA Moves Dot backwards across n ends-of-lines and positions Dot immediately after n+l ends-of-lines, i.e., at the beginning of the -n line. OJ or OA Moves Dot to the beginning of the current line @J or @A Moves Dot to the Marked location /J or /A Moves Dot to the end of the Page above) Buffer (see also E Notice that while n moves Dot n characters in the Jump command, its role becomes that of a line counter in the Advance command. However, because 0, @, and / are absolute, their use with these commands overrides line/character distinctions. That is, Jump and Advance perform identical functions if both have either 0, @ or / for an argument. 4-6 EDITING THE SOURCE PROGRAM 4.3.2.3 Mark - The M command marks ("remembers") the current position of Dot for late.r reference in a command using the argument @. Note that only one position at a time can be in a marked state. Mark is also affected by the execution of those commands which alter the contents of the Page Buffer: C 4.3.3 o H I K N R x Search Commands 4.3.3.1 Get - The basic search command nG starts at Dot and Gets the nth occurrence of the specified text in the Page Buffer. If no argument is present, it is assumed to be 1. When you type the command, followed by the RETURN key, ED-II goes into Text Mode. The character string to be searched for must now be typed. (ED-II will accept ~ search object of up to 42 characters.) Typing the LINE FEED key terminates Text Mode and initiates the search. This command sets Dot to the position immediately following the found character string, and a OL listing is performed by ED-II. If a carriage return, line feed, or form feed is specified as part of the search object, the automatic OL displays only a portion of text -- the part defined as the last line. Where any of these characters is the last character of the search object, the OL of course yields no printout at all. If the search is unsuccessful, Dot is at the end of the Page Buffer and a? is printed out. The Editor then returns to Command Mode. Examples: Text Command Printout MOV @RMAX,@RS ADD #6,(RS)+ ( CLR $CK3 TST R2 BEQ CKCR 2G./ CK BEQ CK 1. Dot is no\ Dot was here. 2. CMPB BEQ BR D~ G..} ICHAR,#RUBOUT SITE PUT TE./ BR-I- 4.3.3.2 wHole - A second search command, H, starts at Dot and looks through the wHole text file for the next occurrence of the character string you have specified in Text Mode. It combines a Get and a Next such that if the search is not successful in the Page Buffer, the contents of the buffer are punched on tape, the buffer contents are deleted, and a new page is read in, where the .search is continued. This continues until the search object is found or until the complete source text has been searched. In either case, Mark is at the beginning of the Page Buffer. 4-7 EDITING THE SOURCE PROGRAM If the search object is found, Dot is located immediately following it, and a OL is performed by ED-II. As in the Get command, if the search is not successful Dot is at the end of the buffer and a ? appears on the teleprinter. Upon completion of the command, the Editor will be in Command Mode. No argument is allowed. Note that an H command specifying a nonexistent search object can be used to close out an edit, i.e., copy all remaining text from the input tape to the output tape. 4.3.4 Commands to Modify the Text 4.3.4.1 Insert - The Insert command (I) allows text to be inserted at Dot. After I is typed (followed by the typing of the RETURN key), the Editor goes into Text Mode to receive text to be inserted. Up to 80 characters per line are acceptable. Execution of the command occurs when the LINE FEED key (which does not Insert a line feed character unless it is the first key typed in Text Mode) is typed terminating Text Mode. At this point, Dot is located in the position immediately following the last inserted text character. If the Marked location was anywhere after the text to be Inserted, Dot becomes the new Marked location. . During an insert, it sometimes happens that the user accidentally types' CTRL/P rather than SHIFT/P (for @), thus deleting the entire insert (see Section (.4.1). To minimize the effect of such a mistake, the insert may be terminated every few lines and then continued with a new Insert command. As with the Read command, an attempt to overflow the Page Buf£er causes a ? to be printed out followed by an * on the next line indicating that a command may be typed. Allor part of the last line typed may be lost. All previously typed lines are inserted. Examples: Text l. Command Effect I~ MOV~~::~;F MOV #8. ,EKO, CN Dot I - I 2. Dot Inserting a carriage return (and automatic line feed) : CLR Rl,LR R2 I..-J ..-J Dot 3. CLR Rl CLR R2 .j. Inserting a single line feed: I~ LOOK W~ HAPPENS HERE Dot/" + + LOOK WHAT ,APPENS HERE Dot 4-8 EDITING THE SOURCE PROGRAM 4.3.4.2 Delete and Kill - These commands are closely related to each other; they both erase specified text from the Page Buffer. The Delete command (D) differs from the Kill command (K) only in that the former accepts an argument, n, that counts characters to be removed, while the latter accepts an argument, n, that counts lines to be removed. 0, @, and / are also allowed as arguments. After execution of these commands, Dot becomes the Marked location. nO Deletes the following n characters -nO Deletes the previous n characters nK Kills the character string beginning at Dot and at the nth end-of-line -nK Kills the character string beginning with the first (n+l)th previous end-of-line character following the and ending at Dot 00 or OK Removes the current line up to Dot @D or @K Removes the character string bounded by Dot and Mark /0 or /K Removes the character string beginning at Dot ending with the last character in the Page Buffer 1. 2. Text Command Effect jCHECK THE MOZXDE -20 iCHECK THE MODE 00/ ending and Dot ; IS IT A TAB OR i IS IT A CR \ 2K t iIS IT A/ Dot/ Dot 4.3.4.3 Change and exchange - The Change (C) and eXchange (X) commands can be thought of as two-phase commands combining, respectively, an Insert followed by a Delete, and an Insert followed by a Kill. After the Change or eXchange command is typed, ED-II goes into Text Mode to receive the text to be inserted. If n is used as the argument, it is then interpreted as in the Delete (character-oriented) or Kill (line-oriented), and accordingly removes the indicated text. 0, @, and / are also allowed as arguments. nC xxxx Changes the following n characters xxxx -nC xxx nX xxxx xxxx Changes the previous n characters eXchanges the character string beginning at Dot and ending at the nth end-of-line -nX xxx eXchanges the character the first character string beginning with following the (n+l)th previous end-of-line and ending at Dot 4-9 EDITING THE SOURCE PROGRAM OC or OX xxxx xxxx xxxx xxx x Replaces the current line up to Dot @C xxx xxx or @X xxx xxx Replaces the character string bounded by Dot and the Marked location /C or /X Replaces the character string beginning at Dot and ending with the last character in the Page Buffer. xxx xxx Again, the use of absolute arguments 0, and @, and / overrides the line/character distinctions that nand -n produce in these commands. If the Insert portion of a Change or eXchange is terminated because of attempting to overflow the Page Buffer, data from the latest line may have been lost, and text removal does not occur. Such buffer overflow might be avoided by separately executing a Delete or Kill followed by an Insert, rather than a Change or eXchange, which does an Insert followed ·by a Delete or Kill. Examples: Text ;A LINE FEED \IS HERE ;THIS ;IS ON ·FOUR CLINES Dot Command -9C~ Effect IS HERE TAB 42X..j PAPER Dot 4.4 OPERATING PROCEDURES 4.4.1 Error Corrections During the course of editing a page of the program, it may become necessary to correct mistakes in the commands themselves. There are four special commands which do this: 1. Typing the RUBOUT key removes the preceding typed character, if it is on the current line. Successive RUBOUTs remove preceding characters on the line (including the SPACE), one character for each RUBOUT typed. 2. The CTRL/U combination (holding down the CTRL key and U) removes all the characters in the current line. 3. CTRL/P cancels the current command in its entirety. This includes all the current command text just typed, if ED-II was in Text Mode. Do not use another CTRL/P before typing a line terminator as this will cause an ED-II restart (see 4. below). If CTRL/P is typed while,a found search object of a Get or wHole is being printed out, the normal position of Dot (just after the specified search object) is not affected. typing CTRL/P should not be used while a punch operation is in progress as it is not possible to know exactly how much data will be output. 4-10 EDITING THE SOURCE PROGRAM 4. Two CTRL/P's not interrupted by a typed line terminator restart ED-II, initiating the dialogue described in Section 4.4.2. After removing the incorrect command data, the user can directly in the desired input. 4.4.2 type Starting The Editor is loaded by the Absolute Loader (see Chapter 6, Section 6.2.2) and starts automatically. Once the Editor has been loaded, the following sequence occurs: ED-II Prints User Types *1 L~ (if the low-speed Reader is to for source input) be used H~ (if the high-speed Reader is to be for source input) used L...J (if the low-sp,eed Punch is for edited output) to be used H.,.} (if the high-speed Punch is to for edited output) be used *0 If all text is to be entered from the keyboard (i.e., via command) i either L or H may be specified for !nput. the Insert If the output device is the high-speed punch (HSP), the Editor enters Command Mode to accept input. Otherwise, the sequence continues with: LSP OFF (when low-speed Punch (LSP) is off) Upon input of ~ from the keyboard, the Editor enters Command Mode and is ready to accept input. 4.4.3 Restarting To restart ED-II, type CTRL/P twice. This initiates the normal starting dialogue described in Section 4.4.2. If the Low-speed Reader The text to be (LSR) is in operation it must first be turned off. edited should be loaded (or reloaded) at this time. 4.4.4 Creating a Paper Tape Input commands assume that text is to be read from a paper tape by the low-speed reader or high-speed reader. However, the five commands that go into Text Mode enable the user to input from the keyboard. The Insert command, in particular (Section 4.3.4.1) can be useful for entering large quantities of text not on paper tape. The Page Buffer can thus be filled from the keyboard, and a paper tape actually created by using a command to punch out the buffer contents. 4-11 EDITING THE SOURCE PROGRAM 4.4.5 Editing Example The following example consists of three parts: 1. The marked up source program listing indicating changes. the desired 2. The ED-II commands to implement those changes (with on the editing procedure). comments NOTE Typing the RETURN key terminates Command Mode in all cases. In commands which then go into Text Mode, typing the LINE FEED key (symbolized as +) produces the terminator. 3. Part I Th~ edited text. Original Source for Edit ;COMMON INPUT ROUTINE FOR USE BY NON FILE DEVICES UNPI.J'T": ADC CLR MOV MOV ~;CI\MODE! BITB BNE !I;CKNUL: TSTB BEt~ $CI<PAFn BITB BNE MOVB JSR SUB BE(~ PAROI\! BIS CLR BIC CMPB BNE TSTB BEC~ . ~; .JP~.!CI<! $01\: CL.I::: •.lMP I CHAR, (1:::~5) + ..- (LS) (F'~5) +,r';:MAX (1::::5) +, MODADR ;UPDATE CKSUM II CLEAF'~ DONE ;GET ADR MAX ;GET ADR MODE ;R5 NOW POINTS TO POINTER @MODADB,IASCII ;IS THIS ASCII ,"NO .-.-.- 'r I::':Y l:QNARY C~,I\·I~.·.·[N ICHAR CI\ llASCII---IS CHAR A NULL ;YES--NO GO llLOOK AT MODE TO SEE IF :JI:PAFmIT ;SUPPOSED TO CHECK PARITY? PAr-WI\ llNO ICHAF~, OCHAR ; YES·----CK IT (1!MODADF~, Fa,PAF'~GEN I CHAF'~ y ClCHAF'~ PAI:::OK :1t.PARERR, (!)MCJDADF'~ OCHAR :U 77200, ICHAH @1() (I:~ADD) , :IJ:KBD (JI\O EI<DCNT $01< I CHAr.;: CK" ; ; OK'!' ;N(J-~-SET ERR BIT ; STRIP PAF~ITY ;IS THIS KBD INPUT ;NO llYES---DONE EKD OF LAST? llYES ;NO---DROP NEW CHAR llWHAT IS THE --------------------~~ CHAF~ CMPB ICI·Mr.;:? :IJ:CTRLC HS IT A ~c (:~'il~PP BNE ;NO :II:UPC,OCHAR ; YEB-. ·-ECHO ~C MOV INC RDUN :1I:('IBIHAD y 20 (R6) ;DIDDLE RETURN ADR MClV BBPLUS:I. 4-12 EDITING THE SOURCE PROGRAM F~ESTAD. ' ICHAF~ FWUN :II:UF'F'v OCHAI:;: CMPB ICHAF~, BEl~ CI< PUT BB :fl:RUBClUT lIS THIS A RUBOUT I YES-··-·. ·I GNClF~E IT I NCl-'-"'- CK :H:BSLASH,OCHAR ;YES---FClRGET IT llECHO A \ IF'OINTER=POINTER-l I BC==BC-' (I:;:5H (]H~:::j EKO H~KO ~U'? CKLJPU: CI... I:;: MOV ADD CLR BB CKTAB: CKCF~: • ES---··-ECHO / Y IPOINTER=BUFADRt6 • BC::"" 0 IECHO @r';:5 EKfJ :II:HTAB CMPB BNE MOV MDV BB TABCNT,EKfJCNT PUT CMPB BNE MOV INC BB ICHAR,:II:CR !1;CK3 :ft:CFU_F,OCHAR FWUN PLUSl I IS IT A CR'? INO IYES---ECHO CRLF BEO CMPB BEQ CMPB BNE !ML.T ICHAI:;:, :IJ::J. 75 1\ IfB'<P HF.IBL, 861IM~ :rCHAF~, CKCI:;: :I~BLNKS, OCHAF~ lIS IT A TAB INO IYES---ECHCl BLANKS .SET UP COUNTER .;(.'.1".1-:-----------------At'" • .. CMPB ICHAR,I033 ~ ~AL.T3 _ ,.. - ;.%1 (HAR. /,.., !~AL.T ,."., ..~, ICHAR,I:J.76 CK"r--------·&X __~~M~Cl~V~==~li:J.~7~5:,:I:C;H~A~R--~ :;r;ONG I'Im Ihi ... H - -_ _ _ _ _ _.. FUT .. ~ "",r. ~- 4-13 EDITING THE SOURCE PROGRAM CI,\LF: CKFF: BNE I CHAR, :D:I... F CI'\FF CMPB INC l:mUN BB PUT MOV CMPB ICHAF~, OCHAIi: BNE PUT MOV MOV BB :H:13 + ,EKDCNT :fl:I... FL.F, fJCHAR Part II: :r CHAF~, :I~FF PUT Editing Session Assume that ED-II has been started, is in Command Mode, and the is in the reader. Underlined matter indicates ED-II output. *R iReads in a page of text *H 2CK:t $JP2CK: iSearches entire program for 2CK: iwhen found ED-II performs a OL *G CK $JP2CK iSearches current page for next CK iwhen found ED-II performs a OL JMP CK *1 DUNt iInserts DUN following CK *G CKUPFt iSearches for next CKUPP iwhen found ED-II performs a OL BNE CKUPP *-5C OKO OKO replaces last 5 characters (CKUPP) *6A iDot is moved 6 lines ahead (including ia blank line) *9K i9 lines are killed starting with CKUPP: *L iNext line is listed - Dot is not moved iTHIS IS NOT KBD INPUT *1 iBlank line is inserted :.J t *A iDot is moved 1 line ahead to point to icharacter 0 of OKO: *4X iFollowing comments replace the next 4 i lines iFORMATTED AND UNFORMATTED iASCII ARE HANDLED THE SAMEt *G CKINP:t CKINP: iSearches for next CKINP: OL printout occurs when found 4-14 tape EDITING THE SOURCE PROGRAM *OJ ~Dot is moved to the beginning of the ;current line. :/K iThe rest of the page is killed *N ;Current page is punched out on paper tape ia new page is read in *L iThe next line is listed - TST 2(R5) (3 lines) Dot is not moved iBC=O? *15K ;15 lines are killed starting with TST *2L ;1 blank line and 1 line of text ,are listed - Dot is not moved CKTAB: CMPB ICHAR,#HTAB ,IS IT A TAB *2G $CK3+ $CK3 ;Searches for 2nd occurrence of $CK3 iOL printout verifies it is found *-C ALT+ ;ALT replaces preceding character *V iLists entire current line to verify ;the above-C result $CKALT: CMPB ICHAR,#Q33 *G 033+ $CKALT: CMPB ICHAR,#033 ;Searches for the 033 to position Dot ifor next command -- OL occurs *1 ;The following text is inserted in the ;comment field iIS CHAR AN ALTMODE? *G CKLN ;Searches for next CKLF -- OL occurs BNE CKLF *-2C EX ;EX replaces the preceding two characters ; (LF) *2J ;Jumps Dot past the carriage return and ;line feed characters *K ,Kills next line (starting with $ALT:) *1 $ALT :+ ;Inserts $ALT: at beginning of the fol;lowing line *A ;Advances Dot past 1 line feed to the ;beginning of the next line *M ;Marks the position of Dot *B ;Moves Dot to the beginning of the curtrent page 4-15 EDITING THE SOURCE PROGRAM ~@P iPunches out the lines from Dot to the iposition just marked - Dot not moved ~@A iMoves Dot from the beginning of the ipage to the marked position *2K iKills the next 2 lines * PART III Edited Source ;COMMON INPUT ROUTINE FOR USE BY NON FILE DEVICES 'INPUT: ADD CLR MOV MOV ICHAR,(R5)+ -(LS) (R5)+,RMAX (R5)+,MODADR ;UPDATE CKSUM ICLEAR DONE IGET ADR MAX IGET ADR MODE IR5 NOW POINTS TO POINTER 'CKMODEIBITB BNE @MODADB,IASCII CKBIN lIS THIS ASCII INO---TRY BINARY SCKNULI TSTB BEQ ICHAR CK ;ASCII---IS CHAR A NULL IYES--NO GO SCKPAR: BITB BNE MOVB JSR SUB BEQ BIS PAROK: CLR BIC CMPB BNE TSTB BEQ CLR SJP2CK: JMP ,LOOK AT MODE TO SEE IF @MODADR,IPARBIT ISUPPOSED TO CHECK PARITY? PAROK ,NO ICHAR,OCHAR ;YES---CK IT R7,PARGEN ICHAR,OCHAR I PAROK 10K? IPARERR,@MODADR ;NO--~SET ERR BIT OCHAR 1177200,ICHAR ,STRIP PARITY @10(RADD),IKBD lIS THIS KBD INPUT ,NO OKO EKOCNT ;YES---DONE EKO OF LAST? ;YES SOK ICHAR ,NO---DROP NEW CHAR CKDUN 'OK: CKTAB: ;WHAT IS THE CHAR CMPB ICHAR,ICTRLC BNE OKO MOV IUPC,OCHAR INC RDUN MOV IABRTAD,20(R6) BB PLUS1 CMPB BEQ BB CMPB BNE MOV MOV BB ICHAR,IRUBOUT CK PUT ICHAR,IHTAB CKCR IBLNKS,OCHAR TABCNT,EKOCNT PUT ,IS IT A -C ,NO ,YES--ECHO -C ,DIDDLE RETURN ADR ,THIS IS NOT KBD INPUT .FORMATTED AND UNFORMATTED ,ASCII ARE HANDLED THE SAME ,IS THIS A RUBOUT ,YES---IGNORE IT INO--lIS IT A TAB ,NO ,YES---ECHO BLANKS ISET UP COUNTER 4-16 EDITING THE SOURCE PROGRAM CKCH: CMF'B BNE MOV INC ICHAr~' :ft:CR $CK3 :ft:CRLF,OCHAR RDUN PLUS1 ;IS IT A CR? ;NO ; YES-······ECHO CRL.F CMF'B ;IS CHAR AN ALTMODE? CMPB BEQ CMF'B BNE MOV CMPB BNE INC BB I CHAH , :&:0:33 $ALT ICHAR,U75 $ALT ICHMhU76 CKEX :ft::I.7:::i, ICHAH I CHAI~, iLF CKFF FWUN PUT MOV CMBP BNE MOV M()V BB I CHAF~ , OCHAR ICHAR':o:FI::" PUT :1(:8, EK()CNT tl... FL.F,OCHAR PUT aa ~;CKALn BEt~ !~AL T: CKLF: CKFF: 4.5 SOFTWARE ERROR HALTS ED-II loads all unused trap vectors with the code . WORD .+2,HALT so that if the trap does occur, the processor halts in the second word of the vector. The address of the halt, displayed in the console address register, therefore indicates the cause of the halt. In addition to the halts which may occur in the vectors, the standard lOX error halt at location 40 may occur (see Chapter 7). Address of HALT Meaning 12 16 Reserved instruction executed Trace trap occurred Power fail trap EMT executed TRAP executed lOX detected error 26 32 36 40 4-17 CHAPTER 5 DEBUGGING OBJECT PROGRAMS ON-LINE 5.1 INTRODUCTION ODT-ll (Qn-line Qebugging ~echnique for the PDP-II) is a system program which aids in debugging assembled object programs. From the Teletype keyboard you interact with ODT and the object program to: print the alteration contents of any run all or part of an object feature location program for using examination the or breakpoint search the object program for specific bit patterns search the object specific word program for words which reference a calculate offsets for relative addresses During a debugging session you should have at the terminal the assembly listing of the program to be debugged. Minor corrections to the program may be made on-line during the debugging session. The program may then be run under control of ODT to verify any change made. Major corrections, however, such as a missing subroutine, should be noted on the assembly listing and incorporated in a subsequent updated program assembly. A binary tape of the debugged program can be obtained by DUMPAB program (see Chapter 6, section 6.3). 5.1.1 use of the ODT-Il and ODT-IIX There are two versions of ODT included in the PDP-II Paper Tape Software System: a standard version, ODT-ll, and an extended version, ODT-IIX. 1 Both versions are independent, self-contained programs. ODT-IIX has all the features of ODT-ll, plus some additional features. Each version is supplied on two separate paper tapes: a source tape and an absolute binary tape. The purpose of the tapes, and loading and starting procedures are explained in a later section of this chapter. ODT-Il is completely described in section 5.2, and the additional features of ODT-IIX are covered in section 5.3. In all sections of this chapter, except where specifically'stated, refer~nce to ODT Only ODT-IIX is available for the LSI-II or the PDP-ll/03. 5~1 DEBUGGING OBJECT PROGRAMS ON-LINE applies to both versions. Concluding sections discuss ODT's internal operations -- how it effects breakpoints, how it uses the "trace trap" and the T-bit, and other useful data. The following discussion assumes that the reader is f~miliar with the PDP-II introduction formats and the PAL-IIA Assembly Language as described in Chapter 3. 5.1.2 ODT's Command Syntax ODT's commands are composed of the following characters and symbols. They are often used in combination with the address upon which the operation is to occur, and are offered here for familiarization prior to their thorough coverage which follows. Unless indicated otherwise, n below represents an octal address. n/ open the word at location n / reopen last opened location n\ (SHIFT/L) open the byte at location n (ODT-IIX only) \ reopen the last opened byte (ODT-IIX only) (LINE FEED key) open next sequential location open previous location RETURN close open location and accept the next command take contents of opened location, index by contents PC, and open that location of @ take contents of opened location as absolute and open that location (ODT-llX only) > take contents of opened location as relative branch instruction and open referenced location (ODT-llX only) < return to sequence prior to last @, >, or open succeeding location (ODT-IlX only) $n/ open general register n (0-7) separates commands from command alphabetic commands below) iB remove Breakpoint(s) (see version for particulars) niB set Breakpoint at location n command and arguments description address of (used with each ODT lThe circumflex appears on some keyboards and printers in place of the up-arrow. 2The underline appears on some keyboards and printers in place of back-arrow. 5-2 the DEBUGGING OBJECT PROGRAMS ON-LINE n;rB set Breakpoint r at location n (ODT-IIX only) ;rB remove r(th) Breakpoint n;E search for address n n;W search for Words with bit patterns which match n inS enable Single-instruction mode (n can have any and is not significant); disable breakpoints ;S disable Single-instruction mode n;G Go to location n and start program run ;P Proceed with program execution from breakpoint; stop when next breakpoint is encountered or at end of program (ODT~llX instructions that only) reference In Single-instruction mode only (ODT-IIX), execute next instruction only niP value Proceed to stop Proceed with program execution from breakpoint; after encountering the breakpoint n times. In single-instruction mode only (ODT-IIX), execute next n instructions. n/(word)n;O Effective Proceed to calculate Offset from location n to location m $B/ open Breakpoint status word (ODT-ll) open BREAKPOINT D STATUS WORD (ODT-IIX) $M/ open search Mask $S/ open location containing user program's Status register $P/ open location containing ODT's Priority level With ODT-ll, location references must be to even numbered 16-bit words. With ODT-IIX, location references may be to 16-bit words or 8-bit bytes. The semicolon in the above commands is ignored by ODT-ll, but is used for the sake of consistency, since similar commands to ODT-IIX require it. 5.2 COMMANDS AND FUNCTIONS When ODT is started as explained in section 5.6, it indicates its readiness to accept commands by printing an asterisk (*) on the left margin of the terminal paper. In response to the asterisk, you can issue most commands; for example, you can examine and, if desired, change a word, run the object program in its entirety or in segments, or even search core for certain words or references to certain words. The discussion below first explains some elementary features, and then covers the more sophisticated features. All commands to ODT are issued using the characters and symbols above in Section 5.1.2. 5-3 shown DEBUGGING OBJECT PROGRAMS ON-LINE 5.2.1 Opening, Changing, and Closing Locations An open location is one whose contents ODT has printed for examination, and whose contents are available for change. A closed location is one whose contents are no longer available for ch~nge. Any even-numbered location may be opened using ODT-ll. The contents of an open location can be changed by typing the new contents followed by a single character command, which requires no argument (i.e. -} t RETURN + @ > <). Any command typed to open a location when another location is already open causes the currently open location to be closed. 5.2.1.1 The Slash (/) - One way to open a location address followed by a slash: is to type its :'1000/012746 Location 1000 is open for examination and is available for change. Note that in all examples ODT's printout is underlined~ your typed input is not. Should you not wish to change the contents of an open location, merely type the RETURN key and the location will be closed; ODT prints another asterisk and waits for another command. However, should you wish to change the word, simply type the new contents before giving a command to close the location. *1000/012746 * 012345 In the example above, location 1000 now contains 012345 and is closed since the RETURN key was typed after entering the new contents, as indicated by ODT's second asterisk. Used alone, the slash reopens the last location opened: *1000/012345 ~/002340 2340 As shown in the example above, an open location can be closed by typing the RETURN key. In this case, ODT changed the contents of location 1000 to 002340 and then closed the location before printing the * A single slash then directed ODT to reopen the last location opened. This allowed us to verify that the word 002340 was correctly stored in location 1000. (ODT supplies the leading zeroes if not given.) Note again that opening a location while another is currently open automatically closes the currently open location before opening the new location. 5.2.1.2 The LINE FEED Key - If the LINE FEED key is typed when a location is open, ODT closes the open location and opens the next sequential location: *1000/002340 -} 001002/012740 ( + denotes typing the LINE FEED key) 5-4 DEBUGGING OBJECT PROGRAMS ON:....LINE· In this example, the LINE FEED key instructed DDT to print the" addres~ of the next location along with its contents and to wait for furth~r instructions. After the above operation, location 1000 is closed and 1002 is open. The open location may be modified by typin~ the new contents. 5.2.1.3 The Up-Arrow(t) - The up-arrow (or curcumflex) symbol is effected by typ1ng the SHOFT and N key combination. If the up-arrow is typed when a location is open, ODT closes the open location and opens the previous location (as shown by continuing" from the example above) : 001002/012740 001000/002340 t (t is printed by typing SHOFT and N) Now location 1002 is closed and 1000 is open. be modified by typing-the new contents. The o~en location may 5.2.1.4 The Back-Arrow(+) - The back-arrow (or underline) symbol is effected by typing the SHIFT and 0 key combination. If the back-arrow is typed to an open location, ODT interprets the contents of the currently open location as an address indexed by the Program Counter (PC) and opens the location so addressed~ *1006/000006 001016/100405 + ( + is printed by typing SHIFT and 0) Notice in this example that the open location(1006) was indexed by the PC as if it were the operand of an instruction with address mode 67 as explained in Chapter 3. A modification to the opened location can be made before a + , t , or + is typed. Also, the new contents of the location will be used for address calculations using the command. Example: *100/000222 4+ 000102/000111 6t 000100/000004 100+ 000202/(contents) (modify to 4 and open next location) (modify to 6 and open previous location) (change to 100 and open location indexed by PC) 5.2.1.5 Accessing General Registers 0-7 - The program's general registers 0-7 can be opened using the following command format: ~$n/ where n is the integer representing the desired register (in the range o through 7). When opened, these registers can be examined or changed by typing in new data as with any addressable location. For example: ~$0/000033 (RO was examined and closed) * and *$4/000474 464 1< (R4 was opened, changed, and closed} DEBUGGING. OBJECT PROGRAMS- ON-LINE The example above can be verified by typing a ODT's ast.er isk: slash in response to ~/000464 The .j. , t , + , or @ commands may be used when a register is open (the is an ODT-IIX command). @ 5.2.1.6 Accessing Internal Regist~rs. - The program's Statu& Register contains the condition codes of the most recent operational results and the interrupt priority level of the object program. It is opened using the following command: ~$S/000311 where $S represents the address of the Status Register~ In response to $S/ in the example above, ODT printed the 16~bit (of which only the low-order 8 bits are meaningful): Bits 0-3 indicate whether a carry, overflow, z~ro, or negative (in that order) has resulted, and bits 5-7 indicate the interrupt priority level (in the range 0-7) of the object program. The $ is used to open certain other internal locations: $B internal breakpoinb status word (see section 5.2.2.2) $M mask location for specifying which bits are to be examined during a bit pattern search (see section 5.2.4) $P .location defining the operating priority section 5.2.6) $S locatio~ of containing the condition codes (bits interrupt priority level (bits 5-7) ODT (see 0~3) and Breakpoints 5.Z~2 The breakpoint feature facilitates monitoring the progress of program execution. A breakpoint may be set at any instruction which is not referenced by the program for data. When a breakpoint is set, ODT replaces the contents of the breakpoint location with a trap instruction. Thus, when the program is executed and the breakpoint is encountered, program exeeution is suspended, the original contents of the breakpoint location are restored, and ODT regains control. only one 5.2.2.1 .Setting the Breakpoint(n:B) - ODT-11 provides breakpoint: ODT-IIX provides eight. Breakpoint(s) may be changed at any time. A breakpoint is set by typing the address of the desired location of the breakpoint followed by :B. For example:: ~1020:B * sets a breakpoint at location 1020. to location 1120 as shown below. *1020·B , -*1120 ,·B * 5-6 The breakpoint above. is changed DEBUGGING OBJECT PROGRAMS ON-LINE Breakpoints should not be set at locations referenced by the program for data, nor at an lOT, EMT, or TRAP instruction. This restriction is explained in section 5.5.2. The breakpoint is removed by typing ;B without an argument, below. ~1l20 ;B *;B "* as shown (sets breakpoint at location 1120) (removes breakpoint) 5.2.2.2 Locating the Breakpoint($B) - The command $B/ causes ODT-ll to print the address of the breakpoint (see also section 5.3.3 on $B in ODT-IIX): ~$B/001120 The breakpoint was set at location 1120. $B represents the address containing ODT-ll's breakpoint location. Typing the RETURN 'key in the example above leaves the breakpoint at locatidn 1120 and returns control to ODT-ll. The breakpoint could be changed to a different location: *$B/001120 "*$B/0011l4 1114 * The breakpoint was found in location 1120, changed to and the change was verified. location 1114, If no breakpoint is set, $B contains an address internal to ODT-ll. 5.2.3 Running the Ptogram(n;G and niP) Program execution is under control of ODT. There are two commands for running the program: n;G and niP. The n;G command is used to start execution (GO) and niP to .continue (Proceed) execution after halting at a breakpoint. For example: *IOOO;G starts execution at location 1000. The program runs until it encounters a breakpoint or until program completion. If the program enters an infinite loop, it must be restarted or reentered as explained in section 5.6.2. When a breakpoint is encountered, execution stops and ODT-ll prints B; followed by the address of the breakpoint. Desired locations can then be examined for expected data. For example: *IOIO;B *IOOO;G B;OOIOIO (breakpoint is set at location 1010) (execution started at location 1000) (execution stopped at location 1010) * To continue program execution from the breakpoint, type ;P in response to ODT-ll's last *. When a breakpoint is set in a loop, it may be desirable to allow the program to execute a certain number of times through the loop before 5-7 DEBUGGING OBJECT PROGRAMS ON~LINE recognizing the breakpoint. This may be, done by typing the n;P commaI;ldand specifying the number of times the breakpoint is to be encountered before program execution is suspended (on then(th) encounter). (See section 5.3.3 for ODT-IIX interpretation of this command When more than one breakpoint is set in a loop.) Example: B;OOlOlO (execution halted at breakpoint) (set breakpoint at location 1250) (continue execution. loop through breakpoint 3 times and halt on the 4(th) occurrence of the breakpoint) ~1250;B -*4'P , B;001250 * The breakppint repeat count caI;l be inspected by typing $B/ followed by LINE FEED. The repeat count is then printed. This also provides an alternative way of specifying the count. Since the location is open, its contents can be 'modified in the usual manner by typing new contents followed by the RETURN key. *$B/001114 + nnnnnn/000003 6 *. (address of breakpoint .is 1114) .(repeat count wa$ 3, changed to 6) Breakpoints are inserted when performing an n;G or n;P command. Upon execution of the n;G or n;P command, the general registers 0-6 are set to the values in the locations specified as $0-$6 and the processor status register is set to the value in the location specified as $S. 5.2.4 Searches wi th ODT yOI,l can ,search all or any specyfied portion of core ,memory for any specific bit pattern or for references to a specific location. The location represented by $M is used to specify the mask of the search. The next two sequential locations contain the lower and upper limits of the search. Bits set to 1 in the mask are examined during the search; other bits are ignored. For example, *$M/OOOOOO 177400 1000 nnnnnn/OOOOOO 1040 ~nnnnn/OOOOOO + ~ (+ denotes typing LINE FEED) (starting address of search) (last address in search) * where nnnnnn represents some location in ODT. This location varies and,is meaningful only for reference purposes. Note that in the first line above, the slash was used to open $M which now contains 177400, and that the LINE FEEDs opened the next two sequential locations which now contain the lower and upper limits of the search. 5.2.4.1 Word Search(n;W) - Before initiating a word search, the mask and search, limits must be specified as explained above. Then the search object and the initiating comm~nd are given using the n;W command where n is the search object. When a match is found, the address of the unmasked matching word is printed. For example: *$M/000000177400 + 1000 + nnnnnn/OOOOOO 1040 *400;W 001010/000770 001034/000404 ~nnnnn/OOOOOO * (test high order eight bits) (initiating word search) 5-8 DEBUGGING OBJECT PROGRAMS ON-LINE the In the search process, the word currently being examined and search object are exclusive ORed (XORed), and the result is ANDed to the mask. If this result is zero, a match has been found, and is reported at the terminal. Note that if the mask is zero, all locations within the limits are printed. 5.2.4.2 Effective Address Search(njE) - ODT enables you to search for words which address a specified location. After specifying the search limits (section 5.2.4), type niE (where n is the effective address) to initiate the search. Words which are either an absolute address (argument n itself) I a relative address offset, or a relative branch to the effective address are printed after their addresses. For example: '::$M/177400 1nnnnnn/OOlOOO nnnnnn/00l040 *1034,E 001016/001006 001054/002767 *1020'E 001022/177774 001030/001020 ! 1010 11060 (initiating search) (relative branch) (relative branch) (initiating a new searhc) (relative address offset) (absolute address) Particular attention should be given to the reported references to the effective address because a word may have the specified bit pattern of an effective address without actually being so used. ODT will report these as well. 5.2.5 Calculating Offsets(n,O) Relative addressing and branching use an offset - the number of wrods or bytes forward or backward from the current location of the effective address. During the debugging session it may be necessary to change a relative address or branch reference by replacing one instruction offset with another. ODT calculates the offsets in response to the n;O command. The command niO causes ODT to print the l6-bit and 8-bit offsets from the currently open location to address n. In ODT-ll, the 8-bit offset is printed as a 16-bit word. For example: *346/000034 */000022 *20/000046 ~20/000067 414,0 000044 000022 22 200,0 000156 000067 67 In the first example, location 346 is opened and the offsets from that location to location 414 are calculated and printed. The contents of location 346 are then changed to 22 and verified on the next line. The l6-bit offset is printed followed by the 8-bit offset. In the example above, 000156 is the 16-bit offset and 000067 is the 8-bit offset. The 8-bit offset is printed only if the 16-bit offset is even, as in the case above. with ODT-ll only, the user must determine whether the 8-bit offset is out of the range 177600 to 000177 (-128 decimal to 127 decimal) . The offset of a relative branch is calculated and modified as follows: 5-9 DEBUGGING OBJECT PROGRAMS ON-LINE *1034/103421 * 1034;0 177776 177777 103777 Note that the modified low-order byte 377 must be combined with the unmodified high-order byte. Location 1034 was still open after the calculation, thus typing 103777 changed its contents; the location was then closed. 5.2.6 ODT'S Priority Level ($P) $P represents a location in ODT that contains the priority level at which ODT operates. If $P contains the value 377, ODT operates at the priority level of the processor at the time ODT is entered. Otherwise $P may contain a value between 0 and 7 corresponding to the fixed priority at which ODT operates. To set ODT to the desired priority level, open present contents, which may then be changed: *$P/000006 $P. ODT prints the 377 * If $P is not specified, its value is seven. Breakpoints may be set in routines at different priority levels. For example, a program running at a low priority level may use a device service routine operating at a higher priority level. If a breakpoint occurs from a low priority routine, if ODT operates at a low priority, and if an interrupt does occur from a high priority routine, then the breakpoints in the high priority routine will not be executed since they have been removed. '5;.3 ODT-llX ODT-IIX. has all the commands and features of ODT-ll section 5.2, p~us the following. 5.3.1 as explained in Opening, Changing and Closing Locations In addition to operating on words, ODT-IIX operates on bytes. One way to open a byte is to type the address of the byte followed a backslash: ~1001/025 by (\ is printed by typing SHIFT and L) A backslash typed alone reopens the last open byte. If previously open, the backslash reopens its even byte. a word was ~1002/000004\004 The LINE FEED and up-arrow (or circumflex) keys operate on bytes if byte is open when the command is given. For example: *1001\025 + 001002\004 t 001001\025 :!:, 5-10 a DEBUGGING OBJECT PROGRAMS ON-LINE 5.3.1.1 Open the Addressed Location(@) - The symbol @ optionally modifies, closes an open word, and uses its contents as the address of the location to open next. *1006/001024 001024/000500 *1006/001024 002100/177774 @ (open location 1024 next) 2100 @ (modify to 2100 and open location 2100) 5.3.1.2 Relative Branch Offset(» - The right angle bracket, >, optionally modifies, closes an open word, and uses its even byte as a relative branch offset to the next word opened. *1032/000407 000636/000010 (modify to 301 and interpret as a relative branch) > 301 doubled Note that 301 is a negative offset (-77). The offset is before it is added to the PC; therefore, 1034 + -176 = 636. 5.3.1.3 Return to Previous Sequence«) - The left angle bracket, <, optionally modifies, closes an open location, and opens the next location of the previous sequence interrupted by a + , @, or > command. Note that + , @, > cause a sequence change to the word opened. If a sequence change has not occurred, < simply opens the next location as a LINE FEED does. The command operates on both words and bytes. *1032/000407 301 000636/000010 < > (> causes a sequence change) «causes a return to original sequence) (@ causes a sequence change) « now operates on byte) « acts like -I- ) 001034/001040 @ 001040/000405\005 < 001035\ 002 < 001036\ 004 5.3.2 Calculating Offsets (n;O) The command n;O causes ODT to print the 16-bit and 8-bit offsets from the currently open location to address n. The following examples, repeated from the ODT-ll section describing this command (see section 5.2.5), show a difference only in printout format: *346/000034 414;0 *1034/103421 YI03777 1034;0 ~/000022 ~0~00~0~4~4~~0~2~2 177776 22 377\021 377 Note that the modified low-order byte 377 must be unmodified high-order byte. 5-11 combined with the DEBUGGING OBJECT PROGRAMS ON-LINE 5.3.3 Breakpoints with ODT-IIX you can set up to eight breakpoints concurrently, numbered 0 through 7. The niB command used in ODT-ll to set the breakpoint at address n sets the next available breakpoint in ODT-IIX. Specific breakpoints may be set or changed by the n:mB command where m is the number of the breakpoint. For example: ~1020;B (sets breakpoint 0) (sets breakpoint 1) (sets breakpoint 2) (resets breakpoint 1) ~1030iB *1040;B *1032;lB * The ;B command used in ODT-ll to remove the only breakpoint removes all breakpoints in ODT-IIX. To remove only one of the breakpoints, use the inB command, where n is ~he number of t~e break~oint. For example: (removes the second breakpoint) *'2B -' * The $B/ command opens the location containing the address of breakpoint O. The next seven locations contain the addresses of the other breakpoints in order, and thus can be opened using the LINE FEED key. (The next location is for single-instruction mode, explained in the next section.) Example: *$B/00I020 + nnnnnn/00l032 + nnnnnn/(address internal to ODT) In this example, breakpoint 2 is not set. The contents are an address internal to ODT. After the table of breakpoints is the table ot Proceed command repeat counts for each breakpoint and for t~e single-instruction mode (see Section 5.3.4). nnnnnn/00l036 nnnnnn/nnnnnn nnnnnn/OOOOOO nnnnnn/OOOOOO + + + 15 + (address of breakpoint 7) (single-instruction address) (count for breakpoint 0) (count for breakpoint 1) It should be noted that a repeat count in a Proceed command refers only to the most recent breakpoint. Execution of other breakpoints encountered is determined by their own repeat counts. 5.3.4 Single-Instruction Mode With this mode you can specify the number of instructions you wish executed before suspension of the program run. The Proceed command, instead of specifying a repeat count for a breakpoint encounter, specifies the number of succeeding instructions to be executed. Note that breakpoints are disabled when single-instruction mode is operative. Commands for single-instruction mode follow: inS Enables single-instruction mode (n can have any value and serves only to distinguish this form from the form is) i breakpoints are disabled. 5-12 DEBU~GING OBJECT PROGRAMS ON-L~NE niP Proceeds with program run for next.n instructions before reeritering OPT (if n is missing. it is assumed to be 1). . (Trap instructionsrand' associated' handlers can affect the Proceed repeat count. See section 5.5.2.) is Disables single-instruction mode When the repeat count for single-instruction mode is exhausted and the program suspends execution, ODT prints: where n is the address of the next instruction to be executed. The $B breakpoint table contains this address following. that of, breakpoint 7. However, unlike the table entries for breakpoints 0-7, the B8 entry is not affected by direct modification. Similarly, the repeat count for single-instruction mode follows the repeat count for breakpoint 7. This table entry, however, may be directly modified, and thus is an alternative way of setting the single-instruction mode repeat. count. In such a case, iP implies the argument set in the $B repeat count table rather than the argument 1. 5.4 ERROR DETECTION ODT-ll and ODT-IIX inform you of two types of errors: unrecognizable command and bad breakpoint entry. illegal Neither ODT-ll nor ODT-IIX checks for the legality of an address commanded to open a location for examination or modification. or when Thus, the command 177774/ references nonexistent memory, and causes a trap through the vector at location 4. If this vector has not been properly initialized (by IOX~ or the user program if IOX is not used), unpredictable results occur. Similarly, a command such as $20/ which references an address eight times the value represented may cause an illegal (nonexistent) memory reference. by Typing other than a legal command causes ODT to print command, ignore the $2, ? * and wait for another command. Therefore, to cause ODT to ignore a command just typed, type an illegal character (such as 9 or RUBOUT) and the command will be treated as an error, i.e., ignored. ODT suspends program execution whenever it encounters a breakpoint, i.e., a trap to its breakpoint routine. If the breakpoint routine is entered and no known breakpoint caused the entry, ODT prints: BE001542 * 5-13 DEBUGGING OBJECT PROGRAMS ON-LINE and waits for another command. In the example above, BE001542 denotes Bad Entry from location 001542. A bad entry may be caused by an illegal .trace trap instruction, setting the T-bit in the status register, or by a jump to the middle of ODT. 5.5 PROGRAMMING CONSIDERATIONS Information in this section is not necessary for the efficient use of ODT. However, its content does provide a better understanding of how ODT performs some of its functions. 5.5.1 Functional Organization The internal organization of ODT is almost totally modularized into independent subroutines. The internal structure consists of three major functions: command decoding, command execution, and various utility routines. The command decoder interprets the individual commands, checks for command errors, saves input parameters for use in command execution, and send control to the appropriate command execution routine. The command execution routines take parameters saved by the command decoder and use the utility routines to execute the specified command. Command execution routines exit either to the object program or back to the. ".command decoder. The utility routines are common routines such as SAVE-RESTORE and I/O. They are used by both the command decoder and the command executers. Communication and data flow are illustrated in Figure 5-1. 5.5.Z Breakpoints The function of a breakpoint is to pass control to ODT whenever the user program tries to execute the instruction at the selected address. Upon encountering a breakpoint, the user can utilize all of the ODT commands to examine and modify his program. When a breakpoint is executed, ODT removes the breakpoint instruction(s) from the user's code so that the locations may be examined and/or altered. ODT then types a message to the user, in the form Bn(Bm;n for ODT-IIX), where n is the breakpoint address (and m is the breakpoint number). The breakpoints are automatically restored when execution is resumed. A major restriction in the use of breakpoints is that the word 5-14 DEBUGGING OBJECT PROGRAMS ON-LINE MANUAL ENTRY BREAKPOINT HANDLER ~ COMMAND L--rD_E_C.,.O_DE_R..,.---,~ ~--------~I~ I ________~ I I PROGRAM EXAMINATION MODIFICATION COMMANDS PROGRAM ACTION COMMANDS USER INTERNAL TABLE MAINPULATION COMMANDS a. I I --~--------~---~ r-_=t_-- ODT INTERNAL TABLES t PROGRAM -------~--------~- UTILITY _ _ (I/O, _ RO_U_T_I_N_E_S ETC.) __ L.. ~ ~ O~i~UT ODr USER ENVIRONMENT LEGEND Flow of control - - Flow of dolo 11-0065 Figure 5'-1 Communication and Data Flow 5-15 DEBUGGING OBJECT PROGRAMS ON-LINE where a breakpoint has been set must not be referenced by the program in any way since ODT has altered the word. Also, no breakpoint should be set at the location of any instruction that clears the T-bit. For example: MOV :It 2 4 a , 1 77 77 6 ;SET PRIORITY TO LEVEL 5. A breakpoint occurs when a trace trap instruction (placed in the user program by ODT) is executed. When a breakpoint occurs, ODT takes the following steps: 1. Set processor priority to seven instruction) . 2. Save 3. If internal T-bit trap flag is set, go to step 13. 4. Remove breakpoint(s). 5. Reset processor priori ty. 6. Make sure a breakpoint or Single-instruction mode caused interrupt. 7. If the breakpoint did not cause the interrupt, go to step 15. 8. Decrement repeat count. 9. Go to setp 18 if non-zero, otherwise reset count to one. 10. Save Teletype status. 11. Type message to user about Single-instruction mode interrupt. 12. Go to command decoder. 13. Clear T-bit in stack and internal T-bit flag. 14. Jump to the "GO" processor. 15. Save Teletype status. 16. Type "BE" 17. Clear the T-bit, if set, in the user status the command decoder. 18. Go to the "Proceed", bypassing the TTY restore routine. registe~s set by trap and set up stack. priority to ODT's priority the or user's breakpoint the or (Bad Entry) followed by the address. Note that steps 1-5 inclusive take during which time interrupts are running at level 7). When a proceed (automatically and proceed to approximately 100 microseconds not permitted to occur (ODT is (;P) command is given, the following occurs: 1. The proceed is checked for legality. 2. The processor priority is set to seven. 3. The T-bit flags (internal and user status) are set. DEBUGGING OBJECT PROGRAMS ON-LINE 4. The user registers, status, and Program Counter are restored. 5. Control is returned to the user. 6. When the T-bit trap occurs, steps 1, 2, 3, 13, and 14 of the breakpoint sequence are executed, breakpoints are restored, and program execution resumes normally. When'a breakpoint is placed on an lOT, EMT, TRAP, or causing a trap, the following occurs: any instruction 1. When the entered. 2. When iP is typed, the T-bit is set and the lOT, EMT, TRAP, or other trapping instruction is executed. 3. The current PC and status pushed on the stack. 4. The new PC and status (no T-bit set) are respective trap vector. 5. The whole trap breakpoints. 6. When an RTI is executed, the saved PC and PS (including the T-bit) are restored. The instruction following the trap-causing instruction is executed. If this instruction is not another trap-causing instruction, the T-bit trap occurs, causing the breakpoints to be reinserted in the user program, or the Single-instruction mode repeat count to be decremented. If the following instruction is a trap-causing instruction, this sequence is repeated, starting at step 3. breakpoint occurs service as (with routine described the is above, T-bit included) obtained executed ODT is are from the without any NOTE Exit from the trap handler must be via the RTI instruction. Otherwise, the T-bit will be lost. ODT will not gain control again since the breakpoints have not been reinserted yet. In ODT-ll, the iP command is illegal if a breakpoint has not occurred (ODT responds with?). In ODT-IIX, iP is legal after any trace trap entry. WARNING Since ODT-ll ignores all semicolons, typing the ODT-IIX form of breakpoint command number to ODT-ll, specifying a breakpoint number n, causes the following error: 100iB (sets the breakpoint at location 100) breakpoint at 100iOB (sets the location 1000) 100i4B (sets the breakpoint at location 1004) 5-17 DEBUGGING OBJECT PROGRAMS ON-LINE The internal breakpoint status words for format: ODT-ll have the following 1. The first word contains the breakpoint address. If this location points to a location within ODT, it is assumed no breakpoint is set for the cell (specifically, ODT has set a dummy breakpoint within itself). 2. The next word contains the breakpoint repeat count. For ODT-IIX (with eight breakpoints) the formats are: 1. The first eight words contain the breakpoint addresses for breakpoints 0-7. (The ninth word contains the address of the next instruction to be executed in Single-instruction mode.) 2. The next eight words contain the respective repeat counts. (The following word contains the repeat count for Single-instruction mode.) The user may change these words at will, either breakpoint commands or by direct manipulation with $8. by using the When program runaway occurs (that is, when the program is no longer under ODT control, perhaps executing an unexpected part of the program where a breakpoint has not been placed) ODT may be given control by pressing the HALT key to stop the machine, and restarting ODT (see Section 5.6.2). ODT prints *, indicating that it is ready to accept a command. If the program being debugged uses the terminal for input or output, the program may interact with ODT to causes an error since ODT also uses the terminal. This interactive error does not occur when the program being debugged is run without ODT. 5.5.3 1. If the terminal output interrupt is enabled upon entry to the ODT break routine, and no output interrupt is pending when ODT is entered, ODT is entered, ODT generates an unexpected interrupt when returning control to the program. 2. If the interrupt of the terminal input (the keyboard) is enabled upon entry to the ODT break routine, and the program is expecting to receive an interrupt to input a character, both the expected interrupt and the character will be lost. 3. If the terminal input (keyboard) has just read a character into the reader data buffer when the ODT break routine is entered, the expected character in the input data buffer will be lost. Search The word search allows the user to search for bit patterns in specified sections of memory. Using the $M/ command, the user specifies a mask, a lower search limit ($M+2), and an upper search limit ($M+4). The search object is specified in the search command itself. The word search compares selected bits (where ones appear in the mask) in the word and search object. If all selected bits are equal, ODT prints the unmasked word. 5-18 DEBUGGING OBJECT PROGRAMS ON-LINE The search algorithm is: 1. Fetch a word at the current address. 2. XOR (exclusive OR) 3. AND the result of step 2 with the mask. 4. If the result of step 3 is zero, type the address of the unmasked word and its contents. Otherwise, proceed to step 5. 5. Add two to the current address. If the current address is greater than the upper limit, type * and return to the command decoder, otherwise go to step 1. the word and search object. Note that if the mask is zero, ODT prints every word between the limits, since a match occurs every time (i.e., the result of step 3 is always zero). In the effective address search, ODT interprets every word in the search range as an instruction which is interrogated for a possible direct relationship to the search object. The algorithm for the effective address search is contents of x, and k denotes the search object): (where (x) denotes 1. Fetch a word at the current address X. 2. If 3. If (x)+x+2=k 5. 4. If (x) is a relative branch to k, print contents. 5. Add two to the current address. If the current address is greater than the upper limit, perform a carriage return/line feed and return to the command decoder; otherwise, go to step 1. 5.5.4 (x)=k [direct reference], print contents and go to step 5. [indexed by PC]. print contents and go to Teletype Interrupt Upon entering the TTY SAVE routine, the following occurs: 1. Save the LSR status register (TKS). 2. Clear interrupt enable and maintenance bits in the TKS. 4. Clear interrupt enable and maintenance bits in the TPS. To restore the TTY: 1. wait for completion of any I/O from ODT. 2. Restore the TKS. 3. Restore the TPS. 5-19 step DEBUGGING OBJECT PROGRAMS ON-LINE NOTES If the TTY printer interrupt is enabled upon entry to the ODT break routine, the following may occur: 1. If no output interrupt is pending when ODT is entered, an additional interrupt always occurs when ODT returns control to the user. 2. If an output interrupt is pending upon entry, the expected interrupt occurs when the user regains control. If the TTY reader (keyboard) is busy or done, the expected character in the reader data buffer will be lost. If the TTY reader (keyboard) interrupt is enabled upon entry to the ODT break routine, and a character is pending, the interrupt (as well as the character) will be lost. 5.6 OPERATING PROCEDURES This section describes procedures for linking ODT on LSI-II machines, and for loading ODT on other PDP-II machines. It describes starting, restarting, error recovery, and setting the priority level of ODT. 5.6.1 Linking Procedures (LSI-II Systems Only) For LSI-II systems, ODT-IIX is supplied on relocatable object tapes. Binary tapes are produced by linking the ODT-IIX object tape with the object tapes of the program to be debugged (using LINK-lIS). The ODT-IIX tape should be the first tape processed by LINK-lIS; in this manner, ODT-IIX is started first when the binary tape is loaded. 5.6.2 Loading Procedures (non-LSI-ll Systems Only) For all systems other than LSI-II, ODT is supplied on source and binary tapes. Appendix N explains assembly instructions for source tapes. Binary tapes are loaded with the Absolute Loader. Since ODT is started as soon as it is loaded, the program to be debugged should be loaded prior to ODT. When supplied on binary tape, ODT-ll loads beginning at location 13026, and occupies about 533 (decimal) words of memory. ODT-IIX loads beginning at location 12054, and requires about 800 (decimal) words of memory. 5-20 DEBUGGING OBJECT PROGRAMS ON-LINE 5.6.3 Starting and Restarting The Absolute Loader starts ODT automatically after loading it into core. ODT indicates its readiness to accept input by printing an * The starting address for ODT-ll on binary tape is 13026; the starting address for ODT-llX on binary tape is 12054. If ODT is reassembled using PAL-IIA, the starting address in indicated in the symbol table as the value of the symbol O.ODT. If ODT is linked using LINK-lIS, the starting address is indicated in the link map as the value of the global symbol O.ODT. When ODT is started at its start address, the SP register is set to an ODT internal stack, registers RO-R5 are left untouched, and the trace trap vector is initialized. If ODT is started after breakpoints have been set in a program, ODT ignores the breakpoints and leaves the program modified, i.e., the breakpoint instructions are left in the program. There are two ways to restart ODT: 1. Restart at start address+2 2. Reenter at start address+4 To restart, key in the start address+2, press LOAD ADDRess and then START. A restart saves the general registers, removes all the breakpoint instructions from the user program and then ignores all breakpoints, i.e., simulates the ;B command. To reenter, key in the load address+4, press LOAD ADDRess and then START. A reenter saves the general registers, removes the breakpoint instructions from the user program, and types the BE (Bad Entry) error message. ODT remembers which breakpoints were set and resets them on the next ;G command (iP is illegal after a Bad Entry). 5-21 CHAPTER 6 LOADING AND DUMPING MEMORY This chapter describes procedures for loading programs into memory (using the Bootstrap Loader and Absolute Loader) and for dumping the contents of memory (using the DUMPAB and/or DUMPTT programs). The Bootstrap Loader, which loads short paper tape programs (162 or fewer octal words), appears on one of three forms, depending upon the system configuration: 1. Hardware - on some CPUs, the Bootstrap Loader is present as a ROM chip. 2. Software - on some CPUs, the Bootstrap Loader must be toggled in via console switches. 3. Firmware - on LSI-lIs, the Bootstrap Loader loader, present as a programmable ROM chip. is a firmware Once familiar with the operation of the Bootstrap Loader, the user can load other programs (such as the Absolute Loader, DUMPAB, and DUMPTT). The Absolute Loader (see section 6.2) is a system program that enables the user to load data punched on paper tape in absolute binary format into any available memory bank. It is used primarily to load the paper tape system software, binary programs assembled with PAL-llA, and binary tapes produced by LINK-lIS from object tapes produced by PAL-llS. The loader programs are loaded into the upper-most area of available core and are available for use with system and user programs. Programs should not use the locations used by the loaders without restoring their contents; otherwise, the loaders must be reloaded since they will have been altered by the object program. Core memory dump programs (see section 6.3) print or punch the contents of specified areas of core. For example, when developing or debugging user programs it is often necessary to get a copy of the program or portions of core. There are two dump ptograms supplied in the paper tape software system: DUMPTT, which prints or punches the octal representation of specified portions of core, and DUMPAB, which punches specified portions of core in absolute binary format suitable for loading with the Absolute Loader. 6-1 LOADING AND DUMPING MEMORY 6.1 PAPER TAPE BOOTSTRAPS Procedures for operating the various PDP-II paper tape bootstraps described below: 6.1.1 are BM792-YA Paper Tape Bootstrap ROM 1. Set the console ENABLE/HALT switch to HALT. 2. Place the bootstrap tape in the desired paper tape reader with the special bootstrap leader code over the reader sensors (under the reader station). 3. If the low-speed reader (ASR-33) is to be used, and a high-speed reader is, present on the system, turn the high speed reader OFF. If the high-speed reader is to be used, turn it ON. 4. Set the console ENABLE/HALT switch to ENABLE. 5. Set the console switch register to 773000. 6. Press the console START switch. The contents of the bootstrap tape will be loaded into the highest locations of memory. 7. The bootstrap transfers control to the program Typically, this program halts. 6.1.2 just loaded. BM873-YA Bootstrap Loader ROM 1. Set the console ENABLE/HALT switch to HALT. 2. Place the bootstrap tape in the desired paper tape reader with the special bootstrap leader code over the reader sensors (under the reader station). 3. and a If the low-speed reader (ASR-33) is to be used, turn the high-speed reader is present on the system, high-speed reader OFF. If the high-speed reader is to be used, turn it ON. 4. Set the console ENABLE/HALT switch to ENABLE. Sa. If the low-speed reader is to be used, set the console switch register to 773210. Sb. If the high-speed reader is switch register to 773312. to be used, set the console 6. Press the console START switch. The contents of the bootstrap tape will be loaded into the highest locations of memory. 7. The bootstrap transfers control to the program Typically, this program halts. 6-2 just loaded. LOADING AND DUMPING MEMORY 6.1.3 LSI-II Firmware Paper Tape Bootstrap 1. Press the front panel BOOT/INIT switch. micro-ODT; an @ prints at the terminal. 2. Place the bootstrap tape in the desired paper tape reader with the special bootstrap leader code over the reader sensors (under the reader station). 3. If the low-speed reader (ASR-33) is to be used, and a high-speed reader is present on the system, turn the high-speed reader OFF. If the high-speed reader is to be used, turn it ON. 4. Type the command/status register address of the input followed by L to load the tape. For example, when reader, type: loading from This the enables console the device terminal @ 177560L After reading the contents of the tape, the LSI-II microprocessor starts the program, which typically halts. In this case, the micro-ODT automatically restarts and prints @ followed by the address of the instruction after the HALT instruction. For example, after loading the Absolute Loader on an 8K system, the micro-ODT prints: @375000 ~ The starting address of the Absolute Loader in this 375000. 6.1.4 case is press the M9301-YB Bootstrap Loader lao If the system does not have a front panel BOOT/INIT switch. switch register, lb. If the system does not have a BOOT/INIT switch, set the console switch register to 773000; press LOAD/ADDR; then press START. 2. Four numbers are printed at the terminal, followed by a $. These numbers are the contents of the general registers RO, R4, R6, and R5, respectively. For CPUs without switch registers (such as the 11/04), R5 contains the contents of the program counter (PC) at the time BOOT/INIT was pressed. For example: 007740 012450 00546 004054 $ 3. Place the bootstrap tape in the desired paper tape reader with the special bootstrap leader code over the reader sensors (under the reader station). 6-3 LOADING AND DUMPING MEMORY 4. Type the device code (PR for high-speed reader, terminal reader), and type RETURN, as follows: or TT for ~TT..J After reading the contents of the tape, the Bootstrap Loader transfers control to the program just loaded. Typically, this program halts. 6.1.5 M9301-YA Bootstrap Loader If a console terminal is available, boot instructions for the M9301-YA Bootstrap Loader are the same as for the M9301-YB Bootstrap Loader (Section 6.1.4). If no console terminal is available, the auto-boot feature of M9301-YA must be used. See the M9301 Maintenance Manual instructions on placing'the appropriate paper tape bootstrap in M9301 module micro-switch. Then follow the procedure below: 6.1.6 the for the 1. Place the bootstrap tape in the desired paper tape reader with the special bootstrap leader code over the reader sensors (under the reader station). 2. Set the console HALT/CaNT switch to CaNT. 3. Press the console BOOT/INIT switch. After reading the contents of the tape, the Bootstrap Loader transfers control to the program just loaded. Typically, this program halts. Other Bootstrap Loaders This section is for users without any of above. the bootstrap aids listed The Bootstrap Loader should be loaded (toggled) into the highest core memory bank. The locations and corresponding instructions of the Bootstrap Loader are listed and explained below. Location Instruction xx7744 xx7746 xx7750 xx7752 xx7754 xx7756 xx7760 xx7762 xx7764 xx7766 xx7770 xx7772 xx7774 xx7776 016701 000026 012702 000352 005211 105711 100376 116162 000002 xx7400 005267 177756 000765 yyyyyy Figure 6-1 Bootstrap Loader Instructions 6-4 LOADING AND DUMPING MEMORY In Figure 6-1, xx represents the highest available memory bank. For example, the first location of the Loader would be one of the following, depending on memory size, and xx in all subsequent locations would be the same as the first. Location Memory Bank Memory Size 017744 037744 057744 077744 117744 137744 157744 0 1 2 3 4 5 6 4K 8K 12K 16K 20K 24K 28K Note also in Figure 6-1 that the contents of location reflect the appropriate memory bank in the same location. xx7766 manner should as the The contents of location xx7776 (yyyyyy in the Instruction column of Figure 6-1) should contain the device status register address of the paper tape reader to be used when loading the bootstrap formatted tapes. Either paper tape reader may be used, specified as follows: Teletype Paper Tape Reader High-Speed Paper Tape Reader 177560 177550 6.1.6.1 Loading the Loader Into Core - Toggle in the Bootstrap Loader as explained below. 1. Set xx7744 in the Switch Register (SR) and press LOAD ADDRess (xx7744 is displayed in the ADDRESS REGISTER). 2. Set the first instruction, 016701, in the SR and lift DEPosit (016701 is displayed in the DATA register). NOTE When DEPositing data into consecutive words, the DEPosit automatically increments the ADDRESS REGISTER to the next word. 3. Set the next instruction, 000026, in the SR and lift (000026 is displayed in the DATA register). DEPosit 4. Set the next instruction in the SR, press DEPosit, and continue depositing subsequent instructions (ensure that location xx7766 reflects the proper memory bank) until after 000765 has been deposited in location xx7774. 5. Deposit the desired device status register address in location xx7776, the last location of the Bootstrap Loader. It is good programming practice to verify that all instructions stored correctly. This is done by proceeding at step 6 below. 6. Set xx7744 in the SR and press LOAD ADDRess. 6-5 are LOADING AND DUMPING MEMORY 7. Press EXAMine (the octal instruction in location xx7744 is displayed in the DATA register so that it can be compa~,ed to the correct instruction, 016701. If the instruction is correct, proceed to step 8; otherwise go to step 10. 8. Press EXAMine (the instruction of the location displayed in the ADDRESS REGISTER is displayed in the DATA register; compare the DATA register contents to the instruction for the displayed location. 9. Repeat step 8 until all instructions have been verified or go to step 10, whenever the correct instruction is not displayed. When an incorrect instruction is displayed, it performing steps 10 and 11. can be corrected by 10. With the desired location displayed in the ADDRESS REGISTER, set the correct instruction in the SR and lift DEPosit (the contents of the SR are deposited in the displayed location). 11. Press EXAMine to ensure that the instruction was stored (it is displayed in the DATA register). 12. Proceed at step 9 until all instructions have been verified. The Bootstrap Loader is now loaded into core. The are illustrated in the flowchart of Figure 6-2. correctly procedures above 6.1.6.2 Loading Bootstrap Tapes - Any paper tape punched in bootstrap format is referred to as a bootstrap tape (see Section 6.1.3) and is loaded into core using the Bootstrap Loader. Bootstrap tapes begin with about two feet of special bootstrap leader code (ASCII code 351, not blank leader tape as required by the Absolute Loader). With the Bootstrap Loader in core, the bootstrap tape is loaded into core starting anywhere between location xx7400 and location xx7743, i.e., 162 (octal) words. The paper tape input device used is that which is specified in location xx7776 (see section 6.1.6.1). Bootstrap tapes are loaded into core as explained below. 1. Set the ENABLE/HALT switch to HALT. 2. Place the bootstrap tape in the specified reader with the special bootstrap leader code over the reader sensors (under the reader station). 3. Set the console switch register to xx7744 (the starting address of the Bootstrap Loader) and press LOAD ADDRess. 4. Set the ENABLE/HALT switch to ENABLE. 5. Press START. The bootstrap tape passes through the reader as data is being loaded into core. 6. The bootstrap tape stops after the last frame of data (see Figure 6-5) has been read into core. The program on the bootstrap is now in core. The procedures above are illustrated in the flowchart of Figure 6-3. 6-6 LOADING AND DUMPING MEMORY INITIALIZE SETSR TO xx7744 PRESS LOADADDR LOAD VERIFY SETSRTO PRESS EXAM 016701 NO LIFT DEP SETSRTO NEXT INSTRUCTION SETSR TO CORRECT INSTRUCTION NO LIFT DEP LIFT DEP FINISHED NO Figure 6-2 Loading and Verifying the Bootstrap Loader 6-7 LOADING AND DUMPING MEMORY ! WITH BOOTSTRAP LOADER IN CORE (SEE FIGURE 6-2) , SET ENABLE/HALT TO ENABLE J SET ENABLE/HALT TO HALT PRESS START t PLACE BOOTSTRAP TAPE IN SPECIFIED READER (CODE 351 MUST BE OVER READER SENSORS) i TAPE READS IN AND STOPS AT ENDOF DATA ~ ! SETSR TO xx7744 DATA IS IN CORE ~ PRESS LOADADDR I Figure 6-3 Loading Bootstrap Tapes Into Core Should the bootstrap tape not read in immediately after depressing the START switch, one of the following conditions may exist: 1. Bootstrap Loader not correctly loaded. 2. Wrong input device used. 3. Code 351 not directly over the reader sensors. 4. Bootstrap tape not properly positioned in reader. 6.1.6.3 Bootstrap Loader Operation - The Bootstrap Loader source program 1S shown below. The starting address in the example denotes that the Loader is to be loaded into memory bank zero (a 4K system). 6-8 LOADING AND DUMPING MEMORY 1 2 3 4 5 6 7 8 00 (lJ(lJ0(lJ 000001 Rl 000"''''2 R2 0(lJ0(lJ07 PC 01.7400 LCAD = = .. %2 017744 = LCAD+344 ; STARTING ADDRESS 9 10 17744 13167131 START: 01H:'I(lJ26 11 17750 0127"'2 LCOP: 12 17752 0013352 DSPMNT: 13 14 15 17754 005211 16 17756 105711 WAIT: 17 17760 1013~76 18 17762 116162 ·130"'002 0174"'''' 19 17770 "'05267 177756 20 21 17774 000765 BRNCH: 22 17776 177560 DEVICE: 23 24 25 "'00"'01' .ASECT = %1 %7 17400 Mo.V DE"I CE.. Rl ; PC I NTER TO. DE'TI CE ADDRESS ;LCAD ADDRESS DISPLACEMENT ; PROGRAM COUNTER ;DATA CANNOT BE LOADED BELo.W ;THIS ADDRESS. ; Co.PY DEVI CE ADDRESS Mo.V CPC)+ .. R2 +.-LCAD ;Co.PY ADDRESS DISPLACEMENT ; INITIALLY o.FFSET TO. THIS Lo.C ;NCTE THAT THIS LOC IS PART o.F ;PREVIo.US INSTRUCTION INC @Rl ; START THE PAPER TAPE READER TSTB @Rl ;FRA~E READY? BPL\OlAIT ;BRIFNOT MOVB 2(Rl) .. LOADCR2) ; STORE FRAME READ IN MEMORY INC DSPMNT ; INCREMENT DISPLACEMENT TO. NEXT BR LCCP 177560 ; LO CATION ; READ NEXT BYTE ;ADDRESS OF INPUT DEVICE .. MAY BE ;17755'" IF HIGH SPEED READER • END Figure 6-4 The Bootstrap Loader Program The program above is a brief example of the PAL-IIA Assembly which is explained in Chapter 2. Language Bootstrap tapes are coded in the following format. 351 Special bootstrap leader code (at least two feet in length) 351 xxx AAA BBB CCC Load .offset (see text below) Program to be loaded (up to 162 frames) words or 344 ZZZ 301 035 026. 000 302 025 373 yyy Boot overlay code, as shown. Jump offset (see text below) Figure 6-5 Bootstrap Tape Format 6-9 LOADING AND DUMPING MEMORY The Bootstrap Loader starts by loading the device status register address into RI and 3528 into R2. The next instruction indicates a read operation in the device and the next two instructions form a loop to wait for the read operation to be completed. When data is encountered it is transferred to a location determined by the sum of the index word (xx7400) and the contents of R2. Because R2 is initially 3528' the first word is moved to location xx7752, and it becomes the immediate data to set R2 in the next execution of the loop. This immediate data is then incremented by one and the program branches to the beginning of the loop. The leader code, plus the increment, is equal in value to the data placed in R2 during the initialization; therefore, leader code has no effect on the loader program. Each time leader code is read the processor executes the same loop and the program remains unmodified. The first code other than leader code, however, replaces the data to be loaded into R2 with some other value which acts as a pointer to the program starting location (loading address). Subsequent bytes are read not into the location of the immediate data but into consecutive core locations. The program will thus be read in byte by byte. The INC instruction which operates on the data for R2 puts data bytes in sequential locations, and requires that the value of the leader code and the offset be one less than the value desired in R2. The boot overlay code overlays the first two instructions of the Loader, because the last data byte is placed in the core location immediately preceding the Loader. The first instruction is unchanged by the overlay, but the second instruction is changed to place the next byte read, jump offset, into the lower byte of the branch instruction. By changing the offset in this branch instruction, the Loader can branch to the start of the loaded program or to any point within the program. The Bootstrap Loader is self-modifying, and the program loaded by the Loader restores the Loader to its original condition by restoring the contents of locations xx7752 and xx7774 to 000352 and 000765 respectively. 6.2 THE ABSOLUTE LOADER The Absolute Loader is a system program that enables the user to load data punched on paper tape in absolute binary format into any available memory bank. It is used primarily to load the paper tape system software, binary programs assembled with PAL-IIA, and binary tapes produced by LINK-lIS from object tapes produced by PAL-lIS. The major features of the Absolute Loader include: 1. Testing of the checksum on the input tape to assure complete, accurate loads. 2. Starting the loaded program upon completion of loading without additional user action, as specified by the .END in the program just loaded. 3. Specifying the load bias of position independent programs at load-time rather than at assembly time, by using the desired Loader switch register option. LOADING AND DUMPING MEMORY 6.2.1 Loading the Loader Into Core The Absolute Loader is supplied on punched paper tape in bootstrap format. Therefore, a Bootstrap Loader is used to load the Absolute Loader into core. It occupies locations xx7474 through xx7743, and its starting address is xx7500. The Absolute Loader program is 72 words long, and is loaded adjacent to the Bootstrap Loader as explained in section 6.1.6.2. 6.2.2 Using the Absolute Loader Paper tapes punched in absolute binary format are also called absolute tapes, binary tapes, or .LDA tapes. These are the tapes loaded by the Absolute Loader. In the following discussion, reference is made to a "switch register." For systems without switch registers (such as the LSI-II and PDP-llj04) , this term refers to a software switch register, which is a memory location internal to the Absolute Loader for systems without hardware switch registers. The location within the Absolute Loader is xxx516, where xxx reflects memory size as follows: Memory xxx 4K 8K 12K 16K 20K 24K 28K 017 037 057 077 117 137 157 When text indicates that a value be placed in a switch register, users without hardware switch registers must use either the M9301 console emulator or the LSI-II micro-ODT, as appropriate, to store the switch register value in location xxx516. Once this value has been stored, the user starts the Absolute Loader at location xxx500. Once the Absolute Loader is loaded, it initializes the value of location xxx516 to O. This value changes only when modified by the user. A normal load occurs when data is loaded into memory according to the load addresses on the binary tape. The user must set bit 0 of the switch register to 0 immediately before starting the load. There are two types of relocated loads: 1. Loading to continue from where the loader left off after previous load - the This is used, for example, when the object program being loaded is contained on more than one tape. It is specified by setting the switch register to 000001 immediately before starting the load. 2. Loading into a specific .area of core This is normally used when loading position independent programs. A position independent program is one which may be loaded and run anywhere in available core. The program is written using the position independent instruction format (see Chapter 9). This type of load is specified by setting the switch register to the load bias and adding 1 to it 6-11 LOADING AND DUMPING MEMORY (i.e., setting bit 0 to 1). The effect of this is to adq the value in the switch register to the start address c>n the tape. Optional switch listed below. ~egister settings for the three types of loads are Switch Register Bits 1-14 Bit 0 Type of Load Normal (ignored) 0 Relocated - cont-inue loading where left off 0 1 Relocated - load in specified area of core nnnnn (specified address) 1 The absolute tape may be loaded using either of the paper tape readers. The desired reader is specified in the last word of available core memory (xx7776), the input device status word, as explained in section 6.1.6. The input device status word may be changed at any time prior to loading the absolute tape. With the Absolute Loader in core as explained absolute tapes are loaded as explained below. 1. in section 6.1.6.2, Set the ENABLE/HALT switch to HALT. To use an input device different. from that used when loading the Absolute Loader, change the address of the device status word (in location xx7776) to reflect the desired device, i.e., 177560 for the Teletype reader or 177550 for the high~speed reader. 2. Set the switch register to xx7500 and press LOAD ADDR. 3. Set the switch register to reflect the desired type (Figure E-3 in Appendix E). 4. Place the absolute tape in the proper reader leader tape directly over the reader sensors. 5. Set ENABLE/HALT to ENABLE. 6. Press START. The absolute tape begins passing through reader station as data is being loaded into core. of load with blank the If the absolute tape does not begin passing through the reader station, the Absolute Loader is not in core correctly. Reload the Loader and start over at step 1 above. If it halts in the middle of the tape, a checksum error occurred in the last block of data read in. Normally, the absolute tape stops passing through the reader station when it encounters the transfer address as generated by tne statement, .END, denoting the end of a program. If the system halts after loading, check that the low byte of the DATA register is zero. If so, the tape is correctly loaded. If not zero, a checksum error (explained later) has occurred in the block of data just loaded, indicating that some data was not correctly loaded. Reload the tape starting at step 1 above. 6-12 LOADING AND DUMPING MEMORY When loading a continuous relocated load, subsequent blocks of data are loaded by placing the next tape in the appropriate read~r and pressing the CONTinue switch. The Absolute Loader may be restarted at any time by starting at step 1 above.• 6.2~3 Absolute Loader Operation The Loader uses the eight general registers (RO-R7) and does not preserve or restore their previous contents. Therefore, caution should be taken to restore or load these registers when necessary after using the Loader. A block of data punched on paper tape in absolute the following format. FRAME 1 2 3 4 5 6 001 000 xxx xxx yyy yyy zzz binary format has start frame null frame byte count (low 8 bits) byte count (high 8 bits) load address (low 8 bits) load address (high 8 bits) d.ata is placed here last frame contains a block checksum A program on paper tape may consist of one or more blocks of data. Each block with a byte count (frames 3 and 4) greater than six causes subsequent data to be loaded into core (starting at the address specified in frames 5 and 6 for a normal load). The byte count is a positive integer denoting the total number of bytes in the block, excluding the checksum. When the byte count of a block is six, the specified load address is checked to see whether the address is to an even or to an odd location. If even, the Loaded transfers control to the address specified. Thus the loaded program runs upon completion of loading. If odd, the loader halts. The transfer address (TRA) may be explicitly specified in the source program by placing the desired address in the operand field following the .END statement. For example, .END ALPHA specifies the symbolic location ALPHA as the TRA, and .END causes the Loader to halt. with .END nnnnnn the Loader also halts if the address (nnnnnn) is odd. The checksum is displayed in the low byte of the DATA register of the computer console. Upon completion of a load, the low byte of the DATA register should be all zeros (unlit). Otherwise, a checksum error has occurred, indicating that the load was not correct. The checksum is the low-order byte of the negation of the sum of all the previous bytes in the block. When all bytes of a block including the checksum are added together, the low-order byte of the result should be zero. 6-13 LOADING AND DUMPING MEMORY If not, some data was lost during the load or erroneous data was picked up; the load was incorrect. When a checksum error is displayed, the entire program should be reloaded, as explained in the previous section. The loaders occupy core memory as illustrated below. xx7776 I/O DEVICE WORD xx7744 BOOTSTRAP LOADER xx7500 ABSOLUTE LOADER xx7474 LOADER STACK USER AND SYSTEM PROGRAMS 6.3 CORE MEMORY DUMPS A core memory dump program is a system program which enables the user to dump (print or punch) the contents of any specified portion of core memory onto the Teletype printer anp/or punch, line printer or high-speed punch. There are two dump programs available in the Paper Tape Software System: 1. DUMPTT 1 , which dumps the octal representation of the contents of specified portions of core onto the teleprinter, low-speed punch, high-speed punch, or line printer. 2. DUMPAB, which dumps the absolute binary code of the contents of specified portions of core onto the low-speed punch or high-speed punch. Both dump programs are supplied on punched paper tape in bootstrap and absolute binary formats. The bootstrap tapes are loaded over the Absolute Loader as explained in section 6.1.6.3, and are used when it would be undesirable to alter the contents of user storage (below the Absolute Loader). The absolute binary tapes are position independent and may be loaded and run anywhere in core as explained in section 6.2.2. DUMPTT and DUMPAB are similar in function, and differ primarily in the type of output they produce. 6.3.1 Operating Procedures Neither dump program punches leader or trailer tape, but DUMPAB always punches ten blank frames of tape at the start of each block of data dumped. 1 DUMPTT is not available for systems without switch registers. 6-14 LOADING AND DUMPING MEMORY 6.3.1.1 Using DUMPAB on Systems without Switch Registers - Operating procedures for DUMPAB on systems without switch registers are as follows: 1. Select either the absolute binary or the bootstrap version of DUMPAB and place it in the reader specified by location xx7776 (see section 6.1). 2a. If using a bootstrap tape, load the tape using the procedure outlined in section 6.1. When the computer halts, go to step 3. 2b. If using an absolute binary tape, load the tape using the procedure outlined in section 6.2.2, relocating as follows: a. Select the address to which the program is to be relocated. The relocation offset is then equal to the loading address. For example, if the desired relocation address is 000400, the relocation offset is 000401. b. Deposit the relocation offset with bit 0 set in the Absolute Loader's software switch register. Using the example from the previous step, the user would deposit 000401 into location xxx516. Start the Absolute Loader. 3. When the program halts, find the address in the program counter. For LSI-II machines, the value is printed at the console terminal by the micro-ODT. For UNIBUS PDP-II machines, the user must press the BOOT/INIT switch to obtain register values at the console terminal (see section 6.1.4). The last of the four values displayed is the PC contents. Add 2 to the value of the PC. (For example, the PC contents for the bootstrap version of DUMPAB are xxx516; adding 2 to this value gives xxx520.) This new value is the address of the first of these succeeding parameters, described in subsequent steps. 4. Deposit the address of the first byte to be dumped into the first parameter (whose address was determined in the previous step) . 5. Deposit the address of the last byte to be dumped second parameter (next sequential location). 6. The third parameter contains the value 177564 (a default specifying the ASR-33 punch). If this is the first time this step is executed and the high-speed reader is the desired output device, change the value of the third parameter to 177554. into the 7a. If using the LSI-II, type P to proceed. 7b. If using a UNIBUS PDP-II, restart the program (at xxx510 bootstrap tape); press CONT when the program halts. 8. DUMPAB dumps the specified segment of memory and halts. 9. Repeat steps 4 through 8 until all have been dumped. 6-15 desired memory if segments LOADING AND DUMPING MEMORY 10. A transfer block for DUMPAB must be generated to terminate the dump. This value mUst be deposited in the first parameter (step 4) to terminate DUMPAB. If the tape is not to be self-starting, use 000001 as the transfer address. Under no conditions can 000000 be used as the transfer address. 11. Deposit 000000 in the second parameter (as in step 5). 12. Repeat step 7a or 7b, as appropriate, to punch block. 6.3.1.2 the transfer Using DUMPAB and DUMPTT on Systems with Switch Registers - 1. Select the dump program desired and place it in specified by location xx7776 (see Section 6.1). the reader 2. If a bootstrap tape is selected, load it using the Bootstrap Loader, section 6.1.6.2. When the computer halts go to step 4. . 3. If an absolute binary tape is selected, load it using Absolute Loader (section 6.2.2), relocating as desired. the Place the proper start address in the switch register, press LOAD ADDRess and START. (The start addresses are shown in section 6.3.3). 4. When the computer halts, enter the address of the desired output device status register in the switch register and press CONTinue (low-speed punch and teleprinter = 177564; high-speed punch = 177554; line printer = 177514). 5. When the computer halts, enter in the switch register the address of the first byte to be dumped and press CONTinue. This address must be even when using DUMPTT. 6. When the computer halts again enter in the switch register the address of the last byte to be dumped and press CONTinue. When using the low-speed punch, set the punch to ON before pressing CONTinue. 7. Dumping proceeds on the selected output device. 8. When dumping is complete, the computer halts. If further dumping is desired, proceed to step 5. It is not necessary to respecify the output device address except when changing to another output device. In such a case, proceed to the second paragraph of step 3 to restart. If DUMPAB is being used, a transfer block must be generated as described below. If a tape read by' the Absolute Loader does not have a transfer block, the loader will wait in an input loop. In such a case, the program may be manually initiated. However, this practice is not recommended, as there is no ,guarantee that load errors will not occur when the end of the tape is read. The transfer block is generated by performing step 5 with the transfer address in the Switch Register, and step 6 with the transfer address minus 1 in the Switch Register. If the tape is not to be self-starting, an odd-numbered addr~ss must be specified in step 5 (000001, for example). 6-16 LOADING AND DUMPING MEMORY The dump programs use all eight general registers and do not their original contents. Therefore, after a dump the registers should be loaded as necessary prior to their subsequent programs. 6.3.2 restore general use by Output Formats The output from DUMPTT is in the following format: xxxxxx>yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy yyyyyy where xxxxxx is the octal address of the first location printed or punched, and yyyyyy are words of data, the first of which starts at location xxxxxx. This is the format for every line of output. There will be no more than eight words of data per line, but there will be as many lines as are needed to complete the dump. The output from DUMPAB is in absolute binary, as explained in 6.2.3. 6.3.3 section Storage Maps The DUMPTT program is 87 words long. storage map is: When used in absolute format the xx7776 BOOTSTRAP LOADER xx7744 ABSOLUTE LOADER xx7500 xx7474 LOADER STACK SPACE xxxxxx+256 DUMPTT xxxxxx lWO-WORD STACK SPACE xxxxxx = desired load address = start address When used in bootstrap format the storage map is: 6-17 LOADING AND DUMPING MEMORY xx7776 BOOTSTRAP LOADER xx7744 DUMPTT start address = xx7440 xx7434 TWO-WORD STACK SPACE The DUMPAB program (for systems with a switch register) is words long. When used in absolute format the storage map is: xx7776 BOOTSTRAP LOADER xx7744 ABSOLUTE LOADER xx7500 xx7474 LOADER STACK SPACE xxxxxx+244 DUMPAB xxxxxx THREE-WORD STACK SPACE xxxxxx = desired load address = start address When used in bootstrap format the storage map is: 6-18 65{lO) LOADING AND DUMPING MEMORY xx7776 BOOTSTRAP LOADER xx7744 DUMPAB start address = xx7510 xx7500 THREE-WORD STACK SPACE The DUMPAB program (for systems without a switch register) is words long. When used in absolute format the storage map is: xx7776 BOOTSTRAP LOADER xx7744 ABSOLUTE LOADER xx7500 xx7474 LOADER STACK SPACE xxxxxx+202 DUMPAB xxxxxx TWO-WORD STACK SPACE xxxxxx = desired load address = start address 6-19 82(10) LOADING AND DUMPING MEMORY When used in bootstrap format the storage map is: xx7776 BOOTSTRAP LOADER xx7744 DUMPAB start address = xx7500 xx7474 TWO-WORD STACK SPACE 6-20 CHAPTER 7 INPUT/OUTPUT PROGRAMMING 7.1 INTRODUCTION The PDP-II Input/Output executive. (lOX), frees the user from dealing directly with I/O devices. It provides programming formats that allow programs written for the paper tape software system to be used later in a monitor environment with only minor coding changes. lOX provides asynchronous non-file-oriented devices: I/O service for the following 1. Teletype keyboard, printer, and tape reader and punch 2. High-speed paper tape reader and punch For line printer handling, in addition to all lOX is available. facilities, IOXLPT Simple I/O requests can be made, specifying devices and data forms for interrupt-controlled data transfers, that can occur concurrently with the execution of a user program. Multiple I/O devices can run singleor double-buffered I/O processing simultaneously. Real-time capability is provided by allowing user programs to be executed at device priority levels upon completion of a device action or data transfer. Communication with lOX is accomplished by lOT (Input/Output Trap) instructions in the user's program. Each lOT is followed by two or three words consisti~g of one of the lOX commands and its operands. The lOX commands can be divided into two categories: 1. those concerned with establishing necessary conditions for performing input and output (mainly initializations), and 2. those concerned directly with the transfer of data. When transfer of data is occurring, lOX is operating at the priority level of the device. The calling program runs at its priority level, either concurrent with the data transfer, or sequentially. Programming format for commands is: lOT .WORD .(an address) .BYTE (a command code), (a slot number) Before using the data transfer commands, two preparatory tasks must be performed: 7-1 INPUT/OUTPUT PROGRAMMING 1. Since device specifications are made by referring to "slots" in lOX's Device Assignment Table (DAT) rather than devices themselves, the slots specified in the code must have devices assigned to them. 2. The buffer, whose address is specified in the code, set up with information about the data. must be In those non-data-transfer commands where an address or slot number does not apply, a 0 must be used. Addresses or cod~s indicated can, of course, be specified symbolically. The following program segment illustrates input-process-output sequence. It includes: 1. The setting up of a single buffer 2. All necessary initializations 3. A formatted ASCII read into the buffer 4. A wait for completion of the read .5. Processing of data just read 6. A write command from the buffer. F"~ESET::::2 a simple ;ASSIGN lOX COMMAND CODES F"~EAD::::ll WAITR::::4 WRITE::::12 WAIT: lOT .WORD 0 .BYTE RESET,O 9IOX RESET TO DO NECESSARY 9INITIALIZATIONS INCLUDING 9INITING SLOT 0 FOR KBD, AND 1 FOR TTY lOT • WOF"W BUFFER .BYTE REA[I,() ;TRAP TO lOX ;SPECIFY BUFFER 9READ FROM KBD (SLOT 0) TILL ;LINE FEED OR FORM FEED roT ;TRAP TO lOX ;BUSY RETURN ADDRESS WHILE WAITING 9FOR KBD TO FINISH ;WAIT FOR KBD (SLOT 0) TO FINISH .WOFW WAIT • BYTE WAITI~" 0 (p rocess BUFFEFO roT ;TRAP TO lOX ;SPECIFY BUFFER 9WRITE TO TELEPRINTER (SLOT 1) 100 ;BUFFER SIZE IN BYTES ;CODE FOR FORMATTED ASCII MODE 9IOXWILL SET HERE THE NUMBER OF BYTES READ 9STORAGE RESERVED FOR 100 BYTES .WORD BUFFER • BYTE WRITE, 1 BUFFER: o o .::::.+100 In more complex programming it is likely that more than one buffer will be set up for the transfer of data, so that data processing can occur concurrently rather than sequentially, as here. Note too, that there are five lOX commands not used in this example that will help meet the requirements of I/O problems not as straightforward as this. 7-2 INPUT/OUTPUT PROGRAMMING 7.1.1 Using lOX With The LSI-II Processor lOX (IOXLPT) is supplied on source and relocatable object tapes. It is thus unnecessary to assemble lOX unless the program is to be modified. User object tapes can be linked with the lOX object tape (using LINK-lIS) to produce an absolute binary tape. Appendix J describes assembly procedures for source tapes. lOX requires approximately 633 (decimal) requires approximately 724 (decimal) words. 7.1.2 words of core; IOXLPT Using lOX with Unibus PDP-II Processors Appendix J lOX (IOXLPT) is supplied on source and binary tapes. describes assembly procedures for source tapes. Binary tapes are loaded prior to user programs by the Absolute Loader. After lOX is loaded, the Absolute Loader halts. IOXLPT is used instead of lOX if the program uses a line printer. lOX is supplied on an absolute binary tape with a loading address of 15100; the load address for IOXLPT is 34600. If the user desires different load addresses, the programs must be reassembled as described in Appendix J. lOX requires approximately 634 (decimal) requires approximately 725 (decimal) words. 7.1.3 words of core; IOXLPT lOX Interrupt and Trap Vectors lOX (IOXLPT) loads the following interrupt and trap vectors: Console terminal high speed reader and punch timeout and other errors lOT line printer (IOXLPT only) 7.2 THE DEVICE ASSIGNMENT TABLE The Device Assignment Table (OAT) makes programs device-independent by allowing the user to .refer to a slot to which a device has been assigned, rather than a specific device itself. Thus, changing the input or output device becomes a simple matter of reassigning a different device to the slot indicated in the program. The OAT is created by means of the Reset and/or Init commands. The lOX codes for devices (listed in the description of the Init command below) are assigned to the slots. 7-3 INPUT/OUTPUT PROGRAMMING 7.2.1 Reset IOT .WORD 0 .BYTE 2,0 This command must be the first IOX command issued by a user program. It clears the DAT, initializes IOX, resets all devices to their state at power-up, enables keyboard interrupts, and initializes DAT slots 0 and 1 for the keyboard and teleprinter, respectively. 7.2.2 Initialization IOT .WORD (address of device code) .BYTE 1, (slot number) The device whose code (stored as a byte) is found at the specified address is associated with the specified slot (numbered in the range 0-7). The device interrupt is turned off when necessary. (The keyboard interrupt always remains enabled.) There is no restriction on the number of slots that can be initialized to the same device. DEVICE CODE DEVICE Teletype Keyboard (KBD) 1 Teletype printer (TTY) 2 Low-Speed Reader (LSR) 3 Low-Speed Punch (LSP) 4 High-Speed Reader (HSR) 5 High-Speed Punch (HSP) 6 Line Printer (IOXLPT only) (LPT) 10 Note that a device code is used only in the Initialization (INIT) command. All other commands that refer to a device do so by means of a slot. Example: INIT:=::L 10T .WOI:;:D Hm~C(JD .BYTE 1N:l:T,3 HSF~CCJD : 7.3 + BYTE ~) vTRAF' TO 10X v1NITSLOT :3 jl FIJI:;: H81:;: jl HSF~ CODE BUFFER ARRANGEMENT IN DATA TRANSFER COMMANDS Use of data-transfer commands (Read, Write, Real-time Read, Real-time Write) requires the creation of at least one buffer. This buffer is used not only to store data for processing, but to hold information regarding the quantity, form, and status of the data. The non-data 7-4 INPUT/OUTPUT PROGRAMMING portion of the buffer is called the buffer header, and precedes the data portion. In data transfer commands, it is the address of the first word of the buffer header that is specified in the word following the lOT of the command. NOTE lOX uses the buffer header while transferring data. The user's program must not chaQge or reference it. The buffer format is: Location BUFFER HEADER Contents Buffer Maximum number integer) of data Buffer+2 Mode of data (byte) Buffer+3 Status of data (byte) Buffer+4 Number of data bytes (unsigned integer) Buffer+6 Actual data begins here {unsigned bytes involved in transfer BUFFER SIZE (IN BYTES) STATUS I MODE BYTE COUNT DATA 7.3.1 Buffer Size The first word of the buffer contains the size (in bytes) of the data portion of the buffer as specified by the user. lOX will not store more than this many data bytes on input. Buffer size has no meaning on output. 7.3.2 Mode Byte The low-order byte of the second word holds information concerning the mode or transfer. A choice of four modes exists: Coded as 1. Formatted ASCII 0 2. Formatted Binary 1 3. Unformatted ASCII 2 4. Unformatted Binary 3 7-5 (or 200 to suppress echo) (or 202 to suppress echo) INPUT/OUTPUT PROGRAMMING The term echo applies only to the devices never involve an echo. KBD. Data transfers from other MODE BYTE 7 1= NO ECHO 0= ECHO 7.3.3 5 6 Bits 4 3 o 2 Bits UN FOR- ' BINARY MATTED =1 FORMATTED =0 ASCii Status'Byte The high-order byte of the second word of the buffer header information set by IOX on the status of the data transfer: contains Bits 0-4 contain the non-fatal error codes (coded octally) Bit 1 5 = End-Of-File has occurred (attempt at reading data after an End-Of-Medium) Bit 6 1 End-of-Medium has occurred (see Section 7.3.3.3) Bit 7 1 Done (Data Transfer complete) STATUS BYTE 6 7 1= 1= DONE EOM 5 4 1= EOF 3 o 2 I I SEE CODES NON-FATAL ERRORS 7.3.3.1 1. Non-Fatal Error Codes (Octal) 2 checksum error 3 truncation of a long line 4 an improper mode A checksum error can occur only on a (see Section 7.4.3). 7-6 Formatted Binary read INPUT/OUTPUT PROGRAMMING 2. Truncation of a long line can occur on either a Formatted Binary or Formatted ASCII read (Section 7.4.1). This error occurs when the binary block or ASCII line is bigger than the buffer size specified in the buffer header. In both cases, lOX continues reading characters into the last byte in the buffer until the end of the binary block or ASCII line is encountered. 3. An improper mode can occur only on a Formatted Binary read. Such occurrence means that the first non-null character encountered was not the proper starting character for a Formatted Binary block (see Section 7.4.3) 7.3.3.2 Done Bit - When the data transfer to or from complete, the Done Bit is set by lOX. the buffer is 7.3.3.3 End-Of-Medium Bit - The following conditions cause the EOM bit to be set in the buffer Status byte associated with a data transfer command. An EOM occurrence also sets the Done Bit. HSR HSP LSR LPT No tape No tape Timeout detected No paper Off line No power No power No power Printer drum gate open Overtemperature condition An End-Of-Medium condition on an output device is cleared by a manual operation such as putting a tape in the high-speed punch. lOX does not retain any record of an EOM on an output device. However, an EOM on an input device is recorded by lOX so that succeeding attempts to read from that device will cause an End-Of-File (see Section 7.3.3.4). To reenable input the device must be manually readied and a Seek command (Section 7.6) executed on the proper slot. The INIT and RESET commands will also clear the EOM condition for the device. See Section 7.5.3 for information on detection of LSR timeouts. conditions causing When an End-Of-Medium has occurred on a Read, there may be data in the buffer. If an EOM has occurred on a Write, there is no way of knowing how much of the buffer was written. 7.3.3.4 End-Of-File Bit - An EOF condition appears in the Status byte if an attempt to read is made after an EOM has occurred. EOF cannot occur on output. When an EOF has occurred, no data is available in the buffer. 7-7 INPUT/OUTPUT PROGRAMMING 7.3.4 Byte Count The third wdrd contains the Byte Count: 7.4 Input: In unformatted data modes, lOX reads as many data bytes as the user has specifie~. In formatted modes, lOX inserts here the number of data bytes available in the buffer. In all modes, if an EOM occurs, lOX will set the Byte Count equal to the number of bytes actually read. If an EOF occurs, Byte Count will be set to O. Output: Byte Count determines the number of bytes output, for all modes. An HSP end-of-tape or LPT out-of-paper condition will also terminate output, and EOM will be set in the Status byte. lOX does not modify the Byte Count on output. MODES 7.4.1 Formatted ASCII A Formatted ASCII read transfers 7-bit characters (bit 8 will be zero) until a line feed or form feed is read. lOX sets the Byte Count word in the buffer header to indicate the number of characters in the buffer. If the line is too long, characters are read and overlaid into the last byte of the buffer until an end-of-line (a line feed or form feed) or EOM is detected. Thus, if there is no error, the buffer will always contain a line feed or form feed. A Formatted ASCII write transfers the number of 7-bit characters specified by the buffer Byte Count. Bit 8 will always be output as zero. Device-Dependent Functions Keyboard Seven-bit characters read from the keyboard are entered in the and are echoed on the teleprinter except as follows: buffer Null - Ignored. This character transferred to the buffer. Tab (CTRL/TAB keys) - Echoes as spaces up to the next tab stop. are located at every 8th carriage position. RUBOUT - Deletes the previous character on the current line and echoes as a backslash (\). If there are no characters to delete, RUBOUT is ignored. CTRL/U - Deletes the current line and echoes as tU. is not echoed or "Stops" Carriage - Echoes as a carriage return followed by a line feed. Return Both characters enter the buffer. (RETURN key) CTRL/P Echoes as +P and causes a jump address, if non-zero (see 7.6.2). to the restart The echo may be suppressed by setting bit 7 of the buffer header byte. 7-8 Mode INPOTjOUTPUT PROGRAMMING If the buffer overf19ws, only the characters which fit into the buffer are echoed. Of course, characters which are deleted by RUBOUT or CTRLjU do not read into the buffer even though they are echoed. If a carriage return causes an overflow, or is typed after an overflow has occurred, a carriage return and line feed will be echoed but only the line feed will enter the buffer. In the following For.matted ASCII exa.mples: 1. assume there is room for five characters 2. .J indicates: in left column, the RETURN key in center column, the execution of a carriage return in right column, the ASCII code for carriage return 3. + 4. RUB OUT indicates the RUBOUT key CTRL indicates the CTRL and U keys. 5. indicates: in center column, the execution of a line feed in right column, the ASCII code for line feed U Typed Echoed Entered Buffer ABC..) ABCD..) ABC..) + ABCDEF~ ABCD..J4o ABCD\..)4o ABC.J+ ABCD+ ABCD+ ABC..)+ ABCD~4o ABCDEF RUB..) OUT CTRL U RUB..) OUT +U..)+ ABCDEF RUB RUB..) OUT OUT ABCD\ \..)+ ABCDEF RUB RUB RUB x..) OUT OUT OUT ABCD \ \ \X.J4o AX..) + Low-Speed Reader and High-Speed Reader All characters are transferred to the buffer ruboutsare ignored. except that nulls and Teleprinter Characters are printed from the buffer as they appear except that nulls are ignored and tabs are output as spaces up to the next tab stop. Low-Speed Punch and High-Speed Punch Characters are punched from the buffer as they appear nulls are ignored and tabs are followed by a rubout. 7-9 except that INPUT/OUTPUT PROGRAMMING Line Printer (IOXLPT only) Characters are printed from follows: the buffer as they appear except Nulls Ignored Tab Output as spaces up to the next tab stop. Carriage Return Ignored. It is assumed that a line feed or form feed follows. These characters cause the line printer "carriage" to advance. All characters beyond the 80th are ignored except a line feed or feed. 7.4.2 as form Unformatted ASCII Unformatted ASCII transfers the number of 7-bit by the header Byte Count. characters specified Device-Dependent Functions Keyboard Characters are read and echoed except as follows; 7.4.3 Tab Echoes as spaces up to the next tab stop. CTRL/P Echoes as Ap and causes a jump to address, if non-zero (see 7.6.2). the restart Formatted Binary Formatted Binary is used to transfer checksummed binary data (a-bit characters) in blocks. A Formatted Binary block appears as follows: Byte (Octal) Meaning 001 000 Start of block Always null ~} xxx Block Byte Count (low-order followed by high-order). Count includes data and preceding four bytes. DDD DDD Data bytes DDD DDD CCC Checksum. Negation of the sum of all preceding bytes in the block. 7-10 INPUT/OUTPUT PROGRAMMING IOX creates the block on output, from the The Byte Count word in the buffer header bytes following, which are to be output. output is four larger than the header output, IOX calculates the checksum which data byte. buffer and buffer header. specifies the number of data Note that the Byte Count Byte Count. As the block is is output following the last On Formatted Binary reads, IOX ignores null characters until the first non-null character is read. If this character is a 001, a Formatted Binary block is assumed to follow and is read from the device under control of the. Byte Count value. If the first non-null character is not 001, the read is immediately terminated and error code 4 is set in the Status byte. As the block is read a checksum is calculated and compared to the checksum following the block. If the checksum is incorrect, error code 2 is set in the Status byte of the buffer header. If the binary block is too large (Byte Count less 4, larger than the Buffer Size specified in the header), the last byte of the buffer is overlaid until the last data byte has been read; error code 3 is set in the Status byte. Device-Dependent Functions None. Eight-bit data characters are transferred device and buffer exactly as they appear. 7.4.4 to and from the Unformatted Binary This mode transfers 8-bit characters with no formatting or character conversions of any kind. For both input and output, the buffer header Byte Count determines the number of characters transferred. Device-Dependent Functions None 7.5 7.5.1 DATA TRANSFERS Read IOT .WORD (address of first word of the buffer header) .BYTE 11, (slot number) This command causes IOX to read from the device associated with the specified slot according to the information found in the buffer header. IOX initiates the transfer of data, clears the Status byte, and returns control to the calling program. If the device on the selected slot is busy, or a conflicting device (see Section 7.5.3) is busy, IOX retains control until the data transfer can be initiated. Upon completion of the Read, the appropriate bits in the Status byte are set by IOX and the Byte Count word indicates the number of bytes in the data buffer. Note that use of the KBD while an LSR Read is in progress will intersperse KBD characters into the buffer unpredictably. 7-11 INPUT/OUTPUT PROGRAMMING 7.5.2 Write lOT .WORD (address of first word of the buffer header) .BYTE 12, (slot number) lOX writes on the device associated with the specified slot according to the information found in the buffer header. Transfer of data occurs in the amount specified by Byte Count (Buffer+4). lOX returns control to the calling program as soon as the transfer has been initiated. If the device on the selected slot is busy, or a conflicting device is busy, lOX retains control until the transfer can be initiated. Upon completion of the Write, lOX will set the Status byte to the latest conditions. If a write causes an EOM condition, the user has no way of determining how much of his buffer has been written (the Byte Count remains the same.) 7.5.3 Device Conflicts In Data Transfer Commands Because there is a physical association between the devices on the ASR Teletype, certain devices cannot be in use at the same time.· When a data transfer command is given, lOX simultaneously checks for two conditions before executing the command: 1. Is the device requested already in use? and, 2. Is there some other device in use that operational conflict? would result in an lOX resolves both conflict situations by waiting until the first device is no longer busy, before allowing the requested device to start functioning. (This is an automatic Waitr command. See next section.) For example, if the LSR is in use, and either a KBD request or a second request for the LSR itself is made, lOX will wait until the current LSR read has been completed before returning control to the calling program. In the particular case of the LSR, lOX also performs a timeout check while waiting for it to become available. When a Read command has been issued for the LSR, lOX waits about 100 milliseconds for each character to be read. If no character is detected by this time (presumably because the LSR is turned off, or out of tape), a timeout is declared and lOX sets EOM in the appropriate buffer Status byte. The following is a table listing the devices. Corresponding to each device on the left is a list of devices (or the echo operation) which would conflict with it in operation. Device All Possible Conflicting Devices or Operations KBD CHO, KBD, TTY, LSR, LSP TTY Echo, KBO, TTY, LSP LSR KBD, LSR LSP Echo, KBD, TTY, LSP HSR HSR HSP HSP LPT (IOXLPT only)LPT 7-12 INPUTjOUTPUTPROGRAMMING 7.5.4 Waitr (Wait, Return) lOT .WORD (busy return address) .BYTE 4, (slot number) Waitr, like device conflict resolution, causes lOX to test the status of the device associated with the specified slot. If the device (or any possible conflicting device) is not transferring data, control is passed to the instruction following the Waitr. Otherwise, lOX transfers program control to the busy return address. If it is desired to continuously test for completion of data transfer on the device, the busy return address of the immediately preceding lOT instruction can be specified, effecting a Wait loop. If a slot is inited to any device other than the LSR, control is returned to the calling program about 150 microseconds after execution of a Waitr. For the LSR, however, the time is about 100 milliseconds. Note that a not-busy return from Waitr normally means the device is available. However, in the case of a Write, this only means that the last character has been output to the device. The device is still in the process of printing or punching the character. Thus, care must be exercised when performing an lOX Reset, hardware RESET, or HALT after a Write-Waitr sequence, since these may prevent the last character from being physically output. 7.5.5 waitr vs. Testing the Buffer Done Bit Since lOX permits you to have device-independent code, it may not be known, from run to run, what devices will be assigned to the slots in your program. Waitr tests the status, not only of the device it specifies, but also of all possible conflicting devices. This means that when Waitr indicates that the device is not busy, the data transfer on the device of interest may have been done for some time. Depending on the program and what devices are assigned to the slots for a given run, the Waitr could have been waiting an additional amount of time for a conflicting device to become free. Where this possibility exists and buffer availabili,ty is what is of interest, testing the Done bit of the Status byte (set when buffer whereas waitr transfer is complete) would be preferable to Waitr; would be preferable if device availability is what is of interest. This distinction is made in order to In the example below: write device-independent code. 1. If the devices at slots 2 and 3 could be guaranteed always to be conflicting, neither Waitr nor testing the Done bit would the be necessary, because lOX would automatically wait for busy device to finish before allowing the other device to begin. 2. If these devices could be guaranteed never to be conflicting, it wouldn't matter which of these methods was used, because Waitr couldn't be waiting extra time for a conflicting device (of no interest) to become free. 7-13 INPUT/OUTPUT PROGRAMMING Example: PROGRAM A PROGRAM B JOT .WORD BUF2 .BYTE F'~EAD , SUJT2 lOT .WORD BUF2 .BYTE READ, SUJT2 lOT • WOF'W BUF:L .BYTE READ, JOT .WORD BUn .BYTE READ, SLOT2 SLOT~.~ 101' .WORD BUF2 .BYTE WRITE, SI.. OT:3 DUNTST: TSTB BUF1+~~ (IE~VTST : BPL DUNTST JOT .WORD BUF2 .BYTE WRITE, SLOT3 lOT .WORD DEVTST .BYTE WA ITR, SL.OT~;~ JOT .WORD SLOT2DEV .BYTE INIT, SLOT4 Programs A and B do two successive reads from the same device into two different buffers. Since the devices are the same, lOX waits for the first read to finish before allowing the second to begin. In Program A, we wish to process buffer 1. To have issued a Waitr for the device associated with slot 2 could have meant waiting also for the device at slot 3 if that device were in conflict. Hence, testing the Done bit in the buffer header is the proper choice. In Program B, we wish control of the device at slot 2, so that it can be assigned to another slot and so we must know its availability. Therefore, Waitr is appropriate. 7.5.6 Single Buffer Transfer on One Device At lOT .WOF'W BUF:L .BYTE READ,SLOT3 ; TF~AP TO lOX ; SF'ECIFY BUFFER 9READ FROM DEVICE AT ;SLOT 3 INTO BUFFER BUSY: IOT .WORD BUSY .BYTE WAITR,SLOT3 ;TRAP TO lOX ;SPECIFY BUSY RETURN ADDRESS ;WAIT FOR DEVICE AT SLOT ;3 TO FINISH READING (process buffer :L) JMP A The program segment above includes a waitr which goes to a Busy Return address that is its own lOT -- continuously testing the device at slot 3 for availability. In this instance, involving only a single device and a single buffer, a Done condition in the Buffer 1 Status byte can be inferred from the availability of the device at slot 3. This knowledge assures us that all data requested for Buffer 1 is available for processing. Testing the Done Bit of Buffer 1 might have been used instead, but was not necessary with only one device operating. Moreover, a Waitr, unlike a Done Bit test, would detect a timeout on the LSR if that device happened to be associated with slot 3. 7-14 INPUT/OUTPUT PROGRAMMING 7.5.7 Double Buffering lOT .WORD BUFI .BYTE READ,SLOT3 ;TRAP TO lOX ;SPECIFY BUFFER 1 ;READ FROM DEVICE AT ;SLOT 3 INTO BUFFER 1 lOT .WORD BUF2 .BYTE READ,SLOT3 ;TRAP TO lOX ;SPECIFY BUFFER 2 READ FROM DEVICE AT SLOT ;3 INTO BUFFER 2 (process BUFI concurrent with Read into BUF2) lOT .WORD BUFI .BYTE READ,SLOT3 ;TRAP TO lOX ;SPECrFY BUFFER 1 ;READ FROM DEVICE AT ;SLOT 3 INTO BUFFER 1 (process BUF2 concurrent with Read into BUF1) JMP A The example above illustrates a time-saving double-buffer scheme whereby data is processed in Buffer 1 at the same time as new data is being read into Buffer 2; and, sequentially, data is processed in Buffer 2 at the same time as new data is being read into Buffer 1. Because lOX ensures that the requested device is free before initiating the command, the subsequent return of control from the rOT at A implies that the read prior to A is complete; that is, that buffer 1 is available for processing. Similarly, the return of control from the rOT at B implies that buffer 2 is available. Wai~r's are not required because lOX has automatically ensured the device's availability before initiating each Read. 7.5.8 Readr (Real-time Read) lOT .WORD (address of first word of the buffer header) .BYTE 13, (slot number) .WORD (done-address) The Readr command functions as the Read except that upon completion of the data transfer, program control goes to the specified Done-address at the priority level of the device. Readr is used when you wish to execute a segment of your program immediately upon completing the data transfer. lOX goes to the Done address by executing a JSR R7, Done-address. The general registers, which were saved when the last character interrupt occurred, are on the SP stack in the order indicated below: (SP)~ Return address to lOX R5 R4 R3 R2 Rl RO 7-15 INPUT/OUTPUT PROGRAMMING Return to lOX is accomplished by an RTS R7 instruction. lOX will then restore all registers and return to the interrupted program Care should be taken in initiating another data transfer if the specified device can conflict with device requests at other priority levels. Waitr cannot be used to resolve conflict situations between priority levels. 7.5.9 writr (Real-time Write) lOT .WORD (address of first word of the buffer header) .BYTE 14, (slot number of device) .WORD (done address) The Writr command functions as the Write except that, upon completion of the data transfer, program control goes to the specified Done-address at the priority level of the device. lOX goes to the Done-address by executing a JSR R7, Done-address. The condition of the general registers and the return to lOX are the same as for Readr. Writr is used when you wish to execute a segment of your program immediately upon completing the data transfer. As in the Readr, care should be taken in initiating another data transfer if the specified device can conflict with device requests at the priority level of the calling program. 7.6 7.6.1 REENABLING THE READER AND RESTARTING Seek lOT .WORD .BYTE 5, ° (slot number of LSR or HSR) The Seek command clears lOX's internal End-Of-Medium (EOM) indicator on the LSR or HSR, making possible a subsequent read on those devices. With no EOM, an EOF cannot occur. The device associated with the specified slot remains Inited. 7.6.2 Restart lOT .WORD (address to restart) .BYTE 3,0 This command designates an address at which to restart your program. After this command has been issued, typing CTRL/P on the KBD will transfer program control to the restart address, providing there is no LSR read in progress. In such a case, the LSR must be turned off (causing a timeout) before typing a CTRL/P. If the Restart address is designated as 0, the CTRL/P Restart capability is disabled. It is the The Restart command does not cancel any I/O in progress. program's responsibility in its restart routine to clean up any I/O by executing a RESET command and ensuring that the stack pointer is reset. 7-16 INPUT/OUTPUT PROGRAMMING 7.7 FATAL ERRORS Fatal errors result in program termination and a jump to location 408 (loaded with a HALT by lOX), with RO set to the error code and Rl set as follows: If the fatal error was due to an illegal memory reference 0), Rl will contain the PC at the time of the error. (code If the fatal error was due to an error coded in the range 1-5, Rl will point to some element in the lOT argument list or to the instruction following the argument list, depending on whether lOX has finished decoding the arguments when it detects the error. Fatal Error Code Reason 0 Illegal Memory Reference, instruction 1 Illegal lOX command 2 Slot out of range 3 Device out of range 4 Slot not inited 5 Illegal data mode SP overflow, illegal Note that the SP stack contains the value of the registers at the time of the error, namely (SP)-+ R5 R4 R3 R2 Rl RO PC Processor Status (PS) (See Section 7.3.3.1 for a discussion of non-fatal errors.) 7.8 EXAMPLE OF PROGRAM USING lOX This program is used to duplicate paper tape. Note that it could be altered by changing the device code at RDEV or PDEV. For instance, the program could easily be made to list a tape. RO::::%O Rl::::%l R2::::%2 r~3:::::;('3 1:;:4::::%4 1:~6::::%6 KBI...OT::::0 TSl..ClT:::: :1. f~SI...OT::::3 PBI...DT::::4 f~E8ET::::2 RESTRT:::::3 I NIT:::::/. 7-17 INPUT/OUTPUT PROGRAMMING WAITR=4 READ=ll WRITE=12 EOF=20000 CR=15 LF=12 MSG1: 9CR ASSIGNED ASCII CODE FOR CARRIAGE RETURN 9LF ASSIGNED ASCII CODE FOR LINE FEED .=1000 o o ;CANNED MESSAGE ;FORMATTED ASCII ;BYTE COUNT 5 9DEVICE CODE FOR HSR ;DEVICE CODE FOR HSP MSG1BC: END1-MSG1BC-2 .BYTE CR,LF .ASCII / PLACE TAPE IN READER/ .BYTE CR,LF .ASCII / STRIKE CR WHEN READY/ END1: .EVEN BUF3: 2 9BUFFER SIZE o ;FORMATTED ASCII MODE o 9BC ;CR LF o RDEV: PDEV: BUF1: 6 100 3 BUF2: 100 .=.+100 100 3 BEGIN: 100 .=.+100 MOV $500,R6 9BUFFER SIZE 9CODE FOR UNFORMATTED BINARY ;SPECIFIES NUMBER OF BYTES FOR TRANSFER ;RESERVES STORAGE FOR DATA 9BUFFER SIZE ;CODE FOR UNFORMATTED BINARY ;SPECIFIES NUMBER OF BYTES FOR TRANSFER 9RESERVES STORAGE FOR DATA 9SPECIFY ADDRESS FOR BOTTOM OF STACK lOT o .BYTE RESET,O 9INITIALIZATION lOT BEGIN .BYTE MOV MOV RESTRT,O $100,BUF1+4 *100,BUF2+4 9"BEGIN" SPECIFIED AS RESTART 9ADDRESS FOR CTRL P 98ET UP INITIAL BC ON BUFI ;SET UP INITIAL BC ON BUF2 lOT MSGI .BYTE WRITE,TSLOT 9TYPE OUT DIRECTIONS lOT BUF3 .BYTE READ,K8LOT At lOT ;WAIT FOR HIM TO TYPE A CARRIAGE RETURN, ;LINE FEED A .BYTE WAITR,KSLOT lOT RDEV .BYTE INIT,RSLOT jINIT READER lOT PDEV .BYTE INIT,PSLOT 9INIT PUNCH 7-18 INPUT/OUTPUT PROGRAMMING LOOP: IOT BUn • BYTE F~EAD, F~SLOT ;START FIRST READ IOT BUF2 • BYTE READ, F~SI... OT ;READ INTO 2ND BUFFER BIT BNE ~~EOF ;END OF FILE'? nES ;NO BUF 1 +2 BEGIN ;WRITE OUT THIS BUFFER IOT BUF1 ~BYTE c: WRITE,PSLOT ;WAIT TILL DEVICE HAS FINISHED IOT C .BYTE WAITR,PSLOT ;READ INTO 1ST BUFFER roT BUF1 .BYTE READ,RSLOT BIT BNE ;END OF FILE? :II:EOF, BUF2+2 BEGIN IOT BUF2 .BYTE WRITE,PSLOT ;WRITE OUT BUFFER 2 HlT ;WAIT TILL DEVICE HAS FINISHED B .BYTE WAITR,PSLOT BR LOOP .END BEGIN 7.9 lOX INTERNAL INFORMATION 7.9.1 Conflict Byte/Word The lOX Conflict byte (in IOXLPT, Conflict Word) contains the status (busy or free) of all devices as well as whether or not an echo is in progress. Bit 0 is the echo bit, bits 1-6 (and 8 in IOXLPT) refer to the corresponding codes for devices: I f Bit is Set o Bit Bit } Echo in progress 1 = KBD busy 2 = TTY busy 3 = LSR busy Device Bit Device } Bit } Device. 7-19 INPUT/OUTPUT PROGRAMMING Bit Device Bit Device Bit Device Bit Device } } } } 4 LSP busy 5 HSR busy 6 HSP busy 8 LPT busy lOS In IOXLPT, the Conflict Byte is expanded to a word in order to accommodate the line printer, there being no bit 8 to correspond with that device's code of 10 (octal) (the lowest available code for an output device - see Section 7.9.5.1). Device All possible Conflicting Devices Conflict Number KBD Echo, KBD, TTY, LSR, LSP 37 TTY Echo, KBD, TTY, LSP 27 LSR KBD, LSR 12 LSP Echo, KBD, TTY, LSP 27 HSR HSR 40 HSP HSP 100 LPT LPT 400 For each of the devices in the left hand column, all the possible conflicts are listed along with their respective conflict numbers. These numbers, representing bit patterns of the devices listed in column two above, are used to resolve any conflicting requests for devices. The appropriate number is masked with the conflict byte. If the result is zero, there are no conflicts and the device being tested has its bit set allowing data transfer to begin. 7.9.2 Device Interrupt Table (DIT) Each device interrupt handler has associated with it a Device Interrupt Table (DIT) containing information that the handler needs: DIT Checksum DIT+2 Byte size from buffer header DIT+4 Address of Mode byte in buffer header DIT+6 Byte Location Pointer DIT+lO Byte Count DIT+l2 Device code 7-20 INPUT/OUTPUT PROGRAMMING DIT+14 Real time done-address DIT+16 Address of device's data buffer register The device interrupt routines gain access to the proper data by means of the DIT entry. When a transfer is complete, they set the appropriate bits in the buffer header pointed to by the DIT contents. 7.9.3 Device Status Table (DST) The Device Status Table (DST) is used by lOX to check for EOF conditions. This table contains a word for each device indicating an EOM condition with a 1. When an EOM condition is recognized on input, lOX not only sets the appropriate bit in the buffer status byte associated with the data transfer, it also records this occurrence in the DST. When a data transfer command is given, lOX checks the DST for the EOM condition. If the appropriate word has a value of 1, lOX sets EOF in the Status byte of the current-command buffer. Since EOF is only possible for the LSR (code 3), and HSR (code 5), the words corresponding to those devices are the only ones that can ever be set to 1. 7.9.4 Teletype Hardware Tab Facility If the Teletype model has a hardware tab facility, teleprinter can be speeded up by: output 1. For lOX, deleting the code from I.TTYCK+6 through I.TAB3+3. 2. For IOXLPT, skipping the code from I.IOLF through I.TAB3+3 (for the teleprinter only - not the line printer). 7.9.5 Adding Devices To lOX In order to add a device to lOX the following tasks must be done: 1. Assign a legal code- to the device 2. Modify the lOX tabies 3. Provide an interrupt routine to handle data for the device. The line printer (in IOXLPT) will be used this discussion. as an example throughout 7.9.5.1 Device Codes - The numbers from 7 to 17 (octal) are available for new-device codes, with the exception of 10 (octal) in the IOXLPT version. This code has been assigned to the line printer. The device code must be odd for an input device and even for an output device. This is so a check can be made for command/device correspondence; i.e., for a Read from an input device or a write to an output device. If the newest device was assigned a number that is higher than the codes of all the other devices, I.MAXDEV must be redefined to that value. This is so an out-of-range device specification in an Init command can be detected. In IOXLPT, I.MAXDEV=lO. 7-21 INPUT/OUTPUT PROGRAMMING Since each device code functions as an index in several word tables, the entries relating to a given device must be placed at the same relative position in each appropriate table. That is, the code~~mber must indicate how many words into the table the entry for that device will be found. This, of course, means accounting for any unused space preceding the entry, if the codes are not assigned in strict sequence. Table entries for the line printer are found at the 10th (octal) word past the table tag, i.e., at Table+20. 7.9.5.2 Table Modification - 1. I.FUNC - Each entry is the octal value of the bit pattern in the device Control/Status Register that enables the corresponding device and/or any interrupt facility it has. Bit setting this number into the device's Control/Status register turns the device on; bit clearing turns it off. Determine this value for the device to be added, and place the entry in the appropriate device position in the table. For example, the line printer Control/Status Register has an Interrupt Enable facility in bit 6. This pattern of 100 is the LPT entry, and is located at I.FUNC+20. 2. I.SCRTAB - This table contains the addresses of the device Control/Status registers. The line printer entry I.LPTSCR has the value 177514, and is located at I.SCRTAB+20. 3. I.DST - (Refer to Section 7.9.3.) Create an entry of 0 for the device in the proper table location. Inserting a word of o at I.DST+20 created a device status entry for the line printer. 4. I.CONSIT - An entry in this table is used to set or clear a device's busy/free bit in the Conflict Byte (Conflict Word in IOXLPT). (See Section 7.9.1, and 5. below.) Each value is obtained by setting one bit only the bit number corresponding to the device number. The line printer, being device 10(octal), has a value of 400(octal) (bit 10 set) and is located at I.CONSIT+20. In the lOX version without the line printer, entries to this table are found in the high-order bytes of Table I.CONFLC. One more input device entry can be added to it. In IOXLPT, however, I.CONSIT is a separate word table, allowing eight more devices (four input and four output) to be added. Byte operations in the lOX I.CONSIT became word operations in IOXLPT to adapt to this expansion. 5. I.CONFLC - (Refer to Section 7.9.1 on Conflict Byte/Word.) Entries are bit patterns of conflicting devices. Since the line printer can only conflict with itself, the I.CONFLC entry is equal to the I.CONSIT entry. As in the I.CONSIT table, byte operations were changed to word operations for I.CONFLC in IOXLPT. 6. Create a DIT for the device (refer to Section 7.9.2) by assigning a DIT label and seven words of O. If it is an output device, the address of the Device Buffer Register must be added as an eighth word. 7-22 INPUT/OUTPUT PROGRAMMING 7. I.INTAB - This is a table of DIT addresses. Place the label of the DIT (mentioned in 6. above) in the correct position in the table. I.INTAB+20 contains the line printer entry I.LPTDIT. 7.9.5.3 Interrupt Routines - write interrupt routine for the device to: (and assign a label to) an 1. Get a character 2. Check for register 3. Do character interpretation according to the device and mode 4. Get a character in or out of the buffer 5. Update lOX's Byte Count 6. Compare lOX's Byte Count to User's Byte Count and Buffer size specification 7. Return for next character errors by means of the device Control/Status Place the label of the interrupt routine at the address of the device vector, and follow it with the value of the interrupt priority in bits 7, 6, and 5. I.LPTIR, the address of the line printer interrupt routine, is at location 200. Location 202 contains the value 200 (indicating priority level 4). If the device to be added is similar to the other single-character devices, steps 3-7 above can be performed by lOX as indicated below: There are two routines, I.INPUT and I.OUTPUT, that are called from the interrupt routines. These routines mainly perform common functions for input and output devices. They are called as follows: JSR R5,I.INPUT JSR and R5,I.OUTPUT At the location following one of these calls is the DIT for the proper device. The routine is thus able to use R5 to reference the DIT entries. I.INPUT and I.OUTPUT also contain device-dependent code to perform functions such as tab counters for the teleprinter and line printer, and deletion of carriage returns in Formatted ASCII mode for the line printer. The device index value is used to identify the device. For the line printer, a symbol I.LPT, has been assigned the value 20 for convenient reference to the device index. 7-23 CHAPTER 8 FLOATING POINT MATH PACKAGE OVERVIEW] The new Floating-Point Math Package, FPMP-ll, is designed to bring the 2/4 word floating point format' of the FORTRAN environment to the paper tape software system of the PDP-II. The numerical r6utines in FPMP-ll are the same as those of the DOS/BATCH FORTRAN Operating Time System (OTS) . TRAP and error handlers have been included to aid in interfacing with the FORTRAN routines. FPMP-ll provides an easy means of performing basic arithmetic operations such as add, subtract, multiply, divide, and compare. It also provides transcendental functions (SIN, COS, etc.), type conversions (integer to floating-point, 2-word to 4-word, etc.), and ASCII conversions (ASCII to 2-word floating-point, etc.). Floating-point notation is particularly useful for computations involving numerous multiply and divide operations where operand magnitudes may vary widely. FPMP-ll stores very large and very small numbers by saving only the significant digits and computing an exponent to account for leading and trailing zeros. To conserve core space in a small system, FPMP-ll can be tailored to include only those routines needed to run a particular user program. For more information on FPMP-ll, refer to the FPMP-ll (DEC-II-NFPMA-A-D) and to Appendix H of this manual. I User's FPMP is not currently available for the LSI-II (PDP-ll/03). 8-1 Manual CHAPTER 9 PROGRAMMING TECHNIQUES This chapter presents various programming techniques. They can be used to enhance your programming and to make optimum use of the PDP-II processor. The reader is expected to be familiar with the PAL-II assembly language (Chapters 1 & 2). 9.1 WRITING POSITION INDEPENDENT CODE When a standard program is available for different users, it often becomes useful to be able to load the program into different areas of core and to run it there. There are several ways to do this: 1. Reassemble the program at the desired location. 2. Use a relocating loader which accepts specially coded from the assembler. 3. Have the program relocate itself after it is loaded. 4. Write code which is position independent. binary On small machines, reassembly is often performed. When the required core is available, a relocating loader (usually called a linking loader) is preferable. It generally is not economical to have a program relocate itself since hundreds or thousands of addresses may need adjustment. Writing position independent code is usually not possible because of the structure of the addressing of the object machine. However, on the PDP-II, position independent code (PIC) is possible. PIC is achieved on the PDP-II by using addressing modes which form an effective memory address relative to the Program Counter (PC). Thus, if an instruction and its object(s) are moved in such a way that the relative distance between them is not altered, the same offset relative to the PC can be used in all positions in memory. Thus, PIC usually references locations relative to the current location. PIC may make absolute references as long as the locations referenced stay in the same place while the PIC is relocated. For example, references to interrupt and trap vectors are absolute, as are references to device registers in the external page and direct references to the general registers. 9-1 PROGRAMMING TECHNIQUES 9.1.1 position Independent Modes There are three position independent modes or forms They are: of instructions. 1. Branches the conditional branches, as well as the unconditional branch, BR, are position independent since the branch address is computed as an offset to the PC. 2. Relative Memory References of the form any relative memory reference CLR X MOV X,Y JMP X is position independent because the assembler assembles it as an offset indexed by the PC. The offset is the difference between the referenced location and the PC. For example, assume the instruction CLR 200 is at address 100: :1.001 :1.021 ;FIRST WORD OF CLR 200 ;OFFSET = 200-:J.04 ()O~5067 000074 The offset is added to the PC. The PC contains the address of the word following the offset. 104, i.e., Although the form CLR X is position independent, the form CLR @X is not. Consider the following: St CU~ x: .wmw A A: • wmm 0 ;CLEAR LOCATION A (l1X ; PO I NTEF, TO A The contents of location X are used as the address of the operand in the location labeled A. Thus, if all of the code is relocated, the contents of location X must be altered to reflect the new address of A. If A, however, was the name associated with some fixed location (e.g., trap vector, device register), then statements S and X would be relocated and A would remain fixed. Thus, the following code is position independent. ;ADDRESS OF SECOND WORD OF ; n~AP VECTOI::: ;CLEAR LOCATION A A'"" 36 CL.F~ x: 3. (i?X ; POINTEF, TO A • WClFm A Immediate Operands The assembler addressing form #X specifies immediate data, that is, the operand is in the instruction. Immediate data is position independent since it is a part of the instruction and is moved with the 9-2 PROGRAMMING TECHNIQUES instruction. Immediate data is fetched using the PC autoincrement mode. in the As with direct memory references, the addressing form @#X is not position independent. As before, the final effective address is absolute and points to a fixed location not relative to the PC. 9.1.2 Absolute Modes Any time a memory location or register is used as a pointer to data, the reference is absolute. If the referenced data is fixed in memory, independent of the position of the PIC (e.g., trap-interrupt vectors, device registers), the absolute modes must be used. l If the data is relative to the PIC, the absolute modes must not be used unless the pointers involved are modified. The absolute modes are: @X Location X is a pointer @#X The immediate word is a pointer ( R) The register is a pointer (R)+ and - (R) The register is a pointer @(R)+ and @- (R) The register points to a pointer X (R) R;i6 or 7 The base, X, modified by (R) the address of the operand @X(R) is The base, modified by (R), is a pointer The non-deferred index modes and stack operations require a little clarification. As described in Sections 3.6.10 and 9.1.1, the form X(7) is the normal mode to reference memory and is a relative mode. Index mode, using a stack pointer (SF or other register) is also a relative mode and may be used conveniently in PIC. Basically the stack pointer points to a dynamic storage area and index mode is used to access data relative to the pointer. The stack pointer may be initially set up by a position independent program as shown in Section 9.1.4.1. In any case, once the pointer is set up, all data on the stack is referenced relative to the pointer. It should also be noted that since the form 0 (SP) is considered a relative mode so is its equivalent @SP. In addition, the forms (SP)+ and -(SP) are required for stack pops and pushes. 9.1.3 Writing Automatic PIC Automatic PIC is code which requires no alteration of addresses or pointers. Thus, memory references are limited to relative modes unless the location referenced is fixed (trap-interrupt vectors, etc.). In addition to the above rules, the following must be observed: 1. Start the program with .=0 to allow easy relocation using the Absolute Loader (see Chapter 6). lWhen PIC is not being written, references to fixed locations performed with either the absolute or relative forms. 9-3 may be PROGRAMMING TECHNIQUES 2. All location setting statements must be of the form .=.±X or .- function of tags within the PIC. For example, .=A+IO where A is a local label. 3. There must not be any absolute location setting statements. This means that a block of PIC cannot set up trap and/or interrupt vectors at load time with statements such as: .=34 .WORD TRAPH,340 ;TRAP VECTOR The Absolute Loader, when it is relocating PIC, relocates all data by the load bias (see Chapter 6). Thus, the data for the vector would be relocated to some other place. vectors may be set at execution time (see Section 9.1.4). 9.1.4 Writing Non-Automatic PIC Often it is not possible or economical to write totally automated PIC. In these -cases, some relocation may be easily peformed at execution time'. Some of the required methods of solution are presented below. Basically, the methods operate by examining the PC to determine where the PIC is actually located. Then a relocation factor can be easily computed. In all examples, it is assumed that the code is assembled at zero and has been relocated somewhere else by the Absolute Loader. 9.1.4.1 Setting Up The Stack Pointer - Often the first task of a program is to set the stack pointer (SP). This may be done as follows: BEG: MOV TST PC,SP -CSP) ;BEG IS THE FIRST INSTRUCTION OF ;THE PROGRAM ;SP=ADR BEG+2 ;DECREMENT SP BY 2. ;A PUSH ONTO THE STACK WILL STORE ;THE DATA AT BEG-2. 9.1.4.2 Setting Up A Trap or Interrupt Vector - Assume the first word of the vector is to point to location INT which is in PIC. x: Mov PC,RO ADD tINT-X-2,RO MOV RO,@tVECT ;RO = ADR X+2 ;ADD OFFSET ;MOVE POINTER TO VECTOR The offset INT-X-2 is equivalent to INT-(X+2) and X+2 is the value of the PC moved by statement X. If PC is the PC that was assumed for th~ program when loaded at 0, and if PC is the current real PC, then the calculation is: Thus, the relocation factor, PC~-PCo' is added to the assembled of INT to produce the relocated value of INT. 9-4 value PROGRAMMING TECHNIQUES 9.1.4.3 Relocating Pointers - If pointers must be used, they may be relocated as shown above. For example, assume a list of data is to be accessed with the instruction ADD (RO)+,Rl The pointer to the list, list L, may be calculated at as follows: MOV ADD PC,RO tL-M-2,RO execution time ;GET CURRENT PC ;ADD OFFSET Another variation is to gather all pointers into a table. The relocation factor may be calculated once and then applied to all pointers in the table in a loop. x: MOV SUB MOV ADD MOV ADD DEC BGE LOOP! PC,RO ;RELOCATE ALL ENTRIES IN PTRTBL ;CALCULATE RELOCATION FACTOR :fI:PTRTBL,Rl ;GET AND RELOCATE A POINTER I:;:O,IU TO PTRTBL tTBLLEN,R2 ;OET LENGTH OF TABLE RO,(IUH ;RELOCATE AN ENTRY ;COUNT R2 ;BRANCH IF NOT DONE LOOP :II:X+:;!,RO Care must be exercised when restarting a program which relocates a table of pointers. The restart procedure must not include the relocating again, i.e., the table must be relocated exactly once after each load. 9.2 LOADING UNUSED TRAP VECTORS One of the features of the PDP-II is the ability to trap on various conditions such as illegal instructions, reserved instructions, power failure, etc. However, if the trap vectors are not loaded with meaningful information, the occurrence of any of these traps will cause unpredictable results. By loading the vectors as indicated below, it is possible to avoid these problems as well as gain meaningful information about any unexpected traps that occur. This technique, which makes it easy to identify the source of a trap, is to load each unu"sed trap vector with: .=trap address .WORD .+2,HALT This will load the first word of the vector with the address of the second word of the vector (which contains a HALT). Thus, for example, a halt at location 6 means that a trap through the vector at location 4 has occurred. The old PC and status m"ay be examined by looking at the stack pointed to by register 6. The trap vectors of interest are: Vector Location Halt At Location 4 6 Bus Error; Illegal Instruction; Stack Overflow; Nonexistent Memory; Nonexistent Device; Word Referenced at Odd Address 10 12 Reserved Instruction Meaning 9-5 PROGRAMMiNG TECHNIQUES 9.3 14 16 Trace Trap Instruction {000003) or T-bH. Set in Status Word (used by ODT) 20 22 IOT Executed (used by IOX) 24 26 Power Failure or Restoration 30 32 EMT Executed (used by FPP-ll) 34 36 TRAP Executed CODING'TECHNIQUE~ Because of the great flexibility in' PDP-II coding, timeand space-saving ways.' of performing operations may not be immediately apparent. Some comparisons follow. 9.3.1 Altering Register Contents The techniques described in this section take advantage of the automatic stepping feature of auto increment and autodecrement modes when used especially in TST andCMP instructions. These instructions do not alter operands. However, it is important to make note of the following: • These alternative ways of altering register affect the condition codes differently. contents • Register contents must be even when stepping by 2. • These techniques work properly only if the registers are pointing to an. existing memory location; otherwise, a trap is generated. 1 . . Adding 2 to a register might be accomplished by ADD #2.,RO. this takes two words, whereas TST (RO)+ which also adds 2 to a register, takes only one word. How~ver, 2. Subtracting 2 from a register can complementary instructions SUB #2~~0 same conditions as in adding)2. 3. This can be extended to adding or different registers, or 4 from single-word instruction: be done by the or TST -(RO) with the subtracting 2 from two the same register, in one ;A[I[I 4 TO RO ;SUBTRACT 4 FROM Rl ;A[lD 2 TO RO, SUBTi=i:ACT 2 FROM Rl ;SUBTRACT 2 FROM BOTH R3 AND Rl ;AD[I 2 TO BOTH F~3 AND RO CMF-' (FW)·h (ROH CMF-' -·(Rl) ,-(R:L) CMF-' (ROH"-(F~:L> CMF-' -(R3)'-(R:L> CMF-' (R3H, (ROH 9-6 PROGRAMMING TECHNIQUES 4. Variations of the examples above can be employed if the instructions operate on bytes and one of the registers is the Stack Pointer. These examples depend on the fact that the Stack Pointer (ai well as the PC) is always auto incremented or autodecremented by 2, whereas registers RO-R5 step by 1 in byte instructions. CMPB (SP)+,(R3)t CMPB -(R3),-(SP) CMPB (R3)t,~(SP) 5. 9ADD 2 TO SP ~ND 1 TO R3 9SUBTRACT 1 FROM R3 AND 2 FROM SP 9ADD 1 TO R3, SUBTRACT 2 FROM SP Popping an unwanted word off the processor stack (adding' 2 to register 6) and testing another value can be two separate instructions or one combined instruction: TST (SP)t TST COUNT ;POP WORD ;SET CONDITION CODES FOR COUNT MOV COUNT~(SP)t ;POP WORD & SET CODES FOR COUNT or The differences are that the TST instructions take three words and clear the Carry bit, and the MOV instruction takes two words and doesn't affect the Carry bit. 9.3.2 Subroutines 1. Condition codes set within a subreutine can be used to conditionally branch upon return to the calling program, since the RTS instruction does not affect condition codes. JSR PC,X BNE ABC ;CALL SUBROUTINE X ;BRANCH ON CONDITION SET ;IN SUBROUTINE X X: ·;SUBROUTINE ENTRY CMP R2,DEF RTS PC 2. ;TEST CONDITION ;RETURN TO CALLING PROGRAM When a JSR first operand register is not the PC, data stored following a subroutine call can be accessed within the subroutine by referencing the register. (The register contains the return address.) JSR R5,Y .WORD HIGH .WORD LOW ;LATEST R5 VALUE WILL POINT HERE Y: MOV (RS)t,R2 MOV (RS)+,R4 ;VALUE OF HIGH ACCESSED ;VALUE OF LOW ACCESSED RTS RS ;RETURN TO LOCATION ;CONTAINED IN RS 9-7 PROGRAMMING TECHNIQUES Another possibility is: JSR R5,SUB BR PSTARG ;LOW-ORDER BYTE IS OFFSET TO RETURN ;ADDRESS, WHICH EQUALS NO. Qf ARGS. ;ADDRESS OF ARG A 9ADDRESS OF ARG B 9ADDRESS OF ARG C .WORD A .WORD B .WORD C PSTARG: SUB: ;RETURN ADDRESS MOVD@R5,COUNT ;GET NO. OF ARGS FROM LOW BYTE 90F BR (IF DESIRED). ;E.G., GET 6TH ARGUMENT ;GET 3RD ARGUMENT MOV @14(R5),R2 NOV @6(R5),Rl RTS R5 In the example above, the advantages: ;RETURNS TO BRANCH WHICH JUMPS PAST ;ARG LIST TO REAL RETURN ADDRESS branch instruction contributes two main 1. If R5 is unaltered when the RTS is executed, return will always be to the branch instruction. This ensures a return to the proper location even if the length of the argument list is shorter or longer than expected. 2. The operand of the branch, being an offset past the list, provides the number of arguments in the list. argument Arguments can be made sharable by separating the data from the main code. This is easily accomplished by treating the JSR and its return as a subroutine itself: CALL: ARGLST: JSR PC,ARGLST JSR R5,SUB DR PSTARG .WORD A • 3. The examples above all demonstrate the calling of subroutines from a non-reentrant program. The called subroutine can be either reentrant or non-reentrant in each case. The following example illustrates a method of also allowing calling programs to be reentrant. The arguments and linkage are first placed on the stack, simulating a JSR R5,SUB, so that arguments are accessed from the subroutine via X(R5). Return to the calling program is executed from the stack. 9-8 PROGRAMMING TECHNIQUES CALL: MOV R5,-(SP) MOV JSBR,-(SP) x: RET: MOV BRN,-(SP) MOV SP,R5 JSR PC, SUB MOV (SP >+, R5 ;SAVE R5 ON STACK. ;PUSH INSTRUCTION JSR R6,@R5 ON ;STACK. PUSH ADDRESSES OF ARGU;MENTS ON STACK IN REVERSE ORDER ; (SEE BELOW). ;PUSH BRANCH INSTRUCTION ON STACK ;MOVE ADDRESS OF BRANCH TO R5. 9CALL SUB AND SAVE RETURN ON STACK. 9RESTORE OLD R5 UPON RETURN. ;DATA AREA OF PROGRAM. JSBR: BRN: ~JSR R6,@R5 BR .+N+N+2 ;BRANCH PAST N WORD ARGUMENTS The address of an argument can be pushed several ways. Three are shown below. a. the stack in The arguments A, B, and C are read-only constants in memory (not on the stack): which are Arguments A, B, and C have their addresses on the stack the Lth, Mth, and Nth bytes from the top of the stack. at MOV :IJ:C,·· (SP ) MOV :g:B, - (SP ) MOV :fI:A,-(SP) b. on ;PUSH ADDRESS OF C ;PUSH ADDRESS OF B 9PUSH ADDRESS OF A MOV N(SP),-(SP) MOV M+2(SP),-(SP) MOV L+4(SP),-(SP) ;PUSH ADDRESS OF C ;PUSH ADDRESS OF B ;PUSH ADDRESS OF A Note that the displacements from the top of the stack are adjusted by two for each previous push because the top of the stack is being moved on each push. c. Arguments A, B, and C are on the stack at the Lth, Mth, Nth bytes from the top but their addresses are not. MOV :fI:N+~~, _. (SP) ADD SP,@SP MOV :Jf:M+4 , .. (SF') ADD SP,@SP MOV :IJ:L. +6, ." ( SP ) ADD SP,@SP 9-9 ;PUSH DISPLACEMENT TO ARGUMENT ;CAL.CULATE ACTUAL ADm~ESS OF ("., 9ADDRESS OF B ;ADDREBS OF A and PROGRAMMING TECHNIQUES When subroutine SUB is entered, the stack appears as follows: RET BR .+N+N+2 A B JSR R6.@R5 ;BRANCH IS TO HERE OLD R5 Subroutine SUB returns by means of an RTS R5, which places R5 into the PC and pops the return address from the stack into R5. This causes the execution of the branch because R5 has be"en loaded (at location X) with the address of the branch .. The JSR branched to then returns control to the calling program, and in so doing, moves the current PC value into the SP, thereby removing everything above the old R5 from the stack. Upon return at RET, this too is popped, restoring the original R5 and SP values. 4. The next example is a recursive subroutine (one that calls itself). Its function is to look for a matching right parenthesis for every left parenthesis encountered. .The subroutine is called by JSR PC,A whenever a left parenthesis is enco~ntered (R2 points to the character following it). When a right parenthesis is found, an RTS PC is executed, and if the right parenthesis is not the la&t legal one, another is searched for. When the final matching parenthesis is found, the RTS returns control to the main program. Al MOVB (R2)f,RO CMF'B :If: , ( , RO BNE B JSR F'C,A ;GET SUCCESSIVE CHARACTERS. ;LOOK FOR LEFT PARENTHESIS. ; FOUND'i' ;LEFT F'AREN FOUND, CALL SEL. ;GO LOOK AT NEXT CHARACTER BF: A CMF'B :J:'),RO ;LEFT F'AREN NOT FOUND, LOOK FOR HUGHT F'AREN. ;FOUND'i' IF NOT, GO TO A. ;RETURN F'AREN FOUND. IF NOT LAST, ;GO TO B. IF LAST, GO TO MAIN PROGRAM. BNE A Ins F'C 5. The example below illustrates the use of co-routines, called by JSR PC,@(SP)+. The program uses double buffering on both input and output, performing as follows: Write 01 } Read II Process 12 concurrently Write 02 } Read 12 Process II concurrently JSR PC,@(SP)+ always performs a jump to the address specified on top of the stack and replaces that address with the new return address. Each time the JSR at B is executed, it jumps to a different location; initially to A and thereafter to the location following the JSR executed prior to the one at B. All other JSR's jump to B+2. 9-10 PROGRAMMING TECHNIQUES PC==%7 BEGIN: (do 1/0 resets, inits, etc.) lOT ;READ INTO 11 TO START PROCESS .WORD 11 .BYTE READ,INSLOT MOV *A,-(6) ;INITIALIZE STACK FOR FIRST JSR iiDO 1/0 FOR 01 AND 11 OR 02 AND 12 JSR PC,@(6)+ perform BR B processin~ iiMORE I/O fEND OF MAIN lOOP ; 1/0 CO··-ROUTINES iiREAD INTO 12 lOT .wmm 12 .BYTE READ,INSLOT set parameters to process 11, 01 JSR PC,@(6H iiRETURN TO PROCESS AT B+2 lOT ii WRITE FROM 01 .WORD 01 .BYTE WRIT~,OUTSLOT lOT iiREAD INTO 11 .wmm 11 .BYTE READ,INSLOT set parameters to process 12, 02 lOT iiRETURN TO PROCESS AT B+2 FROM O~~ I WR ITE .WORD 02 .BYTE WRITE, OUTSlOT BR A .READ INTO 12 6. The trap handler, below, simulates a two-word JSR instruction with a one-word TRAP instruction. In this example, all TRAP instructions in the program take an operand, and trap to the handler address at location 34. The table of subroutine addresses (e.g., A, B, ... ) can be constructed as follows; TABLE: CALA::::. --TABLE .WORD A fCALLED BY: TRAP CALA CALB::: • _. TABLE .wmm B iiCALLED BY: TRAP CALB Another way to construct the table: TABLE: CALA~.-TABLE+TRAP .WORD A leALLED BY: 9-11 CAL A PROGRAMMING TECHNIQUES The TRAP handler for either of the above methods follows: TRAP34: MOV @SP,2(SP) ;REPLACE STACKED PS WITH Per. SUB t2,@SP ;GET POINTER TO TRAP INSTRUCTION. MOV @(SP)+,-(~P);REPLACE ADDRESS OF TRAP WITH 9 TRAP INSTRUCTION ITSELF. ADD tTABLE-TRAP,@SP ;CALCULATE SUBROUTINE ADDR. MOV @(SP)+,PC 9JUMP TO SUBROUTINE. In the example above, if the third instruction had been written MOV @(SP), (SP) it would have taken an extra word since @(SP) is in Index Mode and assembles as @O(SP]. In the final instruction, a jump was executed by a MOV @(SP)+,PC because no equivalent JMP instruction exists. Following are some JMP and MOV equivalences (note that affect condition codes). JMP (R4) MOV R4,PC JMP @(R4) (2 words) MOV (R4) ,PC (1 word) none JMP -(R4) = = JMP @(R4)+ not none MOV (R4) ,PC = MOV -(R4) ,PC none = MOV @(R4)+,PC none MOV @-(R4) ,PC JMP X MOV #X,PC none does MOV @(R4) ,PC JMP @-(R4) JMP @X JMP = MOV X,PC MOV @X,PC The TRAP handler can be useful, also, as a patching technique. Jumping out to a patch area is often difficult because a two-word jump must be performed. However, the one-word TRAP instruction may be used to dispatch to patch areas. A sufficient number of slots for patching should first be reserved _in the dispatch table of the TRAP handler. The jump can then be accomplished by placing the address of the patch area into the table and inserting the proper TRAP instruction where the patch is to be made. ,-.iReplacing the saved PS loses the T-bit status. If a breakpoint has been set on the TRAP instruction, ODT will not gain control again to reinsert the breakpoints because the T-bit trap will not occur. 9-12 APPENDIX A ASCII CHARACTER SET EVEN PARITY BIT 7-BIT OCTAL CODE CHARACTER o 1 000 001 NUL SOH 1 002 STX o 003 ETX 1 004 EOT o 1 1 005 006 007 010 ENQ ACK BEL BS o o 011 012 HT LF 1 o 013 014 VT FF 1 015 CR 1 016 SO o 017 SI 1 o o o 020 021 DLE DCl 022 DC2 1 023 DC3 o 024 DC4 1 025 NAK 1 026 027 SYN ETB 030 031 032 033 CAN EM SUB ESC o o 1 1 o REMARKS NULL, TAPE FEED, CONTROL SHIFT P. START OF HEADING; ALSO SOM, START OF MESSAGE, CONTROL A, START OF TEXT; ALSO EOA, END OF ADDRESS, CONTROL B, END OF TEXT: ALSO EOM, END OF MESSAGE CONTROL C, END OF TRANSMISSION (END): SHUTS OFF TWX MACHINES, CONTROL D, ENQUIRY (ENQRY); ALSO WRU, CONTROL E, ACKNOWLEDGE. ALSO RU, CONTROL F. RINGS THE BELL. CONTROL G. BACKSPACE: ALSO FEO, FORMAT EFFECTOR. BACKSPACE SOME MACHINES, CONTROL H. HORIZONTAL TAB. CONTROL I. LINE FEED OR LINE SPACE (NEW LINE) : ADVANCES PAPER TO NEXT LINE, DUPLICATED BY CONTROL J. VERTICAL TAB (VTAB). CONTROL K. FORM FEED TO TOP OF NEXT PAGE (PAGE). CONTROL L. CARRIAGE RETURN TO BEGINNING OF LINE. DUPLICATED BY CONTROL M. SHIFT OUT: CHANGES RIBBON COLOR TO RED. CONTROL N. SHIFT IN: CHANGES RIBBON COLOR TO BLACK. CONTROL 0 DATA LINK ESCAPE. CONTROL P (DCO). DEVICE CONTROL 1, TURNS TRANSMITTER (READER) ON, CONTROL Q (XON). DEVICE CONTROL 2, TURNS PUNCH OR AUXILIARY ON. CONTROL R (TAPE, AUX ON). DEVICE CONTROL e, TURNS TRANSMITTER (READER) OFF, CONTROL S (XOFF). DEVICE CONTROL 4. TURNS PUNCH OR AUXILIARY OFF. CONTROL T (TAPE, AUX OFF) NEGATIVE ACKNOWLEDGE: ALSO ERR. ERROR. CONTROL U. SYNCHRONOUS IDLE (SYNC). CONTROL V. END OF TRANSMISSION BLOCK: ALSO LEM. LOGICAL END OF MEDIUM. CONTROL W. CANCEL (CANCL). CONTROL X. END OF MEDIUM. CONTROL Y. SUBSTITUTE. CONTROL Z. ESCAPE. PREFIX. A-I ASCII CHARACTER SET 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 b 0 1 1 O. 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 0 0 1 034 035 036 037 040 041 042 043 044 045 046 047 050 051 052 053 054 055 056 057 060 061 062 063 064 065 066 067 070 071 072 073 074 075 076 077 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 133 FS GS RS US SP FILE SEPARATOR. CONTROL SHIFT L. GROUP SEPARATOR. CONTROL SHIFT M. RECORD SEPARATOR. CONTROL SHIFT N. UNIT SEPARATOR. CONTROL SHIFT O. SPACE. " # $ % & ACUTE ACCENT OR APOSTROPHE. ( ) * + / b 1 2 3 4 5 6 7 8 9 i < > ? @ 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 [ SHIFT K A-2 ASCII CHARACTER SET 0 1 1 0 0 0 0 1 134 135 136 137 140 175 176 177 ] t SHIFT L SHIFT M SHIFT N -+- DEL ACCENT GRAVE. THIS CODE GENERATED BY ALT MODE. THIS CODE GENERATED BY ESC KEY (IF PRESENT) DELETE, RUB OUT. LOWER CASE ALPHABET FOLLOWS (TELETYPE MODEL 37 ONLY). 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 a b c d e f 9 h i j k 1 m n 0 P q r s t u v w x Y z A-3 APPENDIX B PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER B.l TERMINATORS The list below defines all characters which are considered to be terminators. The order of the list implies the descending hierarchy of significance. Character Function CTRL/FORM Source line terminator. LINE FEED Source line terminator. RETURN Source line terminator Label terminator Direct assignment delineator Register term delineator % TAB --?\ Item terminator Field terminator BLANK or SPACE Item terminator Field terminator # Immediate expression field indicator @ Deferred addressing indicator Initial register field indicator Terminal register field indicator Operand field separator Comments field delimiter + Arithmetic addition operator Arithmetic subtraction operator & Logical AND operator Logical OR operator " Double ASCII text indicator Single ASCII text indicator. B-1 PAL-lIS ASSEMBLy LANGUAGE AND ASSEMBLER B.2 ADDRESS MODE SYNTAX r is an integer between 0 and 7. R is a register expression, E is an expression, ER is either a register expression or an absolute expression in the range of 0 to 7. Address Address Mode Mode Name Number Symbol in Operand Field Meaning Or Register lr Deferred Register @R or (R)Register address. 2r Autoincrement (ER) + The contents of the register specified by ER is incremented after being used as the address of the operand. 3r Deferred Autoincrement @(ER)+ ER contains the pointer address of the operand. incremented after use. 4r Autodecrement -(ER) The contents of register ER is decremented before it is used as the address of the operand. Sr Deferred Autodecrement @-(ER) 6r Index by the register Specified The contents of register ER is decremented before it is used as the pointer to the address of the operand. E(ER) 7r Deferred index by the register specified E plus the contents of the register specified, ER, is the address of the operand-.- @E(ER) E. added to ER gives the pointer the address of the operand. 27 Immediate Operand #E E is the operand. 37 Absolute address @#E E is the operand address. 67 Relative address E E is the address of the operand. 77 Deferred relative address. @E ~ is the pointer to the address the operand. B.3 Register R contains the operand. is a register expression. R R contains R the. operand to the ER is to of INSTRUCTIONS The tables of instructions which follow are grouped according to the operands they take and according to the bit patterns of their op-codes. B-2 PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER In the representation of op-codes, the following symbols are used: SS Source operand specified by a 6-bit address mode DD Destination operand specified by a 6-bit address mode xx 8-bit offset to a location R (branch instructions) Integer between 0 and 7 representing a general register Symbols used in the description of instruction operations are: SE Source effective address DE Destination effective address () contents of -+ becomes PS Processor Status word The condition codes in the processor status word (PS) are affected by the instructions; these condition codes are represented as follows: N Begative bit: set i f the result is negative Z Zero bit: set i f the result is zero V OVerflow bit: set i f the result had an overflow C ~arry bit: set i f the result had a carry In the representation of the instruction's codes, the following symbols are used: * effect on the condition Conditionally set Not affected o Cleared I Set To set conditionally means to determine the state of the code. use the instruction's result Logical operators are represented by the following symbols: Inclusive OR Exclusive OR & AND (used over a symbol) NOT (i.e., l's complement) B-3 to PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER B.3.1 OP A,A Double Operand Instructions Op-code MNEMONIC Stands for 01ssdd llssdd mov movb move move Byte 02SSDD 12SSDD CMP CMPB 03SSDD 13SSDD Operation (SE)+DE Condition Codes N Z V C * * 0 CoMPare (SE)-(DE) CoMPare Byte * * * BIT BITB BIt Test (SE)&(DE) BIt Test Byte * * 0 04SSDD 14SSDD BIC BICB BIt Clear (SE) & (DE)-+DE BIt Clear Byte * * 0 05SSDD 15SSDD BIS BISB BIt Set (SE) BIt Set Byte (DE)-+DE * * 0 06SSDD 16SSDD ADD SUB ADD SUBtract (SE) + (DE)-+DE (DE) - (SE)-+DE * * * * * * B.3.2 Single Operand Instructions * * * OP A Operation: Condition Codes N Z V C Op-code MNEMONIC Stands for 0050DD 1050DD CLR CLRB CLeaR CLeaR Byte O-+-DE 0 1 0 0 0051DD 1051DD COM COMB COMplement (DE)-+-DE COMplement Byte * * 0 1 0052DD 1052DD INC INCB (DE) + l-+-DE INCrement INCrement Byte * * * 1 0053DD 1063DD DEC DECB DECrement (DE) -l-+-DE DECrement Byte * * * 0054DD 1054DD NEG NEGB NEGate NEGate Byte (DE) + l-+-DE * * * * 0055DD 1055DD ADC ADCB ADd Carry (DE) + (C)-+DE ADd Carry Byte * * * * 0056DD 1056DD SBC SBCB SuBtract Carry (DE) - (C)-+DE SuBtract Carry Byte * * * * 0057DD 1057DD TST TSTB TeST TeST Byte * * 0 0 (DE) - O-+DE B-4 PAL-llS ASSEMBLY LANGUAGE ANO ASSEMBLER B.3.3 Rotate/Shift C 006000 ROR ROtate Right 106000 RORB ROtate Right Byte 006100 ROL ROtate Left 106100 ROLB ROtate Left Byte 006200 ASR Ari thmetic Shift Right 1 '" '" '" '" ~ '" '" '" '" C ~ '" '" '" '" '" '" r£H 1< 1< '" '" '" '" C 0 106200 ASRB Ari thmetic Shift Right Byte C '" '" '" '" 006300 ASL Arithmetic Shift Left C '" '" '" '" 106300 ASLB Arithmetic Shift Left Byte 000100 JMP JuMP 0003DO SWAB SWAp Bytes B.3.4 Operation Instructions ict ,ll~o l '" '" '" * OE-PC C{5J 0 '" '" 0 Op Condi tion Codes N Z V C Op-Code MNEMONIC Stands for Operation 000000 HALT HALT The computer stops all functions. 000001 WAIT WAIT The computer stops and waits for an interrupt. 000002 RTI ReTurn from Interrupt The PC and PS are popped off the SP stack: ( (SP) ) .... PC (SP)+2 .... SP - ( (SP) ) .... PS '" '" * '" 000003 000003 breakpoint trap Trap to location 14 • This is used to call OOT-ll. 000004 IOT Input/Output Trap Trap to location 20. This is used to call IOX. 000005 RESET RESET Returns all I/O device handlers to power-on state. B-5 * * '" * PAL.,...llS ASSEMBLY LANGUAGE"AND ASSEMBLER Trapping Op or Op E where O<E<377 104000104377 EMT EMulator Trap Trap-to loc~tion 30. This is used to call system programs. * * * * 104400104777 TRAP TRAP Trap to location * 34. This is used to call any routine desired by the programmer. * * * - -s CONDITION CODE OPERATES Op-code MNEMONIC Stands for 000241 CLC CLear Carry bit in ~S. 000261 SEC SEt Carry bit. 000252 CLV CLear oVerflow bit. 000262 SEV SEt oVerflow bit. 000244 CLZ CLear Zero bit. 000264 SEZ SEt Zero bit. 000250 CLN CLear Negative bit. 000270 SEN SEt Negative bit. 000254 CNZ CLear Negative and Zero bits. 000257 CCC CLear all Condition Codes. 000277 SCC Set all Condition Codes. 000240 NOP No-operation. B.3.5 Branch Instructions Op E Where -12S10«E-.-2)/2<12710 Condition to be met if branch is to occur Op-Code MNEMONIC Stands for 0004XX BR BRanch always OOlOXX BNE Branch if Not Equal to Zero Z=O OO14XX BEQ Branch i f EQual (to zero) Z=l 0020XX BGE Branch i f Greater than or equal (to zero) N(DV=O 0024XX BLT Branch i f Less Than (zero) N(DV = 1 0030XX BGT Branch i f Greater Than (zero) Z! (N(DV) =0 0034XX BLE Branch i f Less tha.n or Equal (to zero) Z! (N(DV)=1 B-6 PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER IOOOXX BPL Branch i f PLUS N=O IOO4XX BMI Branch i f MInus N=l IOIOXX BHI Branch i f HIgher cG)z=o I014XX BLOS Branch i f LOwe'r or Same C!Z=1 I020XX BVC Branch i f oVerflow Clear V=O I024XX BVS Branch i f oVerflow Set V=l I030XX BCe (or BHIS) Branch if Carry Clear (or Branch i f HIgh or Same) C=O BCS (or BLO) Branch i f Carry Set (or Branch i f LOw) C=l I034XX B.3.6 Subroutine Call JSR ER,A Op-code MNEMONIC Stands for Operation 004RDD JSR Jump to SubRoutine Push register on the SP stack, put the PC in the register: DE -+- TEMP -a temporary st'orage register int~rnal to processor (SP)-2-+-SP (REG) -+- (SP) (PC)+m REG -m depends upon the address mode. (TEMP) -+- PC B.3.7 Subroutine Return Op-code MNEMONIC Stands for Operation 00020R RTS ReTurn from Subroutine Put register contents in PC and pop old contents from SP stack into register. B.3.8 Extensions for the LSI-II Version Of PAL-lIS Op-code MNEMONIC Stands for Operation 0067dd SXT Sign eXTend Nx(-l) DE I067dd MFPS Move byte From PS (PS) DE ~These extensions are PAL-llS. available only B-7 with Condition Codes N Z V C * * * the LSI-II 0 0 version of PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER 1064ss MTPS Move byte To PS (SE) PS 074rdd XOR eXclusive OR r 070rss MUL MULtiply r x (SE) r 07lrss DIV DIVide r 072rss ASH Arithmetic SHift * * * * 073rss ASHC Ari thmetic SHift Combined * * * * 0064nn MARK MARK SP+2xnn SP R5 PC SP~ R5 077rnn SOB Subtract One and Branch if 0 (r)-l r; if (r) o then (PC)-2xnn PC 000006 RTT ReTurn from Trap PC «SP» «SP»+2 SP ( (SP) ) PS (SP)+2 SP B.4 ! (DE) DE I (SE) r * * * * * * 0 * * 0 * * * * * loaded from stack ASSEMBLER DIRECTIVES MNEMONIC Operand Stands for Operation .EOT none End Of Tape Indicates the physical end of source input medium .EVEN none EVEN Insures that the assembly location counter is even by adding I if it is odd. E END (E optional) Indicates the physical and logical end of the program and optionally specifies the entry point (E) .END the . WORD E, E, ••• E, E, .•• WORD (the void operator) Generates words of data Generates words of data . BYTE E, E ••• BYTE Generates bytes of data .ASCII Ixxx • .. xl ASCII Generates 7-bit ASCII characters for text enclosed by delimiters. .TITLE NAME TITLE Generates a name module. • ASECT none ASECT Initiates the Absolute section . .CSECT none CSECT Initiates the Relocatable section. .LIMIT none LIMIT Generates two words containing the B-8 for the object Control PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER low and high limits of the relocatable section. .GLOBL NAME,NAME, ..• GLOBAL Specifies each name to be a global symbol .RAD50 /XXX/ RADIX 50 Generates the RADIX representation of the character in delimiters. .IFZ E IF E=O Assemble what follows up to the terminating .ENDC if the expression E is O. .IFNZ E IF E/O Assemble what follows up to the terminating .ENDC, if the expression E is not o. .IFL E IF E<O Assemble what follows up to terminating .ENDC, if expression E is less than O. .IFLE E IF E~O Assemble what follows up to the terminating .ENDC, if the expression E is less than or equal to o. .IFG E IF E>O Assemble what follows up to the terminating .ENDC, if the expression E is greater than O. .IFGE E IF E~O Assemble what follows up to the terminating .ENDC, if the expression E is greater than or equal to o. .IFDF NAME IF NAME defined Assemble what follows up to the terminating .ENDC if the symbol NAME is defined. .IFNDF NAME IF NAME undefined Assemble what follows up to the terminating .ENDC if the symbol NAME is undefined. . EN DC none End of Conditional Terminates the range of a conditional directive. B-9 50 ASCII the the PAL-llS ASSEMBLY LANGUAGE AND ASSEMBLER B.S ERROR CODES Error Code Meaning A Addressing error. Tnstruction is relocation errors. B Bounding error. Instructions or word data being assembled at an odd address in memory. D Doubly-defined symbol referenced. Reference was made to a symbol which is defined more than once. I Illegal character detected. Ilegal characters which are also non-printing are replaced by a ? on the listing. L M N Line buffer overflow. 72 are ignored. An address within the incorrect. Also includes are All extra characters beyond Multiple definition of a label. A label was encountered which was equivalent (in the first six characters) to a previously encountered label. Number containing an 8 or 9 was not terminated a decimal point. by P Phase error. A label's definition or value varies from one pass to another. Q Questionable syntax. There are missing arguments or the instruction scan was not completed, or a carriage return was not followed by a linefeed or form feed. R ~egister-type S Symbol table overflow. When the quantity of user-defined symbols exceeds the allocated space available in the user's symbol table, the assembler outputs the current source line with the S error code, then returns to the command string interpreter to await the next command string to be typed. T Truncation err.or. More than the allotted number of bits were input so the leftmost bits were truncated. T error does not occur for the result of an expression. U Undefined symbol. An undefined symbol encountered during the evaluation of expression. Relative to the expression, undefined symbol is assigned a value of zero. error. An invalid use reference to a register has been made. B-IO of or was an the PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER B.6 INITIAL OPERATING PROCEDURES Loading: Use Absolute Loader. The start address Loader must be in the console switches. of the be in Storage Requirements:PAL-llS uses 8K of memory. Starting: Immediately upon loading, PAL-lIS control and initiate dialogue. will Ini tial Dialogue: Printout Inquiry *S What is the input device of the *B What is the output device of the .!!inary object tape? *L What is the output device of the assembly ~isting? *T What is the output device of the symbol Table? ~ource Each of these questions may be answered by anyone characters: Character the following other characters Answer Indicated T !eleprinter keyboard L ~ow-speed H gigh-speed reader or punch P Line Printer Each of these answers indicating options: Option Typed of symbolic tape? reader or punch may be followed by the Function to be performed /1 on pass 1 /2 on pass 2 /3 on pass 3 /E errors to be listed on the Teletype on the same (meaningful only for *B or *L) . Each answer is terminated by typing the RETURN key. answer will delete the function. pass A RETURN alone as Dialogue During Assembly: Printout Response EOF ? A .END Place next tape in reader and type RETURN. statement may be forced by typing E followed by RETURN. END ? Start next pass by placing first tape typing RETURN. B-11 in reader and PAL-lIS ASSEMBLY LANGUAGE AND ASSEMBLER EOM ? If the end-of-medium is on the listing device, the device may be readied and the assembly may be continued by typing RETURN. If the end-of-medium is on the binary device, the assembler will discontinue the assembly and restart itself. Restarting: Type CTRL/P. again. The initial B-12 dialogue will be started APPENDIX C PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C.l SPECIAL CHARACTERS Character Function form feed Source line terminator line feed Source line terminator carriage return Source statement terminator Label terminator Direct assignment indicator % Register term indicator tab Item terminator Field terminator space Ite"m terminator Field terminator # Immediate expression indicator @ Deferred addressing indicator Initial register indicator Terminal register indicator Operand field separator Comment field indicator + Arithmetic addition operator Arithmetic subtraction operator & Logical AND operator Logical OR operator " Double ASCII character indicator Single ASCII character indicator Assembly location counter C-1 PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C.2 ADDRESS MODE SYNTAX n is an integer between 0 and 7 representing a register. R is a register expression, E is an expression, ER is either a register expression or an expression in the range 0 to 7. Format Address Mode Name Address Mode Number Meaning R Register On Register R contains the operand. R is a register expression. @R or (ER) Deferred Register In Register R contains operand address. (ER)+ Autoincrement 2n The contents of the register specified by ER are incremented after being used as the address of the operand. @(ER)+ Deferred Autoincrement 3n ER contains the pointer to the address of the operand. ER is incremented after use. -(ER) Autodecrement 4n The contents of register ER are decremented before being used as the address of the operand. @- (ER) Deferred 'Autodecrement 5n The contents of register ER are decremented before being used as the pointer to the address of the operand. E (ER) Index 6n E plus the contents of the register specified, ER, is the address of the operand. @E (ER) Deferred Ind,ex 7n E added to ER gives the pointer to the address of the operand. #E Immediate 27 E is the operand. @#E Absolute 37 E is the address of operand. the E Relative 67 E is the address of operand. the @E Deferred Relative 77 E is the pointer to the address of the operand. C-2 the PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C.3 INSTRUCTIONS The instructions which follow are grouped according they take and the bit patterns of their op-codes. to the operands In the representation of op-codes, the following symbols are used: SS Source operand specified by a 6-bit address mode. DD Destination operand specified by a mode. xx 8-bit offset to a location (branch instructions) R Integer between 0 and register. 7 6-bit representing address a general Symbols used in the description of instruction operations are: SE Source Effective address DE Destination Effective address () Contents of Is transferred to PS Processor Status word The condition codes in the processor status word (PS) are affected by the instructions. These condition codes are represented as follows: set i f the result is negative N ~egative Z Zero bit: set i f the result is zero V oVerflow bit: set i f the operation caused an overflow C .£arry bit: set i f the operation caused a carry bit: In the representation of the instruction's codes, the following symbols are used: * effect' on the condition Conditionally set Not affected o Cleared I Set To set conditionally means to use the instruction's result to determine the state of the code (see the PDP-II Processor Handbook). Logical operations are represented by the following symbols: Inclusive OR Exclusive OR & AND (used over a symbol) NOT (i.e., l's complement) C-3 PAL-llA ASSEMBLY LANGUAGE AND ASSEMBLER C.3.l Op A,A Double-Operand Instructions Op-Code MNEMONIC Stands for OlSSDD llSSDD MOV MOVB MOVe MOVe Byte (SE) -.. DE * * 0 02SSDD l2SSDD CMP CMPB CoMPare CoMPare Byte _(SE) - (DE) * * * 03SSDD 13SSDD BIT BITB BIt Test BIt Test Byte (SE) & (DE) * * 0 04SSDD 14SSDD BIC BICB BIt Clear BIt Clear Byte (SE) & (DE) -.. DE * * 0 05SSDD l5SSDD BIS BISB BIt Set BIt Set Byte (SE) ! (DE) -.. DE * * 0 06SSDD l6SSDD ADD SUB ADD SUBtract (SE) + (DE) -.. DE (DE) - (SE) -.. DE * * * * * * C.3.2 Operation Status Word Condition Codes N Z V C * * * Op A Single-Operand Instructions Op-Codes MNEMONIC Stands for Operation 0050DD lO50DD CLR CLRB CLeaR CLeaR Byte 005lDD lO5lDD COM COMB COMplement (DE) COMplement Byte 0052DD lO52DD INC INCB INCrement INCrement Byte (DE)+l 0053DD lO53DD DEC DECB DECrement DECr.ement Byte 0054DD lO54DD NEG NEGB 0055DD lO55DD Status Word Condition Codes C N Z V 0 1 0 0 * * 0 1 DE * * * (DE)-l DE * * * NEGate NEGate Byte (DE)+l DE * * * * ADC ADCB ADd Carry ADd Carry Byte (DE) + (C) -.. DE * * * * 0056DD lO56DD SBC SBCB SuBtract Carry (DE)-(C) -.. DE SuBtr.act Carry Byte * * * * 0057DD lO57DD TST TSTB TeST TeST Byte * * 0 0 0 DE DE (DE)-O -"DE C-4 PAL-11A ASSEMBLY LANGUAGE AND ASSEMBLER C.3.3 Op-Code Rotate/Shift Instructions MNEMONIC Op A Stands for Operation 15 C 0060DD 1060DD 0061DD 1061DD ROR RORB ROL ROLB ROtate Right ROtate Left Byte rD.J C Arithmetic Shift Right 1062DD ASRB Arithmetic Shift Right Byte 1063DD ASLB * * * 1* * * * 1* * * * 1* * * * JuMP 0003DD SWAB SWAp Bytes 110 1514 ~1 * * * * even or odd byte ~l~ c ~TI ~d: * * * * ~2,o * *' * * * * * * * * 0 0 even or odd byte Arithmetic Shift Left Byte JMP even or odd byte ~I~ Arithmetic Shift Left 0001DD ~:I : «0 DE -+ PC 15 0 I f °I 8·7 I ~~ .' C.3.4 1* cD=' cD~ ROtate Left ASR ASL 0 ROtate Right even or odd byte Byte ~, 0062DD 0063DD Status Word Condition Codes Z N V C Operate Instructions Op Op-Code MNEMONIC Stands for Operation 000000 HALT HALT The computer stops all functions. 000001 WAIT WAIT The computer stops and waits for an interrupt. C-5 Status Word Condition Codes Z C N V PAL-llA ASSEMBLY LANGUAGE AND ASSEMBLER 000002 RTI ReTurn from Interrupt The PC and PS are popped off the SP stack: * * * * ( (SP) ) -+ PC (SP) +2 ..... SP «SP» ..... PS (SP) +2 ..... SP RTI is also used to return from a trap. 000005 C.3.5 RESET RESET Trap Instructions Returns all I/O devices to power-on state. Op or Op E Where 0~E~377 8 Status Word Condition Codes C N Z V Op-Code MNEMON;IC *000003 (none) (breakpointTrap to location 14. This * is used to call ODT. trap) * * * *000004 IOT Input/Out- Trap to location 20. This put Trap is used to call IOX. * * * * 104000104377 EMT EMulator Trap Trap to location 30. This * is used to call system programs. * * * 104400 104777 TRAP TRAP Trap to location 34. This * is used to call any routine desired by the programmer. * * * Stands for Operation *Op (only) CONDITION CODE OPERATES Op-Code MNEMONIC Stands for 000241 CLC CLear Carry bit in PS. 000261 SEC SEt Carry bit. 000242 CLV CLear oVerflow bit. 000262 SEV SEt oVerflow bit. 000244 CLZ CLear Zero bit. 000264 SEZ SEt Zero bit. 000250 CLN CLear Negative bit. 000270 SEN SEt Negative bit. 000254 CNZ CLear Negative and Zero bits. 000257 CCC Clear all Condition Codes. 000277 SCC Set all Condition Codes. C-6 PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C.3.6 Branch Instructions Op E where-128 l0 S. (E-.-2)/2s.l27 l0 Condition to be met i f branch is to occur Op-Code MNEMONIC 0004XX BR BRanch always OOlOXX BNE Branch i f Not Equal (to zero) Z=O 0014XX BEQ Branch i f EQual zero) Z=l 0020XX BGE Branch if Greater than or Equal (to zero) N(DV=O 0024XX BLT Branch if Less Than (zero) N(DV=l 0030XX BGT Branch if Greater Than (zero) Z! (N(DV) =0 0034XX BLE Branch i f Less than or Equal (to zero) Z! (N(DV) =1 1000XX BPL Branch i f PLus N=O 1004XX BMI Branch i f MInus N=l 1010XX BHI Branch i f HIgher C Z 0 1014XX BLOS Branch i f LOwer or Same C Z 1 1020XX BVC Branch i f oVerflow Clear V=O 1024XX BVS Branch i f oVerflow Set V=l 1030XX BCC (or Branch if Carry Clear BHIS) (or Branch i f HIgher or Same) C=O 1034XX BCS (or Branch i f Carry Set (or BLO) Branch i f LOwer) C=l C.3.7 Stands for (to Subroutine Call Op ER, A Op-Code MNEMONIC Stands for 004RDD Jump to SubRoutine JSR Operation Push register stack,put the register: on PC the in SP the temporary DE (TEMP) - a storage register to internal processor. (SP) -2+SP (REG) -+- (SP) (PC) -+- REG (TEMP) -+- PC C-7 PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER C.3.8 Subroutine Return Op ER Op-Code MNEMONIC Stands for 00020R ReTurn from Subroutine C.4 RTS Operation Put register contents into and pop old contents from stack into register. PC SP ASSEMBLER DIRECTIVES Op-Code MNEMONIC Stands for Operation .EOT End Of Tape Indicates the physical end the source input medium . EVEN EVEN Ensures that the assembly location counter is even by adding I if it is odd .END mEND (m optional) Indicates the physical and logical end of the program and optionally specifies the entry point (m) . WORD E,E, .. E, E, ... WORD Generates words of data (the void operator) Generates words of data .BYTE BYTE E,E, .•. .ASCII ASCII Ixxx • .• xl of Generates bytes of data Generates 7-bit for the character enclosed by delimiters Ascii text , C.S ERROR CODES Error Code A Meaning ~ddressing error. An address within the instruction is incorrect. B Bounding error. Instructions or word assembled at an odd address in memory. data D Doubly-defined symbol referenced. Reference was made to a symbol which is defined more than once. I Illegal character detected. Illegal characters which are also non-printing are replaced by a? on the listing. L Line buffer overflow. are ignored. M Multiple definition of a label. A label was encountered which was equivalent (in the first six characters) to a previously encountered label. N ~umber P Ehase error. A label's definition or one pass to another. Extra characters (more are than being 7210 ) containing an 8 or 9 has a decimal point missing. C-8 value varies from PAL-llA ASSEMBLY LANGUAGE AND ASSEMBLER C.6 Q- Questionable syntax. There are missing arguments or the instruction scan was not completed, or a carriage return was not followed by a line feed or form feed. R Register-type error. An invalid use of or reference to register has been made. S Symbol-table overflow. When the. quantity of user-defined symbols exceeds the allocated space available in the user's symbol table, the assembler outputs the current source line with the S error code, then returns to the command string interpreter to await the next command string to be typed. T Truncation error. A number was too big for the allotted number of bits; the leftmost bits were truncated. T error does not occur for the result of an expression. U Undefined symbol. An undefined symbol was encountered during the evaluation of an expression. Relative to the expression, the undefined symbol is assigned a value of zero. a INITIAL OPERATING PROCEDURES Loading: Use Absolute Loader (see Chapter 6). Make sure that the start address of the absolute loader is in the switches when the assembler is loaded. Storage Re- PAL-llA exists in 4K and 8K versions. quirements: Starting Initial Dialogue: Immediately upon loading, PAL-llA will be in initiate dialogue. Printout control and Inquiry *S What is the input symbolic tape? *B What is the output device of the ~inary object tape? *L What is the :histing? *T What is the output device of the symbol !able? Each of these questions may characters: be output answered Character device by of device one of of Answer Indicated T ~eletype L :how-speed reader or punch H ~igh-speed P line Printer (8K version only) keyboard reader or punch C-9 the the the Source assembly following PAL-IIA ASSEMBLY LANGUAGE AND ASSEMBLER Each of these answers may be followed by other options: Option Typed characters indicating Function to be Performed II on pass 1 12 on pass 2 13 on pass 3 IE errors to be listed on the Teletype on the same pass (meaningful or *B or *L only) Each answer is terminated by typing the RETURN key. answer will delete the function. A RETURN alone as Dialogue during assembly: Printout Response EOF ? Place next tape in reader and type RETURN. A .END statement may be forced by typing E followed by RETURN. END ? Start next pass by placing reader and typing RETURN. EOM ? If listing on HSP or LPT, paper and type RETURN. start assembly again. replenish tape or If binary on HSP, Type CTRL/P. The started again. dialogue Restarting: C-IO initial first tape will in be APPENDIX D TEXT EDITOR, ED-II D.l INPUT/OUTPUT COMMANDS R Reads a page of text from input device, and appends it to the contents (if any) of the page buffer. Dot is moved to the beginning of the page and Marked. (See Band M below.) o Opens the input device when the user input with a new tape in the reader. wishes to continue ARGUMENTS ~n} o L @ Lists the character string (n) beginning at Dot and ending with nth line feed character. (-n) beginning with 1st character following the (n+l)th previous line feed and terminating at Dot. (0) beginning with 1st character of current line and ending at Dot. (@) bounded by Dot and the Marked location (see M). (/) beginning at Dot and ending with the last character in the page. / ~n} o P @ Punches the character string / F Outputs a Form Feed character tape. nT Punches four inches of Trailer (blank tape) n times. nN Punches contents of the page buffer (followed by a trailer if a form feed is present), deletes the contents of the buffer, and reads the next page into the page buffer. It does this n times. At completion, Dot and Mark are located at the beginning of the page buffer. V Lists the entire line containing Dot (i.e., line feed to next line feed or form feed). < Same as -IL. If Dot is located at the beginning of a line, this simply lists the line preceding the current line. > ~iststhe line following the current line. D-l and four inches from of blank previous TEXT EDITOR, ED-II D.2 POINTER-POSITIONING COMMANDS B Moves Dot to the beginning of the page. E Moves Dot to the end of the page. M Marks the current position of Dot for later reference in a command using the argument @. Certain commands implicitly move Mark. (n) (-n) (0) (@) (/) forward past n characters backward past n characters to the beginning of the current line to the Marked location to the end of the page n (n) -n (-n) forward past n ends-of-lin~s to first characte~ following the (n+l)th previous end-of-line to the beginning of current line to the Marked location to the end of the page Moves Dot: o A Moves Dot: @ / D.3 SEARCH COMMANDS nG XXXX Gets (searches for) the nth occurrence of the specified character string on the current page. Dot is set immediately after the last character in the found text, and the characters from the beginning of the line to Dot are listed on the teleprinter. If the search is unsuccessful, Dot will be at the end of the buffer and a ? will be printed out. H Searches the wHole file for ,the next occurrence, of the specified character string. Combines G and N commands. If search is not successful on current page, it continues on Next page. Dot is set immediately after the last charact~r in the found text and the characters from the beginning of the line to Dot are listed on the teleprinter. If the Search object is not found, Dot will be at the end of the buffer and a? will be printed out. In such a case, all text scanned is copied to the output tape. XXXX D.4 (0) (@) (/) COMMANDS TO MODIFY THE TEXT Character-Oriented nD nC XXXX DeleteS} the following Changes n characters -nD -nC XXXX DeleteS} the previous Changes n characters Line-Oriented Kills } eXchanges the character string beginning at Dot and ending at the nth end-of-line. -nK Kills } -nX eXchanges XXXX the character strinq beginning with th first character following the (n+l)th previous end-of-line and ending at Dot. nK nX XXXX D-2 TEXT EDITOR, ED-ll aD D,eletes } the current line OK Kills Changes up to Dot OX eXchanges XXXX Deletes } The character Kills @K Changes string begineXchanges @X ning at Dot and XXXX ending at a previously Marked location. OC XXXX @D @C XXXX /D /C DeleteS} the character Changes string beginning at Dot and ending with the last character of the page. xxxx the character string } beginning at Dot and ending at a previously Marked location. the character } string beginning at Dot and ending with the last character of the page. SYMBOLS Dot Location following the most recent character operated upon. t Holding down the CTRL key (not the t key) combination with another keyboard character. RETURN If in command mode, it executes the current command; goes into Text Mode if required. If in Text Mode, it terminates the current line, enters a carriage return and line feed into the buffer and stays in text mode. At all times causes the carriage to move to the beginning of a new line. (RETURN ,is often symbolized as .,..) ) . CTRL/FORM D.6 the current line up to Dot. Inserts the specified text. LINE FEED terminates Text Mode and causes execution of' the command. Dot is set to the location immediately following the last character inserted. If text was inserted before the position of Mark, ED~11 performs an M command. I XXXX D.5 Kills /K eXchanges /X XXXX } in (Typing the LINE FEED key) unless the first character executes the current command. Terminates Text Mode typed in Text Mode; A Form feed which terminates, page of the user's text. and thus defines, a GROUPING OF COMMANDS No Arguments V < > B E F H I M 0 R (Verify: Lists current line) (Lists previous line) (Lists next line) (Begin) (End) (Form feed) (wHole) (Insert) (Mark) (Open) (Read) Argument n only G N T D-3 (Get) (Next) (Trailer) All Arguments A C D J K L P X (n,-n,O,@,/) (Advance) (Change) (Delete) (Jump) (Kill ) (List) (Punch) (eXchange) TEXT EDITOR, ED-ll D.7 Requiring Text Mode Line Oriented Character Oriented C G H I X A K L P X J D (Jump) (Delete) C (Change) (Change) (Get) (wHole) (Insert) eXchange) (Advance) (Kill ) (List) (Punch) eXchange) OPERATING PROCEDURES D.7.1 Loading: Use Absolute Binary Loader D.7.2 Storage Requirements: ED-II uses all of core. D.7.3 Starting: Immediately upon loading, ED-II will be in control. D.7.4 Initial Dialogue: Program Types (see Chapter 5). User Response *1 L-.J H-.J (if LSR is to be used for source input) (if HSR is to be used for source input) *0 L...J H-.J (if LSP is to be used for edited output) (if HSP is to be used for edited output) I f the output device is the (HSP) , Editor enters high-speed punch command mode to accept input. Otherwise the sequence continues with: LSP OFF? ~(when LSP is off) Upon input of ~ from the keyboard, Editor enters command mode and ready to accept input. D.7.5 is Restarting: Type CTRL/P twice, initiating the normal initial dialogue. The text to be edited should be loaded (or reloaded) at this time. D-4 APPENDIX E DEBUGGING OBJECT PROGRAMS ON-LINE, ODT-ll AND ODT-llX E.I SUMMARY OF CONTENTS ODT indicates readiness to accept commands by typing location by printing its contents. l. * or by opening a ODT-ll n/ opens word n \ reopens last word opened RETURN key closes open location + opens next location t opens previous location + opens relatively addressed word $n/ opens general register n (0-7) n;G goes to word n and starts execution niB sets breakpoint at word n ;B removes breakpoint $B/ opens breakpoint status word i P proceeds from breakpoint, stops again on next encounter niP proceeds from breakpoint, stops again on nth encounter $M/ opens mask for word search n;W searches for words which match n in bits specified in $M n;E searches for words which address word n n/ (contents) miO calculates offsets from n to m $S/ opens location containing user program's status register $P/ opens location containing ODT's priority level E-1 DEBUGGING OBJECT PROGRAMS ON-LINE, ODT-II AND ODT-IIX NOTE If a word is currently open, new contents for the word may be typed followed by any of the commands RETURN,1-, t, -+- or. The open word will be modified and closed before the new command is executed. 2. ODT-llX In addition to the commands version has the foll,:owing: of the regular version, the extended n\ opens byte \ reopens last byte opened @ opens the absolutely addressed word > opens the word to which the branch refers < opens next location of previous sequence n;rB (r between 0 and 7) sets breakpoint r at word n ;rB removes breakpoint r ;B removes all breakpoints $B/ opens breakpoint 0 status word. Successive LINE FEEDs open words for other breakpoints and singleinstruction mode. inS enables Single-instruction mode value and is not significant) niP in single-instruction mode, Proceeds with program run for next n instructions before reentering ODT (if n is missing, it is assumed to be 1) ;S disables Single-instruction mode E-2 (n can have any APPENDIX F LOADING AND DUMPING CORE MEMORY F.l THE BOOTSTRAP LOADER This appendix pertains only to systems with a Switch Register. F.l.l Loading The Bootstrap Loader The Bootstrap Loader should be toggled into the bank. xx7744 xx7746 xx7750 xx7752 xx7754 xx7756 xx7760 xx7762 xx7764 xx7766 xx7770 xx 7772 xx7774 xx7776 highest core memory 016701 000026 012702 000352 005211 105711. 100376 116162 000002 xx7400 005267 177756 000765 yyyyyy xx represents the highest available memory bank. For example, the first location of the loader would be one of the following, depending on memory size, and xx in all subsequent locations would be the same as the first. Location Memory Bank Memory Size 017744 037744 057744 077744 117744 137744 157744 0 1 2 3 4K 8K 12K 16K 20K 24K 28K 4 5 6 The contents of location xx7776 (yyyyyy) in the Instruction column above should contain the device status register address of the paper tape reader to be used when loading the bootstrap formatted tapes specified as follows: Teletype Paper Tape Reader -- 177560 High-speed Paper Tape Reader -- 177550 F-l LOADING AND DUMPING CORE MEMORY 11-0068 Figure F-l Loading and Verifying the Bootstrap Loader F-2 LOADING AND DUMPING CORE MEMORY ------I see Fig ure E-1 L..----r-----I _________ Code 351 must be over reader sensors ------I see Figure 5-5 '------.----' 11-0067 Figure F-2 F.2 Loading Bootstrap Tapes into Core THE ABSOLUTE LOADER 1. Loading the Absolute Loader The Bootstrap Loader is used to load the Absolute Loader into core. (See Figure F-2.) The Absolute Loader occupies locations xx7474 through xx7743, and its starting address is xx7500. 2. Loading with the Absolute Loader When using the Absolute Loader, there are three types of loads available: normal, relocated to specific address, and continued relocation. Optional switch register settings for the three listed below. F-3 types of loads are LOADING AND DUMPING CORE MEMORY F.3 Type of load Switch Register Bits 1-14 Bit 0 Normal (ignored) o Relocated - continue loading where left off o 1 Relocated - load in specified area of core nnnnn (speci1ied address) 1 CORE MEMORY DUMPS The two dump programs are DUMPTT, which dumps the octal representation of the contents of all or specified portions of core onto the teleprinter, low-speed or high-speed punch, or line printer. DUMPAB, which dumps the absolute binary code of the contents of specified portions of core onto the low-speed (Teletype) or high-speed punch. Both d~mps are supplied on punched paper tape in bootstrap and absolute binary formats. The following figure summari.zes loading and using the Absolute binary tapes. F-4 LOADING AND DUMPING CORE MEMORY ABS LOADER IN CORE )-~N~O~____., HSR = 177550 LSR = 177560 xx IS HIGHEST CORE MEMORY BANK (This is necessary only if using a reader different from that used by the bootstrap loader.) TAPE READS IN YES CHECKYES SUM ERROR )----'--<>-{ NO Figure F-3 Loading with the Absolute Loader F-5 LOADING AND DUMPING CORE MEMORY LSR = 177560 HSR = 177550 xx IS HIGHEST CORE MEMORY BANK SPECIFY READER IN xx7766 BOOT ! SEE FIGURE F-1 ! TOGGLE IN BOOT LOADER ABS ! SEE FIGURE F-2! NO LOADER IN CORE NO YES ! SEE FIGURE F-21- - - -'- YES LOAD DUMP TAPE LOAD DUMP TAPE ___ -1 SETSRTO TRANSFER ADDRESS PRESS LOADADDR AND START TTY OR LSP SETSR TO 177564 OUTPUT DEVICE FOR DUMP LP HSP SETSRTO 177554 SETSR TO 177514 TTY OR TTY PRESS PUNCH ON PRESS CONTINUE Figure F-4 LOAD ABS LOADER Dumping Using DUMPAB or DUMPTT F-6 SEE FIGURE F-3! LOADING AND DUMPING CORE MEMORY Figure F-4 (continued). Dumping Using DUMPAB or DUMPTT F-7 APPENDIX G INPUT/OUTPUT PROGRAMMING, lOX G.l 'INSTRUCTION SUMMARY l. Format lOT . WORD .BYTE . WORD 2. (an address) (a command code, a slot number of a device) ;READR AND WRITR ONLY (done address) Command Codes: INIT RESET RSTRT WAITR SEEK READ WRITE READR WRITR G.2 1 2 3 4 5 11 12 13 14 PROGRAM FLOW SUMMARY 1. Set up buffer header: Location BUFFER HEADER Contents Buffer and Buffer+l Maximum number of data bytes (unsigned integer) Buffer+2 Mode of data (byte) Buffer+3 Buffer+4 and Buffer+5 Status of data (byte) Number of data bytes involved in transfer (unsigned integer) Buffer+6 Actual data begins here. Mode Byte Format Mode Byte Format Bits 7 1= NO ECHO 0= EC.HO 6 5 4 3 o Bits UNFORMATTED BINARY =1 FORMATTED ASCII =0 2 INPUT/OUTPUT PROGRAMMING, lOX Coding Mode Byte Formatted ASCII o Formatted Binary 1 Unformatted ASCII 2 Unformatted Binary 3 (or 200 to suppress echo) (or 202 to suppress echo) Status Byte Format Status Byte Format 6 7 1= DONE 1= EOM 5 3 4 1= EOF o 2 I I I I SEE CODES I I I I NON-FATAL ERRORS Coding Non-Fatal Errors checksum error (formatted binary) truncation of a long line an improper mode 2 3 4 2. Assign devices to slots in Device Assignment Table: (RESET and INIT commands) Slot numbers are in the range 0 to 7. Device Codes: KBD TTY LSR 3. G.3 1 2 3 LSP HSR HSP LPT 4 5 6 10 Use a data transfer command to initiate the transfer. FATAL ERRORS Fatal errors result in a jump to 40 with RO set to the error code. Errors 1-5 cause R1 is set to the value of the PC for error code O. Rl to be set to an lOT argument or to the instruction following the arguments. Reason Fatal Error Code o Illegal Memory Reference, SP overflow, illegal instruction 1 Illegal command 2 Slot out of range 3 Device out of range 4 Slot not inited 5 Illegal data mode G-2 APPENDIX H SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-II This appendix lists all the global entry points of FPMP-II and provides a brief description of the purposes of each. Sections H.l and H.2 are for reference when it is desired to call FPMP-II routines directly (i.e., without the use of the TRAP handler). Entry names preceded by an octal number can be referenced via the TRAP handler. The number is the "routine number" referred to in the FPMP-II manual. If the number is enclosed in parentheses, the routine cannot be accessed by the present TRAP handler, but has been assigned a number for future use. For a more detailed explanation of the Floating Point Math Package, refer to the FPMP-II User's Manual DEC-II-NFPMA-A-D. Examples ~f the calling conventions are: POLISH MODE: JSR R4,$POLSH $subrl $subr2 jenter Polish mode ;call desired subroutines $subrn • WORD ;call last subroutine desired ;leave Polish mode .+2 JSRR: XX: JSR RS,subr BR XX • WORD argl . WORD arg2 'jcall desired subroutine • WORD ;last argument ireturn point argn ;subroutine argument address ---------~--~----~--------~----~---------------------- --------------- H-1 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-ll JPC: push args onto stack JSR PC,subr H.l OTS ROUTINES Thesecare the routines taken from the FORTRAN operating The codes used in the £ollowingtable ar~: time system. S Routine is included in the standard single precision (2-word) package. D = Routine is included in the standard double precision (4-word) package. SD = Routine is included· in both standard packages. Octal codes shown in parenthe.ses are not yet implemented. NAME OCTAL CODE PKG #: OF ARGU MODE DESCRIPTION $ADD 14 D 2 Polish The double precision add routine. Adds the top stack item (4-words) to the second item (4-words) and leaves the four word sum in their place. $ADR 12 S 2 Polish The single precision add routine. Same as $ADD except it uses 2 word numbers. AINT 26 S 1 J5RR Returns sign of argument * integer = greatest real absolute value of the argument in RO;Rl. ALOG 53 S 1 J5RR Calculates natural logarithm of its single argument and returns a two word result in RO,Rl. ALOGIO 54 S, 1 J5RR Same as ALOG, except calculates base-IO logarithm. ATAN 42 S 1 J5RR Returns th~ arctangent of argument in RO,Rl. its ATAN2 (43) S 2 J5RR Returns ARCTAN (ARGI/ARG2) RO,Rl. in $CMD 16 D 2 Polish Compares top 4 word items on the stack, flushes the two items; and returns the following condition codes: 4(SP) @SP N=l,Z=O 4(SP) @SP N=O,Z=l 4(SP) @SP N=O,Z=O H-2 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP~11 $CMR. 17 S 2 Polish Same as $CMD except it is 2 word arguments. for cos 37 .S 1 J5RR Single DCOS. precision version of DATAN 44 D .1 J5RR Double ATAN. precision version of DATAN2 (45) D 2 J5RR Double ATAN2. precision version of DBLE (34) 1 J5RR Returns in RO-R3 the double precision equivalent of the single precision (two word) argument. $DCI (57) 4 . JPC ASCII to double conversion. Calling sequence: Push address of start of ASCII field. Push length of ASCII field in bytes. Push format scale D (from W.D) position of assumed decimal point (see FORTRAN manual) . Push P format scale (see FORTRAN manual). JSR PC,$DCI. SD Returns 4 word result of stack. on top $DCO (61) SD 5 JPC Double precision to A~CII conversion. Calling sequence: Push address of start of ASCII field. Push length in bytes of ASCII field (W part ofW.D) Push D pait of W.D position of decimal point). Push P scale. Push 4 word value to be converted, lowest order word first. JSR PC,$DCO. DCOS 41 D 1 J5RR Calculates the cosine of its double precision argument and returns the double precision result in RO-R3. DEXP 52 D 1 ··J5RR Calculates the exponential of its double precision argument, and returns the double precision result in'RO-R3. $DI (11) SD Polish Converts double precision number on the top of the stack to integer. Leaves result on stack. $DINT (76) D Polish OTS internal function to find the integer part of a double precision number. 1 H-3 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-ll DLOG 55 D 1 J5RR Double precision version of ALOG. (4 word) DLOGIO 56 D 1 J5RR Double precision version of ALOGIO. (4 word) $DR (6 ) 1 Polish Replaces the. double precision item at the top of the stack with its two word, rounded form. DSIN 40 D 1 J5RR Calculates the sine of its double prec1s10n argo and returns the double precision result in RO-R3. DSQRT 47 D 1 J5RR Calculates the square root of its double ptecision argo and returns the double precision result in RO-R3. $DVD 23 D 2 Polish The double precision division routine. Divides the second 4-word item on the stack by the top item and leaves the quotient in their place. $DVI (24) 2 Polish The integer division routine. and Calculates 2(SP)/@SP returns the integer quotient on the top of the stack. $DVR 25 S 2 Polish The single precision division routine. Same as $DVD, but point for 2 word floating numbers. $ECO (62) SD 5 JPC ASCII Single precision to according to E conversion format. Same calling sequence as $DCO except that a 2-word value is to be converted. EXP 51 S 1 J5RR Single DEXP. RO,Rl. $FCALL S $FCO (64) FLOAT (32) $GCO (63) SD SD precision Returns version result of in Internal OTS routine. 5 JPC Same as $ECO except format conversion. 1 J5RR Returns in equivalent argument. 5 JPC Same as $ECO except format conversion. H-4 uses F RO-Rl, the real of its integer uses G SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-ll $ICI (65) 2 JPC ASCII to integer conversion calling sequence: Push address of start of ASCII field. Push length in bytes of ASCII field. JSR PC,$ICI Returns with integer result on top of stack. $ICO (67) 3 JPC Integer to ASCII conversion. Calling sequence: Push address of ASCII field. Push length in bytes of ASCII field. Push integer value to be converted. JSR PC,$ICO Error will return with C bit set on. Ro-R3 destroyed. IDINT (31) 1 J5RR Returns sign of arg * greatest integer <= arg in RD. Arg is double precision. $ID ( 5) 1 Polish Convert full word argument on the top of the stack to double precision and return result as top 4-words of stack. IFIX (35) 1 J5RR Returns the truncated and fixed real argument in RD. INT (30) 1 J5RR Same as IDINT precision args. $INTR (27) S 1 Polish Same function as AINT, but called in Polish mode with argument and returns result on the stack. $IR ( 4) SD 1 Polish Convert full word argument on the top of the stack to single precision and return result as top 2-words of stack. $MLD 22 D 2 Polish precision multiply. Double Replaces the top two doubles stack with their on the product. $MLI (20) 2 Polish Integer multiply. Replaces the top 2 integers on the stack with their full word product. $MLR 21 S 2 Polish precision multiply. Single Replaces the top two singles on the stack with their product. $NGD ( 3) SD 2 Polish Negate number stack. SD H-5 the on for single double precision the top of the SUMMARY OF FLOA~ING POINT MATH PACKAGE, FPMP-ll $NGI (1) SD 1 Polish Negate the integer on the of the stack. $NGR (2) SD I Polish Negate number stack. $OCI (66) 2 JPC ASCII to octal conversion. Same call as $ICI. $OCO (70) 3 JPC Octal to ASCII conversion. Same call as $ICO. $POLSH SD $POPR3 D the on top single precision the top of the Called whenever it is desired to enter Polish mode from normal in-line code. It must be called via a JSR R4,$POLSH. Polish Internal routine to 2-words from the stack place them into RO,Rl. pop ~nd $POPR4 D Polish Internal routine to 4-words from the stack place them in RO-R3. $:POPR5 D Polish Internal routine to pop 4-words from the stack and place them in registers RO-R3. $PSHRI SD Polish Internal routine to push the contents of RO onto the stack. $PSHR2 SD Polish Same as $PSHRI. $PSHR3 SD Polish Push RO,Rl onto stack. $PSHR4 SD Polish Push RO-R3 onto stack. $PSHR5 SD Polish Same as $PSHR4. JPC ASCII to single precision Same conversion. calling sequence as $DCI. Returns 2-word result on top of stack. Polish Converts the single precision number on the top of the stack to double preclslon format. Leaves result on stack. pop and $RCI (60) $RD (7) $RI (10 ) SD Polish Converts single precision number on the top of the stack to integer. Leaves result on stack. $SBD 15 D Polish The double precision subtract routine. Subtracts the double precision number on the top of the stack from the second double precision number on the stack and leaves the result on the top of the stack in their place. SD 4 H-6 SUMMARY OF FLOATING POINT MATH .PACKAGE, FPMP-ll $SBR 13 S SIN 36 S SNGL (33) SQRT 46 TANH 50 H.2 Polish Same as $SBD precision. I J5RR Single DSIN. I J5RR Rounds double precision argument to single precision. Returns result in RO,RI. S I J5RR Single DSQRT. S I J5RR Single precision hyperbolic function. Returns tangent (EXP(2*ARG)-I/(EXP(2*ARG)+I) in RO,RI. precision precision for single version version OCTAL CODE PKG of should not SD Internal error handler. $ERRA SD Similar to $ERR. $LDR 71 S Load FLAC, single precision. $LDD 72 D Load FLAC, double precision. $STR 73 S Store FLAC, single precision. $STD 74 D Store FLAC, double precision. SD The TRAP handler routines and tables. TRAPH be DESCRIPTION $ERR H.3 of NON-OTS ROUTINES These routines are written especially for FPMP-II and called directly by the user. NAME but ROUTINES ACCESSED VIA TRAP HANDLER The following is a table of the FPMP-II routines which can be accessed via TRAPH, the trap handler. Each routine name (entry point) is preceded by its TRAP code number to be used to access it, and followed by a brief description of its operation when called via the TRAP handler. Those entries which are preceded by an asterisk (*) perform operations only on the FLAC, and address no operands. For example, a TRAP call to the single precision square root routine can be coded as follows: TRAP 46 H-1 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-ll The net effect of the above TRAP instruction is to replace the contents of the FLAC with its square root and then set the condition codes to reflect the result. Note that since the FLAC is implicitly addressed in this instruction, the TRAP call supplies no other address. For such a TRAP call, the addressing mode bits (bits 6 and 7 of the TRAP instruction) are ignored. All entries not marked by an asterisk require an operand when called. The operand is addressed in one of the four addressing modes explained in section 3.1.1. of the FPMP-ll User's Manual. The addressing mode is specified in bit 6-7 of the TRAP instruction. ("Operand" is the contents of call. ) * the location addressed in the TRAP OCTAL CODE NAME DESCRIPTION 14 $ADD Adds Double precision addition routine. Assumes 4-word operand to the FLAC. operand. 12 $ADR Adds Single precision addition routine. Assumes 2-word operand to the FLAC. operand. 26 AINT Replaces contents of the FLAC by its part. SIGN (FLAC) integer * greatest 2-word integer Assumes <= IFLACI argument in FLAC. . * 53 ALOG Replaces contents of logarithm. natural argument in FLAC. the FLAC Assumes by its 2-word * 54 ALOGIO Same as ALOG, except log. calculates base-IO * 42 ATAN Replaces contents of Assumes arctangent. FLAC. the FLAC by its 2-word argument in 16 $CMD Compares operand to the contents of the FLAC, and returns the following condition codes. FLAC<operand, N=l,Z=O FLAC=operand, N=O,Z=l FLAC>operand, N=O,Z=O Assumes 4-word operands. * * * 17 $CMR Same as $CMD, but for 2-word operands. 37 COS Same as DCOS, but for 2-word argument. 44 DATAN Same as ATAN, but for 4-word argument. 52 DEXP Replaces the contents of the FLAC by its exponential. Assumes 4-word argument in the FLAC. H-8 SUMMARY OF FLOATING POINT MATH PACKAGE, FPMP-Il * 55 DLOG Same as ALOG, but for 4-word argument. * 56 DLOGIO Same as ALOGIO, but for 4-word argument. * 41 DCOS Replaces the contents of the FLAC by its cosine. Assumes 4-word argument in the FLAC. * 40 DSIN Same as DCOS, but calculates sine instead of cosine. * 47 DSQRT Replaces the contents of the FLAC by its square root. Assumes 4-word argument in the FLAC. 23 $DVD Double precision division routine. Divides the FLAC by the operand and stores the result in the FLAC. Assumes 4-word operands. 25 $DVR Same as $DVD, but for 2-word operands. 51 EXP Same as DEXP, but for 2-word argument. 72 $LDD Same as $LDR, but assumes 4-word operand. 71 $LDR Replaces the contents of the FLAC by operand. Assumes 2-word operand. 22 MLD Double precision multiplication routine. Multiplies the contents of the FLAC by the operand and stores the result in the FLAC. Assumes 4-word operands. 21 $MLR Same as $MLD, but for 2-word operands. 15 $SBD The double precision sUbtraction routine. Subtracts the operand from the contents of the FLAC. Assumes a 4-word operand. 13 $SBR Same as $SBD, but for 2-word operand. * 36 SIN Same as DSIN, but for 2-word argument. * 46 SQRT Same as DSQRT, but for 2-word argument. 73 $STR Stores the contents of the FLAC into the operand location. The contents of the FLAC are unchanged. 74 $STD Same as $STR, but assumes 4-word location. 50 TANH Replaces the contents of the FLAC by its hyperbolic tangent. Assumes 2-word argument. * * H-9 the operand APPENDIX I TAPE DUPLICATION Duplication of paper tapes can be accomplished via low- or high-speed I/O devices by toggling (as with the Bootstrap Loader) the following program directly into memory through the Switch Register. (Refer to Section 6.1.1 in Chapter 6 if necessary, for toggling procedure.) 1. Turn on appropriate device switches and place tape in desired reader. 2. Set ENABLE/HALT switch to HALT. 3. Set Switch Register to the desired starting address and press LOAD ADDR. 4. Set Switch Register to each value listed in the CONTENTS column below, lifting the DEP switch after each setting. (Addresses are automatically incremented.) The desired input device (either Low- or High-Speed Reader) and output device (Low- or High-Speed Punch) are- specIfied in the last two words. ADDRESS CONTENTS o 016700 000024 016701 000022 005210 105710 100376 105711 100376 022021 111011 000764 177560 (LSR) or 177550 (HSR) 177564 (LSP) or 177554 (HSP) 2 4 6 10 12 14 16 20 22 24 26 30 32 5. Set Switch Register to starting address specified in 3 and press LOAD ADDR. 6. Set ENABLE/HALT switch to ENABLE. 7. Press START switch. I-I above TAPE DUPLICATION NOTE This program is recommended as a simple way of duplicating the system tapes. However, for extensive tape duplication, the program shown in section 7.8 is recommended. I-2 APPENDIX J ASSEMBLY AND LINKING INSTRUCTIONS J.I J.I.I SYSTEMS WITHOUT SWITCH REGISTERS IOX/IOXLPT IOX/IOXLPT is provided in both source and relocatable object form. Unless modifications are made to the source it is not necessary to assemble the source tapes. The object tape may be linked with the user's object tapes to produce an absolute tape (.LDA). J.I.I.I Assembling lOX - lOX consists of three source tapes (-PAl to -PA3) . These tapes are assembled together in sequence with PAL-lIS. J.I.I.2 Assembling IOXLPT - IOXLPT consists of two source tapes (-PAl to PA2). These tapes are assembled together in sequence with PAL-lIS. J.I.I.3 Linking lOX and IOXLPT - IOX and lOXLPT are linked LINK-lIS with the user's object tapes to produce an absolute tape. J.I.2 by ODTIIX ODTllX is provided in both source and relocatable object form. Unless modifications are made to the source, it is not necessary to assemble the source tape. The object tape may be linked with the user's object tapes to produce an absolute tape. J.l.2.1 Assembling ODTIlX - ODTIIX consists of one source tape (-PAL) which is terminated with the following: .EOT form feed .END O.ODT When PAL-IlS indicates that it has encountered the .EDT, so that it will process the .END statement. J-l type return ASSEMBLY AND LINKING INSTRUCTIONS J.1.2.2 Linking ODTllX - ODTllX is linked with user object tapes. It is self starting and should be the first object tape input to LINK-lIS so that it will be the program started by the Absolute Loader when the program is loaded. J.1. 3 ED-II The ED-II source file is available only in RT-ll format on a flexible diskette. The RT-ll MACRO assembler is required to assemble ED-II. The RT-ll linker (LINK) is us~d to produce the absolute tape. J.1.3.l Assembling ED-II - The RT-ll commands to assemble as follows: ED~ll are .R MACRO *EDITll=DXl:EDITll J.1. 3.2 Linking ED-II - The RT-ll follows: commands to link ED-ll are as .R LINK *PP:EDITll/L=EDITll J.1. 4 PAL-llS The PAL-lIS source file is available only in RT-ll format on a flexible diskette. The RT-ll MACRO assembler is required to assemble PAL-lIS. The RTll linker (LINK) or LINK-lIS may be used to produce the absolute tape. are J.l.4.l Assembling PAL-lIS - There are three sources which assembled separately for PAL-lIS. One of these, the symbol table source, is available in three versions: 8K, 12K, and 16K. The RT-ll commands to assemble PAL-lIS source files are as follows: .R MACRO *RELMEM=DXl:RELMEM.PAL *PSYM08=DXl:PSYM08.PAL *PSYM12=DXl:PSYM12.PAL *PSYM16=DXl:PSYM16.PAL *PALllS=DXl:PALllS.PAL Clear Memory Program 8K Symbol Table 12K Symbol Table 16K Symbol Table Assembler In addition to the above, IOXLPT is used by PAL-lIS. The IOXLPT source is also available in RT-ll format on a flexible diskette. The commands to assemble IOXLPT are: .R MACRO *IOXLPT=DXl:IOXLPT.PAL J-2 ASSEMBLY AND LINKING INSTRUCTIONS J.I.4.2 Linking PAL-lIS - PAL-lIS may be linked with LINK-lIS or the RT-II linker, LINK. The PAL-lIS tape actually contains two programs: RELMEM and PAL-lIS. RELMEM precedes PAL-lIS on the tape. Using LINK-lIS, link PAL-lIS as follows: 1. Link RELMEM as a separate program and do not remove the from the punch when finished. tape 2. Link PALIIS.OBJ, IOXLPT.OBJ, and one of the symbol table object tapes (PSYM08.0BJ, PSYMI2.0BJ, or PSYMI6.0BJ) in that order. The symbol table tape is selected depending on the size of the memory of the computer on which the program is to be executed. If the target computer has 8K words of memory then PSYM08.0BJ, if 12K then PSYMI2.0BJ, and if 16K then PSYMI6.0BJ. Specify a top address of 57460 for 12K and 77460 for 16K. DO not link PAL-lIS to run above 16K. The size of the symbol table is fixed, and there is no need to re-link at a higher address even on large systems. Using RT-II LINK, link PAL-lIS as follows: 1. Link RELMEM as a separate program as shown .R LINK *RELMEM/L=RELMEM 2. Link 8K, 12K, and 16K versions of PAL-lIS .R UN', *PAL08/L/B:204=PALllS~IOXLPT~PSYM08 *PAL12/L/B:204~PALllS,IOXLPT,PSYM12 *PAL :l6/L/B: 204~-::PAI... l:l. S, I OXI...PT, PSYM16 3. Use RT-II PIP to punch the tapes. Remember not to remove the tape from the punch after punching RELMEM . • R PIP *PP:=REI...MEM.I...DA/B *PP:=PAI...08.I...DA/B remove 8K PALIIS.LDA from punch *PP:=REI...MEM.I...DA/B *PP=::PAL:L2.I...DA/B remove 12K PALIIS.LDA from punch *PP:=REI...MEM.LDA/B *PP:~PAL:l.6.I...DA/B J.1. 5 LINK-llS The LINK-lIS source file is available only in RT-II format on a flexible diskette. The RT-II MACRO assembler is required to assemble LINK-lIS. LINK-lIS is composed of two components: LINK-lIS proper and IOXLPT. See Section N.l.4.1 for instructions on how to assemble IOXLPT using RT-II. J-3 ASSEMBLY AND LINKING INSTRUCTIONS J.l.5.l follow: Assembling LINK-lIS - The RT-ll commands to assemble LINK-lIS .R MACRO *LINKll=DX1:LINKll J.l.5.2 Linking LINK-lIS - LINK-lIS may be linked with LINK-lIS or the RT-ll linker, LINK. There are two object tapes which ate linked together to produce LINK-lIS: LINKll.OBJ and IOXLPT.OBJ. Using LINK-lIS to link LINK-lIS, link the following two tapes in order: LINKll.OBJ and IOXLPT. If versions are desired for systems with more than 8K, specify a top address of 57460 for 12K and 77460 for 16K. Using RT-ll LINK to link LINK-lIS is a two step process because of a difference in philosophy. An initial link is required which produces a link map so that the size of LINKllS can be determined. A final link is then made with the information obtained in the initial link used to compute the bottom address. The initial link is executed as follows: .R LINK *,TT:=LINKll,IOXLPT The value displayed for "HIGH LIMIT" is used to compute the bottom address for the final link. Assume for an example that the following was displayed: HIGH LIMIT = 015572 Select 37460, 57460, or 77460 depending on whether an 8K, 12K, or 16K top address is desired. The bottom address is computed as follows: B = T - 4 + 1000 Where: B = bottom address T top address H high limit Example: B 37460-15572+1000 B = 22666 Using the figures in the example above, system would be executed as follows: the final link for an 8K .R LINK *PP:/B:22666/L,TT:=LINKll,IOXLPT As a check, examine the link map produced and verify limit matches the one used in the calculations above. the high limit value must be 37460. J-4 that the high In the example, ASSEMBLY AND LINKING INSTRUCTIONS J.2 SYSTEMS WITH SWITCH REGISTERS J.2.1 Assembling PAL-IIA The following procedures are for assembling the PAL-II Assembler source tapes. An 8K version of the PAL-IIA (V007A) Assembler is required, thus also requiring at least an 8K PDP-II system. The Assembler consists of two programs. The first program, on tape 1, is a memory clear program and is very short (DEC-II-UPLAA-A-PAl). The second program is the Assembler proper, and consists of eleven ASCII tapes (DEC-II-UPLAA-A-PA2-PA12). They are assembled as follows: 1. Generate a sufficient amount of blank leader tape. 2. Assemble the memory clear program source tape (DEC-ll-UPLAA-A-PAl) and assign the binary output to the high-speed punch. For example, PAL-IIA's initial dialogue to specify the 2-pass assembly would be: *S *B *L *T H HIE (PAl assembly - 1st pass) END? 000000 ERRORS C 3. (PAl assembly - 2nd pass) (No errors - Do not remove the binary tape from the punch.) Assemble the rest of the Assembler's PA12) in numerical sequence. source tapes (PA2 Assign the binary output to the high-speed punch. For example, the initial dialogue should be answered as follows: *S H *B HIE *L *T EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? MAXCL13 END ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? (Enter tape PA2 for 1st pass) (End of tape PA2, enter PA3) (End of tape PA3, enter PA4) (End of tape PA4, enter PAS) (End of tape PAS, enter PA6) (End of tape PA6, enter PA7) (End of tape PA7, enter PA8) (End of tape PA8, enter PA9) (End of tape PA9, enter PAID) (End of tape PAID, enter PAll) (End of tape PAll, enter PA12) (End of first pass) ****** SIMBC = ****** (Enter tape PA2 for 2nd pass) (End of tape PA2, enter PA3) (End of tape PA3, enter PM) (End of tape PA4, enter PAS) (End of tape PAS, enter PA6) (End of tape PA6, enter PA7) (End of tape PA7, enter PA8) (End of tape PA8, enter PA9) (End of tape PA9, enter PAID) (End of tape PAID, enter PAll) (End of tape PAll, enter PAI2) J-S ASSEMBLY AND·· LINKING INSTRUCTIONS 000000 ERRORS (End of 2nd pass) C *S Note that at the end of the first pass there are two undefined symbols: MAXCl3 and SIMBC. These undefined symbols are resolved so that there are no errors reported during the second pass. Be sure that there is sufficient blank trailer tape on the output tape before removing the assembled tape from the punch. binary Normally, using high-speed paper tape input and output, this process requires about 45 minutes. If a symbol table and listing are requested, there will be about 750 symbols and about 4500 lines of listing. J.2.2 Assembling ED-II ED-II consists of five source tapes (PAl to PAS) which together in sequence with 8K PAL-IIA. are assembled In subsequent discussion, reference to ODT applies to both ODT is supplied on both source and absolute binary tapes. versions. J.2.3 ODT-II/ODT-IIX If the program being debugged requires storage where the version of ODT being used is normally loaded, it is necessary to reassemble ODT after changing the starting location. The source tape of ODT is in three segments, each separated next by blank tape. The first segment contains: .=n .EOT from the (standard location setting statement) where n=13026 for ODT-II or n=12054 for ODT-IIX. This statement tells the Assembler to start assembling at address n. To relocate ODT to another starting address, substitute for segment one a source tape consisting of: . (n is the new load address for ODT) .=n .EOT The .EOT statement tells the Assembler that this is the end of the segment but not the end of the program -- the Assembler will stop and wait for another tape to be placed in the reader. The second segment of tape contains the segment is also terminated with .EOT. ODT source program. This The third segment of the tape consists of the statement: .END O.ODT where .END means "end of program" and O.ODT address of the program (see Section 6.2.3). represents the starting When relocating ODT, the first segment of the source tape must be changed to reflect the desired load address. The third segment may be changed to .END without a start address. The latter will cause the Loader to halt upon completion of loading. J-6 ASSEMBLY AND LINKING INSTRUCTIONS The segmentation allows the following assembly forms: 1. Assemble alone but at a new address. A new segment one be generated and assembled with segments two and three. must 2. Assemble immediately after the user's program to be debugged. Assemble the tape of the user's program (ending with .EOT) followed by ODT's segment two and either segment three or a new segment three. 3. Assemble inside the program to be debugged. Assemble the first part of the user program (ending with .EOT) followed by ODT's second segment followed by the second part of the user program. When setting locations before assembling, it must be noted that immediately preceding ODT a minimum internal stack of 40 8 bytes is required for the ODT~ll and 116 8 bytes is required· for ODT-IIX. Additional room must be allocated for subroutine calls and possible interrupts while ODT is in control. Twelve bytes maximum will be used by ODT proper for subroutine calls and interrupts, giving a minimum safe stack space of 528 bytes for ODT-ll or 1308 bytes for ODT-IIX. Once a new binary tape of ODT has been assembled, load it using the Absolute Loader as explained in Section 6.2.2. Normally, the program to be debugged is loaded before ODT, since ODT will automatically be in control immediately after loading, unless the third segment of ODT's source tape was altered before assembly. As soon as the tape is read in, ODT will print an * on the Teletype to indicate that it is ready for a command. J.2.4 Assembling IOX/IOXLPT In subsequent discussion, reference to lOX applies to both lOX is supplied on both source and absolute binary tapes. versions. If there is more than 4K of core available and it is desired to load lOX (or IOXLPT) in other than the normal location, lOX must be reassembled. The code .=15100 .EDT appears at the beginning of the first lOX tape (PAl) and contains the starting address. Create a new tape containing the new starting address desired; be sure to allow enough room for 63410 words for lOX, 72510 for IOXLPT. For example, .=25100 .EDT Use PAL-IIA to assemble rox and substitute the new section of the first part of the old tape (PAl). After the new section insert the lOX tape in the reader so the read head is past starting address and .EOT and type the RETURN key to read in of the tape. tape for is read, the old the rest Now read in the second tape (PA2). An EOF? message is output at the end of the second tape. Type the RETURN key and the END? message is printed. Put the tapes through for the second pass of the assembler. J-7 ASSEMBLY AND LINKING INSTRUCTIONS lOX (IOXLPT) can also be assembled with a user program if desired. The .=15100 and .EOT lines must be deleted before lOX is assembled with a user program. lOX can be assembled into the program wherever desired but if it is the first tape read by the assembler, remove it from the reader before typing the RETURN key (after the EOF? message of the second tape. lOX and IOXLPT have a .END code which would cause the assembly pass to end when read). Assembling a user program and lOX together eliminates the need to read in lOX each time the program is run. J.2.5 Assembling and Linking PAL-lIS PAL-lIS consists of two independent programs. The first program is a memory clear program. The second is the assembler. All programs are available as ASCII source tapes, object modules and as a load module. The memory clear program, MEMCLR, (DEC-II-UPLSA-A-PAl) consists of one ASCII tape. This program should never need to be assembled. The object module may be used when constructing a new load module of PAL-lIS. The assembler consists of three program modules which are assembled separately and then linked together. The first is the main program called PAL-lIS. It consists of 13 ASCII tapes (DEC-UPLSA-A-PA2-PA14). The second module is the symbol table, PALSYM, which consists of 2 ASCII tapes (DEC-II-UPLSA-A-PA15-PA16). The third is IOXLPT consisting of 2 ASCII tapes (DEC-II-UPLSA-A-PA17-PA18). Also included is PALSYM, specially created for 12K and 16K, consisting of one tape each (DEC-II-UPLSA-A-PA19-PA20). If changes are made in any of these modules, that module must be assembled by PAL-lIS (V003A) and the new object module can be linked with the other object modules. It should be noted that assembly of these programs will result in: Program PAL-lIS PALSYM IOXLPT Pages of Listing (Decimal) Number of Symbols (Decimal) 160 11 29 756 32 191 Also note that there will be two undefined symbols listed at the end of pass 1. These are forward references on direct assignments which get defined properly in pass 2. An example of the PAL-lIS assembly follows: PAL-lIS V003A *S H *B H *L P *T P/2 END ? 000000 ERRORS (first pass on PAl) (2nd pass on PAl) (End of tape tl assembly) (Remove tape from punch) J-8 ASSEMBLY AND LINKING INSTRUCTIONS PAL-llS V003A *S H *B H *L P *T P/2 EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? - EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? BINCNT=****** SIMBC=****** END ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? EOF ? 000000 ERRORS (Insert PA2 for 1st pass) (End of PA2, insert PA3) (End of PA3, insert PA4) (End of PA4, insert PAS) (End of PAS, insert PA6) (End of PA6, insert PA7) (End of PA7, insert PAS) (End of PAS, insert PA9) (End of PA9, insert PAlO) (End of PAlO, insert PAli) (End of PAll, insert PA12) (End of PA12, insert PAl3) (End of PA13, insertPA14) (End of PA14 and 1st pass) (Insert PA2 for 2nd pass) (End of PA2, insert PA3) (End of PA3, insert PA4) (End of PA4, insert PAS) (End of PAS, insert PA6) (End of PA6, - insert PA7) (End of PA7, insert PAS) (End of PAS, insert PA9) (End of PA9, insert PAlO) (End of PAlO, insert PAll) (End of PAll, insert PA12) -(End of PA12, insert PAl3) (End of PA13, insert PAl4) (End of PA14 and 2nd pass) (Remove tape from punch) PAL-lIS V003A *S H *B H *L P *T P/2 EOF ? END ? EOF ? 000000 ERRORS (1st pass on PAIS) (End of PAIS, insert PA16) (End of PA16, insert PAIS for 2nd pass) (End of PAIS, insert PA16) (End of 2nd pass) (Remove tape from punch) PAL-llS V003A *S H *B H *L P *T P/2 EOF ? END ? EOF ? 000000 ERRORS (1st pass on PA17) (End of PA17, insert PAIS) (End of PAIS, insert PA17 for 2nd pass) (End of PA17, insert. PAIS) (End of 2nd pass) (Remove tape from punch) PAL-llS V003A *S H *B H *L P *T P/2 END ? 000000 ERRORS (Pass 1 on PA20) (Pass 2 on PA20) (End of pass 2) (Remove tape from punch) J-9 ASSEMBLY AND LINKING INSTRUCTIONS The final load module is constructed by LINK-lIS. First the· memory clear program object module is processed by the linker and the resulting load module is left in the punch while the PAL-lIS, PALSYM, and IOXLPT object modules are linked to create a second load module. The resulting tape ~ontains two load modules. The first clears memory and then jumps to the absolute loader to load the second. In order to take advantage of core sizes larger than 8K, PALSYM, the symbol table, specially created for 12K core and 16K core, and the object modules are included with the assembler. To link for 12K (or 16K), simply sUbstitute the appropriate object tape for PALSYM (use DEC-II-UPLSA-A-PR5 for 12K or DEC-II-UPLSA-A-PR6 for 16K) specify a top address to LINK-lIS ~f 57460 for 12K (77460 for 16K) and link as described in the preceding paragraph. Do not reI ink PAL-lIS to run above 16K. The size of the symbol table is fixed, and there is no ne.ed to re-link at a higher address even on large systems. The supplied tapes are identified as follows: Contents Library Code DEC-II-UPLSA-A-PAI Tape 1 of 20 DEC-II-UPLSA-A-PA2 DEC-II-UPLSA-A-PA8 DEC-II-UPLSA-A-PA9 DEC-II-UPLSA-A-PAIO DEC-II-UPLSA-A-PAII DEC-II-UPLSA-A-PA12 DEC-II-UPLSA-A-PA13 DEC-II-UPLSA-A-PA14 Tape Tape Tape Tape Tape Tape Tape Tape Tape Tape Tape Tape Tape DEC-II-UPLSA-A-PA15 DEC-11-UPLSA-A-PA16 Tape 15 of 20 } Tape 16 of 20 One Assembly DEC11-UPLSA-A-PA17 DEC-II-UPLSA-A-PA18 DEC-II-UPLSA-A-PA19 DEC-II-UPLSA-A-PA20 Tape Tape Tape Tape 17 18 19 20 One Assembly One Assembly One Assembly DEC-II-UPLSA-A-PRI DEC-II-UPLSA-A-PR2 DEC-II-UPLSA-A-PR3 DEC-II-UPLSA-A-PR4 DEC-II-UPLSA-A-PR5 Tape Tape Tape Tape Tape 1 of 2 of 3 of 4 of 5 of DEC-II-UPLSA-A-PR6 Tape 6 of 6 DEC-II-UPLSA-A~PA3 DEC-II-UPLSA-A-PA4 DEC-II-UPLSA-A-PA5 DEC-II-UPLSA-A-PA6 DEC-Il~UPLSA-A-PA7 DEC-II-UPLSA-A~PL I 2 of 20 3 of 20 4 of 20 5 of 20 6 of 20 7 of 20 8 of 20 9 of 20 10 of 20 11 of 20 12 of 20 13 of 20 14 of 20 of of of of 20 } 20 20 20 6 6 6 6 6 One Assembly RELMEM (Memory Clear Program) PAL-lIS (Main Program) One Assembly PALSYM (Symbol Table) for 8K IOXLPT PALSYM (Symbol Table) for 12K PALSYM (Symbol Table) for 16K RELMEM Object Module PAL-lIS Object Module PALSYM Object Module for 8K IOXLPT Object Module PALSYM Object Module for 12K assembler PALSYM Object Module for 16K Assembler PAL-lIS Load Module l This tape is the concatenation of a link of the RELMEM object module followed by a link of the PAL-lIS, PALSYM for 8K, and IOXLPT object modules. J-IO ASSEMBLY AND LINKING INSTRUCTIONS J.2.6 Assembling And Linking LINK-lIS LINK-lIS is available as an absolute load module (for an SK machine), as two object modules (for reI inking) and as several ASCII source tapes. There is one object module fo~ the Linker and one for IOXLPT. The supplied object modules may be reI inked (using the supplied load module) to load into any size machine larger than SK. However, the resulting Linker will still assume a top of memory corresponding to an SK machine (this can be overridden in· the command string options). The assumed top of memory and reserved Absolute Loader space may be changed by editing the first linker ASCII tape with ED-II. The parameters to be changed are HGHMEM (high memory address +1 (always even)) and ALODSZ (Absolute Loader size (always even)). The source tapes for the Linker may then be assembled with PAL-lIS and the new object module can then replace the supplied Linker object module. The tapes are identified as follows: Library Code DEC-II-ULKSA-A-PAI DEC-II-ULKSA-A-PA2 DEC-II-ULKSA-A-PA3 DEC-II-ULKSA-A-PA4 Tape Tape Tape Tape DEC-II-ULKSA-A-PA5 DEC-II-ULKSA-A-PA6 Tape 5 of Tape 6 of DEC-II-ULKSA-A-PRI DEC-II-ULKSA-A-PR2 Tape 1 of 2 Tape 2 of 2 1 of 2 of 3 of 4 of ~1 LINK-lIS (Main Program) One Assembly ~ } Assembly One IOXLPT LINK-lIS Object Module IOXLPT Object Module DEC-II-ULKSA-A-PL LINK-lIS Load Module J-II APPENDIX K STANDARD PDP-II ABBREVIATIONS Abbreviation Definition ABS A/D ADC ADRS ASCII absolute analog-to-digital add carry address American Standard Code for Information Interchange arithmetic shift left arithmetic shift right automatic send/receive ASL ASR B BAR BBSY BCC BCS BEQ BG BGE BGT BHI BHIS BIC BIS BIT BLE BLOS BLT BMI BNE BPL BR BRD BRX BSP BSR BSY BVC BVS byte bus address register bus busy branch if carry clear branch if carry set branch if equal bus grant branch if greater or equal branch if greater than branch if higher branch if higher or same bit clear bit set bit test branch if less or equal branch if lower or same branch if less than branch if minus branch if not equal branch if plus branch bus register data bus request back space bus shift register back space record busy branch if overflow clear branch if overflow set CBR CLC CLK CLN CLR CLV console bus request clear carry clock clear negative clear clear overflow K-l STANDARD PDP-II ABBREVIATIONS CLZ CMP CNPR CNTL COM COND CONS CaNT CP CSR clear zero compare console nonprocessor request control complement condition console contents continue central processor control and status register DEL DEP DEPF DIV DMA DSEL DST DSX data digital-to-analog device address register data in data in, pause data out data out, byte data buffer register decoder destination effective address decrement Digital Equipment Corp. delay deposit deposit flag divide direct memory access device select destination display, X-deflection register EMT ENB EOF EOM ERR EX EXAM EXAMF EXEC EXR emulator trap enable end-of-file end-of-medium error external examine examine flag execute external reset F FCTN FILa FLG flag (part of signal name) function first in,last out flag GEN generator INDIVR INC integer divide routine increment increase increment flag indicator inhibit ini tialize instruction interrupt interrupt flag input/output input/output trap input/output executive routine D D/A DAR DATI DATIP DATa DATOB DBR DCDR DE DEC INCF IND INH INIT INST INTR INTRF I/O lOT lOX K-2 STANDARD PDP-ll ABBREVIATIONS IR IRD ISR instruction register instruction register decoder instruction shift register ' JMP JSR jump jump to subroutine LIFO LKS LOC LP LSB LSBY LSD last in,first out line time clock status register location line printer least significant bit least significant byte least significant digit MA MAR MBR MEM ML MOV MSB MSBY MSD MSEL MSYN memory address memory address register memory buffer register memory memory location move most significant bit most significant byte most significant digit memory select master sync ND NEG NOR NPG NPR NPRF NS negative driver negate normalize nonprocessor grant nonprocessor request nonprocessor request flag negative switch ODT OP octal debugging technique operate operation operator operand OPR PA PAL PB PC PD PDP PERIF PGM PP PPB PPS PR PRB PROC PRS PS PTR PTS PUN parity available program assembly lanquage parity bit program counter positive driver programmed data processor peripheral program paper tape punch paper tape punch buffer tegister paper tape punch status register paper tape reader paper tape reader buffer register processor paper tape reader status register processor status positive switch priority transfer paper tape software system punch K-3 STANDARD PDP-II ABBREVIATIONS RD RDR REG REL RES ROL ROM ROR R/S RTI RTS R/W R!WSR read reader register release reset rotate left read-only memory rotate right rotate shift return from interrupt return from subroutine read/write read/write shift register S single selection acknowledge SACK SBC SC SE SEC SEL SEN SEV SEX SEZ SI SP SR SRC SSYN ST STPM STR SUB SVC SWAB SUBTRACT CARRY s.ingle cycle source effective address set carry select set negative set overflow sign extend set zero single instruction stack pointer spare switch register source slave sync start set trap marker strobe subtract service swap byte TEMP TK TKB TKS TP TPS TRT TSC TST trap address track address temporary teletype keyboard teletype keyboard buffer register teletype keyboard status register teletype printer teletype printer status register trace trap timing state control test UTR user trap VEC vector WC WCR word count word count register XDR XRCG XWCG X-line driver X-line read control group X-line write control group YDR YRCG YWCG Y-line driver Y-line read control group Y-line write control group TA K-4 APPENDIX L CONVERSION TABLES L.l OCTAL-DECIMAL INTEGER CONVERSIONS 0000 to 0777 (Octal) Octal a I 2 3 4 5 6 7 0000 0008 0016 0024 0032 0040 0048 0056 0001 0009 0017 0025 0033 0041 0049 0057 0002 0010 0018 0026 0034 0042 0050 0058 0003 0011 0019 0027 0035 0043 0051 0059 0004 0012 0020 0028 0036 0044 0052 0060 0005 0013 0021 0029 0037 0045 0053 0061 0006 0014 0022 0030 0038 0046 0054 0062 0007 0015 0023 0031 0039 0047 0055 0063 0400 0410 0420 0430 0440 0450 0460 0470 0100 0064 0065 0110 0072 0073 0120 0080 0061 0130 0088 0089 0140 10096 0097 0150 0104 0105 0180 0112 0113 0170 0120 0121 0066 0074 0082 0090 0098 0106 0114 0122 0067 0075 0083 0091 0099 0107 0115 0123 0068 0076 0084 0092 0100 0108 0116 0124 0069 0077 0085 0093 0101 0109 0117 0125 0070 0078 0086 0094 0102 0110 0118 0126 0071 0079 0087 0095 0103 0111 0119 0127 0128 0136 0144 0152 0160 0129 0137 0145 0153 0161 elsa 0169 0176 0177 0184 0185 0130 0138 0146 0154 0162 0170 0178 0186 0131 0139 0147 0155 0163 0171 0179 0187 0132 0140 0148 0156 0164 0172 0180 0188 0133 0141 0149 0157 0165 0173 0181 0189 0134 0142 0150 0158 0166 0174 0182 0190 0135 0143 0151 0159 0167 0175 0183 0191 0193 0201 0209 0217 0225 0233 0240 0241 1 0370 0248 02fe 0194 0202 0210 0218 0226 0234 0242 0250 0195 0203 0211 0219 0227 0235 0243 0251 0196 0204 0212 0220 0228 0236 0244 0252 0197 0205 0213 0221 0229 0237 0245 0253 2 3 4 0514 0522 0530 0538 0546 055. 0562 0570 0515 0523 0531 0539 0547 0555 0563 0571 0000 0010 0000 0020 to 0030 0511 (Decimal ) 0040 0050 0060 0070 Decimal 10000 - 4096 20000 - 8192 30000 - 12288 40000-163a4 50000 - 20480 60000 -·24576 70000 - 28672 0200 0210 0220 0230 0240 0250 0260 0270 0300 OliO 0320 10330 0192 0200 0208 0216 i 0340 1 0224 03~0 0232 i~36~ 0 1000 to 1777 (Octal) I 1000 0512 0513 1010 0520 0521 1020 0528 0529 10301 0536 0537 (Decimal) 1040 05H 0545 1050 0552 0553 1060 0560 U561 1070 0568 0569 I 0512 to 1023 0 I 2 3 4 $ 6 7 0256 0264 0272 0280 0288 0296 0304 0312 0257 0265 0273 0281 0289 0297 0305 0313 0258 0266 0274 0282 0290 029a 0306 0314 0259 0267 0275 0283 0291 0299 0307 0315 0260 0268 0276 0284 OB2 0300 0308 0316 0261 0269 0277 0285 0293 0301 0309 0317 0262 0270 0278 0286 0294 0302 0310 0318 0263 0271 0279 0287 0295 0303 0311 0319 0500 0320 0321 0510 0328 0329 05~0 0336 0337 0530 0344 0345 0540 0352 0353 0550 0360 0361 0560 0368 0369 0570 0376 0377 0322 0330 0338 0346 0354 0362 0310 0378 0323 0331 0339 0317 0355 0363 0371 0379 0324 0332 0340 0348 0356 0364 0372 0380 0325 0333 0141 0349 0357 0365 0373 0381 0326 0334 0342 0350 0358 0366 0374 0382 on7 0335 0343 0351 0359 0386 0394 0402 0410 0418 0426 0434 OH2 0387 0395 0403 0411 0419 0427 0435 OH3 0388 0389 0390 0396 0397 0398 040~ 0405 0406 0412 0413 04 I 4 0420 0421 0422 0428 0429 0430 0436 0437 0438 0444 0445 0446 0391 0399 0407 I 0415 , 0423 0431 0439 0447 0198 0206 0214 0222 0230 0238 0246 0254 ·0384 0385 0600 0392 0393 0610 0620 0400 0401 0630 0408 0409 0640 0416 0417 0650 0424 0425 0660 I 0432 0433 0670,0440 0441 1 0199 0700' 0448 0449 0207 0710 0456 0457 0215 0720,0464 0465 0223 0730! 0472 0473 0231 0740 0480· 0481 0239 0750 0488 0489 0247 0750 0496 0497 02~ 0770 0504 0505 0450 0451 0452 0453 0454 0458 0459 0460 0.61 0462 0466 0467 0468 0469 0470 0414 0~75 0476 0471 0478 0~82 0483 0484 0485 0486 0490 0491 0492 0493 0494 0498 0499 0500 05dl· 0502 0510 0507 0508 nS09 . --- 0506 0455 0463 0471 0479 1 0487 5 6 7 0515 0524 0532 0540 0548 0556 0564 0512 0517 0525 0533 0541 0549 0557 1)565 0573 1 i ! 0 ~~~i I 05.!..!J --, i I 7 0712 0713 0780 0781 0788 0789 0796 0797 0804 0805 0812 0813 0820 0821 0828 0829 0774 0782 0790 0798 0808 0814 0822 0030 0775 0783 1 0791 0799, 0807i 0815i 0823 1 0837 0845 0853 0861 0869 0877 0885 oe93 0838 0846 0854 0852 0870 0878 0886 J 0518 0519 11400 0768 0769 0526 0527 1410 10776 0777 0534 0535 1420 0784 0785 ~542 0543 1430 0792 0793 0550 0551 1443 08JO 0801 0558 0559 1450 0808 080~ 0566 0567 1460 0816 0817 0574 0575 1470 0824 0825 071Q 0778 0786 0794 0802 0810 0818 0826 0771 0719 0787 0795 0803 0811 0819 0827 0834 0835' 0836 0842 0843 0844 0850 0851 0852 0858 0859 0860 0866 0367 0868 0874 0875 0875 0882 0883 0864 0890 0891 0092 I i i 6 4 2 I 03~7 0375 03B3 5 i 0831 0839 1 0847 1 0855 1 1100 0576 1110 0584 1120 0592 1130 0600 1140 0608 1150 0616 1160 0624 1170 0632 0571 0585 059.3 0601 0609 0617 0625 0633 0578 0586 0594 0602 0610 0618 0626 0634 0579 0587 059S 0603 0611 0619 0627 0635 0580 0588 0596 0604 0612 0620 0628 0636 0581 0589 0591 0605 0813 0621 0629 0637 0582 0590 0598 0606 0614 0622 0630 0638 0583 0591 0599 0607 0615 OE2l 0631 0639 1200 1210 1220 1230 1240 1250 1260 1270 0640 0648 0656 0664 0672 0680 0688 0696 0641 0649 0657 0665 0673 0681 0689 0691 0642 0650 0658 0666 0674 0682 0690 0698 0643 0651 0659 0667 0675 0683 0691 0699 0644 0652 0660 0668 0616 0684 0692 0700 0645 0653 0661 0669 0677 0685 0693 0701 0646 0654 0662 0670 0678 0686 0694 0702 0647 0655 0663 0671 0679 0607 0695 0703 1600 0896 1610 0904 1320 0912 1630 0920 1640 0928 1650,0936 1660 10944 1670 10952 0897 0905 0913 0921 0929 0937 0945 0953 0898 0906 0914 0922 0930 0938 0946 0954 0899 0900 0907 0908 0915 0916 0923 0924 0931 0932 0939 0940 0947 0948 0955 0956 1300 IJIO 1320 1330 IHO 1350 1360 1370 0704 0712 0720 0728 0736 0744 0752 0760 0705 0706 0713 0714 0721 0722 0729 0730 0737 0738 0745 0746 0753 ·0754 07GI 0762 0707 07 I 5 0723 073! 0739 0747 0755 07&3 0708 0716 0724 0732 0740 0748 0756 0764 0109 0717 0725 0733 0141 0740 0757 0765 0710 0718 0726 0734 0742 0750 0758 0766 0711 0719 0727 073S 0743 0751 075' 0781 1100 0960 0961 1710 i0968 0969 1720,0976 0977 0985 1740 0992 0993 1750 1000 1001 ITGOlooe 1009 1770 IOU 1017 0962 0970 0978 0986 0994 1002 1010 IOU 0963 0964 0965 0966 0967 0971 0972 0973 0974 0915 1 0979 0980 Ogel 0982 0987 0988 0989 0990 0991 0983 0995 0996 0997 009a 0999 1 1003 1004 100; 1006 lOIS 1011 IOU 1013 1014 1007 1019 1020 1021 IO~1 1500,0832 0833 0841 1520 08~8 0849 1530; 0856 0857 1540 I 0864 0865 1550' 0872 0873 1560 1 0880 0881 1570 0888 0889 1510108~0 i 089~' ::::1 0878 0887 0095 1 "'"11" L-l 0901 0902 0903 [ 0909 0910 09111 0917 0918 0919 0925 0926 0927 0933 0934 0935 0941 0942 0943! 0949 0950 0951! 0957 0958 0959 j CONVERSION TABLES OCTAL-DECIMAL INTEGER CONVERSIONS (Continued) 2000 to 2777 I I0 1024 to 1535 I 2 J 0 7 6 5 ~ 2001l! I02~ 1025 1026 1027 1028 1029 1030 lOll 2 I 3 4 1400 1280 1281 \282 1283 12e'4 5 6 -7 nos 1286 1287 2410 1288 1289 1290 1291 1292 1293 1294 1295 1032 1033 1034 1035 1036 1037 1038 1039 201°1 1100 1301 1302 1303 202Q 1040 1041 1042 1043 1044 1045 1046 1041 2420 1296 1297 1298 1299 B054 1062 1070 1076 1086 1055 1063 1071 1079 1081 2430 2440 2450 2460 2470 1304 1305 1306 1307 1312 1313 UI4 1315 1320 1321 132~ 1323 1328 1329 1330 1331 1336 1337 1338 1339 B308 1316 1324 1332 1340 1309 1311 1325 1333 1341 1310 1311 1318 1319 1326 1327 1334 1335 1342 1343 1346 1347 135~ 1355 1332 1363 1370 1371 1378 1379 1386 1387 1394 1395 1402 1403 1348 J 356 1364 1372 1380 1388 1396 1404 1349 1357 1365 1373 1381 1:.189 1397 1405 1350 1358 1366 i3H 1302 (Decimal) 2030! 1048 2040 1056 2050 1064 2060 1072 2070 1080 Octal Decimal 10000 - 4096 2100 1088 20000· 8192 2110 1096 30000 - 12288 2120 1104 40000 - 16384 2130 1112 50000 - 20480 2140 1120 60000 - 24576 70000 - 28672 215011128 2160 1136 2170 1144 1049 1051 1065 1073 1081 1050 1058 1066 1074 1002 1051 1059 1067 1075 1083 1052 1060 1068 1076 1084 1053 1061 1069 1077 1085 1089 1097 1105 1113 1121 1129 1137 1145 1090 1096 1106 1114 1122 1130 1138 lUG 1091 1099 !I07 1115 1:23 1131 1139 1147 1092 1100 1108 1116 1124 il3Z 1140 1148 1093 1101 1109 1117 1125 1133 1141 1094 1095 1102 1103 1110 1111 1118 1119 1126 1127 1134 1135 1142 1143 1149 1150 1151 2500 1344 1345 2510 1352 1353 2520 1360 1361 2530 1368 1369 2540 1376 1377 2550 1384 1365 2560 1392 1393 2570 1400 1401 nOOllU2 2210 1160 2220 1168 2230 1176 2240 1184 22~0 1192 2260 1200 2210 1208 1153 1161 1169 1177 IIB5 1193 1201 1209 1154 1162 1170 117a 1186 1155 1163 1171 1179 118' 1194 \195 1202 1203 1210 1211 1156 1164 1112 1180 1188 1196 1204 1212 liS? 1158 1159 IUS 1166 1167 1173 1174 i175 1181 1182 1183 JlB9 1190 USI 1197 1196 1199 1205 1206 1207 1213 1214 1215 2600 2610 2620 2630 2640 265C1 2660 2670 1408 1416 1424 1432 1440 1448 1456 1464 1409 1417 1425 1433 1441 1449 1457 1465 1434 1442 1450 1458 1466 1435 1443 1451 1459 1467 1221 1229 1237 1245 1253 1261 1269 1277 1222 1230 1238 1241 1254 2700 2710 2720 2730 2740 2750 2760 2770 1472 1480 1488 1496 1504 1512 1520 1528 1473 1474 1481 1432 1489 1490 1497 1498 1505 1506 1513 1514 1521 1522 1529 1530 1491 1499 1507 1515 1523 1531 1492 1500 1508 1516 1524 1532 1493 1501 1509 1517 1525 1533 1494 1502 1510 1518 1526 1534 1495 1503 1511 1519 1527 1535 3 4 5 6 7 (Octal) 2300 2310 2320 2330 2340 2350 2360 2370 1216 1224 1232 1240 1246 12511 1264 1212 1217 1218 1219 1220 1225 1226 1227 1228 1233 1234 1235 1236 1241 1242 1243 1244 1249 1250 1251 1252 1257 1258 1259 1260 1265 1266 1267' 1268 un 1274 1275 1276 ~ 3000 to 3777 (Octal) 1223 1231 1239 1247 1255 1262 1263 1270 1271 1278 1279 1483 1484 1485 1486 1417 3500 3510 3520 3530 3540 3550 3560 357D 1856 1064 1872 1880 1888 1896 1670 1678 1686 169<t 1702 1710 1718 1726 3600 1920 1921 1922 1923 1924 1925 1926 1921 3610 1928 1929 IUO 1931 1932 1933 1934 1935 1539 1547 1555 1563 1571 1579 1587 1595 1540 1548 1556 1564 1572 1580 1588 1596 1541 1549 1557 1565 1573 1581 1589 1597 1542 1550 1558 1566 1574 1582 1590 1598 1543 1551 1559 1567 1575 1583 1591 1599 1601 1609 1617 1$25 1633 1641 1649 1657 1602 1610 1610 1626 1634 1642 1650 J65a 1603 1611 1619 1627 1635 1643 1651 1659 1604 1612 1620 1626 1636 1644 1652 1660 t605 1613 1621 1629 1637 1645 1653 1661 3200 1664 1665 3210 1672 1673 322011680 1681 3230 1688 1689 3240 1696 1697 3250 1104 1705 326011712 1713 3270 1720 1721 1666 1674 1682 1690 U9a 1706 1714 1722 1667 1675 1683 1691 1699 1707 1115 1723 1668 1676 1684 1692 1700 1708 1116 1724 1669 1677 1685 1693 1701 11091717 1725 i un 1476 1477 1478 147. 1601 1615 1623 1631 1639 16~6 1647 16.4 1655 1662 1663 1537 1538 1545 1546 1553 1554 1561 1562 156S 1570 1577 1578 i585. 1586 1593 1594 1100 1600 3110 1 1608 . 3120 1616 3130 1824 3140 1632 3150 1640 3160 1648 3170 1656 1438 1'139 1446 1447 1454 IUS 1462 1463 1470 1471 1793 1794 1195 1796 1797 1798 1799 1801 1802 1803 1804 1805 1806 1801 1809 1810 !Gil 1812 1813 1814 Ifil5 7 1536 1544 1552 1560 1568 1576 1584 1592 1437 1445 1453 1461 1469 1792 1800 1808 1816 1824 1832 1840 1848 6 3000 3010 3020 2047 (Decimal ) 3030 3040 3050 3060 3070 2 1436 1444 1452 1460 1468 3400 3410 3420 3430 3440 3450 3460 3470 5 to 1410 1411 1412 1413 1414 1415 1418 1419 1420 1421 1422 1423 1426 1427 1428 1429 1430 1431 I 4 1536 1390 1391 1398 1399 140e 1407 0 3 2 1351 1359 1367 IJ1S 138J 1606 1614 1622 1630 i638 1671 ',679 1687 1695 1703 1711 1719 1727 3620 3630 3640 3650 3660 3670 1817 1825 1833 1841 1849 1857 1865 1873 1881 1889 1897 1904 1905 1912 1913 1936 1944 1952 1960 1968 1976 1818 1819 1826 1827 1834 1835 1842 _1843 1850 \851 1858 1866 1874 1882 1890 1898 1906 1914 1859 1867 1875 1883 1891 1899 1907 1915 I 1820 1921 1822 1823 1028 1829 1830 1831 1836 1837 1838 1839 1 1844 1845 1846 1847 1 1852 1853 1854 1855' 1860 1868 1876 1884 1892 1900 1908 1916 1937 1938 1939 1940 1945 1946 19.7 1948 1953 1954 19:'5 1956 1961 1962 1963 1964 1969 1970 1971 1972 1971 1973 1979 1900 1861 1869 1877 1885 1893 1901 1909 1917 1941 1949 1957 1965 1973 1981 1862 1870 1878 18d6 1894 1902 1910 1910 1942 1950 1958 1966 1974 1982 18113 1871 1879 1887 1895 1903 1911 1919 1943i 1959 1951 19S7 1975 1 1983 1731 1732 1733 1734 !135 3700 1984 1985 1986 1987 1988 1989 1990 1991 1 1739 1740 1741 1742 1143 3110 1992 11193 1994 199~ 1996 1997 1998 j9!l9 1741 1748 1149 1750 1751 3120 2000 2001 2002 2003 2004 2005 2006 20011 J7~5 1756 1157 1158 1759 3130 2008 2009 2010 2011 2012 2013 2014 201~ 1763 1764 1165 1766 I7G7 3140 2016 2017 2018 2019 2020 2021 2022 lG,'!.> , 1171 1772 1173 1774 1775 3'50 2024 2025 2026 2027 ~("g 2029 2030 ~ 1779 1780 1731 1782 I7Il 3160 2,)32 2033 20~4 203; ~036 20J7 20~e 2039 ~3!0 }_~~12~.!786 ."81 1188 I~~!J!! 3!'!..Q I 21140 2~,-_2_042 _ 2(101~ __ ~.. _1~~~'12~ 2M7 3300 '1728 1729 1730 331011736 1137 1738 1145 1746 3110 Inz 1753 1754 3340 1760 176\ 1762 1768 1769 1770 3360 1776 1777 1778 '1" tJ50 L-2 CONVERSION TABLES OCTAL-DECIMAL INTEGER CONVERSIONS (Continued) 2 I 0 3 4 5 I 0 7 8 3 2 4 • 5 7 4000 2048 20~9 2050 2051 2052 2053 2054 2055 4010 2056 2057 2058 2059 2010 2011 2012 2013 4020 2064 2065 2066 2067 2068 2069 2070 2071 (Octal) (Decimal ) 4030 2072 21173 2074 ,2075 2076 2071 207' 2079 4040 2080 2081 2082 2083 2084 2085 2086 2017 4050 2018 2089 2090 2091 2092 2093 2094 2095 Octal Decimal 4060 2et6 2091 2098 2099 2100 ZlOI 2102 2103 10000· 4096 4070 2104 2105 2106 2107 2108 2109 2110 2111 4400 2304 2305 2301 2307 2308 not 2310 ,t;1\ 4410 2312 2313 2314 2315 2311 2317 2311,\13.' 4420 2320 2321 2322 2323 2324 232$ 2321 '~327 4430,2,328 2329 2330 2331 2332 2333 2334 335 4440 2336 2331 2338 2339 2340 2341 2342 1343 445012344 2345 2346 2347 2348 2349 1350 2351 4460 2352 2353 2354 2355 235! 2357 2351 235. 4470 2360 2361 2362 :i363 2364 2365 nil 2317 4100 2112 2\13 2114 2115 2116 2117 2118 2119 4110 2120 2121 %122 2123 2124 2125 2126 Zl27 4120 2128 2129 2130 2131 2132 2133 2134 2,135 4130 2136 2137 2138 2139 2140 2141 2142 2143 4140 2144 2145 2146 2147 2148 2149 2150 2151 4150 2152 2153 2154 2155 2156 2157 2158 2159 4160 2160 2161 2162 2163 2164 2165 2166 Zl67 4170 2168 2169 2170 2171 2172 217~ 2174 ,2175 1 4500 2368 2369 2370 2371 2372 2373 2374 2375 4510 2376 2371 2378 2379 2380 2311 2312 2383 4520 \2384 2385 2386 2387 2388 2389 2390 2311 4530,2392 2393 2394 2395 2396 2397 239. 2.319 45401 2400 2401 2402 2403 2404 2405 2401 2407 4550i 2408 2409 2410 2411 2412 2413 2414 2415 4560 2416 2417 24\8 2419 H2O 2421 2422 2423 457012424 2425 2426 2427 2428 2429 2430 2431 4200 2176 2171 4210 218~ 2185 4220 2192 2\93 4230 2200 2201 4240 2208 2209 4250 2216 2217 4260 2224 2225 421p 2232 2233 4600 2432 2433 2H4 '2435 2436 2437 4610 2440 2441 2442 2443 2444 2445 4620 2448 2449 2450 2451 2452 2453 4630 2456 2457 2458 2459 2460 2461 4640' 2464 2465 2466 246? 2468 2469 4650: 2472 2473 2474 2475 2476 2477 4660,24,80 2481 2482 2483 2184 24,85 4670 \2488 2489 2490 2491 2U2 2493 ~I~ 4777 2559 20000·, 8192 30000 . 12288 40000 . 16384 50000 . 20480 60000 . 24576 70000 . 28672 I 2178 2179 2180 2181 2182 2183 2186 2187 2188 2119 2190 2191 2\94 2\95 2196 2111~ 2198 2199 2202 2203 2204 2205 2206 2201 2210 2211 2212 2213 2214 2215 2218 2219 2220 2221 2222 ·2223 2226 2227 2228 2229 2230 2231 22H 2235 2236 2231 2238 2239 ! i i 4300 2240 4310 2248 4320 2256 4330 2254 4340 2212 4350 2280 4360 2288 4370 2296 2241 2'49 2257 2265 2273 2281 2289 2297 2242 2250 2258 2266 2274 2282 2290 2298 2243 2244 2245 2246 2247 4700 2496 2497 2.498 2499 2251 2252 2253 2254 22S5 471012504 2.505 2506 2507 2259 '2260 2261 2262 2263 4720,2512 2513 2514 2515 2267 22S8 2269 2270 2271 413012520 2511 2522 2523 2275 2216 2277 2278 2279 474012528 2529 2530 2531 Ull 2284 2285. 2286 2287 4150 2536 2537 2538 2539 2291 2292 2293 2294 2295 4760: 2SH 2545 2546 2547 2299 2300 2301 ~302 2303, i4770! 2552 2553 2554 2555 I0 I 2 3 5 6 7 I 0 5000 2560 2561 2562 2563 2564 2565 2~66 540012816 258!1 541012824 5010 2568 256. 2570 2571 2572 2573 2574 2575 !iOOO 2560 to to 5020 257& 2577 2571 '2579 2580 2511 ~582 5420 2832 5777 3071 2591 5430 2840 (Octal) (Decimal ) 5030 2584 2585 25841 2517 2511 251" 2590 2583 5040 2592 25" 2594 25.5 25,. 2597 25'8 2599 5440 2848 5050 2&00 21101 2102 2S03 2804 2105 2101 2&07 1 5450 2856 5060 2608 2109 2etO 2811 2&12 Ut3 2114 2615 5460 2864 5070 2616 2617 2618 2619 2620 :1821 2622 2823 5470 2872 510012624 5110 2632 5120 2640 5\30 2648 5140 2656 5150 2664 5180 2672 5170 2680 2500 2501 2502 2503 2508 2509 2510 2511 2516 2517 2518 2519 2524 2525 2UI 2527 2532 2533 2534 2535 2540 2541 2542 2543 2548 2549 2550 2551 2~..s6 2557 2558 2559 I 4 2625 2626 2627 2628 2629 2633 2634 2635 2636 2637 2641 2642 2643 2644 2645 2649 2650 2651 2652 2653 2657 2658 2659 2660 2661 2665 2666 2667 2668 2669 2673 2674 2615 2676 2677 2681 2682 2683 2684 2685 5200 12688 2689 2690 2691 5210 2696 2697 2698 2699 522012704 2705 2706 2707 5230 1 271 2 2713 2714 2715 5240,2720 2721 2722 2723 5250! 2728 2729 2730 2731 5260 2736 2137 2738 2139 5270 2744 2745 2746 2747 2630 2638 2646 2654 2682 2670 2618 2686 2631 2639 2647 2655 2663 2671 2679 2687 5500 2880 551012888 5520 2896 5530 2904 5540 29\2 555012920 5560 2928 557012936 3 2438 243. 2446 2447 2454 2455 2462 2413 2470 2471 2471 2479 2485 2417 2494 2495 4 ~ 6 7 I 2 2817 2825 2833 2841 2849 2857 2865 2873 2818 2819 2820 281.1 2822 2121 2826 2827 2828 2829 2130 2131 2834 2835 2836 2837 2831 213. 28~2 2843 2844 2845 2846 :147 2850 2851 2852 2853 2154 2151 2858 2859 2860 2861 2162 2..' 2866 2861 2868 2869 2170 2nl 2874 2875 ~876 2877 2871 217" 2881 2889 2897 2905 29\3 2921 2929 2937 2882 2883 2884 2885 2886 21.7 2890 289\ 2891 2893 2894 2895 2898 2899 2900 2901 2902 2903 2906 2907 2908 2909 2910 2911 29\4 29\5 2916 2917 2918 21119 2922 2923 2924 2925 29U 2927 2930 2931 2932 2933 2934 2935 2938 '2939 2940 2941 2942 2943 2692 2693 2694 2695 5600 12944 2945 2946 2947 2948 2949 2950 2951 2700 2701 2702 2703 '5610 i2952 2953 2954 2955 2956 2957 2958 2959 2108 2709 2710 2711 562012960 2961 2962 2983 2964 2965 2966 2967 27\6 2717 2718 27\9 5630 2968 2969 2970 297: 2972 2973 2974 2975 2724 2725 2726 2727 564012976 29n 2978 2979 2980 2981 2982 21113 2732 2733 2734 2135 5650 2S8~ 2985 2986 2987 29!8 2989 2990 2911 2740 2741 2742 2143 5660 2992 2993 2994 2995 2996 2997 2998 2919 2748 2749 2750 2751 ,5670 3000 3001 3002 3003 3004 3005 3006 3007 5300 2152 2753 275~ 2755 2756 2757 2758 2759 5310 2160 2761 2762 2763 2764 2765 2766 2767 5320 2768 2759 2770 2771 2772 2773 2774 2775 5330 2171 2777 2778 2779 2780 2781 2782 2783 5340 2784 2785 2716 2787 2788 2789 2790 2791 5=50 2792 2793 2794 2795 2796 2797 2791 2799 5380 2100 2801 2102 2803 2804 2105 2106 2807 5370 2101 2809 '21t 0 2ItI 2112 2113 2814 2115 L-3 3008 3009 3010 3011 3012 3013 3014 3015 5710 301'6 3017 3018 3019 3020 3021 3022 3023 5720 3024 3025 3026 3027 3028 3029 3030 3031 5730 3032 3033 3034 3035 3036 3037 3038 3039 5740 3040 3041 3042 3043 3044 3045 3046 3047 5750 3048 3049 3050 3051 3052 3053 3054 3055 5760 305S 3057 3051 3059 3010 3061 3012 3013 5770 3014 3015 301S 301~ 3068 3069 3070 3071 ~700 CONVERSION TABLES OCTAL-DECIMAL INTEGER CONVERSIONS (Concluded) I I 0 8000 3072 8010 3080 6020 3088 6777 3583 I) (Octal) (Decima 6030 3096 8040 3104 e050 3112 6060,3120 Octal Decimal 607013128 10000· 4096 1 20000· 8192 6100 :3136 30000·12288 6110.3144 40000 . 16384 6120.3152 50000 . 20480 G130 i 3160 60000 . 24576 6140131S8 70000 . 28672 6150·3176 6160 3184 GJ7D 3192 6000 to 3072 to I 2 3 4 5 6 7 3073 3081 3089 3097 3105 3113 3121 3129 3074 3082 3090 3098 3108 3114 3122 3130 3075 3083 3091 3099 3107 3115 3123 3131 3076 3084 3092 3100 3108 3116 3124 3132 3077 3085 3093 3101 3109 3117 3125 3133 3078 3086 3094 3102 3110 3118 3126 3134 3079 3087 3095 3103 3111 3119 3127 3135 3137 3145 31,3 316i 3169 3177 3185 3193 3138 3146 3154 3162 3170 3178 3186 3:194 3139 3147 3155 3163 :'171 31H 3187 3195 3140 3148 3156 3164 3172 3180 3188 3196 3141 3149 3157 3165 3173 3181 3189 3197 3142 3150 3158 3166 3174 3182 3190 3198 J143 JI51 3159 3167 3175 3183 3191 JI99 0 I 2 3 4 5 6 -7 3333 3334 3335 64~! me 3329 .3330 3331 3332 3340 3341 3342 3343 3336 641°1 6420 3344 6430 3352 6440 3360 645013368 6460 3376 3337 334.5 3353 3361 3369 3377 64701.3384 3385 3338 3346 3354 3362 3370 3378 3386 3339 3347 3355 3363 3371 3379 3387 6500 3392 3393 3401 3409 6530: 3416 3417 .6540 1 3424 3425 6550,3432 3433 6560 3440 3441 6570 3448 3449 3394 J402 3410 3418 3426 3434 3442 3450 3395 3403 3411 3419 3427 3435 3443 3451 I:~;~: ~:~~ 3348 3356 3364 3372 3380 3388 3349 3350 3357 3358 3365 3366 3373 3374 3381 ·3382 3389 3390 3397 3405 3413 3421 3429 34~6 3437 3444 3445 3452 3453 3396 3404 3412 3420 3428 3398 3406 3414 3422 3430 3438 3446 3454 3351 3359 3367 3375 3383 3391 3399 3407 3415 3423 3431 3439 3447 H55 3461 3462 3463 15200 3200 3201 3202 3203 3204 3205 3206 3207 1 6600 I 3456 3457 3458 3459 3460 3210 3208 3209 3210 3211 3212 3213 3214 3215 16610; 3464 3465 3466 3467 3468 3469 3470 3471 J216 3224 3232 3240 3248 3256 3!l17 3225 3233 3241 3249 3257 3218 3226 3234 3242 3250 3258 3219 3227 3235 3243 3251 3259 3220 3228 3236 3244 3252 3160 3221 3229 3237 3245 3253 3261 3222 3230 3238 3246 3254 3262 3223 6620 3472 3473 3474 3475 3231 ·6630: 3480 3481 3482 3483 3239 6640· 3488 3489 3490 3491 3247 6650 I 3496 3497 3498 3499 3255 6660! 3504 3505 3506 3507 3263 6670i 3512 3513 3514 3515 3476 3484 3492 3500 3508 3516 3477 3485 3493 3501 3509 3517 3478 3486 3494 3502 3510 3518 3479 3487 3495 3503 3511 3519 6300,3264 8310 : 3272 832013280 6330 3288 5340 : 3296 6350 3304 6360,3312 6370 I 3J20 3265 3273 328 ! 3289 3297 3305 3313 3321 3266 3267 3274 3275 3282 3283 3290 3291 3298 3299 3306 3307 3314 3315 3322 3323 3268 3276 3284 3292 3300 3308 3316 3324 3269 3277 3285 3293 3301 3309 3317 3325 3270 3278 3286 3294 3302 3310 3318 3326 3271 3279 3287 3295 3303 3311 3319 3327 3525 3526 3533 3534 3541 3542 3549 3550 3557 3558 3565 3566 3573 3574 3581· 3582 3527 3535 3543 3551 3559 3567 3575 3583 4 5 6 7 3588 359. 3604 3612 3620 3628 3636 3644 3589 3597 3605 3613 3621 3629 3537 3645 3590 3598 3608 3614 3622 3630 3638 3646 3591 3599 3607 3615 3623 3631 3639 3647 8220 6230 6240 6250 G260 6270 0 7000 to 7777 (Octal) I 3584 10 4095 (DEcimal ) 1 7000 I 3584 3585 7010 3592 3593 7020 3600 3601 7030 3608 3609 7040 3616 ~617 7050 3624 3625 7060 3632 3633 7070 3640 3641 2 3 3587 3595 3603 3611 3618 3619 3626 3627 3634 3635 3642 3643 3586 3594 3602 361U , 6700 I 3520 16710 13528 16720 I 3536 16730 3544 ,6740 3552 1615013560 ,6760: 3568 [!770: 3576 i 0 3eu 3726 3727 3734 3735 3742 3750 3758 3766 3714 3743 3751 3759 3787 3775 3793 3799 3106 3807 3814 3815 Jan 3823 3UO ~31 3i3e 31139 L-4 4 5 6 7 3845 3846 3854 3862 3870 3878 3886 3894 3902 3847 3855 3663 3871 3879 3807 3395 3903· 3906 3914 3922 3930 393S 3946 3954 3962 3907 3915 3923 3931 3939 3947 3955 3963 3908 3915 3924 3932 3909 3917 3925 3933 39~0 3941 3949 3949 3956 3957 3964 3965 3910 3918 3926 3934 3968 3976 3904 3992 7MO 4000 7650 4008 7660 4016 7670 402~ 3969 3977 3985 3993 4001 3970 3978 3986 3994 4002 ~OO9 4010 4017 4018 3971 3979 3987 3995 4003 4011 4019 4027 3972 3980 3988 3996 3973 3981 3989 3997 400~ 4005 4012 4013 4020 4021 4028 ~O29 39H 3982 3990 3998 4006 4014 1022 4030 4037 4045 4053 4061 4069 ~O7~ ~076 4071 4083 4034 4085 4091 4092 4083 4038 4046 4054 4062 4070 4078 40GG 3782 3783 3790 3791 3715 3723 3731 3139 374? J 3905 3913 3921 3929 3937 3945 3953 3961 3778 3717 3778 3779 3780 3781 nB4 3785 ~718 3797 3768 3789 3792 3793 379~ 3795 3796 3797 ~IOO 3MI 3802 3903 3804 3eos 310S 3809 lUO 3@1I 30U J313 73$~ lBn 1918 3819 3320 3821 7~0 3134 3a25 3926 3927 382S 3929 '370 3632 3033 Jil34 JUS 3838 3S37 7300 7310 7320 7330 7:140 3714 3723 3730 3738 3746 3754 3782 3770 2 3904 3912 3920 3928 3936 3944 3952 3960 7600 7610 7620 7630 7200 3712 3713 7210 3720 3721 1220 3721\ ~39 7230 373. 3737 7240 3744 ~745 1250 37~2 3753 7aeo 3780 376\ 7270 3108 3769 I 3857 3865 3873 3881 3889 3897 I 3'18 3719 36S1 3662 3569 3670 3677 3678 3685 3688 3694 3689 3690 3691 33Q2 3701 3702 3700 3691 3698 3699 370~ 3706 3707 3700 3709 3710 3524 35J2 3540 3548 3556 3564 3572 3580 3842 3843 3844 3852 3858 3859 3860 3866 3867 3863 3874 3875 3876 3882 3883 3884 3890 3891 3892 3899 3899 3900 3718 3717 3724 3725 3732 3733 3HO 3741 3748 3749 375~ 3756 3757 3763 3764 3785 3771 3772 3773 36~9 3650 3651 3652 3657 3658 3659 3650 3685 3666 3667 3568 3673 3674 3675 3676 3881 3682 3683 3664 3523 3531 3539 3547 3555 3563 3571 3579 3841 7500 7510 7520 7530 7540 7550 7560 7570 3648 3656 3664 3672 36@0 3698 3ege 3704 3522 3530 3538 3546 3554 3562 3570 3578 7400 38~0 7110 3848 1 7420 3856 1 7430 3864 7440 3872 7450 3880 7460 30B8 7470 3896 3653 3654 3655 3663 3671 3679 3687 3695 leu 3703 3711 7100 7110 7120 7130 7140 7150 7100 7170 3521 3529 3531 3545 3553 3561 3569 3577 7700 '7710 7720 7730 7740 7no 7760 7770 3849 3850 3851 402~ ~026 4032 4033 ~040 4041 4048 4049 4056 4057 4064 4085 4072 4073 4080 4081 ~08e 4089 4034 4042 4050 4058 4066 4074 4082 4090 4035 4043 Q051 4059 4067 4036 4044 4052 4060 4066 3853 3861 3869 3877 3885 3893 3901 3911 3919 3927 3935 39~2 394JI 3950 3951 3958 3959 3966 3967 ~084 3975 3983 3991 3999 4007 4015 4023 4031 403S 4047 4055 4063 4071 4079 4087 4005 CONVERSION TABLES L.2 POWERS OF TWO n -2 1.0 0.5 0.25 0.125 0.062 0.031 25 0.015 625 0.007 812 5 0.003 906 25 0.001 953 125 0.000 976 562 5 0.000 488 281 25 0.000 244 140 625 0.000 122 070 312 5 0.000 061 035 156 25 0.000 030 517 578 125 0.000 015 258 789 062 5 0.000 007 629 394 531 25 0.000 003 814 697 265 625 0.000 001 907 348 632 812 5 0.000 000 953 674 316 406 25 0.000 000 476 837 158 203 125 0.000 000 238 418 579 101 562 5 0.000 000 119 209 289 550 781 25 0·.000 000 059 604 644 775 390 625 0.000 000 029 802 322 387 695 312 5 0.000 000 014 901 161 193 847 656 25 0.000 . 000 007 450 580 596 923 808 125 0.000 000 003 725 290 298 461 914 062 5 0.000 000 001 862 645 149 230 957 031 25 0.000 000 000 931 322 574 615 478 515 625 0.000 000 000 465 661 287 307 739 257 812 5 0.000 000 000 232 830 643 653 869 628 906 25 0.000 000 000 116 415 321 826 934 814 453 125 0.000 000 oo<i 058 207 660 913 467 407 226 562 5 0.000 000 000 029 103 830 456 733 703 613 081 25 0.000 000 000 014 551 9·15 228 366 851 806 640 625 0.000 000 000 007 275 957 614 183 425 903 320 312 5 0.000 000 000 003 637 978 807 091 712 951 660 156 25 0.000 000 000 001 818 989 403 545 856 475 830 078 125 0.000 000 000 000 909 494 701 772 928 237 915 039 062 5 0.000 000 000 000 454 747 350 886 464 118 957 519 531 25 0.000 000 000 000 227 373 675 443 232 059 478 759 765 625 0.000 000 000 000 113 686 837 721 616 029 739 379 882 812 0.000 000 000 000 056 843 418 860 808 014 869 689 941 406 25 0.000 000 000 000 028 421 709 430 404 007 434 844 970 703 125 0.000 000 000 000 014 210 854 715 202 003 717 422 485 351 562 5 0.000 000 000 000 007 105 427 357 601 001 858 711 242 675 781 25 0.000 000 000 000 003 552 713 678 800 500 929 355 621 337 890 625 0.000 000 000 000 001 776 356 839 400 250 464 677 810 668 945 312 5 O.OQO 000 000 000 000 888 178 419 700 125 232 338 905 334 472 656 25 0.000 000 000 000 000 444 089 209 850 062 616 169 452 667 236 328 125 0.000000 000 000 000 222 044 604 925 031 308 084 726 333 668 164 062 5 0.000 000 000 000 000 111 022 302 462 515 654 042 363 166 834 582 031 25 0.000 000 000 000 000 055 511 151 231 257 827 021 171 5q.417 041 015 625 0.000 000 000 000 000 027 755 575 615 628 913 510 590 791 708 520 507 812 5 0.000 000 000 000 000 013 877 787 807 814 456 755 215 395 854 260 253 906 25 0.000 000 000 000 000 006 938 893 903 907 228 377 647 697 927 130 126 953 125 0.000 000 000 000 ooQ 003 469 446 951 953 614 188 823 848 963 565 063 476 562 0.000 000 000 000 000 001 734 723 475 976 807 094 411 924 481 782 531 738 281 25 0.000 000 000 000 000 000 867 361 737 988 403 547 205 962 240 891 265 869 140 625 L-5 CONVERSION TABLES L.3 SCALES OF NOTATION L.3.1 2 x In Decimal X 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 L.3.2 +n 10- 2' l! 2' X 2' 1.00069 331174 62581 1.00138 72557 11335 1.00208 16050 79633 1.00277 64359 01078 1.00347 17485· 09503 1.00416 75432 30973 1.00486 311204 23785 1.00556 05803 984611 1.00625 78234 97782 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.011 0.09 1.00695 55500 56719 1.01395 94797 90029 1.02101 21257 on93 1.02811 38266 56067 1.03526 49238 41377 1.04246 57608 41121 1.04971 66836 23067 1.05701 80405 61380 1.06437 01824 53360 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 UJ7177 34625 36293 1.14869 83549 97035 1.23114 44133 44916 1.31950 79107 12894 1.41421 35623 73095 1.51571 65665 10398 1.62450 4.7927 12471 1.74110 11265 922411 1.116606 59830 73615 In Octal 10" L.3.3 L.3.4 n 10-' n 10-' I 12 144 I 750 23 420 0 1 2 3 4 1.000 000 000 000 000 000 00 0.063 146 314 631 463 146 31 0.005 075 341 217 270 243 6.6 0.000 406 111 564 570 651 77 0.000 032 155 613 530 704 15 112 402 762 000 I 351 035 564 000 16 432 451 210- 000 221 411 634,520 000 2 ,657.142:036 440 000 10 11 12 13 14 0.000 000 000 006 676 337 66 0.000 000 000 000 537 657 77 0.000 000 000 000 043 136 32 0.000 000 000 000 003 411 35 0.000 000 000 000 000 264 11 303 240 3 641 100 46 113 200 575 360 400 7 346 545 000 5 6 7 8 9 0.000 002 476 112 610 706 64 0.000 000 206 157 364 055 37 0.000 000 015 327 745 152 75 0.000 000 001 257 143 551 06 0.000 000 000 104 560 276 41 34327724451500000 434 157 lIS 760 200 000 5 432 127 ~13 542 400 000 67 405 553 164 731 000 000 15 16 17 111 0.000 000 000 000 000 022 01 0.000 000 000 000 000 001 63 0.000 000 000 000 000 000 14 0.000 000 000 000 000 000 01 10' n Log 2 and 10 In .Decimal n n loglQ 2 n IOi] 10 n n IOilo 2 n IOi2 10 1 2 3 4 5 0.30102 99957 0.60205 99913 0.90308 99870 1.20411 99827 1.50514 99783 3.32192 80949 6.64385 61898 9.96578 42847 13.28771 23795 16.60964 04744 6 7 II 9 10 1.80617 99740 2.10720 99696 2.40823 99653 2.70926 99610 3.01029 99566 19.93156 85693 23.25349 66642 26.57542 47591 29.89135 l8540 33.21928 09489 Addition and Mul tipl icatiqn, Binary and Octal Addition Multiplication BinaryScalt;l oxo=o O:x I=IXO=O 1 x 1 = 1 0+0 = 0 0+1=1:+0= I 1 1 = 10 Octal Scale 0 01 02 03 04 05 06 07 1 02 03 04 05 06 07 02 03 04 05 06 07 10 2 04 06 10 12 14 16 03 04 05 06 07 10 11 3 06 II 14 17 22 25 3 04 05 06 07 10 11 12 <4 10 14 20 24 30 34 4 05 06 07 10 II 12 13 5 12 17 24 31 36 43 5 06 07 10 11 12 13 14 6 14 22 30 36 44 52 Ii 07 10 II 12 13 14 15 7 16 25 34 43 52 61 7 10 11 12 13 14 15 16 L-6 CONVERSION TABLES L.3.S Mathematical Constants In Octal 7r= 3.11037 552421, e= 2.55760 521305, 'Y= 0.44742 147707. 7r- 1 = 0.24276 301556, e- I = 0.27426 53066la In'Y = - 0.43127 233602. '1/" = 1.61337 611067. 'l/e= 1.51411 230704. 10112 'Y = - 0.62573 030645. In 7r = 1.11206 404435, 10810 e = 0.33626 754251, '1/2= 1.32404 746320. 1.51544 163223. 1012 e = 1.34252 166245. In 2 = 0.54271 027760. '1/10 = 3.12305 407267. 101210 = 3.24464 741136. In 10 = 2.23273 067355. 10827r = L-7 APPENDIX M NOTE TO USERS OF SERIAL LA30 AND 600, 1200, AND 2400 BAUD VT05'S The serial LA30 requires that filler characters follow each carriage return; the 600, 1200, and 2400 baud VT05's require that filler characters follow each line feed. The following table lists the filler characters ,needed. The byte at location 448 has been established as the filler count and the byte at location 4~B contains the character to be filled. These locations are initially set to zero by PAL-IIA and ED-II to allow normal operation of the program. Depending on the terminal, change the locations as follows: LOC 44 LOC 45 Resulting Word (binary) LA30 011 015 0000110100001001 VT05 600 Baud 001 012 0000101000000001 VT05 1200 Baud 002 012 0000101000000010 VT05 2400 Baud 004 012 0000101000000100 The proper binary word can be stored at location 44 by using the console switches as described in section 2.1.2 of this manual. Furthermore, users with a 2400 baud VT05 should avoid the use of vertical tab characters in their programs. Vertical tabs will not be properly filled and may cause characters to be lost. Once the changes have been made, the program may be dumped to paper tape by using the bootstrap version of DUMPAB (see section 6.3 in this manual). However, since programs change each time a new version is released, it is necessary to have a program listing to determine the exact memory limits to be dtimped. The above changes only affect output to the console teleprinter. Users of IOX or IOXLPT source tapes will find the byte at location 44 tagged "I.44:" and the byte· at location 45 tagged "I.45:". These locations are defined near the end of the second source tape and can be changed to appropriate values using ED-II. ODT-ll uses the locations (44 and 45) but does not set initially. M-l them to zero APPENDIX N USING THE ABSOLUTE LOADER ON PDP-II'S WITHOUT SWITCH REGISTERS This appendix describes the procedures for loading and using the Absolute Loader on PDP-II's without switch registers. The procedures are divided into LSI-II, M930l-YB bootstrap loader, and M930l-YA bootstrap loader. Chapter 6 describes the procedures for machines with switch registers. N.l LSI-ll The following are instructions for Loader on an LSI-II. loading and using the Absolute 1. Press the BOOT/INIT switch on the LSI-II front panel to enable the bootstrap loader. An @ prints at the terminal. 2. Place the Absolute Loader reader. 3. Type the status register address of the input device and L to load the Absolute Loader. tape For example, when loading from tape reader, type: (DEC-ll-UABLB-A-PO) the console in the terminal paper When the tape has been read, an @ followed by the address of the Absolute Loader prints at the terminal. start ~177560L For example, on a machine with 8K memory, type: @177560L The Absolute Loader: Loader prints the address of the Absolute @37500 @ 4. Place the tape to be loaded via the Absolute reader. 5. Select the type of loading from the following: a. Loader in the Normal Loading For normal loading, type the address of the Absolute Loader (printed at the terminal), followed by G, e.g., ~xxx500G N-l USING THE ABSOLUTE LOADER ON PDP-II'S WITHOUT SWITCH REG where xxx is the memory size of the system and is: xxx Memory Size 017 037 057 077 117 137 157 4K 8K 12K 16K 20K 24K 28K For example, in an 8K system, type: @37500G Normal loading can also command, e.g., be achieved by typing the P @P b. Relocated Loading Type the software switch register value and relocation value as follows: deposit the @xxx516/yyyyyy zzzzzz.J ~xxx500G or type: ~xxx516/yyyyyy zzzzzz~ ~P where xxx516 is dependent on memory size and is the address of the software switch register, yyyyyy is the old content of the switch register, and zzzzzz is the new relocation value. The value of zzzzzz is explained in Section 6.2.2 for the value of the switch register for relocated loading. For example, in an 8K system, the dialogue would be: @37516/yyyyyy zzzzzz.J ~ The following is an example of a normal machine. @177560L @37500 ~P load on an 8K ;boot system and put Absolute Loader ;in reader ;Absolute Loader tape is read ;put tape to be loaded in reader ;tape is read ip. The following is an example of a relocated load on an machine: @l77560L @37500 @37516/000000 1001 @P N-2 ;boot system ;put Absolute Loader tape ;in reader ;put tape in reader ;tape is read 8K USING THE ABSOLUTE LOADER ON PDP-II'S WITHOUT SWITCH REG To continue loading, change 1001 in the above example 1. to 6. If more tapes are to be loaded as explained in Section 6.2.2, put the next tape in the reader and repeat section a or b of item 5. 7. If the tape is not self-starting, the halt address of the Absolute Loader is printed, followed by an @' Type the starting address followed by a G to start the program. @37500 ~xxxxxxG where xxxxxx is the starting address of the program. N.2 M9301-YB BOOTSTRAP LOADER The following are instructions for loading and using the Absolute Loader on a PDP-II (e.g., PDP-ll/04) without a switch register. 1. Press the BOOT/INIT switch on the PDP-II front panel to enable the bootstrap loader. A $ and four numbers print at the terminal. The four numbers are the values of RO, R4, R6, and the PC, respectively. For example: 0077400 012450 000546 004054 $ 2. Place the Absolute Loader (DEC-II-UABLB-A-PO) in the reader. 3. Type the device code (PR for the PCll high-speed reader or TT for the terminal reader) to load the Absolute Loader. ~PR~ or when the tape has read in, the machine halts. 4. Place the tape to be loaded by the reader. 5. Select the type of loading from the following: a. Absolute Loader the Normal Loading For normal loading, press the CONT switch on front panel. b. in the PDP-II Relocated Loading 1) Press the BOOT/INIT switch; a $ followed by the four numbers explained in item 1 prints at the terminal. 2) Load the address of the software switch follows: ~L xxx5l6~ N-3 register as USING THE ABSOLUTE LOADER ON PDP-ll.'S WITHOUT SWITCH REG 3) Deposit the relocation value in the. register as follows: software switch where yyyyyy is the value explained in Section for relocated loading. 6.2.2 .~P yyyyyy-./ 4,) Load. the starting address of the Absolute follows: Loader as ~L xxx500.) 5) Type S to start running the Absolute Loader. 6. If more tapes are to be loaded as explained in Section 6.2.2, put the next tape in the reader and repeat section a or b of item 5. 7. If the tape is not self-starting, a. Press the BOOT/INIT switch. b.Load the starting address command, i.e., of the program with the L ~L xxxxxx.) c. Start the program with the Scommand: The following are examples for PDP-II with 16K words of memory. Relocated - continuo.us loading: $L 77516.) ~D 1.) $L 77500.) $S.) Relocated- load in specified area of core: ~L 77516-./ $0 1001--1 ~L 77500-./ $S.,) N.3 M9301-YA BOOTSTRAP LOADER The instructions for loading and using the Absolute Loader on a PDP-II (e.g., PDP-II/04) without a switch register but with a console terminal are the same as described in Section 0.2. N-4 USING THE ABSOLUTE LOADER ON PDP-II'S WITHOUT SWITCH REG PDP-II's without console terminals may only be loaded with normal loading methods. See the M9301 Maintenance Manual for instructions on placing the address of the paper tape bootstrap in the micro switch on the M9301 module. The following instructions are for PDP-II's without console terminals. 1. Place the Absolute Loader reader. 2. Press the BOOT/INIT switch. machine halts. 3. Place the self-starting tape to be Loader in the reader. 4. Press the CONT switch. N-S tape (DEC-II-UABLB-A-PO) in the When the tape has read in, the loaded by the Absolute INDEX Abbreviations, standard PDP-II, K-l Absolute and relocatable program sections, LINK-lIS, 3-2 Absolute expressions, PAL-lIS, 1-9 Absolute Loader, 6-1, 6-10, F-3 PAL-lIS, 1-24 Accessing internal registers, ODT-ll, 5-6 Adding devices to lOX, 7-21 Address Mode syntax, PAL-IIA, C-2 PAL-lIS, B-2 Addressing, PAL-llA, 2-9 PAL-lIS, 1-12 Altering register contents, 9-6 Arithmetic and logical operators, PAL-llA, 2-8 PAL-lIS, 1-8 ASCII, character set, A-I conversion, PAL-IIA, 2-8 conversion, PAL-lIS, 1-8 .ASCII directive, PAL-llA, 2-17 PAL-lIS, 1-21 .ASECT and .CSECT program section directives, PAL-llS, 1-19 Assembler directives, PAL-IIA, 2-3, 2-15 PAL-lIS, 1-18, B-8 Assembly and linking instructions, J-I Assembly dialogue, PAL-IIA, 2-23 Assembly listing, PAL-IIA, 2-24 PAL-lIS, 1-30 Assembly Location Counter, PAL-IIA, 2-8 PAL-lIS, 1-10 Assignment, direct, PAL-IIA, 2-5 PAL-lIS, 1-6 Autodecrement Mode, PAL-llA, 2-11 PAL-lIS, 1-14 Autoincrement Mode, PAL-IIA, 2-10 PAL-IIA deferred, 2-11 PAL-llS, 1-13 Blank operator field, PAL-IIA, 2-16 Bootstrap Loader, 6-1, F-l loading and verifying the, 6-7 Bootstrap tapes, loading into core, 6-8 Bootstraps, paper tape, 6-2 Breakpoints, ODT-H, 5-6 ODT-IIX, 5-12, 5-14 Buffer arrangement in data transfer command, 7-4 Buffer size, lOX, 7-5 Buffering, double, 7-15 Byte count, lOX, 7-8 .BYTE directive, PAL-HA, 2-17 PAL-llS, 1-21 Byte offset, PAL-lIS, 1-17 Calculating offsets, ODT-11, 5-9 ODT-11X, 5-11 Changing, opening, and closing locations, ODT-ll, 5-4 ODT-IIX, 5-10 Character location pointer (Dot), ED-II, 4-2 Character set, ASCII, A-I PAL-IIA, 2-2 PAL-llS, 1-2 Closing, opening, and changing locations, ODT-ll, 5-4 ODT-11X, 5-10 Codes, PAL-IIA error, 2-25 Coding techniques, 9-6 Commands and functions, ODT-ll, 5-3 Command delimiters, ED-II, 4-2 Command Mode and Text Mode, ED-II, 4-1 Command properties, line-oriented, ED-II, 4-3 Commands, ED-II, 4-4 to modify the text, 4-8 to move Dot and Mark, 4-6 Comments, PAL-IIA, 2-4 PAL-lIS, 1-4 Communication and data flow, ODT-IIX, 5-15 Communication with lOX, 7-1 Index-I INDEX (Cont.) Conditional assembly directives, PAL-lIS, 1-23 Control format, PAL-lIS, 1-4 Conversion, PAL-lIS ASCII, 1-8 Conversion tables, L-l Core memory dumps, 6-14, F-4 Counter, PAL-lIS progr~, 1-12 Creating a paper tape, ED-II,. 4-11 CTRL/U, PAL-lIS, 1-24 Data transfer commands, buffer arrangement in, 7-4 device conflicts in, 7-12 Data transfers, lOX, 7-11 Decimal numbers, PAL-lIS, 1-8 Deferred Autodecrement Mode, PAL-llA, 2-11 PAL-lIS, 1-14 Deferred Autoincrement Mode, PAL-llA, 2-11 PAL-lIS, 1-13 Deferred Immediate (Absolute) and Immediate Mode, PAL-llA, 2-12 Deferred Index Mode, PAL-llA, 2-12 PAL-lIS, 1-14 Deferred Register Mode, PAL-lIS, 1-13 Deferred Relative and Relative Mode, PAL-llA, 2-13 Device Assignment Table, lOX, 7-3 Device conflicts in data transfer commands, 7-12 Device Interrupt Table (DIT), 7-20 Device Status Table, (DST), 7-21 Dialogue, PAL-llA assembly, 2-23 PAL-llA initial, 2-18 PAL-lIS initial, 1-24 Direct assignment, PAL-llA, 2-5 PAL-llS, 1-6 Directives, PAL-llA .ASCII, 2-17 PAL-llA .BYTE, 2-17 PAL-llA .END, 2-16 PAL-llA .EOT, 2-15 PAL-llA • EVEN, 2-16 PAL-llA .WORD, 2-16 PAL-lIS .ASCII, 1-21 PAL-lIS .ASECT, 1-19 PAL-lIS .BYTE, 1-21 Directives (cont.), PAL-lIS .CSECT, 1-19 PAL-lIS .END, 1-20 PAL-lIS • EaT , 1-20. PAL-lIS • EVEN, 1-20 PAL-lIS .GLOBL, 1-18 PAL-lIS .LIMIT, 1-23 PAL-lIS .RAD50, 1-22 PAL-lIS .TITLE, 1-18 PAL-lIS .WORD, 1-20 Directory, PAL-lIS global symbol, 1-30 Done bit, lOX, 7-7 (Dot) character 'location pointer, ED-II, 4-2 Double buffering, 7-15 Dumps, core memory, 6-14, F-4 output formats, 6-17 storage maps, 6-17 Duplication, tape, I-I ED-II, Character location pointer, (Dot), 4-2 command delimiters, 4-2 Command Mode and Text Mode, 4-1 commands, 4-4 commands to modify the text, 4-8 commands to move Dot and Mark, 4-6 creating a paper tape, 4-11 editing example, 4-12 error corrections, 4-10 grouping of commands, D-3 input and output commands, 4-4, D-l line-oriented command properties, 4-3 Mark, 4-3 operating procedures, 4-10, D-4 page buffer, 4-3 pointer-positioning commands, D-2 restarting, 4-11 search commands, 4-7, D-2 software error halts, 4-17 starting, 4-11 symbols, D-3 Editing example, ED-II, 4-12 Editor (ED-II), PAL-lIS, 1-2 .END directive, PAL-llA, 2-16 PAL-lIS, 1-20 End-of-File Bit, lOX, 7-7 End-of-Medium Bit, lOX, 7-7 Index-2 INDEX (Cont.) . EOT directive,. PAL-llA, 2-15 PAL-lIS, 1-20 Error codes, lOX, 7-6 PAL-llA, 2-7, 2-25, C-8 PAL-lIS, 1-31, B-lO Error corrections, BD-ll, 4-10 Error detection, ODT-llX, 5-13 Error halts, PAL-llA software, 2-26 Error procedure and messages, LINK-lIS, 3-7 Error, Q, PAL-lIS, 1-2 .EVEN directive, PAL-llA, 2-16 PAL-lIS, 1-20 Example of program using lOX, 7-17 Expressions, absolute, PAL-lIS, 1-9 external, PAL-lIS, 1-9 mode of, PAL-lIS, 1-9 PAL-llA, 2-7 PAL-lIS, 1-7 relocatable, PAL-lIS, 1-9 External expression, PAL-lIS, 1-9 External symbol, PAL-lIS, 1-5 Fatal errors, lOX, 7-17, G-2 Fields, PAL-llA instruction operand, 2-14 Format control, PAL-llA, 2-4 PAL-lIS, 1-4 Format, PAL-lIS statement, 1-2 Forms, PAL-llA instruction, 2-14 FPMP-ll, non-OTS routines, H-7 OTS routines, H-2 routines accessed via trap handler, H-7 summary, H-l Functions and commands, ODT-ll, 5-3 General registers, PAL-lIS, 1-6 Global symbol directory, PAL-lIS, 1-30 Global symbols, LINK-lIS, 3-2 PAL-lIS, 1-5 .GLOBL directive, PAL-lIS, 1-18 Grouping of commands, ED-II, 0-3 Halts, PAL-llA software error, 2-26 Immediate and Deferred Immediate (Absolute) Mode, PAL-llA, 2-12 PAL-lIS, 1-15 Index Mode, PAL-llA, 2-11 PAL-lIS, 1-14 Initial dialogue, PAL-llA, 2-18 PAL-llS, 1-24 Initial operating procedures, PAL-llA, C-9 PAL-lIS, B-1! Initialization, 7-4 Input and output, LINK-lIS, 3-3 Input/output commands, ED-II, 4-4, 0-1 Instruction forms, PAL-llA, 2-14 PAL-llS, 1-17 Instruction mnemonic, PAL-llA, 2-3 Instruction operand fields, PAL-llA, 2-14 PAL-lIS, 1-17 Instruction summary, lOX, G-l Instructions, Assembly and linking, J-l PAL-llA, C-3 PAL-lIS, B-2 Integer conversions, octal-decimal, L-l Internal information, lOX, 7-19 Internal registers, accessing, ODT-ll, 5-6 Internal symbol, PAL-lIS, 1-5 Introduction, ODT-ll, 5-1 lOX, adding devices to, 7-21 buffer size, 7-5 byte count, 7-8 communication with, 7-1 data transfers, 7-11 device assignment table, 7-3 Done Bit, 7-7 End~of-File Bit, 7-7 End-of-Medium Bit, 7-7 error codes, 7-6 example of program using, 7-17 Index-3 INDEX (Cont.) IOX (cont.), fatal errors, 7-17, G-2 instruction summary, G-l ~nternal information, 7-19 Mode Byte, 7-5 modes, 7-8 program flow summary, G-l reenabling the reader and restarting, 7-16 Status Byte, 7-6 using, 7-3 Label, PAL-llA, 2-3 PAL-lIS, 1-3 .LIMIT directive, PAL-lIS, 1~23 Line-oriented command properties, ED-II, 4-3 LINK-lIS, absolute and relocatable program sections, 3-2 error procedure and messages, 3-7 global symbols, 3-2 input and output, 3-3 load map, 3-4 load modules, 3-3 loading and command string, 3-5 object module, 3-3 operating procedures, 3-5 Linking and assembly instructions, J-l Linking and relocation, PAL-lIS, l-ll Listing, assembly, PAL-llA, 2-24 PAL-lIS, 1-30 Load map, LINK-lIS, 3-4 Load modules, LINK-lIS, 3-3 Loader, Absolute, 6-1, 6-10, F-3 Bootstrap, 6-1, F-l PAL-lIS Absolute, 1-24 Loading, bootstrap tapes into core, 6-8 PAL-IlA, 2-18 PAL-lIS, 1-24 unused trap vectors, 9-5 Loading and command string, LINK-lIS, 3-5 Loading and verifying the Bootstrap Loader, 6-7 Location counter, PAL-lIS, assembly, 1-10 Logic'al and arithmetic. operators, PAL-llA, 2-8 PAL-lIS, 1-8 Mark, ED-II, 4-3 Mathemat'ical constants in octal, L-7 Mnemonic, PAL-llA instruction, 2-3 Mode, IOX, 7-8 PAL-llA, Autodecrement, 2-11 PAL-llA, Autoincrement Deferred, 2-11 PAL-llA, Deferred Autodecrement, 2-11 PAL-llA, Deferred Index, 2-12 PAL-llA, Immediate and Deferred Immediate (Absolute), 2-12 PAL-llA,lD'ndex, 2-11 PAL-llA, Relative and Deferred Relative, 2-13 Mode Byte, IOX, 7-5 Mode of expressions, PAL-lIS, 1-9 Negative numbers, PAL-lIS, 1-8 Non-OTS routines, FPMP-ll, H-7 Notation, scales of, L-6 Numbers, decimal, PAL-lIS, 1-8 negative, PAL-lIS, 1-8 qctal, PAL-lIS, 1-8 PAL-llA, 2-7 positive, PAL-lIS, 1-8 Object module, LINK-lIS, 3-3 Object module output, PAL-lIS, 1-30 Octal-decimal integer conversions, L-l Octal numbers, PAL-lIS, 1-8 ODT, command syntax, 5-2 priority level, 5-10 ODT-ll, accessing internal registers, 5-6 breakpoints, 5-6 calculating offsets, 5~9 commands and functions, 5-3 introduction, 5-1 opening, changing, and closing locations, 5-4 Index-4 INDEX (Cont.) ODT-ll (cont.), operating procedures, 5-20 running the program, 5-7 searches, 5-8, 5-18 starting and restarting, 5-21 summary, E-l teletype interrupt, 5-10 ODT-IIX, breakpoints, 5-12, 5-14 calculating offsets, 5-11 communication and data flow, 5-15 error detection, 5-13 opening, changing, and closing locations, 5-10 programming considerations, 5-14 single-instruction Mode, 5-12 Offsets, calculating, ODT-ll, 5-9 calculating, ODT-IIX, 5-11 PAL-lIS byte, 1-17 One device, single buffer transfer on, 7-14 Opening, changing, and closing locations, ODT-ll, 5-4 ODT-IIX, 5-10 Operand, PAL-IIA, 2-3 PAL-lIS, 1:-4 Operand fields, instruction, PAL-IIA, 2-14 PAL-lIS, 1-17 Operating procedures, ED-II, 4-10, D-4 LINK-lIS, 3-5 ODT-ll, 5-20 PAL-IIA, 2-17 PAL-IIA initial, C-9 PAL-lIS, 1-24 PAL-lIS initial, B-li Operator, PAL-IIA, 2-3 PAL-lIS, 1-3 Operators, PAL-IIA, arithmetic and logical, 2-8 PAL-lIS, arithmetic and logical, 1-8 OTS routines, FPMP-ll, H-2 Output formats, dumps, 6-17 Output, PAL-lIS object module, 1-30 Page size, PAL-IIA, 2-4 PAL-lIS, 1-4 PAL-IIA, Address Mode syntax, C-2 addressing, 2-9 arithmetic and logical operators, 2-8 ASCII conversion, 2-8 .ASCII directive, 2-17 assembler directives, 2-3, 2-15 assembly dialogue, 2-23 assembly listing, 2-24 Assembly Location Counter, 2-8 Autodecrement Mode, 2-11 Autoincrement Mode, 2-10 blank operator field, 2-16 .BYTE directive, 2-17 character set, 2-2 comments, 2-4 Deferred Autodecrement Mode, 2-11 Deferred Autoincrement Mode, 2-11 Deferred Index Mode, 2-12 direct assignment, 2-5 .END directive, 2-16 .EOT directive, 2-15 error code, 2-7 error codes, 2-25, C-8 .EVEN directive, 2-16 expressions, 2-7 format control, 2-4 Immediate and Deferred Immediate (Absolute) Mode, 2-12 Index Mode, 2-11 initial dialogue, 2-18 initial operating procedures, C-9 instruction forms, 2-14 instruction mnemonic, 2-3 instruction operand fields, 2-14 instructions,C-3 label, 2-3 loading, 2-18 numbers, 2-7 operand, 2-3 operating procedures, 2-17 operator, 2-3 page size, 2-4 permanent symbols, 2-5 Program Counter, 2-9 Register Mode, 2-10 register symbols, 2-6 Relative and Deferred Relative Mode, 2-13 software error halts, 2-26 special characters, C-l statements, 2-2 Index-5 INDEX (Cont.) PAL-llA (cont.), user-defined symbols,2-S. .WORD directive, 2-16 PAL-llS absolute expression,. 1-:.9 Absolute Loader, 1-24 Address Mode .syntax , B-2 addressing, 1-12 ASCII conversion, 1-8 .ASCII direcd:ve, 1:""21 assembler directives, 1"';18, B-8 assembly listing~ 1"';30 Autodecrement Mode, 1...,14 Autoincrement Mode, 1-13 .BYTE directive, 1-21 . byte offset, 1-17 character set, 1-2 comments, 1-4 conditional assembly directives, 1-23 control format, 1-4 CTRL!U, 1-24 decimal numbers, 1-8 Deferred. Autodecrement Mode, 1-14 Deferred Autoincrement Mode, 1...,13 Deferred Index Mode, 1-14 Deferred Register Mode, 1-13 direct assignment, 1-6 Editor (ED-H), 1-2 .END directive, 1-20 .EOT directive, 1-20 error codes, 1-31, B-10 .EVEN directive, 1-20 expressions, 1-7 external symbol, 1-5 general registers, 1-6 global symbol, 1-5 global symbol directory, 1-30 .GLOBL directive, 1,...18 Immediate and Deferred Immediate (Absolute) Modes, 1-15 Index Mode, 1-14 initial dialogue, 1-24 initial operating procedures, . B-ll instruction forms, 1-17 instruction operand fields, 1-17 instructions, B-2 internal symbol, 1-5 label, 1-3 .LIMIT directive, 1-23 loading, 1-24 negative numbers, 1-8 object module output, 1-30 PAL-llS (cont.), octal numbers, 1-8 operand, 1-4 operating procedures, .1-24 operator, 1-3 page size, 1-4 permanent symbols,· 1-5 positive numbers, 1-8 Program Counte:l:', 1-12 program section directives (.ASECT:and .CSECT), 1-19 .RAD50 directive, 1-22 Register Mode, 1-12 register symbols, 1-6 Relative and Deferred Relative Modes, 1-15 relocatable expression, 1-9 relocation and linking,. 1-11 relocation directory, 1-31 RUBOUT, 1-24 software error halts, 1-32 statement format, 1-2 statements, 1-2 symbol table, 1-5 symbols, 1-5 termina.tors, B-1 text block, 1-31 .TITLE directive, 1-18 truncation, 1-8 user-defined symbols, 1-5 .WORD directive, 1-20 Paper tape bootstraps, 6-2 Permanent symbols., PAL-llA, 2-5 PAL-llS, 1-5 Pointer-positioning commands, ED-ll, D-2 Position-independent code, writing, 9-1 positive numbers, PAL-llS, 1-8 Powers of two, L-S Priority level, ODT, 5-10 Program Counter, PAL-llA, 2-9 PAL-llS, 1-12 Program flow summary, lOX, G-l Program section directives UASECT and .CSECT) PAL-llS, 1-19 Programming considerations, ODT-llX, 5-14 Q error, PAL-llS, 1-2 Index-6 INDEX (Cont.) .RAD50 directive, PAL-lIS, 1-22 Real-time capability, 7-1 Reenabling the reader and restarting, lOX, 7-16 Register contents, altering, 9'-6 Register Mode, PAL-llA, 2-10 P~L-llS, 1-12 Register symbols, PAL-llA, 2-6 PAL-lIS, 1-6 Registers, general, PAL-lIS, 1-6 Relative and Deferred Relative Mode, PAL-llA, 2-13 PAL-lIS, 1-15 Relocatable expression, PAL-lIS, 1-9 Relocation and linking, PAL-llS, 1-11 Relocation directory, PAL-lIS, 1-31 Restarting and starting ODT-ll, 5-21 Restarting ED-II, 4-11 Routines accessed via trap handler, FPMP-ll, H-7 RUBOUT, PAL-lIS, 1-24 Running the program, ODT-ll, 5-7 Scales of notation, L-6 Search commands, ED-II, 4-7, 0-2 Searches, OOT-ll, 5-8, 5-18 Single buffer transfer on one device, 7-14 Single-Instruction Mode, OOT-llX, 5-12 Software error halts, ED-ll, -4-17 PAL-llA, 2-26 PAL-lIS, 1-32 Special characters, PAL-llA, C-l Standard PDP-II abbreviations, K-l Starting and restarting OOT-ll, 5-21 Starting ED-II, 4-11 Statement format, PAL-lIS, 1-2 Statements, PAL-llA, 2-2 PAL-lIS, 1-2 Status Byte, lOX, 7-6 Storage maps, dumps, 6-17 Subroutines, 9-7 Summary, FPMP-ll, H-l OOT-ll, E-l Symbol, external, PAL-lIS, 1-5 global, PAL-lIS, 1-5 internal, PAL-lIS, 1-5 Symbol table, PAL-lIS, 1-5 Symbols, ED-II, 0-3 PAL-llA permanent, 2-5 PAL-llA register, 2-6 PAL-llA user-defined, 2-5 PAL-lIS, 1-5 permanent, PAL-lIS, 1-5 register, PAL-lIS, 1-6 user-defined, PAL-lIS, 1-5 Table, symbol, PAL-lIS, 1-5 Tables, conversion, L-l Tape duplication, 1-1 Techniques, coding, 9-6 Teletype interrupt, OOT-ll, 5-19 Terminators, PAL-lIS, B-1 Text block, PAL-lIS, 1-31 .TITLE directive, PAL-lIS, 1-18 Trap vectors, loading unused, 9-5 Truncation, PAL-lIS, 1-8 Two, powers of, L-5 Unused trap vectors, loading, 9-5 User-defined symbols, PAL-llA, 2-5 PAL-lIS, 1-5 Using lOX, 7-3 Verifying and loading the bootstrap loader, 6-7 .WORO directive, PAL-llA, 2-16 PAL-lIS, 1-20 Writing position-independent code, 9-1 Index-7 PDP-II Paper Tape Software Handbook DEC-II-XPTSA-B-D READER'S COMMENTS NOTE: This form is for document comments only. Problems with software should be reported on a Software Problem Report (SPR) form. Did you find errors in this manual? If so, specify by page. Did you find this manual understandable, usable, and well-organized? Please make suggestions for improvement. Is there sufficient documentation on associated system programs required for use of the software described in this manual? 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 [] Higher-level language programmer [] Occasional programmer (experienced) [] User with little programming experience [] Student programmer [] Non-programmer interested in computer concepts and capabilities Name Date ___________________________ Organization __________________________________________________________________ Street ______________________________________________________________________ City __________________ Sta te ~_ _ _ _ _ _ Zip Code ___________ or Country If you require a written reply, please check here. [J - - -I Do Not Tear - Fold Here and Tape IIIII I No Postage Necessary if Mailed in the United States I BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE RT/C SOFTWARE PUBLICATIONS ML 5-5/E45 DIGITAL EQUIPMENT CORPORATION 146 MAIN STREET MAYNARD, MASSACHUSETTS - - - - Do Not Tear - Fold Here - - - - - - - - - - 01754 - - - - - - - - - - - - digital equipment corporation Printed in U.S .A.
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies