CHAPTER 4 D86 CONTROL KEYS D86 has a set of functions invoked by single keys. Keys which switch the display (for example, to show a help screen) can be pressed in any context, to be acted upon immediately. Other keys, such as the single-stepping keys, can be invoked any time D86 is awaiting the beginning of an assembly language command. Display Control Keys There are numerous keys that let you control the switchable window in the upper right corner of the screen. The F10 and Alt-F10 keys let you toggle between windows, giving you a "tour" of what's available. Various keys accessed by using the "Ctrl" key as a shift key let you move directly to the window of your choice. The keys in this section are acted upon in any debugger context, whether you are in the main command mode or in the middle of one of the other modes (typing in a debugger command, an immediate-execute line, a patch-memory line, or a memory window specification): ALT-F10 Toggles you between Help and Non-Help modes. If the window is showing you a help page, it will switch to the last Non-Help page that was displayed. If not, the window switches to the last Help screen displayed for the current context. (HELP key on Wang and DEC, F11 key on TI-PC, CTRL-PF5 key on Sanyo) F10 In non-help mode, toggles you between the available non-help windows: the sign-on/second disassembly window, the status window, the memory display window, and, if you have a floating-point chip, the floating-point display window. In help mode, toggles you between the help windows available in the current context. (Keypad 0 on the DEC, Print Screen on the Z-100) Ctrl-I (or TAB) takes you from any other window directly to the sign-on/second disassembly window. This window contains the D86 sign-on message until the first time that the Instruction Pointer leaves the first disassembly page. From that point on, the sign-on message is no longer available, and you get a second disassembly page instead. Ctrl-S Takes you from any other window directly to the debugger status window. Ctrl-F Takes you from any other window directly to the floating point display window, if your machine has a floating point chip in operation. If not, this key is ignored. 4-2 Ctrl-N If you have a memory display window in sight, this key advances to the Next window full of memory. If you do not have a memory display window, but do have at least one memory line specification, this key takes you from any other window to the memory display window, continuing from the end of the last line display. If you have no memory line specifications set up, this key is ignored. Ctrl-P If you have a memory display window in sight, this key retreats the pointer to memory displayed, by the amount displayed in the window. If all the memory formats specified generate a fixed-size display (such as the B,W,T formats), then this will effect a "Previous page" function. If there are formats producing a variable-size display (such as the N,D,C,S,L formats), then the retreat will be a probably imperfect approximation to an appropriate "Previous page" amount. If you do not have a memory display window, this key will go to one, just like the Ctrl-N key. Ctrl-Q If you are not displaying a help window, this key takes you to the last help window that was displayed for the current context. If you are already displaying a help window, this key toggles through all the help windows available for this context. Instruction Pointer Positioning Control Keys All the remaining keys in this chapter can be invoked any time the debugger is in its main command mode, awaiting the first key of a debugger command or immediate assembly line. They change the value of the Instruction Pointer (IP register), and thus they change the disassembly display. None of the control keys in this section cause any program code to be executed, other than the equivalent of a JMP instruction, to the place that the disassembly cursor winds up. WARNING: On some debuggers, you can change the location of what is being disassembled without changing the IP register value. I've decided on a "what you see is what you get" philosophy, since you may well be moving the IP cursor to effect a jump in the program (for example, you might use the Down-Arrow key to experimentally skip over the execution of one or more instructions in the program). If your intention was just to look around the program before continuing execution at the place you left off, you may use the HOME key to return to the place where execution last halted. Down-Arrow Jump to the instruction following the current one. Visually, the disassembly cursor moves down by one instruction line. 4-3 Up-Arrow Jump to the instruction preceding the current one. Visually, the disassembly cursor moves up by one instruction line. NOTE that the implementation of this function is a little tricky, since it's impossible to reliably disassemble backwards. What D86 does is retreat a fixed, fair-sized distance, disassemble forward until the current instruction is reached, and take the instruction disassembled just before the current one. If there is non-instruction code in memory shortly before the current position, the synchronization may fail, and this instruction may put you in the middle of a previous instruction instead of the beginning. If this happens, you may adjust by using the Ctrl-D or Ctrl-U keys. Ctrl-D This key is identical to the Down-Arrow key, except the jump forward is just one byte, instead of a full (usually multibyte) instruction. (IP is incremented.) You use this key when you think you've landed in the middle, rather than the start, of an instruction. Ctrl-U This key decrements IP, moving the cursor "Up" by one byte's worth. Like Ctrl-D, it is used to manually synchronize disassembly. Pg Dn Jump to the next disassembly page, at the memory location immediately following this page. Repeated pressing of this key allows you to scan program code quickly. (Alt-Down-Arrow on the TI-PC, Ctrl-C on the Victor, Next Screen on the DEC, F12 on the Z-100) Pg Up Jump to the previous disassembly page, ending with the instruction just before the top instruction on the current page. NOTE the warning given with the Up-Arrow description, about possible synchronization problems, applies here as well. (Alt-Up-Arrow on the TI-PC, Ctrl-R on the Victor, Prev Screen on the DEC, F11 on the Z-100) Home If you have moved the IP cursor since the last program instruction executed, then this key returns IP to that spot. If you are already at that spot, this key returns you to the program's starting location. For COM files, this is always location 0100 in the original code segment. For EXE files, this location was derived from the EXE header record. Note that repeated pressing of HOME will cause IP to alternate between the two locations, so you can't mess yourself up by pressing the key one too many times-- just press it again. (Ctrl-K on the Victor, Find on the DEC) 4-4 Ctrl-E Jump to the End of the program, as determined when it was loaded, and possibly advanced if the program was patched from the end. Program Execution Control Keys Ctrl-X Single step the current instruction. If the instruction is a call, go into the procedure to single step it. If you want the entire procedure executed on a single keystroke, use the F2 key. F1 Single-step the current instruction just like the Ctrl-X key, except that INT instructions are executed all at once, not stepped into. This exception was added with D86 V3.21, because stepping into DOS or the BIOS is a hazardous operation, likely to crash the computer. (Keypad 1 on the DEC) F2 Procedure step: start program, trapping at the instruction following the current one. This is used for executing a procedure call all at once; for breaking out of a loop; and for executing a repeated string operation all at once. F4 Start the program, setting a trap at the destination of the conditional jump instruction currently pointed to. If we are not pointing to a conditional jump, then we single step. F6 Start the program, setting a trap at the address on top of the stack (hopefully a procedure return address). F9 Go until here: Start the program from the point at which it last stopped, setting a trap at the current CS:IP location. If you didn't move the IP cursor since the program stopped, this will simply tell the program to go until the next time this same point is reached. If you did change IP, (for example, if you paged forward to find an interesting section of code), this command saves you from having to go back and single-step up to this point. Special Action Control Keys F3 Repeat the last typed-in assembly language or debugger command F7 Enter the Patch Memory mode, described in Chapter 3. 4-5 Shift-F7 Mark the current CS:IP memory location, for use by a following F debugger line command. F can either return to this location, or find memory bytes that match the ones at this location. (Ctrl-7 on the Sanyo, Select on the DEC) Alt-F9 If you have a Color video board, your debugger display may become corrupted by the program's console output. If it does, press Alt-F9 to eliminate the corruption. This key exists only temporarily; on later versions of D86, the corruption will be corrected automatically. (Ctrl-Shift-PF4 on the Sanyo) Ctrl-T Reset the debugger's internal Top-of-Stack pointer to the current SP value. This will cause the current stack display to become empty, so that subsequently pushed values will appear by themselves on the stack display.