TOPS-20 DDT Manual | Electronic distribution with Autopatch Tape 16 | August 1987 This manual describes the use of TOPS-20 DDT, the Dynamic Debugging Tool for MACRO-20 programs. | This manual updates the _______ ___ ______ | TOPS-20 DDT Manual printed for | TOPS-20 6.1. This version of | the manual is not printed and | is not available from DIGITAL | in printed form. It is | distributed on the Autopatch | tape #16 for TOPS-20 in .MEM | file format only. You can | print this file on any | printer; page length has been | set at 58 lines. Change bars | indicate changes and bullets | indicate data deletions since | the previous version of this | manual. OPERATING SYSTEM: TOPS-20 V6.1 | SOFTWARE: DDT V44C(670) digital equipment corporation marlboro, massachusetts First Printing, May 1985 | Autopatch Revision, August 1987 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 only be used or copied in accordance with the terms of such license. No responsibility is assumed for the use or reliability of software on equipment that is not supplied by DIGITAL or its affiliated companies. | Copyright (C) 1985, 1987, Digital Equipment Corporation. All Rights Reserved. The following are trademarks of Digital Equipment Corporation: DEC DECnet IAS DECUS DECsystem-10 MASSBUS Digital Logo DECSYSTEM-20 PDT PDP DECwriter RSTS UNIBUS DIBOL RSX VAX EduSystem VMS VT CONTENTS PREFACE CHAPTER 1 INTRODUCTION TO DDT 1.1 SYMBOLIC DEBUGGING . . . . . . . . . . . . . . . . 1-1 1.2 TOPS-20 VARIANTS OF DDT . . . . . . . . . . . . . 1-1 CHAPTER 2 GETTING STARTED WITH DDT 2.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . 2-1 2.2 LOADING DDT . . . . . . . . . . . . . . . . . . . 2-1 2.3 BASIC FUNCTIONS . . . . . . . . . . . . . . . . . 2-2 2.3.1 Error Conditions . . . . . . . . . . . . . . . . 2-3 2.3.2 Basic Concepts . . . . . . . . . . . . . . . . . 2-4 2.3.3 Starting and Stopping the Program . . . . . . . 2-5 2.3.4 Examining and Modifying Memory . . . . . . . . . 2-6 2.3.5 Executing Program Instructions . . . . . . . . . 2-9 2.4 A SAMPLE DEBUGGING SESSION USING DDT . . . . . . 2-10 2.5 PROGRAMMING WITH DDT IN MIND . . . . . . . . . . 2-21 CHAPTER 3 DDT COMMAND FORMAT 3.1 COMMAND SYNTAX . . . . . . . . . . . . . . . . . . 3-1 3.2 INPUT TO DDT . . . . . . . . . . . . . . . . . . . 3-2 3.2.1 Values in DDT Expressions . . . . . . . . . . . 3-2 3.2.2 Operators in DDT Expressions . . . . . . . . . . 3-7 CHAPTER 4 DISPLAYING AND MODIFYING MEMORY 4.1 DISPLAY MODES . . . . . . . . . . . . . . . . . . 4-1 4.1.1 Default Display Modes . . . . . . . . . . . . . 4-1 4.1.2 Selecting Display Modes . . . . . . . . . . . . 4-2 4.2 DISPLAYING EXPRESSIONS . . . . . . . . . . . . . . 4-6 4.3 DISPLAYING BYTE POINTERS . . . . . . . . . . . . . 4-6 4.4 DISPLAYING AND DEPOSITING IN MEMORY . . . . . . . 4-7 4.4.1 Commands that Use the Current Location . . . . 4-10 4.4.2 Commands that Use the Location Sequence Stack 4-11 4.4.3 Commands that Use an Address within the Command 4-12 4.5 DISPLAYING ASCIZ STRINGS . . . . . . . . . . . . 4-19 4.6 ZEROING MEMORY . . . . . . . . . . . . . . . . . 4-19 4.7 AUTOMATIC WRITE-ENABLE . . . . . . . . . . . . . 4-20 4.8 AUTOMATIC PAGE CREATION . . . . . . . . . . . . 4-21 4.9 DISPLAYING PAGE ACCESSIBILITY INFORMATION . . . 4-22 4.10 WATCHING A MEMORY LOCATION . . . . . . . . . . . 4-23 4.11 TTY CONTROL MASK . . . . . . . . . . . . . . . . 4-23 iii CHAPTER 5 CONTROLLING PROGRAM EXECUTION 5.1 BEGINNING EXECUTION . . . . . . . . . . . . . . . 5-1 5.2 USING BREAKPOINTS . . . . . . . . . . . . . . . . 5-1 5.2.1 Setting Breakpoints . . . . . . . . . . . . . . 5-3 5.2.2 Proceeding from Breakpoints . . . . . . . . . . 5-6 5.2.3 Conditional Breakpoints . . . . . . . . . . . . 5-9 5.2.4 The "Unsolicited" Breakpoint . . . . . . . . . 5-10 5.3 EXECUTING EXPLICIT INSTRUCTIONS . . . . . . . . 5-11 5.4 SINGLE-STEPPING INSTRUCTIONS . . . . . . . . . . 5-11 5.5 EXECUTING SUBROUTINES AND RANGES OF INSTRUCTIONS 5-13 5.5.1 Single-Stepping "Dangerous" Instructions . . . 5-15 5.6 USER-PROGRAM CONTEXT . . . . . . . . . . . . . 5-16 CHAPTER 6 SEARCHING FOR DATA PATTERNS IN DDT CHAPTER 7 MANIPULATING SYMBOLS IN DDT 7.1 OPENING AND CLOSING SYMBOL TABLES . . . . . . . . 7-1 7.2 DEFINING SYMBOLS . . . . . . . . . . . . . . . . . 7-2 7.3 SUPPRESSING SYMBOL TYPEOUT . . . . . . . . . . . . 7-3 7.4 KILLING SYMBOLS . . . . . . . . . . . . . . . . . 7-3 7.5 CREATING UNDEFINED SYMBOLS . . . . . . . . . . . . 7-4 7.6 FINDING WHERE A SYMBOL IS DEFINED . . . . . . . . 7-4 7.7 SEARCHING FOR SYMBOLS . . . . . . . . . . . . . . 7-5 7.8 LISTING UNDEFINED SYMBOLS . . . . . . . . . . . . 7-5 7.9 LISTING SYMBOLS . . . . . . . . . . . . . . . . . 7-5 7.10 LOCATING SYMBOL TABLES WITH PROGRAM DATA VECTORS . 7-6 CHAPTER 8 INSERTING PATCHES WITH DDT CHAPTER 9 FILDDT 9.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . 9-1 9.2 USING FILDDT . . . . . . . . . . . . . . . . . . . 9-1 9.2.1 FILDDT Commands . . . . . . . . . . . . . . . . 9-3 9.2.2 Symbols . . . . . . . . . . . . . . . . . . . . 9-4 9.2.3 Commands to Establish Formats and Parameters . . 9-4 9.2.4 Commands to Access the Target and Enter DDT . . 9-5 9.2.5 Exiting FILDDT . . . . . . . . . . . . . . . . . 9-8 CHAPTER 10 PRIVILEGED MODES OF DDT 10.1 MDDT . . . . . . . . . . . . . . . . . . . . . . 10-2 10.2 KDDT . . . . . . . . . . . . . . . . . . . . . . 10-3 10.3 EDDT . . . . . . . . . . . . . . . . . . . . . . 10-4 iv CHAPTER 11 PHYSICAL AND VIRTUAL ADDRESSING COMMANDS CHAPTER 12 EXTENDED ADDRESSING 12.1 LOADING DDT INTO AN EXTENDED SECTION . . . . . . 12-1 12.2 EXAMINING AND CHANGING MEMORY . . . . . . . . . 12-2 12.3 BREAKPOINTS . . . . . . . . . . . . . . . . . . 12-2 12.3.1 The Breakpoint Block . . . . . . . . . . . . . 12-2 12.3.2 Enabling and Disabling Inter-section Breakpoints . . . . . . . . . . . . . . . . . 12-3 12.4 DISPLAYING SYMBOLS IN NONZERO SECTIONS . . . . . 12-4 12.5 DEFAULT SECTION NUMBERS . . . . . . . . . . . . 12-5 12.5.1 Permanent Default Section . . . . . . . . . . 12-6 12.5.2 Floating Default Section . . . . . . . . . . . 12-6 12.6 EXECUTING SINGLE INSTRUCTIONS . . . . . . . . . 12-8 12.7 ENTERING PATCHES IN EXTENDED SECTIONS . . . . . 12-8 APPENDIX A ERROR MESSAGES GLOSSARY INDEX FIGURES 2-1 Sample Program X.MAC . . . . . . . . . . . . . . 2-11 2-2 Annotated Debugging Session . . . . . . . . . . 2-12 2-3 Terminal Display of Debugging Session . . . . . 2-20 4-1 DDT Session Showing Columnar Output . . . . . . 4-25 8-1 Annotated Patching Session . . . . . . . . . . . . 8-4 8-2 Terminal Display of Patching After an Instruction 8-5 8-3 Terminal Display of Patching Before an Instruction 8-6 TABLES 3-1 Commands that Return Values . . . . . . . . . . . 3-3 3-2 Effects of Operators When Evaluating Expressions . 3-8 4-1 Evaluation of Symbolic Display Mode . . . . . . . 4-1 4-2 DDT Display Modes . . . . . . . . . . . . . . . . 4-4 4-3 Commands to Display Expressions . . . . . . . . . 4-6 4-4 DDT Commands to Display Memory . . . . . . . . . . 4-9 4-5 TTY Control Mask . . . . . . . . . . . . . . . . 4-24 5-1 Breakpoint Locations of Interest . . . . . . . . . 5-2 5-2 User-Program Context Values . . . . . . . . . . 5-16 vi PREFACE MANUAL OBJECTIVES AND AUDIENCE This manual explains and illustrates the features of TOPS-20 DDT, the debugger for MACRO-20 programs. Although TOPS-20 DDT can be used to debug the compiled code of programs written in higher-level languages, this manual illustrates the use of TOPS-20 DDT to debug programs written in MACRO-20 only. This manual is both an introduction to the basic functions of TOPS-20 DDT and a reference guide to all TOPS-20 DDT commands and functions. This manual assumes that the reader is familiar with using TOPS-20, has done some programming in MACRO-20, and is familiar with the format of MACRO-20 instructions. STRUCTURE OF THIS DOCUMENT This manual has 12 chapters, one appendix, and one glossary. o Chapter 1 introduces the concept of symbolic debugging and describes the variants of TOPS-20 DDT. o Chapter 2 describes loading TOPS-20 DDT with your program, discusses basic TOPS-20 DDT commands, and illustrates a sample debugging session. o Chapter 3 explains the syntax of a DDT command. Chapter 3 also describes expressions to enter data and explains how TOPS-20 DDT evaluates expressions. o Chapter 4 discusses how to examine and modify a program using TOPS-20 DDT. o Chapter 5 describes the use of TOPS-20 DDT to control program execution: how to start, stop, and monitor the running of a program. vii o Chapter 6 explains how to perform searches of a program's address space using TOPS-20 DDT. o Chapter 7 discusses the manipulation of program symbols using TOPS-20 DDT. o Chapter 8 describes how to use the TOPS-20 DDT patching function to insert and test a new series of instructions in your program without reassembling the program. o Chapter 9 describes the use of FILDDT. o Chapter 10 describes the use of the privileged DDTs: KDDT and MDDT. o Chapter 11 describes special-use commands that control physical and virtual addressing. These commands are useful primarily when running EDDT and FILDDT. o Chapter 12 describes the use of DDT in non-zero sections (NZS). o Appendix A explains DDT and FILDDT error messages. o The glossary defines important TOPS-20 DDT terms. OTHER DOCUMENTS Other documents to which the reader should have access are: _____ _________ _________ ______ o MACRO Assembler Reference Manual _______ ____ _________ ______ o TOPS-20 LINK Reference Manual _______ ________ _________ ______ o TOPS-20 Commands Reference Manual _________________________ _________ _________ ______ o DECsystem-10/DECSYSTEM-20 Processor Reference Manual _______________ _______ ______ _________ ______ o TOPS-10/TOPS-20 RSX-20F System Reference Manual viii CONVENTIONS The following conventions are used in this manual in the description of DDT commands and concepts. {} Curly brackets (braces) indicate that the enclosed item is optional. . (period) The address contained in DDT's location counter; also _______ ________ called the current location. addr A symbolic location within a program, a symbolic or absolute address in memory, an AC, or ".", the current location. c A single ASCII or SIXBIT character. expr Any expression that is legal in DDT. filnam One or more components of a file specification. instr Any instruction in the PDP-10 machine instruction set. location sequence stack A circular stack of memory locations that is used to store the addresses of certain previously referenced locations. n A numeric argument. page A page in memory. A page equals 512 words of memory. symbol A symbol name of up to 6 RADIX50 characters. text Any string of ASCII or SIXBIT characters. word Any 36-bit value occupying one word of memory. Represents pressing the ESCAPE or ALTMODE key once. Represents pressing the ESCAPE or ALTMODE key twice. Represents pressing a key (represented by X) at the same time as you press the key labeled CTRL. represents pressing the BACKSPACE key or . Represents pressing the LINE FEED key. Represents pressing the RETURN key. Represents pressing the TAB key or . ix Numbers are in octal radix unless otherwise specified. Examples of interaction between the user and DDT show user input in lowercase and DDT output in uppercase. The symbols , , , , , and always represent user input. NOTE The descriptions of many DDT commands list the actions and effects of those commands. The actions and effects may not occur in precisely the order specified, but this has no effect on the user. x 1-1 CHAPTER 1 CHAPTER 1 INTRODUCTION TO DDT INTRODUCTION TO DDT DDT is a utility program you can use to help you debug your MACRO-20 programs. This manual describes how to use the DDT utility. 1.1 SYMBOLIC DEBUGGING 1.1 SYMBOLIC DEBUGGING It is sometimes difficult to understand precisely the operation of a program by reading the source code. DDT is a tool for interactively examining the operation of a MACRO-20 program while it is running. DDT is useful for finding programming errors (bugs) in programs that do not run correctly. You can also use DDT to analyze the flow of control in a program that is to be revised or rewritten. With DDT, you can interrupt the execution of your program at locations (breakpoints) you choose, and then examine and modify the program's address space as required. You can execute instructions one-by-one to check whether the effect of each instruction is what is intended. You can then set other breakpoints in your program before continuing execution. When you refer to program locations and values, DDT allows you to use the symbols that are defined in the program rather than absolute values and addresses. This makes it much easier to refer to the source listing and to find specific locations in memory. After modifying the program's instructions or data, you can exit DDT and save (with the monitor-level SAVE command) the changed version of the program for further testing. 1.2 TOPS-20 VARIANTS OF DDT 1.2 TOPS-20 VARIANTS OF DDT There are several variants of DDT, each useful under specific circumstances or for specific tasks. 1-1 INTRODUCTION TO DDT INTRODUCTION TO DDT The variants of TOPS-20 DDT are: o EDDT o FILDDT o KDDT o MDDT o RDDT o SDDT o UDDT o XDDT EDDT is used to debug programs that run in executive mode (such as BOOT), and is described in Chapter 10. FILDDT is used to examine and patch disk files and structures. You can also use FILDDT to examine the running monitor. FILDDT is described in Chapter 9. KDDT is used to debug and patch monitor .EXE files and the running monitor, and is described in Chapter 10. MDDT is used to debug and patch the running monitor, and is described in Chapter 10. RDDT is a relocatable variant of DDT that can be used to debug programs in user mode. If your program is in memory (and has been loaded with RDDT as below), you invoke RDDT by entering (at TOPS-20 command level): START You load RDDT with your program by running LINK as follows: @LINK *MYPROG,SYS:RDDT.REL/GO where MYPROG is the name of your program. Loading RDDT.REL with your program does not prevent you from using other LINK features. You must load RDDT.REL last, or its start address is lost. RDDT.REL is useful in situations where you do not wish to have DDT loaded at its default location. This example shows only the minimal steps required to load the ____ _________ ______ relocatable DDT with your program. See the LINK Reference Manual for further information about using LINK. 1-2 INTRODUCTION TO DDT INTRODUCTION TO DDT SDDT is a "stub" that places XDDT in its own section, with system symbols defined as in MONSYM and MACSYM. SDDT is the DDT variant invoked when, at TOPS-20 command level, you enter: SDDT SDDT exists so that entering SDDT invokes DDT version 44 in the same manner as previous versions. UDDT is a "stub" that resides in your user program's section if the program has a TOPS-10-style entry vector and the program entry vector is in section zero. This is done for compatibility with programs that use locations 770000, 770001 and 770002. If you load a program in section zero and the program has a TOPS-10-style entry vector, when you use the DDT command, the EXEC loads the UDDT stub into your program's section at address 770000. UDDT then loads XDDT into the highest-numbered free (nonexistent) section (if XDDT is not already loaded), and starts XDDT. XDDT is the DDT variant normally used to debug user programs. If you load your program in a nonzero section or the program does not have a TOPS-10-style entry vector, the DDT command causes the EXEC to load XDDT directly into the highest-numbered free section. XDDT is also invoked by the SDDT and UDDT stubs. If you type in XDDT while at TOPS-20 command level, the EXEC loads XDDT into section zero, with system symbols defined. 1-3 1-4 CHAPTER 2 CHAPTER 2 GETTING STARTED WITH DDT GETTING STARTED WITH DDT 2.1 INTRODUCTION 2.1 INTRODUCTION This chapter is an introduction to using DDT. It describes how to load DDT with your program and shows how to perform basic DDT functions. It then illustrates a sample session debugging a simple MACRO-20 program, using basic DDT functions. You can use DDT to debug programs, using only the commands described in this chapter. Once you are familiar with using these commands, you may wish to learn how to use the commands and functions that are described in the rest of the manual, to perform more sophisticated debugging. The commands used in this chapter are described only in sufficient detail for the debugging task being performed; all commands are thoroughly described in Chapters 3 through 11 of this document. _____ The best way to learn is by doing. You will learn the commands and techniques discussed in this manual if you use them as you read about them. If you have a MACRO-20 program that you wish to debug, use it to practice the commands discussed here. If not, type in the program X.MAC listed in Figure 2-1. 2.2 LOADING DDT 2.2 LOADING DDT | It is much easier to debug a program when you can use the symbols that | are defined in the program. For you to be able to use program | symbols, DDT must have access to your program's symbol table. One way | to provide this access is to use the TOPS-20 DEBUG command to load DDT | with your program and retain your program symbols. Load an existing | MACRO-20 program with the TOPS-20 DEBUG command as follows: | | DEBUG filnam | 2-1 GETTING STARTED WITH DDT GETTING STARTED WITH DDT ______ | where filnam is the name of your MACRO-20 program. The following | appears on your terminal (if your .REL file is older than your .MAC | file, MACRO-20 reassembles your program, otherwise the second line | does not appear): | | @DEBUG PROG | MACRO: filnam | LINK: Loading | [LNKDEB DDT execution] | DDT | ______ | where filnam is the name of your MACRO-20 program (with default | extension .MAC). The last line (DDT) indicates that DDT is loaded, | and is ready to accept your commands. 2.3 BASIC FUNCTIONS 2.3 BASIC FUNCTIONS You must be able to perform certain basic functions to interactively debug a program. Basic DDT functions are: o starting the program o stopping the program at specified locations o examining and modifying memory o executing program instructions one-at-a-time o continuing execution of the program | | o deleting input o exiting DDT You must give DDT commands to tell DDT what functions to perform. DDT does not wait for a line terminator (such as a carriage return) to indicate the end of your command. Instead, DDT reads your commands character-by-character as you enter them. When you enter a DDT command, you almost never have to press the RETURN key. This manual explicitly indicates the occasions when a command requires you to press the RETURN key. NOTE You must press the ESCAPE key as part of entering many DDT commands. This manual uses the symbol to indicate where you press the ESCAPE key. When you press the ESCAPE key, DDT displays a dollar sign ($) on the screen. DDT never displays when you press the ESCAPE key. 2-2 GETTING STARTED WITH DDT GETTING STARTED WITH DDT NOTE This manual uses the symbols , , , , and to indicate where you press the BACKSPACE, ESCAPE, LINE FEED, RETURN, and TAB keys, respectively. This manual also uses the symbol to indicate where you simultaneously press the CONTROL key and the key indicated by X. These symbols ALWAYS indicate where you press the specific keys noted here. You need NEVER enter the characters ______ _____ ____ _____ _____ ________ , , , , , or , to enter a DDT command. Your commands appear on the screen as you type them. Use the DELETE key to delete partially entered commands character-by-character. If you try to delete more characters than you have entered, DDT displays: XXX You can delete an entire command line with . When you do, DDT displays: XXX To exit DDT, enter: The other basic DDT functions are described in the rest of this chapter. 2.3.1 Error Conditions 2.3.1 Error Conditions If DDT cannot execute a command, it displays a message to let you know. The message may be only a single character (such as M or U, for _ _ Multiply-defined symbol or Undefined symbol), a question mark (?), or a complete message string. For most errors, DDT also sets a pointer to the error string, so that if DDT did not display it, you can enter a command to display the error string. The error string is available for display until another error occurs, when DDT changes the pointer. To display the error string that describes the last DDT error, enter: ? (press the ESCAPE key, followed by a question mark). o 2-3 GETTING STARTED WITH DDT GETTING STARTED WITH DDT 2.3.2 Basic Concepts 2.3.2 Basic Concepts _______ ________ A very useful DDT concept is that of the current location. The current location is a memory location that you have referenced, either implicitly or explicitly, with your last command, and that is the default point of reference of your next command. The current location can be thought of as the location "where you are". The symbol "." (period) refers to the address of the current location, and can be used as an argument in DDT commands. ________ _______ The location counter is a DDT pointer that contains the address of the current location. The location counter performs a function similar to that of a bookmark. You can enter a command to display the contents of a specific location but not change the address of the current location, in order to maintain a specific point of reference for your next command. Most DDT commands change the address of the current location, and therefore also change the location counter. The commands that do not change the current location are so indicated. ____ ________ The open location is a memory word that can be modified by your next command. DDT "opens" the location as a result of a command you give to examine or modify memory. There is never more than one location open at any given time. The open location is usually also the current location. __ ____ ___ ________ _______ __ ___ _______ ________ To find the symbolic address of the current location, enter: ._ (a period followed by an underscore) This causes DDT to display the following: ADDR1+n where ADDR1 is a label defined in your program, and n is the offset of the current location from that label (if the current location is __ ADDR1, DDT does not display +n). _______ ________ Another useful DDT concept is that of the current quantity. This is a value that is the contents of the last word that DDT displayed, or the value that you last deposited in memory. The current quantity is the most recent of those values. Many DDT commands use arguments that default to the current quantity. ________ ________ _____ The location sequence stack is a DDT storage area used to store the addresses of previous current locations. Certain DDT commands store the address of the current location on the location sequence stack. Other DDT commands change the address of the current location to an address that has already been stored on the location sequence stack. The location sequence stack functions in a fashion similar to inserting place-markers in a source code listing, to be able to "get back" to prior references. 2-4 GETTING STARTED WITH DDT GETTING STARTED WITH DDT 2.3.3 Starting and Stopping the Program 2.3.3 Starting and Stopping the Program When your program is loaded and DDT is ready to accept your commands ___ (as indicated by DDT appearing on the terminal display), you can begin execution of your program at its start address by entering: G ___________ Unless you set one or more breakpoints before you start the program, your program runs either to completion or until it commits a fatal error. A breakpoint is a location in a program's executable code that __ has been modified so that if the program attempts to execute the ______ instruction at that location, control passes to DDT before the instruction is executed. The command to set a breakpoint is: addrB ____ where addr is the address at which to stop execution. If the user-program PC reaches addr, DDT interrupts execution of the program before the program executes the instruction at the specified address. When DDT interrupts program execution at a breakpoint, it changes the current location to the breakpoint and opens the current location (the breakpoint). While program execution is stopped at a breakpoint, you can display and change the contents of instruction and data words, remove breakpoints, set new breakpoints, and execute instructions one at a time (single-step). As you examine memory, you may find an instruction that is incorrect, and modify it. You can also examine and modify data words in memory. After modifying incorrect instructions and data in memory, you can immediately execute the instructions to check the effects of the modifications, without having to reassemble the source code. Once you have made your changes, you can continue program execution at the place where execution was interrupted, restart the program at the beginning, or start execution at any other location you choose. The program will run to completion, until it reaches a breakpoint, or until it gets a fatal error. 2-5 GETTING STARTED WITH DDT GETTING STARTED WITH DDT 2.3.4 Examining and Modifying Memory 2.3.4 Examining and Modifying Memory One command to examine memory is: addr/ ____ where addr is the address of the memory word you wish to examine (display), and can be numeric or symbolic. DDT displays the contents of the word located at addr. If the opcode field (bits 0-8) of the memory word matches a recognized instruction or user-defined OPDEF, DDT displays the contents of addr as an instruction (or OPDEF). If DDT finds (in the symbol table) any of the values to be displayed, DDT displays those symbols rather than the numeric values. For example, either of the following display lines might appear on your terminal (depending on the address and contents of the word): ADDR1/ MOVE 2,SYM1 ADDR1+5/ SYM1,,SYM2 where ADDR1, SYM1, and SYM2 have been defined in the program. If you enter a symbol that DDT does not find in the symbol table, DDT _ sounds the terminal buzzer or bell, and displays U on the screen. If you enter a symbol that is defined as a local symbol in more than one _ module, DDT sounds the terminal buzzer or bell and displays M. You can eliminate the multiply-defined symbol problem by "opening" the symbol table of the module in which the correct symbol is defined. See Chapter 7 (Manipulating Symbols in DDT) for more information. When searching for a symbol to display, DDT uses global symbols in preference to local symbols. However, DDT searches the "open" symbol table first, and treats local symbols found in the open symbol table as global symbols. If DDT finds only a local symbol that is not in the open symbol table, DDT displays the symbol with a pound-sign (#) appended to the symbol. For example, DDT might display: ADDR#/ MOVE 2,SYM1# See Chapter 7 (Manipulating Symbols in DDT) for more information on symbols and symbol tables. _____ ____ The command addr/ changes the current location to addr and opens the ____ word at addr. ____ _____ If you omit addr from an examine-memory command, such as addr/, DDT uses the current quantity to determine the address of the location to display. For example, after DDT displays the contents of ADDR1+5 as above, if you enter "/", DDT displays the contents of the word located at SYM2. The display line then appears: ADDR1+5/ SYM1,,SYM2 / value 2-6 GETTING STARTED WITH DDT GETTING STARTED WITH DDT _____ where value is the contents of the word located at SYM2. By default, _____ DDT displays value symbolically if it can. ____ The command / by itself (without addr) does not change the current location. Both forms of the / command open the location displayed, enabling you to modify the location with your next command. Another very useful command for examining memory is . This | command starts a new display line before displaying the contents of ____ | addr, making the display easier to read. For example, if you enter after DDT displays the address and contents of ADDR1+5 (as above) on your terminal, the terminal display appears: ADDR1+5/ SYM1,,SYM2 SYM2/ value _____ where value is the contents of the word located at SYM2. does not appear on the screen, but is shown above to indicate where you | press the key. changes the current location to SYM2 and | opens the word at SYM2. In this example, the current quantity becomes _____ | value. also stores the address of the current location (ADDR1+5) on the location sequence stack before changing the current location to the location just displayed (SYM2). DDT uses the location sequence stack to "remember" previous values of the location counter. To "get back" to the previous current location, enter: In the above example, after you press at ADDR1+5, DDT displays the contents of SYM2 and changes the current location to SYM2. When you enter , DDT changes the current location to ADDR1+5, opens the location at ADDR1+5, and again displays the contents of ADDR1+5. o _________ ____ If you use the command addr, DDT deposits addr in the open ____ location and closes the location before opening the location at addr and displaying its contents. by itself does not deposit anything, but does save the current location on the location sequence stack, making more useful than / (slash by itself). You can display and open the word after the current location by entering: 2-7 GETTING STARTED WITH DDT GETTING STARTED WITH DDT DDT changes the current location to the next word in memory, starts a new line, and displays the address of the (new) current location (as a symbol or a symbol plus an offset, if it can find a corresponding symbol in the symbol table), displays the contents of the current location, and opens the current location. For example, to display the next word in memory after ADDR1+5, enter: DDT changes the current location to ADDR1+6, starts a new line, and displays the address and contents of ADDR1+6. The screen display then appears as follows: ADDR1+5/ SYM1,,SYM2 ADDR1+6/ -1,,SYM3 ____ Note that DDT does not display the characters . does not affect the location sequence stack. Entering another causes DDT to display and open the next word. ________ To display and open the word previous to the current location, enter: DDT changes the current location to the previous word, starts a new line, displays the address and contents of the (new) current location, and opens the current location. does not affect the location sequence stack. For example, if you enter to open and display the location before ADDR1+5, the screen appears as follows: ADDR1+5/ SYM1,,SYM2 ADDR1+4/ -3,,SYM2 ______ Note that does not appear on the screen. To change the contents of the open location, enter: value _____ where value can be an instruction, a symbol, or a numeric expression. ______ For example, if you enter the command LABL2/, DDT displays the contents of the memory word at LABL2, and "opens" that word. If the word at LABL2 contains: MOVE 1,SYM1 and you wish to change SYM1 to SYM2, enter: MOVE 1,SYM2 2-8 GETTING STARTED WITH DDT GETTING STARTED WITH DDT DDT stores the new instruction in the location at LABL2 and "closes" the location. DDT does NOT display . The terminal display appears as follows (your input is in lowercase): labl2/ MOVE 1,SYM1 move 1,sym2 The current location is still LABL2, but there is no open location. To check whether the instruction is now correct, you can enter: ./ to display the contents of the current location. The screen display now appears (your input is in lowercase): labl2/ MOVE 1,SYM1 move 1,sym2 ./ MOVE 1,SYM2 After entering a command to display and open a location, if you enter: value DDT stores the new value, changes the current location to the next location in memory, starts a new display line and opens and displays the new current location. The example above would then appear as follows (your input is in lowercase): labl2/ MOVE 1,SYM1 move 1,sym2 LABL2+1/ CONTENTS ________ where CONTENTS is the value stored at LABL2+1. o 2.3.5 Executing Program Instructions 2.3.5 Executing Program Instructions When you have interrupted program execution at a breakpoint, you can execute the next instruction (the one at the breakpoint), by entering: X DDT executes the instruction, displays the results of executing the instruction, and displays the address and contents of the next instruction to be executed. This command changes the current location to the next instruction to be executed. For example, assume that the next instruction to be executed is located at LABEL1, which contains: MOVE 1,VARIBL 2-9 GETTING STARTED WITH DDT GETTING STARTED WITH DDT If the word at VARIBL contains SYM1, when you enter X, DDT starts a new line and displays: 1/ SYM1 VARIBL/ SYM1 LABEL1+1/ instr _____ where instr is the contents of LABEL1+1, and is the next instruction to be executed. You can continue to execute instructions one-at-a-time by entering successive X commands. This is known _______________ as single-stepping. _______ _ __________ To execute a subroutine, enter: X | DDT executes the subroutine and returns control to you if the | subroutine returns to a location +1, +2, or +3 from the instruction | that calls the subroutine. DDT changes the current location to the | address of the next instruction to be executed. o ________ _________ __ ___ _______ To continue execution of the program until the next breakpoint or until program completion, enter: P DDT starts the program running again, beginning with the next instruction to be executed. If you did not single-step any instructions, the program begins by executing the instruction at the breakpoint. If you have executed any instructions by single-stepping, the program continues where you stopped. The effect is as if the program were running without DDT in control. o 2.4 A SAMPLE DEBUGGING SESSION USING DDT 2.4 A SAMPLE DEBUGGING SESSION USING DDT This section describes a debugging session using DDT. The program being debugged is X.MAC, shown in Figure 2-1. The program and the sample session are for illustration only. There are many styles of programming and debugging, and these examples are descriptive rather than prescriptive in intent. You will understand this section and learn the commands described more easily if you type in the program listed in Figure 2-1 and use the commands as they are described. 2-10 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-1: Sample Program X.MAC Figure 2-1: Sample Program X.MAC SEARCH MONSYM TITLE X R0=0 ;AC0 IDX=6 ;INDEX REGISTER P=17 ;STACK COUNTER START:: MOVE P,PWORD ;Set up stack counter MOVEI IDX,TABLE1 ;Address of table with X & Y PUSHJ P,ADDEM ;Do the addition MOVEI IDX,TABLE1 ;Address of table MOVE R0,ANSWER(IDX) ;Answer to R0 JFCL 0 HALTF% ;All done! ADDEM: MOVE R0,X(IDX) ;Load X ADD R0,Y(IDX) ;X + Y MOVE R0,ANSWER(IDX) ;Store answer POPJ P, ;Return TABLE1: BLOCK 3 ;3 words X==0 ;Offset for X Y==1 ;Offset for Y ANSWER==2 ;Offset for answer STKSIZ==10 ;Stack size PWORD: IOWD STKSIZ,STACK ;Stack pointer STACK: BLOCK STKSIZ ;Stack END START Figure 2-2 is an annotated session debugging X.MAC, the program in Figure 2-1. In the annotated session, the DDT terminal display is on the left, user input is in the center in lowercase, and explanatory comments about the session are on the right. This is not always the way it appears on the terminal. Figure 2-3 shows the session as it actually appears on the terminal. The program is designed to pass the address of a table to a subroutine. The table contains three elements. The subroutine is to add the first two elements of the table and store the result in the third element before returning to the main program. There are no input or output routines in the program. The table is initialized using DDT, and the result is checked while in DDT. NOTE DDT does not display , , or . These are shown in the sample session to indicate user input. 2-11 GETTING STARTED WITH DDT GETTING STARTED WITH DDT NOTE DDT does not display the AC field of an instruction if it is zero. This means that if your program contains the instruction MOVE R0,LABL1, where R0=0, DDT displays the instruction as MOVE LABL1. Figure 2-2: Annotated Debugging Session Figure 2-2: Annotated Debugging Session SCREEN DISPLAY USER INPUT EXPLANATION @ TOPS-20 prompt. debug x Begin the session by entering "debug x", where x is the name of your MACRO program. MACRO: X MACRO reassembles your program LINK: Loading (if needed), and LINK loads [LNKDEB DDT execution] your program with DDT. DDT DDT displays the "DDT" prompt. start/ Begin examining code at label "START". MOVE P,PWORD# DDT displays the instruction at START. Press to display the next instruction. .JBDA+1/ MOVEI IDX,TABLE1# The first symbol in this program happens to coincide with .JBDA, a JOBDAT symbol. When DDT scans the symbol table, it finds .JBDA before it finds START, and displays .JBDA instead. DDT still accepts START as an input symbol. Also note the pound-sign (#) appended to TABLE1 and PWORD. PWORD and TABLE1 are local symbols that are not in the open symbol table. 2-12 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION .jbdak Enter .jbdak to suppress DDT typeout of symbol .JBDA. DDT will display START rather than .JBDA from now on. x: Enter the module name (X) followed by and a colon to open the symbol table associated with X. DDT will not append any more pound-signs. Press to start a new display line, evaluate the current quantity as if it were an instruction, and display the contents of the location addressed by the Y field of the instruction. (Entering / (slash) displays the same word as , but does not start a new line.) also saves your place (like a bookmark) on the location sequence stack, so you can get back here easily. TABLE1/ 0 When you enter the command, DDT displays the address and the contents of the location. The first element of the table contains zero. The command also opens the location. 2 Enter "2" followed by to deposit the value "2" in the first element, and to open and display the second element. TABLE1+1/ 0 The second element contains zero. 2-13 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION 3 Enter "3" followed by to deposit the value "3" in the second element and open and display the third element. The addition to be performed by the program is 2+3. TABLE1+2/ 0 The third element (the answer) contains zero. Press , then press to return to the address you saved on the location sequence stack. START+1/ MOVEI IDX,TABLE1 DDT displays the address and contents of the last location you displayed before you entered . Press to look at the next location. START+2/ PUSHJ P,ADDEM This is the call to the subroutine that does the computation. .b Enter ".", press , and enter "b" to set a breakpoint at the current location. g Enter g to start program execution. $1B>>START+2/ PUSHJ P,ADDEM DDT displays the breakpoint number, the address of the breakpoint, and the instruction at the breakpoint. This instruction has not yet been executed. x Press twice, then enter "x" to let DDT execute the subroutine. 2-14 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION START+3/ MOVEI IDX,TABLE1 DDT returns from the subroutine at the next instruction, and displays the address and contents of the instruction. If there is a "skip return", DDT displays "" if the program skipped one instruction. If the program skips 2 or 3 instructions, DDT displays "", where n is the number of instructions skipped. x Press and enter "x" to execute the instruction. IDX/ TABLE1 TABLE1 DDT displays the address and contents of IDX (the result of executing the instruction), and also displays "TABLE1" (the result of evaluating the Y field of the instruction). START+4/ MOVE 2(IDX) DDT then starts a new line and displays the address and contents of the next instruction. Note that DDT does not display the zero in the AC field of the instruction. Press , then to display the contents of the location addressed by the instruction, using any indexing and indirection. (If you omit , DDT uses only the Y field, without indexing and indirection.) TABLE1+2/ 0 The location addressed by the instruction is TABLE1+2, and its contents is zero. This is the table element that contains the answer, which should be 5. 2-15 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION Press to see the previous element in the table. TABLE1+1/ 3 This element contains 3. That is correct. Press again to check the previous element. TABLE1/ 2 This element contains 2. That is also correct. One way to find the error is to single-step through the program. startb Enter "start", press , and enter "b" to set a breakpoint at the beginning of the program. g Press and enter "g" to start the program again. $2B>>START/ MOVE P,PWORD DDT displays the breakpoint number, and the address and contents of the instruction at the breakpoint. x Press , then enter "x" to execute the instruction. This instruction moves a memory word to a register. P/ -10,,PWORD PWORD/ -10,,PWORD DDT displays the address and new contents of the register, and the address and contents of the memory word. START+1/ MOVEI IDX,TABLE1 DDT then displays the address and contents of the next instruction. 2-16 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION x Press , then enter "x" to execute this instruction, which moves an immediate value to a register. IDX/ TABLE1 TABLE1 DDT displays the address and new contents of the register, and the immediate value. START+2/ PUSHJ P,ADDEM DDT then displays the address and contents of the next instruction. x Press , then enter "x" to execute the instruction. P/ -7,,STACK DDT displays the address and new contents of the stack pointer used by the PUSHJ. DDT displays "" if the change in PC is less than one or greater than 4. ADDEM/ MOVE 0(IDX) DDT displays the address and contents of the next instruction to be executed. x Press and enter "x" to execute the instruction. 0/ 2 TABLE1/ 2 The instruction moved the contents of the word at TABLE1 (which is 2) to AC0. Looks OK so far. ADDEM+1/ ADD 1(IDX) DDT displays the next instruction. x Press and enter "x" to execute the instruction. 0/ 5 TABLE1+1/ 3 The instruction added the contents of the word at TABLE1+1 (which is 3) to AC0, which now contains 5. OK. 2-17 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION ADDEM+2/ MOVE 2(IDX) DDT displays the next instruction. x Press and enter "x" to execute the instruction. 0/ 0 TABLE1+2/ 0 The instruction moved the contents of the word at TABLE1+2 to AC0. The MOVE instruction at ADDEM+2 should be MOVEM. ADDEM+3/ POPJ P,0 DDT displays the next instruction (as a result of the x). Press to display and open the location with the incorrect instruction. ADDEM+2/ MOVE 2(IDX) DDT displays the previous instruction. This is the incorrect instruction. movem r0,answer(idx) Enter the new instruction and press . ./ Check the current location to see what you deposited. MOVEM 2(IDX) Looks OK. .b Set a breakpoint at ".", the current location. g Restart the program at the beginning. $2B>>START/ MOVE P,PWORD DDT displays the breakpoint information. p Press and enter "p" to proceed from breakpoint 2 to the next breakpoint. 2-18 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-2: Annotated Debugging Session (Cont.) Figure 2-2: Annotated Debugging Session (Cont.) SCREEN DISPLAY USER INPUT EXPLANATION $1B>>START+2/ PUSHJ P,ADDEM DDT displays the breakpoint information. p Proceed from breakpoint 1. $3B>>ADDEM+2/ MOVEM 2(IDX) DDT displays the breakpoint information. This is the instruction you changed. x Single-step the instruction to watch what it does. 0/ 5 TABLE1+2/ 5 The instruction moves the contents of AC0 to the word at TABLE1+2. OK!! ADDEM+3/ POPJ P,0 DDT also displays the address and contents of the next instruction. start+4b Set a breakpoint at START+4 to check the results. p Proceed from breakpoint 3. $4B>>START+4/ MOVE 2(IDX) DDT displays the breakpoint information. x Single-step the instruction. 0/ 5 TABLE1+2/ 5 The instruction moves the contents of the word at TABLE1+2 to AC0. The new value of AC0 is 5. OK! START+5/ JFCL 0 DDT displays the address and contents of the next instruction. Quit. @ Back at TOPS-20 command level. 2-19 GETTING STARTED WITH DDT GETTING STARTED WITH DDT Figure 2-3 shows the session as it actually appears on the terminal screen. Again, user input is in lowercase. Comments on the right indicate where you enter characters that do not echo. Figure 2-3: Terminal Display of Debugging Session Figure 2-3: Terminal Display of Debugging Session @debug x MACRO: X LINK: Loading [LNKDEB DDT execution] DDT start/ MOVE P,PWORD# Enter . .JBDA+1/ MOVEI IDX,TABLE1# .jbda$k x$: Enter . TABLE1/ 0 2 Enter . TABLE1+1/ 0 3 Enter . TABLE1+2/ 0 $ Enter . START+1/ MOVEI IDX,TABLE1 Enter . START+2/ PUSHJ P,ADDEM .$b $g $1B>>START+2/ PUSHJ P,ADDEM $$x START+3/ MOVEI IDX,TABLE1 $x IDX/ TABLE1 TABLE1 START+4/ MOVE 2(IDX) $ Enter . TABLE1+2/ 0 Enter . TABLE1+1/ 3 Enter . TABLE1/ 2 start$b $g $2B>>START/ MOVE P,PWORD $x P/ -10,,PWORD PWORD/ -10,,PWORD START+1/ MOVEI IDX,TABLE1 $x IDX/ TABLE1 TABLE1 START+2/ PUSHJ P,ADDEM $x P/ -7,,STACK ADDEM/ MOVE 0(IDX) $x 0/ 2 TABLE1/ 2 ADDEM+1/ ADD 1(IDX) $x 0/ 5 TABLE1+1/ 3 ADDEM+2/ MOVE 2(IDX) $x 0/ 0 TABLE1+2/ 0 ADDEM+3/ POPJ P,0 Enter . ADDEM+2/ MOVE 2(IDX) movem r0,answer(idx) Enter . ./ MOVEM 2(IDX) .$b $g $2B>>START/ MOVE P,PWORD $p $1B>>START+2/ PUSHJ P,ADDEM $p $3B>>ADDEM+2/ MOVEM 2(IDX) $x 0/ 5 TABLE1+2/ 5 ADDEM+3/ POPJ P,0 start+4$b $p $4B>>START+4/ MOVE 2(IDX) $x 0/ 5 TABLE1+2/ 5 START+5/ JFCL 0 ^Z @ 2-20 GETTING STARTED WITH DDT GETTING STARTED WITH DDT 2.5 PROGRAMMING WITH DDT IN MIND 2.5 PROGRAMMING WITH DDT IN MIND There are a few MACRO-20 programming techniques that make debugging with DDT easier. These techniques primarily concern the use of labels and symbols. Labels that meaningfully describe (perhaps mnemonically) the function of the code are more helpful when examining code and setting breakpoints than labels that are alphanumerically coded (such as A0001). When using symbols as offsets into tables, you can prevent DDT from displaying the offset symbol in place of the symbol's numeric value if you define the symbol in this way: symbol==expression ______ Symbol is still entered in the symbol table, and you can use symbol as ______ input to DDT, but DDT does not display symbol on output. For example, if you have defined: OFFSET==3 DDT displays the contents of a word that contains the value of 3 as: addr/ 3 rather than: addr/ OFFSET _____ _________ where addr is the address of the word. See the MACRO Assembler _________ ______ Reference Manual for more information about defining symbols. 2-21 2-22 CHAPTER 3 CHAPTER 3 DDT COMMAND FORMAT DDT COMMAND FORMAT 3.1 COMMAND SYNTAX 3.1 COMMAND SYNTAX The complete syntax of a DDT command is: {arg1<}{arg2>}{arg3}{{}{arg4}}c{arg5} _ where arg1, arg2, arg3, arg4, and arg5 are arguments to the command c. Arg1, arg2, and arg3 can be any legal DDT expression. Arg1 must be followed by a left angle bracket (<), and arg2 must be followed by a right angle bracket (>). Arg4 can only be a number. Arg5 is a text argument of the form: /text/ or c where text is a string of characters, the slashes (/) are delimiters that can be any character not contained in text, and c is a single character. DDT commands never use all five arguments. Each argument is optional or required according to the syntax of the specific command. Most DDT commands are not more complicated than: arg3c or arg3arg4c You can enter alphabetic commands and text arguments in uppercase or lowercase. An argument to a command can be the result of executing another command. For example, you can enter a command to evaluate a text string, and then enter another command to deposit in memory the result of evaluating the text string. The entire command line would be: "/abcd/ ______ where /abcd/ is the argument to the command " (quotation mark). The function of the quotation mark command is to evaluate the string (abcd) within the delimiters (/) as a left-justified ASCII string. 3-1 DDT COMMAND FORMAT DDT COMMAND FORMAT ____ The left-justified ASCII string abcd is then the argument to the command (entered by pressing the RETURN key). The function of the command is to deposit an argument (in this case, the string ____ abcd) into the open location. The " command is described in this chapter, and the command is described in Chapter 4 (Displaying and Modifying Memory). Most commands produce results that are immediately visible, such as commands that display the contents of memory locations. However, commands such as those that invoke search functions or those that evaluate text expressions (as above) may not produce immediately visible results. If you enter a question mark (?) while DDT is performing a function invoked by one of these commands, DDT displays a message that tells you what DDT is currently doing. For example, such a message might be: Searching: addr/ value ____ where addr is the address that DDT is to next test as part of a _____ ____ search, and value is the contents of the memory location at addr. Still other commands return values that DDT does not display, but can use as arguments to other commands. 3.2 INPUT TO DDT 3.2 INPUT TO DDT ___________ You enter arguments to DDT as expressions. An expression can be a single value, or a combination of two or more values with one or more _________ operators. 3.2.1 Values in DDT Expressions 3.2.1 Values in DDT Expressions Values in DDT expressions can be: o octal or decimal integers o floating point numbers o symbols o values that are returned by commands o text _____ _______ _____ To enter an octal integer value, simply enter the integer in octal digits. For example: 70707065 3-2 DDT COMMAND FORMAT DDT COMMAND FORMAT _______ _______ _____ To enter a decimal integer value, enter the integer in decimal digits and follow the value with a decimal point. For example: 9876. ________ _____ ______ To enter a floating point number, use regular or scientific notation. For example, you can enter the value .034 as one of the following: .034 3.4E-2 Note that 1. is a decimal integer, while 1.0 is a floating point number. ______ To enter a symbol as a value in an expression, type in the symbol name _________ ______ as defined in your program. To enter an undefined symbol that you can define later, enter: symbol# ______ where symbol is the symbol that you will later define. See Chapter 7 (Manipulating Symbols in DDT) for more information about using undefined symbols. _______ ____ _______ _ _____ You can enter a command that returns a value as a value in an expression. DDT commands that return values and the values they return are listed in Table 3-1. Table 3-1: Commands that Return Values Table 3-1: Commands that Return Values COMMAND VALUE RETURNED VALUE ALSO COMMAND VALUE RETURNED VALUE ALSO KNOWN AS KNOWN AS . The address of the current location. . . The address of the next user program $. instruction to be executed. . The previous value of ".". $$. nB The address of the DDT location that $nB contains the address of breakpoint n. nI The address of the DDT location that contains the saved machine state flags (user-program context). nM The address of DDT "mask" n. Q The current quantity. $Q 3-3 DDT COMMAND FORMAT DDT COMMAND FORMAT Table 3-1: Commands that Return Values (Cont.) Table 3-1: Commands that Return Values (Cont.) COMMAND VALUE RETURNED VALUE ALSO COMMAND VALUE RETURNED VALUE ALSO KNOWN AS KNOWN AS Q The current quantity, with halves $$Q swapped. nU The address of the DDT location that contains the argument (or default) that was given in the virtual addressing command: exprnU. The commands nB, nI, nM, and nU, return values that are the addresses of locations internal to DDT, which contain information that you can use and modify. For brevity, these commands are said to address those internal DDT locations. For example, the command nB returns (but does not display) the address of the DDT location that contains the address of breakpoint n, and the command addr/ (address followed by slash) displays the contents of the location at addr. To display the address of breakpoint n, enter: nB/ where you enter the command nB as the expression for DDT to ____ evaluate as addr. ____ | You can enter text to be interpreted in the following ways: | | o left-justified ASCII strings | | o left-justified SIXBIT strings | | o single right-justified ASCII characters | | o single right-justified SIXBIT characters | | o RADIX50 words | You can enter text expressions in uppercase or lowercase. DDT translates strings to uppercase for SIXBIT or RADIX50 text as required. ____ ____ ______ The term long text string refers to an expression in a DDT command that is a string of text characters that requires more than one 36-bit expression for full evaluation. You can enter long text strings in SIXBIT and ASCII as DDT expressions. If you use a long text string as an expression, DDT assumes that you will enter a command that deposits the expression in memory. 3-4 DDT COMMAND FORMAT DDT COMMAND FORMAT DDT evaluates the string one 36-bit expression at a time. After evaluating the first 36-bit expression, DDT deposits the expression in the open location, closes the open location, and opens the next location. DDT then evaluates the next 36-bit expression contained in the string, and deposits that expression in the (new) open location. This process _ continues until you enter c, the command. If you enter a command that does deposit to memory, DDT deposits the final 36-bit expression in the open location, and updates the location counter according to the rules of that particular command. The current quantity is the last 36-bit expression that DDT evaluated. If you do not enter a command that deposits to memory, DDT uses, as the argument to the command, the 36-bit expression that was last evaluated. All other 36-bit expressions that were evaluated as part of the string have been deposited, and the current and open locations were updated accordingly. The current quantity is then the last 36-bit expression that DDT evaluated. If there is no open location when you begin typing the long text string, DDT evaluates only the first 36-bit expression, ignores the rest of the string, and uses the first 36-bit expression as the argument to the command. The current quantity is then the first 36-bit expression that DDT evaluated in the string. If you enter a command that deposits to memory, it has no effect because there was no open location. o _____ ______ The syntax to enter an ASCII string is: "/text/ ____ where text is the string, and the slashes (/) represent any printing ____ character that is not contained within text. DDT evaluates the string as a series of 36-bit expressions, each in 7-bit ASCII format (left-justified), with all unused bits reset. For example, if you enter: "+abc/def+ _____ DDT evaluates one 36-bit expression as the 7-bit ASCII string abc/d in bits 0-34, and bit 35 reset. If there is no open location, DDT uses that expression as the argument to the command, and that expression becomes the current quantity. _____ If there is an open location, DDT deposits abc/d in the open location, closes it, and opens the next location in memory. DDT then evaluates a __ second 36-bit expression as the 7-bit ASCII string ef in bits 0-13, and bits 14-35 reset. The last 36-bit expression evaluated becomes the current quantity. 3-5 DDT COMMAND FORMAT DDT COMMAND FORMAT NOTE You cannot use this format to enter an ASCII string that begins with the ESCAPE character, because terminates the command that enters a single right-justified ASCII character (in this case, your intended delimiter). ______ ______ The syntax to enter a SIXBIT string is: "/text/ where text is the string, and the slashes (/) represent any printing ____ character that is not contained within text. DDT evaluates the string as a series of 36-bit expressions, each in SIXBIT format (left-justified), with any unused bits in the last 36-bit expression reset. DDT translates lowercase characters to uppercase; all other non-SIXBIT characters cause DDT to sound your terminal buzzer or bell and display a question mark. For example, if you enter: "/qwertyu/ ______ DDT evaluates one 36-bit expression as the SIXBIT string QWERTY in bits 0-35. If there is no open location, DDT uses that expression as the argument to the command, and that expression becomes the current quantity. ______ If there is an open location, DDT deposits QWERTY in the open location, closes it, and opens the next location in memory. DDT then evaluates a _ second 36-bit expression as the SIXBIT character U in bits 0-5, with bits 6-35 reset. The last 36-bit expression evaluated becomes the current quantity. _____ _________ The syntax to enter a right-justified ASCII character is: "c where c is the character. DDT evaluates this as one 36-bit expression _ with the 7-bit ASCII character c in bits 29-35, and bits 0-28 reset. 3-6 DDT COMMAND FORMAT DDT COMMAND FORMAT ______ _________ The syntax to enter a right-justified SIXBIT character is: "c where c is the character. DDT evaluates one 36-bit expression with the _ SIXBIT character c in bits 30-35, and bits 0-29 reset. DDT translates lowercase characters to uppercase; all other non-SIXBIT characters cause DDT to sound your terminal buzzer or bell and display a question mark. _______ ____ The syntax to enter a RADIX50 word is: text5" ____ where text is any string of RADIX50 characters up to six characters long. DDT evaluates one 36-bit expression with bits 0-3 reset and the ____ ____ RADIX50 string text in bits 4-35. DDT ignores any characters in text after the sixth. For example, if you enter: poiuytr5" DDT evaluates one 36-bit expression with bits 0-3 reset and the RADIX50 ______ _ string POIUYT in bits 4-35. DDT ignores the character r. DDT ____ translates lowercase characters to uppercase. Characters in text not in the RADIX50 character set that are DDT commands use, as an argument to ____ the command, any characters already entered. Characters in text not in the RADIX50 character set that are not DDT commands cause DDT to sound your terminal buzzer or bell and display a question mark. 3.2.2 Operators in DDT Expressions 3.2.2 Operators in DDT Expressions When you enter an expression, DDT evaluates the expression to create a 36-bit quantity but does not necessarily use all 36 bits when it executes the command. For example, you can enter a complete MACRO instruction when giving an argument to a command that requires an address, but DDT uses only the address specified by the instruction (and ignores the rest of the evaluated expression) when it executes the command. Table 3-2 lists DDT's expression operators and the effects those _____ __ ___ operators produce on the evaluation. The term value so far represents the accumulated 36-bit value resulting from evaluation of the expression to that point. 3-7 DDT COMMAND FORMAT DDT COMMAND FORMAT Table 3-2: Effects of Operators When Evaluating Expressions Table 3-2: Effects of Operators When Evaluating Expressions OPERATOR EFFECT ON EVALUATION OPERATOR EFFECT ON EVALUATION + Add the 36-bit value on the left to the 36-bit value on the right, using two's complement addition. - Subtract the 36-bit value on the right from the 36-bit value on the left, using two's complement subtraction. * Multiply the 36-bit value on the left by the 36-bit value on the right, using PDP-10 full-word integer multiplication. DDT uses only the low-order 36 bits of the result. ' (apostrophe) Divide the 36-bit value on the left by the 36-bit value on the right, using PDP-10 full-word integer division. DDT ignores any remainder. NOTE Apostrophe is DDT's division operator. / (slash) is a DDT command to examine memory, and is never used in DDT to indicate division. space Add the previous expression (normally an opcode) to the value so far, and add the low-order 18 bits of the value at the right of the space to the low-order 18 bits of the value so far. DDT ignores carries resulting from the addition, and does not change the left half of the value so far. 3-8 DDT COMMAND FORMAT DDT COMMAND FORMAT Table 3-2: Effects of Operators When Evaluating Expressions (Cont.) Table 3-2: Effects of Operators When Evaluating Expressions (Cont.) OPERATOR EFFECT ON EVALUATION OPERATOR EFFECT ON EVALUATION , (comma) If you are entering an I/O instruction, shift the low-order 18 bits of the expression at the left of the comma 26 bits to the left (to the device field of the instruction), otherwise shift the low-order 18 bits of the expression at the left of the comma 23 bits to the left (to the A field of an instruction). Then logically OR the result into the value so far. NOTE DDT does not check whether the value at the left of the comma is a legitimate device or AC address, and may overwrite other parts of the instruction. () Swap the halves of the expression within the parentheses and add the resulting expression to the value so far. This makes it possible to enter an instruction that uses an index register. NOTE DDT does not check whether the value within the parentheses is a legitimate AC address, and may overwrite other parts of the instruction. @ Assume the expression is an instruction and set the indirect bit (bit 13) of the value so far. ,, (two commas) Move the low-order bits of the expression at the left of the commas to bits 0-17 and build a new 18-bit expression in the right half. 3-9 DDT COMMAND FORMAT DDT COMMAND FORMAT The nonarithmetic operators allow you to enter expressions in ___________ ______ ____ ______ instruction format as well as in data format. ___________ To enter an instruction, format the instruction as you would in a MACRO-20 program. For example: MOVE R4,@VAR1+OFFSET(R5) NOTE Follow an opcode (such as MOVE) with a space, not a . _________ To enter halfwords, enter the values (numbers or symbols) separated by two commas (,,). The halfwords can be symbolic or absolute values. For example: -1,,SYM1 NOTE DDT is not designed to evaluate complicated arithmetic expressions. The nonarithmetic operators are implemented to enable DDT to evaluate expressions you enter as MACRO-20 instructions and halfwords. Using values and operators for other purposes may not produce the results you intend. 3-10 CHAPTER 4 CHAPTER 4 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 4.1 DISPLAY MODES 4.1 DISPLAY MODES A major function of DDT is displaying the contents of memory words, both data and instructions. You can choose whether to display the contents of memory words as symbols or as numeric values. You can also select the radix in which DDT displays numeric values. DDT displays symbols, labels, and most messages in uppercase. 4.1.1 Default Display Modes 4.1.1 Default Display Modes There is no sure way for DDT to distinguish between instruction and data words, or between data words of different formats. DDT displays memory words in symbolic mode by default. Symbolic mode is described in Table 4-1. DDT tests for the condition on the left, and if the condition is met, displays the word in the format described on the right. DDT performs the tests in descending order. Table 4-1: Evaluation of Symbolic Display Mode Table 4-1: Evaluation of Symbolic Display Mode CONDITION DDT DISPLAYS EXAMPLE CONDITION DDT DISPLAYS EXAMPLE Bits 0-18 are all set. A negative number -45 in the current radix. The 36-bit value is defined The symbol. SYMBL1 in the user program symbol HALT table. The opcode field is zero. Halfwords. 345,,-27 4-1 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY Table 4-1: Evaluation of Symbolic Display Mode (Cont.) Table 4-1: Evaluation of Symbolic Display Mode (Cont.) CONDITION DDT DISPLAYS EXAMPLE CONDITION DDT DISPLAYS EXAMPLE The opcode and I, X, and Y The OPDEF. CORE 6, fields, or the opcode and A fields match an OPDEF in the user program symbol table. The opcode matches a The instruction. MOVE 3,SYMBL definition in DDT's internal hardware instruction table. No match. Halfwords. 3445,,-23 By default, DDT displays numeric values in radix 8. Leading zeros are always suppressed. 4.1.2 Selecting Display Modes 4.1.2 Selecting Display Modes You can select display modes to control: o the format in which DDT tries to interpret the contents of memory locations; for example, as instructions, or as floating-point numbers. o whether addresses are displayed as symbolic or numeric values. o the radix in which numeric values are displayed. In addition, you can specify these modes on a short-term (temporary mode) or long-term (prevailing mode) basis. A prevailing display mode remains in effect until you select another prevailing mode, but may be overridden by a temporary mode until you enter a command that restores the prevailing display mode. DDT commands that restore the prevailing display mode are: o {expr} (deposit expr and close location) o G (start program execution) o P (proceed from a breakpoint) o W, E, N (perform a search) o Z (zero memory) 4-2 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY _____ o instrX (execute instr) o V (watch a location) The syntax of commands that set the prevailing mode is: mode where mode is one of the display modes shown in Table 4-2. The syntax of commands that set a temporary mode is: mode where mode is one of the display modes shown in Table 4-2. _______ _______ ____ The current display mode is the mode (prevailing or temporary) in which DDT will display the next word (unless you enter a command to change the display mode). DDT has two "masks" that control the action of two of the display modes. 3M is a command that addresses a DDT location that contains the ______ ____ ____ ____ output byte size mask. When the current display mode is O, each bit that is set in the mask indicates the position of a low order bit of a byte in the word being displayed. In this mode, bit 35 is always assumed to be set. For example, if the output byte size mask contains: 510410100400 (octal) the byte sizes specified are, from left to right, 1, 2, 3, 4, 5, 6, 7, and 8. When displaying a word in O mode that contains 777777,,777777, and the current radix is 8, DDT displays: 1,3,7,17,37,77,177,377 The default value of the output byte size mask is zero, specifying one 36-bit byte. You can set the output byte size mask with the command: expr3M ____ where expr evaluates to the bit pattern required. You can also examine and change the output byte size mask with the examine and deposit commands described later in this chapter. 4-3 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 2M is a command that addresses a DDT location that contains the _______ ________ ______ maximum symbolic offset. When DDT displays an address in R(elative) mode, it displays the address symbolically, that is, as a symbol, or as a symbol + the numeric offset of the address from that symbol. The maximum symbolic offset (minus 1) determines the maximum offset address that DDT displays symbolically, and defaults to 1000 (octal). DDT displays addresses beyond that offset in A(bsolute) mode. For example, assume that the maximum symbolic offset is 2, and that you are examining subroutine ADDEM in program X.MAC (Fig 2-1), using to display instructions in sequence. DDT displays: ADDEM/ MOVE 0(6) ADDEM+1/ ADD 1(6) addr/ MOVE 2(6) ____ where addr is the absolute address (for example, 14414) of the location. You can set the maximum symbolic offset with the command: expr2M ____ where expr evaluates to the offset required. You can also examine and change the maximum symbolic offset with the examine and deposit commands described later in this chapter. DDT display modes and the commands that select them are described in Table 4-2. Table 4-2: DDT Display Modes Table 4-2: DDT Display Modes FORMAT MODES FORMAT MODES MODE EFFECT C Display memory word as numbers in the current radix (see Radix Modes). F Display memory word as a floating point decimal number. H Display memory word as two halfword addresses (see Address Modes) separated by two commas (,,). O Display memory word as numeric bytes of sizes that are specified by the 3M mask. n0 Display memory word as n-bit numeric bytes, (with trailing remainder byte, as required). 4-4 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY Table 4-2: DDT Display Modes (Cont.) Table 4-2: DDT Display Modes (Cont.) FORMAT MODES FORMAT MODES MODE EFFECT S Display memory word in symbolic mode (default). 1S Search DDT's internal hardware opcode table before searching the user's symbol table, otherwise follow rules for symbolic mode. nT Display memory word as ASCII text, using n-bit bytes. | n=1: Byte Pointer Format n=5: RADIX50 n=6: SIXBIT | n=7 through 36: | | Specifies the number of bits per byte. The | default is 7-bit ASCII. | | n=0: ASCIZ | | (Stop ASCIZ typeout by typing any character.) A Display addresses as absolute values in the current radix. R Display addresses as values relative to symbols (default). DDT displays the offsets in the current radix. The maximum offset is controlled by the value stored in the 2M mask, and defaults to 1000 (octal). RADIX MODES RADIX MODES MODE EFFECT nR Display numeric values in radix n (default=8), where n is a decimal number greater than 1. If n=8, DDT displays the word as octal halfwords, otherwise DDT displays the word as one number. o 4-5 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 4.2 DISPLAYING EXPRESSIONS 4.2 DISPLAYING EXPRESSIONS DDT has three commands you can use to display expressions in different modes. They are: ; (semicolon) = (equal sign) _ (underscore) The syntax of these commands is: {expr}c ____ ____ where expr is the expression to display (expr defaults to the current _ quantity), and c is one of the above commands. These commands are useful for redisplaying the current quantity without affecting the current display mode. Table 4-3 lists the commands to display expressions and their effects. Table 4-3: Commands to Display Expressions Table 4-3: Commands to Display Expressions COMMAND EFFECT COMMAND EFFECT ; Display the current quantity in the current display mode. expr; Display expr in the current display mode. = Display the current quantity as a number in the current radix. expr= Display expr as a number in the current radix. - Display the current quantity in 1$ mode. expr_ Display expr in 1$ mode. 4.3 DISPLAYING BYTE POINTERS 4.3 DISPLAYING BYTE POINTERS If you set the display mode to 1T, DDT displays the contents of the memory location as a byte pointer. DDT can display one-word local, one-word global, and two-word byte pointers. DDT displays the P and S fields, and the address as determined by the I, X, and Y fields of the byte pointer. In section zero, DDT displays only one-word byte pointers (local and global). 4-6 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY For example, if the contents of the location at ADDR2 is 100702,,addr, where addr is the value of symbol LABL2, the following illustrates one-word local byte pointer display: addr2/ 100702,,addr lT; 10 7 LABL2(2) The following illustrates one-word global byte pointer display, where addr is the value of symbol LABL2: 1,,addr2/ 610002,,LABL2 lT; 44&7 2,,LABL2 The following illustrates two-word global byte pointer display, where addr is the value of symbol LABL2 (DDT echoes as ^H): 1,,addr2/ 440740,,0 1,,addr2+1/ 3,,addr lT^H 1,,addr2/ 44 7 3,,MAIN. <2> 4.4 DISPLAYING AND DEPOSITING IN MEMORY 4.4 DISPLAYING AND DEPOSITING IN MEMORY DDT allows you to display the contents of memory locations and deposit a new value in the open location. In performing these functions, you must understand the concept of the open location, the current location, the location sequence stack, and the current quantity. ____ ________ The open location is a memory location (or AC) that is "open" for modification by the next command. There is never more than one location open at a time. DDT always closes the open location before opening another. ________ _______ The location counter contains the address of a word in memory that has been referenced (implicitly or explicitly) by the previous command, and that is the default point of reference for the next command. That _______ ________ word is known as the current location. DDT uses the address of the current location as the default address in most commands. The current location is often, but not always, the open location. Most DDT commands change the current location to a word specified by an address given (explicitly or by default) in the command. Commands that do not are so indicated. "." (period) is a command that returns (but does not display) the address of the current location. When you first enter DDT, the current location is zero. 4-7 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY ________ ________ _____ The location sequence stack is a "ring" of seventeen words, each containing the address of a prior current location, or of a match found during a search. The present value of the current location is not placed in the ring. Entries are made to and retrieved from the location sequence stack in a last-in, first-out manner. Most commands that change the location counter by values other than +1 and -1 cause DDT to place the address of the current location (before the change) on the location sequence stack. Addresses of matching locations found during searches are also placed on the location sequence stack. When DDT enters a new value in _______ ________ the next word on the stack, the new value becomes the current location _____ _____ stack entry. This is similar to PUSHing entries on a stack. When the current location stack entry is the last location on the location sequence stack, DDT enters a new value on the stack by "wrapping around" to the beginning of the stack and overwriting the value in the first location on the stack. The first location on the stack then contains the current location stack entry. Certain DDT commands change the address of the current location to the current location stack entry, and then change the current location stack entry to the previous entry. This is similar to POPing entries off a stack, and allows you to "return" to locations that have previously been the current location. When the first location on the location sequence stack contains the current location stack entry and DDT changes the address of the current location to the current location stack entry, DDT "wraps around" to the end of the stack, and the value contained in the last word of the stack becomes the current location stack entry (whether or not the stack was previously "full"). _______ ________ The current quantity is a value that is the most recent of: o the last 36-bit quantity that DDT displayed (an expression or the contents of a memory location) o the last expression that you entered as an argument to a command that deposits to memory ____ _____ _____ This value is also known as the last value typed. Q is a command that returns (but does not display) the current quantity. DDT issues an implicit Q to return this value for use as the default argument for some commands. You can give the current quantity as an argument to a command by entering the command Q as the argument. The command Q returns the current quantity with the right and left halves swapped. This manual uses the term $Q to refer to the value that is returned by the command Q, and the term $$Q to refer to the value that is returned by the command Q. 4-8 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY Some commands calculate the address of the location to be opened from an expression given or defaulted in the command. Other commands use the address of the current location or entries on the location sequence stack. The general syntax of these commands is: {expr}{}c ____ where expr is any legal DDT expression, and c is the command. NOTE ______ __ ___ ___________ See Values in DDT Expressions in Chapter 3 for a discussion of long text strings as values in DDT expressions. Table 4-4 summarizes the commands and their effects. Complete descriptions of the commands follow the table. Table 4-4: DDT Commands to Display Memory Table 4-4: DDT Commands to Display Memory COMMAND DISPLAY MODE OPEN CHANGE DEPOSIT COMMAND DISPLAY MODE OPEN CHANGE DEPOSIT CONTENTS OF THE CURRENT EXPR CONTENTS OF THE CURRENT EXPR DISPLAY LOCATION LOCATION DISPLAY LOCATION LOCATION / Yes Current Yes Yes(1) No [ Yes Numeric Yes Yes(1) No ] Yes Symbolic Yes Yes(1) No ! No Suppress Yes Yes(1) No \ Yes(2) Current Yes No Yes(1) Yes(2) Current Yes Yes Yes(1) No Restore No No Yes(1) Yes(2) Current Yes Yes(.+1) Yes(1) Yes(2) Current Yes Yes(.-1) Yes(1) or ^ (1) If you enter expr. (2) If not suppressed by !. 4-9 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 4.4.1 Commands that Use the Current Location 4.4.1 Commands that Use the Current Location The commands , , and use the address of the current location to determine the next address of the current location. These commands do not make entries to the location sequence stack. {expr} does the following: o deposits expr (if given) in the open location o closes the open location o resets the current typeout mode to the prevailing typeout mode o does not change the address of the current location {expr} does the following: o deposits expr (if given) in the open location o closes the open location o increments the location counter o opens the current location o o displays the open location (unless display has been suppressed by !) {expr} and {expr}^ do the following: o deposits expr (if given) in the open location o closes the open location o decrements the location counter o opens the current location o o displays the open location (unless display has been suppressed by !) 4-10 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 4.4.2 Commands that Use the Location Sequence Stack 4.4.2 Commands that Use the Location Sequence Stack The commands , , and use the current location stack entry to determine the next address of the current location. Repetitions of these commands refer to successively earlier entries on the stack, until you again address the most recent entry. These commands do not make entries to the location sequence stack. {expr} does the following: o deposits expr (if given) in the open location o closes the open location o changes the value contained in the location counter to the current location stack entry o opens the current location o starts a new line and displays the address and contents of the open location in the current display mode o causes the previous entry on the location sequence stack to become the current location stack entry NOTE If display is suppressed as a result of using the ! command, the command {expr} restores the current display mode, which can be either a temporary or prevailing display mode. {expr} does the following: o deposits expr (if given) in the open location o closes the open location o changes the value contained in the location counter to the current location stack entry o increments the location counter o opens the current location o starts a new line and displays the address of the open location 4-11 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY o displays the contents of the open location (unless display has been suppressed by !) o causes the previous entry on the location sequence stack to become the current location stack entry {expr} and {expr}^ do the following: o deposits expr (if given) in the open location o closes the open location o changes the value contained in the location counter to the current location stack entry o decrements the location counter o opens the current location o displays the address of the open location o o displays the contents of the open location (unless display has been suppressed by !) o causes the previous entry on the location sequence stack to become the current location stack entry 4.4.3 Commands that Use an Address within the Command 4.4.3 Commands that Use an Address within the Command The commands: / (slash) [ (left square bracket) ] (right square bracket) ! (exclamation point) \ (backslash) use an expression given in the command (either explicitly or by default) to determine the addresses of the current location and the open location. 4-12 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY The complete syntax of these commands is: {expr}{{}}c where expr may be an address, ".", a symbol, or any expression that is legal in DDT, and c is the command. When you use the commands /, [, ], !, \, and : ____ o If you omit expr > DDT uses the current quantity as a default. > enters the address of the current location on the location sequence stack and changes the current location to the address determined from the current quantity. ____ o If you enter expr, DDT enters the address of the current location on the location sequence stack (except \). ____ o DDT treats expr (whether given or defaulted) as if it were in instruction format and performs the effective address calculation as follows: > If you omit , DDT does not perform indexing or indirection. > If you include one , DDT treats expr as an IFIW (instruction format indirect word), and uses the I and Y fields of expr to perform indexing and indirection when appropriate. > If you use , DDT utilizes EFIWs (extended format indirect words), as appropriate, when performing effective address calculations, and can thereby calculate 30-bit addresses. > In section zero, when you include , it is treated as one . These commands always do the following: o close the open location o open the location at the address indicated by expr o change the current quantity to the value displayed (all commands except !) 4-13 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY The following is a list that gives a complete description of the effects of each command. COMMAND EFFECTS / o closes the open location o opens the location at the address calculated from the current quantity o displays the contents of the open location in the current display mode o sets the current quantity to the value displayed expr/ o closes the open location o opens the location at the address calculated from expr o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from expr o displays the contents of the open location in the current display mode o sets the current quantity to the value displayed [ o closes the open location o opens the location at the address calculated from the current quantity o displays the contents of the open location in numeric mode in the current radix o o sets the current quantity to the value displayed 4-14 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY expr[ o closes the open location o opens the location at the address calculated from expr o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from expr o displays the contents of the open location in numeric mode in the current radix o sets the current display mode to numeric mode in the current radix o sets the current quantity to the value displayed ] o closes the open location o opens the location at the address calculated from the current quantity o displays the contents of the open location in symbolic mode o sets the current display mode to symbolic mode o sets the current quantity to the value displayed expr] o closes the open location o opens the location at the address calculated from expr o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from expr o displays the contents of the open location in symbolic mode o sets the current display mode to symbolic mode o sets the current quantity to the value displayed 4-15 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY ! o closes the open location o opens the location at the address calculated from the current quantity o does not display the contents of the open location o suppresses display of the open location by the \, , , and commands (any other display command restores the current display mode) o does not change the current quantity expr! o closes the open location o opens the location at the address calculated from expr o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from expr o does not display the contents of the open location o suppresses display of the open location by the \, , , and commands (any other display command restores the current display mode) o does not change the current quantity \ o closes the open location o opens the location at the address calculated from the current quantity o displays the contents of the open location in the current display mode (unless display has been suppressed by !) o sets the current quantity to the value displayed 4-16 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY expr\ o deposits expr in the open location o closes the open location o opens the location at the address calculated from expr o does not change the address of the current location (and does not enter the address of the current location on the location sequence stack) o displays the contents of the open location in the current display mode (unless display has been suppressed by !) o sets the current quantity to the value displayed o closes the open location o opens the location at the address calculated from the current quantity o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from the current quantity o starts a new line and displays the address of the open location (which is also the current location) o displays the contents of the open location in the current display mode (unless display has been suppressed by !) o sets the current quantity to the value displayed expr o deposits expr in the open location o closes the open location o opens the location at the address calculated from expr o enters the address of the current location on the location sequence stack o changes the current location to the location at the address calculated from expr 4-17 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY o starts a new line and displays the address of the open location (which is also the current location) o displays the contents of the open location in the current display mode (unless display has been suppressed by !) o sets the current quantity to the value displayed ____ You can treat expr as an IFIW (instruction format indirect word), and ____ use any indexing and indirection specified by expr to compute the effective address of the location to be opened. Use the command form: {expr}c where c is /, [, ], !, \, or . For example, assume the following conditions as indicated by the display commands: COMMAND DISPLAY EXPLANATION LABL1/ SYM1 Display contents of LABL1. LABL1+1/ SYM2 Display contents of LABL1+1. SYM2/ SYM3 Display contents of SYM2. 2/ 1 Display contents of AC 2. @LABL1(2)/ SYM1 DDT uses Y field only. @LABL1(2)/ SYM3 causes indexing and indirection. Note that DDT does not start a new line unless you enter , , or , or until the display wraps around the end of the line. DDT also displays three spaces (or a tab, depending on the TTY control mask) before and after its output. Thus, an actual DDT terminal display might be the following (user input is lowercase; and do not appear on the screen, but are shown to indicate where you pressed the corresponding keys): 2/ 1 labl1/ SYM1 LABL1+1/ SYM2 SYM2/ SYM3 sym4/ MOVE 1,@LABL1(2) SYM2/ SYM3 ____ You can treat expr as an EFIW (extended format indirect word) and use ____ any indexing and indirection specified by expr to compute the (global) effective address of the location to be opened. Use the command form: {expr}c where c is /, [, ], !, \, or . 4-18 DISPLAYING AND MODIFYING MEMORY DISPLAYING AND MODIFYING MEMORY 4.5 DISPLAYING ASCIZ STRINGS 4.5 DISPLAYING ASCIZ STRINGS You can display memory as an ASCIZ string. The command addr0T where addr defaults to the open location (if there is one, otherwise addr defaults to the current location), displays memory, beginning with addr, as an ASCIZ string. The