MMD - Mark's MegaDebugger. ========================== Version 1.00. September 1994. Copyright (c) 1993 Mark Thomas NPS Software. 1 Contents ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1 Contents 2 Introduction 2.1 Features and Limitations 3 Legal Notice 4 Quick Start 5 Using MegaDebugger 5.1 Using the Window Mode 5.2 Using the Non-Window Modes 5.3 Screen Swapping 5.4 Expressions 6 Debugging a Program 6.1 Controlling Program Execution 6.2 Restarting the Program 7 Command Line Arguments 8 Command Reference 8.1 Command Parameters 9 Configuration 9.1 MMDCFG 10 Default Key Definitions 10.1 Default Microsoft Keys 10.2 Default Borland Keys 11 Operator Precedence Reference 11.1 Assembler Language Operators 11.2 C Language Operators 11.3 Pascal Language Operators 11.4 A86 Language Operators 12 Error Messages 12.1 Initialisation Errors 12.2 Command Errors 13 Known Bugs 14 Registering 15 Future Enhancements 2 Introduction ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ MegaDebugger is a low level debugger for DOS programs that is designed to provide powerful debugging functions in a more modest amount of memory than traditional debuggers. This manual assumes that you have a basic knowledge of the 80x86 processor's instruction set and registers and of the debugging process. All key references in the manual are based on MMD's default Microsoft configuration, a configuration file MMD_TD.CFG is supplied for a Turbo Debugger setup. 2.1 Features and Limitations þ Features: - A windowed output that automatically displays the registers, watches and unassembly information. - Saves and restores MDA, CGA, EGA and VGA text and graphics screens. Register level swapping means that MMD can handle split screens and VGA mode X perfectly. - Shows DOS memory allocation blocks, interrupt usage and open files. - VGA 25, 28, 43, and 50 line text screen support. - Supports expressions using the operators and data types from C, Pascal and Assembler/A86. - Extremely customisable. - Uses little memory (20k-80k) and works well on older 8086 and 286 systems with limited memory. Fast: No disk overlays and quick conditional breakpoint and watchpoint evaluation. - MMD can 'keep' the keyboard interrupt, allowing it to function with programs that install their own Int09 handler. þ Limitations: - No support for numeric co-processor data types. - No symbolic or source level debugging. - No 386 support. 3 Legal Notice ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The MegaDebugger documentation and software are not public domain. They are copyrighted, Copyright (C) 1994 Mark Thomas. MegaDebugger is free for personal or private use. However some contribution to the development of MMD would be appreciated. This can be a registration, donation, supply of information (see the final section) or simply postcard or Email saying that you find MMD useful. MegaDebugger is NOT free for use in a commercial, institutional or governmental setting. Permission is given to use the software free of charge for a thirty day evaluation period, after which registration is required for continued use. A single user registration costs AUS$50.00 and entitles you to a free upgrade to the next version of MMD. For site licence information contact me. Please send cheques or postal orders (in Australian dollars please) to: Mark Thomas 8 Herronbee Street Toowoomba, Queensland Australia 4350. Please indicate a registration name and preferred disk size when registering. You are free to distribute COMPLETE and UNMODIFIED copies of all the software and documentation via any means to any recipient provided that no charge is made except a small and nominal fee whose sole purpose is to recover reasonable distribution expenses. This software is supplied "AS IS", WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is supplied as is, in the hope that people will find it useful. The author is not responsible for any damage caused by use or misuse of this software. 4 Quick Start ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ If you are familiar with other debuggers such as DEBUG, SYMDEB, or CodeView then you will find the default MMD configuration provides a similar environment. However MMD is designed to be configurable and MMD can easily be setup like Turbo Debugger using the sample configuration file supplied. Here is a quick introduction to using MMD: þ An important feature of MegaDebugger is its dual cursor system. Only the Assembler and Command windows can be made active and both have separate cursors. When the Assembler window is the current window then its cursor will be highlighted. By holding the Shift key while using the scroll keys the other window cursor can be controlled. All letters typed will go to the command window, and commands such as F9;Toggle Breakpoint will work regardless of which window is current. þ To change the size of the windows use Ctrl-G; Expand command window and Ctrl-T; Shrink command window. þ There are some useful shortcut keys for the Assembler Window: Ctrl+O;Origin, Ctrl+N;New CS:IP, Ctrl+P;NOP Instruction þ The commands used by MMD are a superset of those in DEBUG and are more flexible in that expressions can be used in the parameters. The H command or F1;Help will provide help on their usage. F3;Replay Command can be used recall and edit previous commands. þ "/VR /VG /VP" provides the best screen swapping. Enables register level swapping, complete graphics saves and palette saves. The default swapping mode MMD uses is the standard method used by most other programs which can corrupt graphic screens, while register level swapping can restore almost all screens. ³ ³ Do NOT use register level swapping if the target program may use SVGA ³ screen modes. All Super VGA modes are controlled by extended set of ³ chipset specific registers, which MMD's register level swapping is ³ not aware of. Therefore when swapping between the target screen and ³ MMD only the standard VGA registers will be saved and restored, ³ leaving the extended registers in an undetermined state. ³ ³ *** USING REGISTER LEVEL SWAPPING WITH SUPER VGA MODES MAY DAMAGE *** ³ *** YOUR MONITOR OR GRAPHICS CARD. *** ³ ³ All other MMD swapping modes (Standard and VGA BIOS) are completely ³ safe to use in all screen modes. ³ þ "/H- /VN /VR" minimises the memory used by MMD. Disables help and higher screen mode changes and enables register level swapping. The standard swapping mode uses about 16k of memory for swapping, while register mode uses only 4k. Help uses around 15k of memory and is rather limited so should be disabled if it is not required. If there is still insufficient conventional memory for the target to run then try Screen (/S) or DOS (/D) output modes (Note: is difficult to use LOADHI to load MMD into the HMA as about 128k of memory is used during initialisation). þ I also recommend using the A86 language support: it provides a unambiguous method for specifying decimal and hexadecimal numbers and has the same operators as TASM and MASM. þ MMDCFG can be used to create a custom configuration for MMD. 5 Using MegaDebugger ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ When MegaDebugger has successfully loaded it will display its initial screen with a start up message and a hyphen (-) prompt. MegaDebugger. Version 1.00 (c) 1994 Mark Thomas CPU:80286 - This means that the target program is ready for execution and that MegaDebugger is ready to accept your commands. Each command consists command name of one or two characters followed by any parameters that are required. All input on the command line is case insensitive, so input can be in upper or lower case. 5.1 Using the Window Mode The default output mode for MegaDebugger is window mode. This presents the debugging information on the screen in a series of windows. This is the most powerful mode of operation because all the information from the Register, Unassembly and Watch commands is automatically displayed and updated on the screen at the same time. Register Windows There are two register windows in MegaDebugger, one across the very top of the screen known as the Horizontal Register window, which will be closed initially. The second, the Vertical Register window, runs along the right hand side of the screen and is open by default (the initial settings can be changed with MMDCFG). The reason for providing two windows is that the output in the command window, particularly that of Dump Memory command, can sometimes be obscured by the Vertical Register window. The Vertical Register can be open and closed with F2;Toggle Vertical Register Window, Ctrl-F2;Toggle Horizontal Register Window performs the same function for the Horizontal Register window. Watch Window The Watch window displays any watches that are active. If there are no watches then it will be closed, and remain so until a watch is added using one of the Watch commands. Each time a watch is added or deleted this window will resize itself to display all the current watches. Assembler Window In the centre of the screen is the Assembler window, which displays an area of memory in disassembled processor instructions. A large blue highlight bar indicates the current address of CS:IP. As each instruction is executed, and the values of CS:IP change the bar moves through the displayed code to represent the flow of execution. Also in the window is a solid non-blinking cursor, which is the Assembler window cursor. An important feature of MegaDebugger is the dual cursor system. At any time there are two independent cursors on the screen, the first is the traditional hardware blinking cursor in the Command window. The second is a simulated cursor in the Assembler window. One of the windows is known as the current window, the window that responds to the scrolling keys (Up, Down, PgUp, and PgDn) and the other will be the secondary window. MegaDebugger provides a way to access the secondary window without having to use F6;Change Window. By default the Assembler window is the current window. Using any of the window scroll keys will scroll the Assembler window. By pressing and holding the Shift key while using the scroll keys the Command window cursor can be controlled. This method is faster than continually pressing F6;Change Window to move between windows. It also means that a breakpoint can be set at the address of the Assembler window cursor using the F9;Toggle Breakpoint key at any time regardless of which is the current window. The converse is also true, if the Command window is the current window then the scroll keys will move the Command window cursor and the Shift and scroll key combinations will address the Assembler window. When the Assembler window is made the current window then its cursor will become highlighted. You can determine which is the current window simply by looking at the colour of the Assembler window cursor. Scrolling the Assembler window backwards will cause the screen to flip backwards. This is because it is very difficult for MMD to determine the length of a previous instruction, as each byte may have a valid interpretation. Because it is possible for the disassembly to become out of step with the actual code this way the offset address can be adjusted one byte at a time using the Ctrl-Right and Ctrl-Left keys. Command Window At the very bottom of the screen is the Command window, where the MegaDebugger user prompt (-) is displayed and your commands are entered. The current input position is indicated by the blinking cursor. This is where the characters you type will be displayed. All keyboard input goes to this window regardless of which is the current window. Previous commands can be recalled and edited using F3; Replay Command. The initial height of the window is only five lines. Any lines that are printed by MMD will force the top lines to scroll upward and disappear behind the Assembler window. When the window scrolls up the blinking cursor will disappear from the screen, but it will still record any characters you enter. The height of the Command window (and consequently the Assembler window) can be changed using the Ctrl-G and Ctrl-T keys. 5.2 Using the Non Window Modes When either Screen or DOS output mode is specified on the MegaDebugger command line the window functions are disabled and the output can be thought of as if the Command window has been expanded to fill the entire screen. Instead of updating the register window after a section of the target program has been executed, MMD will dump the contents of the registers to the screen. The function keys will continue to work in Screen output mode, except those that are specifically for window mode. In DOS output mode none of the function keys are available so the equivalent MegaDebugger commands must be used. Non window modes are usually only used to save memory or for a primitive form of remote debugging (by redirecting the DOS output to a COM port and displayed by a terminal program on the local computer). 5.3 Screen Swapping Because MMD output occupies the entire screen in Window and Screen modes it leaves no space for the target program to display its output. To overcome this, a technique called screen swapping is used to save and restore the output screen each time a section of the target screen executes. This means that all the target program's output will be displayed normally on the screen, and when MMD becomes active it will save a copy of this screen and replace it with its own. Then when returning to the target program the output screen is restored. MMD has three swapping modes Smart, On and Off. In most cases only smart swapping mode will be the only mode required. It swaps the screen only when it considers necessary: - An instruction reads or writes to BIOS video data or screen memory. - An IN or OUT (and INS or OUTS) instruction is executed. - During Go, Proceed or Goto Cursor. The "On" swapping mode swaps all the time, "Off" will disable all swapping (losing any target output and corrupting the MMD screen). The View Output command or F4;View Output Screen can be used to view the output screen from MMD at any time. 5.4 Expressions MegaDebugger can evaluate expressions using operators from one of four languages supported: C, Pascal, Assembler and A86. By default Assembler operators are used, but this can be modified as a command option or with MMDCFG. An expression can be used in any command parameter instead of providing a constant address. An expression consists of an ordered mixture of constants and operators from the current language. þ Constants There are three types of constant values accepted by MegaDebugger: - Numeric Constants: Numbers are interpreted according to the current radix and language. MMD has a several extensions to the standard radix types for some languages, this is detailed in Section 11. - Registers: The name of any of processor registers, both 8 and 16 bit, can be specified in an expression. MMD will determine the current value of the register and use it in the expression. - Quoted Character Constants: A single character enclosed in single quotation marks (') will be used in the expression as the ASCII character equivalent. To specify a single quote as the character constant use three consecutive quote characters ('''). þ Operators MMD supports all simple unary and binary operators and parentheses for each language, see Section 11. It does not support any assignment operators, array and structure operators, or pointer and type casting operators. In evaluating an expression all arithmetic is done in 16-bit unsigned integer math, if the result exceeds that which can be stored in 16 bits then it will simply wrap around to zero, with no warning. 6 Debugging a Program ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 6.1 Controlling Program Execution MegaDebugger provides a number of ways for you to control the execution of the target program. Trace. In single step mode, control returns to MMD after each processor instruction is executed. The Trace command or F8;Trace function key can be used to trace through the target program. Breakpoint. A breakpoint defines an address in memory which, when executed, will return control to MMD. MegaDebugger provides 10 user breakpoints for this purpose. Breakpoints can be set with the Set Breakpoint command, F9;Toggle Breakpoint function key or with the Go command. Proceed. Proceed is similar to the trace function however it will step over LOOP, CALL and repeated string instructions. The Proceed command or F10;Proceed function key can be used to proceed through the target program. Go. When the Go function is used the target program is allowed to execute freely until it terminates, or is interrupted by a breakpoint or keyboard break. The Go command or the F5;Go function key can be used to run the target program. Keyboard Break Interrupt. When the target program is running MMD will monitor the keyboard for the Ctrl-Break keyboard combination. When these keys are pressed it will force an immediate entry into the debugger screen. This method is different to the normal DOS Ctrl-Break routine, however if you wish to force a DOS break then use the Ctrl-C key combination. MMD will not normally interrupt DOS while it is handling a software INT 21 instruction, instead MMD will wait until DOS completes processing and the break will occur immediately after the INT 21 instruction. WatchPoint (Global Breakpoint) Setting a watchpoint and executing the target will cause MMD to single step through each instruction and evaluate the expression for each watchpoint at each step. If the result is TRUE then MMD will interrupt execution. This slows the execution speed greatly. Go To Cursor. When using Window mode there is an additional way to run the target program, F7; Go To Cursor. This will place a temporary breakpoint at the address represented by the current cursor position in the Assembler window and then run the target program using the Go command. 6.2 Examining and Modifying the Program State Each time MMD returns from executing a section of the target program it will update the display of the program state and display the prompt to allow debugger commands to be entered. The program can be altered at this stage by changing the values of flags and registers (including CS:IP), or by modifying the program memory with the Enter or Fill memory commands. 6.3 Restarting the Program When the target program runs to completion MegaDebugger will display the program termination messages: Program Terminated Normally (xx) or Program Terminated Resident (xx) The value in brackets is the return code, or error level that the target program returned. No further instructions can be executed by MMD until the target program is reloaded using the Reload Target File command. If you try to use one of the execution commands (Go, Trace or Proceed) or their equivalent function keys MMD will display a message advising you of this: Program Terminated: Restart 7 Command Line Arguments ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The command line format for MegaDebugger is: MMD [options] [target [arguments]] þ options /?, /H Command line help. /C Use configuration file. Forces a specific configuration file to be loaded. MMD will automatically load a configuration file called 'MMD.CFG' in the default directory, but other files with other names must be directly specified. /D DOS redirectable output. Specifying DOS output mode will disable the screen swapping and use DOS functions for both input and output. These DOS functions do not support function keys so all input will be through the command line. The primary advantage of this mode is that the input and output of MMD can be redirected using the DOS redirection commands. MMD uses around 10k less memory because the screen saving buffers are not required. /DO, /2 Dual Monitor output. Redirects all MMD output to the monochrome screen on a system with two monitors. ³ Untested: I did not have the necessary equipment to actually ³ try this out but have tested it as far as possible, could ³ someone let me know if they can use it with their system. /Hxx Set screen height: 25,28,43,50. This switch is relevant only for EGA and VGA systems, where the number of lines in a text screen can be varied. By default MegaDebugger will use the same number of screen lines that the current text screen has, but this switch allows you to override this and use a specific screen size. Increasing the size of the screen also increases the size of the buffer required by MegaDebugger for screen swapping. You can view the difference by examining the size of the debugger memory block with the Memory Information command. In DOS output mode this switch has no effect. /H[ñ] Include or exclude online help. Disables loading of the MMD help file. Although compressed is still quite large and this option allows loading of the help file to be disabled, decreasing the amount of memory required by MMD. Help will still be available through the command line ?;Help command. /I[ñ] Allow DOS process ID switching. MMD attempts to have as little to do with DOS as possible, however when writing files from MMD it is wise (though not necessary) to enable PSP switching. ³ Note: MMD does not have a critical error handler so any ³ any errors occurring when writing a file with ³ or W will be passed to the target's handler, if it has one. /KD[ñ] Keep keyboard interrupt thru DOS. Many programs install a new keyboard interrupt (Int09) meaning that the MMD keyboard handler cannot interrupt the target program. MMD will attempt to 'keep' the keyboard interrupt by intercepting any DOS Set Interrupt Vector (Int21/AH=25h) calls that would change the Int09 vector and installs its own handler which chains to the requested new handler. /KP[xx][ñ] Keep keyboard interrupt thru PIC. This option attempts to keep the keyboard by reprogramming the Programmable Interrupt Controller (PIC) to generate an interrupt other than Int09 when a key is pressed. A program installing a new handler for interrupt 09h will be unaware that MMD is using a different set of interrupts. As MMD controls these new interrupts it can check for a keyboard break before chaining to the target's Int09 handler. This method ensures that a keyboard break can always be detected as long as the keyboard IRQ is enabled. However reprogramming the PIC has two drawbacks, firstly a series of 8 consecutive interrupts must be available for the new interrupts. In most systems there is usually such a range between interrupts 78h - EFh. The default interrupt range is D8h-DFh, but MMDCFG should be used to verify that this or any other range is free before it is used. The second problem is that redirecting the interrupts may interfere with a protected mode environment which has usually already shifted the interrupts. If VCPI or DPMI is detected then MMD will notify them of the change. /Kx Key definitions; B:Borland, M:Microsoft. By default MegaDebugger uses CodeView key definitions, but if you are more familiar with Turbo Debugger or any of the Borland Integrated Development Environments then this switch will redefine the function keys (although there are some differences between individual Borland and Microsoft products, see Section 10 for MMD key definitions). /S Screen swapping, no windows. This switch will disable the Window output mode of MMD and produce line orientated output similar to the DOS output mode. However screen swapping and function keys will still be active. This conserves memory by not having to load the window code and buffers. /Lx Expression language; A:Assembler, P:Pascal, C:C, 8:A86. MegaDebugger supports expression operators from four different languages: C, Pascal, Assembler and A86. By default Assembler operators will be used. /Vx Screen swapping type; S:Standard, B:VGABIOS, R:Register. Sets the method MMD uses for swapping screens. Standard mode uses several BIOS functions and adaptor registers to swap screens. VGABIOS mode uses the VGA BIOS Save and Restore state functions, it was written only out of curiosity and was extremely slow on my system. Register level is the most powerful method, it swaps modes by reading and writing all the registers directly, so can support mode-x and split screens but not SVGA modes. Register level swapping is supported on MDA, CGA and VGA systems. ³ ³ Do NOT use register level swapping if the target program may use SVGA ³ screen modes. All SuperVGA modes are controlled by extended set of ³ chipset specific registers, which MMD's register level swapping is ³ not aware of. Therefore when swapping between the target screen and ³ MMD only the standard VGA registers will be saved and restored, ³ leaving the extended registers in an undetermined state. ³ ³ *** USING REGISTER LEVEL SWAPPING WITH SVGA MODES MAY DAMAGE YOUR *** ³ *** MONITOR OR GRAPHICS CARD. *** ³ ³ All other MMD swapping modes (Standard and VGA BIOS) are completely ³ safe to use in all screen modes. ³ /VG[ñ] Enable complete EGA/VGA graphics save. By default MMD will not save and restore video memory used for the character set. In standard text modes and some graphics modes this is acceptable but in graphics modes and some custom text modes it will corrupt the screen. Enabling a complete graphics save requires 4k more memory. /VN[ñ] Disable higher mode sets. MMD can allow its screen height to be changed from the command prompt, however this requires additional buffers to save the largest screen size possible, even if it is not used. /VP[ñ] Enable VGA palette saving. MMD saves and restores the palette information. Uses about 1k extra memory. þ target This specifies the name of the file you wish to debug. An extension is not required for the file name if the file is .COM or .EXE type because MMD will try both extensions when searching for the target file. The first attempt will be for a .COM extension and then .EXE, which is the same order that DOS searches for an executable file. In window mode the file name and path of the target file are displayed at the top of the screen. MMD does not allow the target file to be changed once it is loaded. þ arguments This is the command line you wish to run the target program with when MegaDebugger loads it. The command line can be changed with L;Reload Target command. 8 Command Reference ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Command Parameters - Address: An address can consist of just an offset, in which case the command will use a default value (either DS or CS depending on which command) for the segment, or both the segment and offset values. In this case the segment and offset must be separated by the segment override character (a colon ':'). - Byte: A byte value is an 8-bit expression. - Command line: The command line is simply a string of characters which will be passed to the target program as its command line argument. - Comment: A comment string is simply a string of characters. - Count: A count is simply a expression that will evaluate to a word. - Expression: An expression can be supplied as defined in the Expressions section, however the segment override operator is also allowed. - Format: A format character defines how the output of the command is to be displayed. MegaDebugger uses the following format characters: A ASCII string B Byte C Character D Double Word I Decimal integer L Long Integer U Unsigned decimal integer W Word - List: A list is a set of numbers between 0 and 9, or * to specify all numbers from 0-9. - Port: A port address is the number of one of 65,355 I/O ports available on PC computers. - Range: A range consists of two addresses, or a single address and a length specifier. Only the first address may have a segment specified. In some commands the range is optional and only the address may have to be supplied. To specify an entire segment in a range a length of 0 should be given. - Register: Any 16-bit register name, as well as the flags (FL) register. - Values: A set of bytes and strings separated by spaces. The strings must be delimited by matching (') or (") characters. To specify one of these characters as an element of the string use either double delimiters 'it''s', or use the other type of delimiter to delimit the string, "it's". The ASCII values of the characters in the string are used as byte values. Current Location ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ . This command will return the Assembler window highlight cursor bar, which represents the address of CS:IP, to the top of the screen. SeeAlso: Ctrl-O;Origin. Help ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ?, H Displays a brief summary of all MMD commands and their parameters. Unlike the help window this command is always available, in all output modes and when the context sensitive online help window is not included. SeeAlso: F1;Help. Evaluate Expression ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ? expression[,format] This is essentially a calculator, any expression given will be evaluated and displayed. The optional format character allows the result to be displayed in a format other than the default, which is a hexadecimal word. SeeAlso: Configuration;Default Expression Format. Assemble Instructions ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ A [address] Assembles instructions directly into memory. This is similar to the DEBUG assembler with the following enhancements: - Inline overrides are supported, eg: REP MOVSB and MOV AL,ES:[SI]. - Most real mode 286 instructions are available. - Directives ORG, DB and DW. The default segment is the current CS. Math coprocessor instructions are not supported. SeeAlso: Ctrl-P;NOP Instruction. Set a Breakpoint ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BP [address] [count][,expression] MegaDebugger supports 10 user breakpoints. These can be set at any address in memory, except that of another breakpoint. If at any point the computer executes the instruction at the address of a breakpoint the program will be interrupted and MMD will regain control. If no address is specified then it will default to the current CS:IP. The optional count allows the breakpoint to be passed a number of times before it will interrupt the program's execution. This is particularly useful when the breakpoint is placed inside a loop. Each time the breakpoint is executed the pass count is decremented, until it reaches 1 when the breakpoint becomes the same as an ordinary breakpoint with no pass count. The only way to clear a pass count is by manually clearing and resetting the breakpoint. SeeAlso: F9;Toggle Breakpoint. Clear Breakpoints ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BC list Clearing a breakpoint will remove it from the list of breakpoints that MMD maintains and discards it. Multiple breakpoint numbers may be specified in the list parameter and all will be removed. SeeAlso: F9;Toggle Breakpoint. Disable Breakpoints ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BD list Disabling a breakpoint removes their effect but still keeps them in the list of breakpoints. This allows then to be reenabled at a later point, which is faster and more convenient then clearing and resetting a breakpoint. Disabled breakpoints will be displayed in the Breakpoint List command with the letter D beside its entry. In the Assembler window a disabled breakpoint will be the same colour as the text, and not highlighted. Enable Breakpoints ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BE list After having disabled a breakpoint you may reactivate it using this command. Enabling a breakpoint that is already enabled will have no effect on that breakpoint. List all Breakpoints ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BL The list of breakpoints displays the address, status, and pass count for all current breakpoints. The pass count is displayed as a decimal integer rather than a hexadecimal number. Compare Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ C range address Compares all bytes in the range to those starting at address, and displays any of the differences. For each difference found MMD will display the address and the bytes that differ. If the two areas are identical then there will be no display. Dump Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ D[format] [range] Dumps memory in the range specified to the screen in the format specified. If no range is specified then the dump will continue from the last address previously displayed. There should be no space between the command name and the format character, or the format will be interpreted as part of the range address. The range should also be separated from the command name by a space, to prevent the address being interpreted as a format character. The character format, 'C' is not supported in the Dump Memory command, instead the byte format will display an ASCII character translation of each byte it displays. Enter ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ E address [values] This command enters bytes directly into the memory at address. If no values are specified then an interactive mode is started. In this mode you will be prompted with the current address and the current value for that byte. You then have four choices: - Enter a new value for the byte - Press the space bar to advance to the next byte. - Press the minus (-) key to move back to the preceding address. - Press Enter which will terminate the interactive mode. Fill Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ F range values Fills the memory within the range with the values specified. If the range is larger than the size of the values then the values will be repeated until they fill the range. When the size if the range is smaller than the values then the values will be truncated to fill only the range specified. Go ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ G [address] {address} This command will execute the target program, which will continue to run until it terminates, executes a breakpoint or is interrupted by a keyboard break. If the address is specified then a breakpoint will be set at that address, which is in the current code segment by default. This breakpoint is only temporary, and is not added to the user breakpoint list, and it will be lost when the control returns to MMD. SeeAlso: F5;Run. Set Screen Height ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ H25, H28, H43, H50 Sets the MMD screen height, if allowed by the video card and command line options. SeeAlso: /VN command line switch Input Byte from Port ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ I port This command will read the current value from the I/O port specified and displays it. Reload Target ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ L [arguments] Reloading the program will terminate the program that is currently executing and reload the target file from disk. It will then be ready to start execution again from the beginning of the program. If no command line is specified then MMD will reuse the current command line. To specify no command line type a single space character after the command name. Memory Information ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ M[ | A | I | H | V ] The output of this command is similar to the DOS MEM command. There are five options available: - The default is a list of all the system and program memory blocks. Environment blocks will not be displayed. - A All memory information will be displayed, including interrupts and file information. - I Interrupt information will be displayed for the main memory blocks. - H Provides information about any open files for program memory blocks. - V Verbose mode displays all memory blocks. File information provides information about files opened with file handles (not FCBs) and relies on undocumented DOS structures to find the names of the files, and so it is sensitive to changes between DOS versions. Move Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ M range address This command will copy the block of memory in the range to the destination address. If the blocks overlap then MMD will ensure that the move is performed without losing any of the data. Set Radix ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ N2, N8, N10, N16 Changes the current radix for input values. SeeAlso: Configuration;Default Radix. Output Byte to Port ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ O port byte This command will output the byte value to the I/O port. Set Option ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ O[B | U][+ | -] Sets an option: - OB enables or disables byte decoding display in the Assembler window. - OU toggles between upper and lower case display. SeeAlso: Configuration;Byte Decoding, Configuration;Unassembly Case. Proceed ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ P [count] The proceed command is similar to the trace command, however it will step over loops, calls and repeated string instructions. When the optional count is used then proceed will execute count number of times before returning to user input. The debugger display will be updated for each instruction executed during the count. The proceed command will not work in ROM. The following instructions will be stepped over by this command: - CALL - LOOP, LOOPZ, LOOPNZ - REPx SCASx, REPx LODSx, REPx STOSx, REPx CMPSx, REPx MOVSx - REPx INSx, REPx OUTSx Quit ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Q This command will terminate the target program, and quit from MegaDebugger to DOS. Register ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ R [register] [expression] The Register command allows you to set new values for any of the processor register and flags. If no expression is given for the register then MMD will display the current value and prompt you for a new one. You may enter a new value for the string or ignore it and leave the contents of the register unchanged by pressing Enter. If no parameters are supplied to this command then it will dump the current values for the registers to the screen. To modify the flags the FL register name should be given, again you may either specify the new value directly or be prompted with a display of the current flag settings. Search Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ S range values Searches all the memory in the range for the sequence of values specified. For each match MMD will display the address of that match. If the values are not found then there will be no display. Set Swapping Mode ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ S[ | S | + | - ] This command controls the screen swapping. There are three options: - The default is to display the current status of the screen swapping: on, off, or smart. - S Sets smart swapping. - + Will turn screen swapping on. - - Will turn screen swapping off. SeeAlso: Alt-S;Toggle Swapping. Trace ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ T [count] Single steps one instruction in the target. SeeAlso: F8;Trace. Unassemble ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ U [address] This command will disassemble the program memory at the specified address and display it as processor instructions. MMD can disassemble all 8086 instructions, most real mode 286 instructions and all non-32 bit 387 co-processor instructions When in window mode all the output will be in the Unassemble window. The default segment for the address is the current code segment. View Output Screen ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ V, \ In screen swapping modes this command will switch to the output screen. MMD will then wait for a key to be pressed before returning to the debugger display. SeeAlso: F4;View Output Screen. List Watch ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ W The List Watch command will display all the current watches, their results and any comments that are defined for them. Write File ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ W "filename" range Writes the memory in the range to the specified file. Watch Memory ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ W[format] range [; comment] This will add an area of memory to the watch list. The same comments apply to the format and range as in the Dump Memory command. The default dump size is one byte and the default format is a hexadecimal word. The comment is an optional section of text that can be used as a simple description of the memory region being watched to serve as a reminder to you. SeeAlso: Y;DeleteWatch Watch an Expression ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ W? expression[,format] [; comment] This command will add an expression to the Watch list. The style of this expression is identical to that of the Evaluate Expression command. If the expression cannot be evaluated by MMD then it will not be added to the watches. The comment is an optional line of text that can be used as a simple description of the expression being watched to serve as a reminder. SeeAlso: Y;Delete Watch Write Listing ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ WL "filename" range Writes the unassembly listing of the memory in the range to a text file. This will be a text file with the same formatting as the current unassembly options. SeeAlso: OB;Byte Decoding OC; Unassembly case. Set WatchPoint (Global Breakpoint) ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ WP? expression[,format] [; comment] Sets a watchpoint, when the program is running it is put into single step mode and the expression is evaluated on each instruction executed. When it becomes true the program will be interrupted. Another use of the watchpoint command is to slow execution of the target. SeeAlso: Y;Delete Watch Delete Watch ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Y list Deletes any watches from the current watches 9 Configuration ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 9.1 MMDCFG MMDCFG can be used to configuration MMD. Each project (if they are in separate directories) can have different default configurations as appropriate. During initialising MMD will search for a configuration file called 'MMD.CFG', a different configuration file can be given with the /C command line option. When initialising MMD determines its configuration in the following order of priority: Options given on the MMD command line will override any default of configuration file settings. - A specific configuration file given with the /C command line option. - A CFG file in the current directory. - A CFG file in the same directory as MMD.EXE. - If no configuration file is found then MMD will use the options saved inside its EXE file. MMDCFG menus: þ Debugging Keyboard Keeper: None, DOS, PIC SeeAlso: /KP, /KD. PIC Keeper IRQ Base This option displays the current interrupt vectors for the chosen new IRQ base. All entries in the selected range must be marked Unused, MMD will allow you to select any range but if the interrupts are being used by other software then conflicts will occur. SeeAlso: /KP. Switch DOS PID: On, Off. SeeAlso: /I Expression Language: Assembler, A86, C, Pascal SeeAlso: /L Default Radix: 2, 8, 10, 16 SeeAlso: N;Set Radix Default Expression Format: Hex, Unsigned, Decimal Sets the default output format for the ?; Evaluate expression command. þ Screen Screen Height: Default, 25, 28, 43 ,50 SeeAlso: /H, H;Set Screen Height. Restrict Height changes: On,Off SeeAlso: /VN Default Output Mode: Window, Screen, DOS SeeAlso: /S, /D Default Swapping Mode: Smart, On, Off SeeAlso: S;Set Swapping Mode Default Swapping Type: Standard, Register, VGABIOS, Dual SeeAlso: /VS, /VR, /VR, /VB, /Do, /2 VGA Palette Saving: On,Off SeeAlso: /VP EGA/VGA Complete Save: On,Off SeeAlso: /VG Byte Decoding: On, Off SeeAlso: OB;Set Option: Byte Decoding. Unassembly Case: Upper, Lower SeeAlso: OU;Set Option: Unassembly Case. Horizontal Register Window: Open, Close SeeAlso: Ctrl+F2;Toggle Horizontal Register Window. Vertical Register Window: Open, Close SeeAlso: F2;Toggle Vertical Register Window. Online Help: Include, Exclude SeeAlso: /H þ Keys Key Definitions: Microsoft, Borland, Custom The keys menu allows you to set the default MMD key definitions to the Microsoft, Borland or a Custom setup. SeeAlso: /KM, /KB. Break key Sets the MMD keyboard break combination. By default this will be Ctrl-Break (Note that MMD distinguishes between Ctrl-Break and Ctrl-C, this allows Ctrl-C to be used when a DOS break is specifically required). Any key combination can be used as the MMD keyboard break, if the key has a non standard scan code (such as enhanced keyboards which have extra keys such as Macro) then MMDCFG will display the hexadecimal scan code it received. Customise Keys Selecting the Customise keys displays a screen with a list of all MMD functions. To change a key definition select the function you wish to assign a new key to and then press the desired key. If the key does not change then it has already assigned or is key that has a fixed definition. Customise Key will initially display the current key selection for modification which is Microsoft, to base the modifications on Borland key definitions select Borland keys before enterring Customise Keys. þ Colours Allows the MMD screen colours to be set. þ Directory This is only required if MMD is running under DOS version 2.0 or below, with later versions of DOS MMD is able to determine the directory it was loaded from and search for a CFG file there. Alternatively this option can be used to specify any directory that MMD should search for a CFG file. þ Save Saves the changes to a CFG file or into MMD.EXE. Note that if the options are written to the MMD executable they cannot be reloaded, so if they require further editing they should also be saved to a separate CFG file. 10 Default Key Definitions ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 10.1 Default Microsoft Keys Key Definition ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Command Line Editing. Escape Clear command line Left Right F3 Replay Command Screen Keys. F4 View Output Screen Alt+S Toggle Screen Swapping Window Keys. Up Cursor up Down Cursor down PgUp Scroll up one screen. PgDn Scroll down one screen. Shift+Up Move secondary window up one line Shift+Down Move secondary window down one line Shift+PgUp Scroll secondary window up one screen Shift+PgDn Scroll secondary window down one screen Ctrl+Home Cursor to Top Ctrl+End Cursor to Bottom Window Control. F2 Toggle Vertical Register Window F6 Change Window Ctrl+F2 Toggle Horizontal Register Window Ctrl+G Expand Command Window Ctrl+T Shrink Command Window Assembler Window. Ctrl+Right Byte Adjust Up Ctrl+Left Byte Adjust Down Ctrl+N New CS:IP Ctrl+O Origin Ctrl+P NOP Instruction Debugging. F5 Go F7 Go To Cursor F8 Trace F9 Toggle Breakpoint F10 Proceed Help. F1 Help Tab Next Topic Link Alt+B Sequential Next Topic Alt+F Sequential Previous Topic Alt+F1 Previous Topic Ctrl+F1 Next Topic ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 10.2 Default Borland Keys Key Definition ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Command Line Editing. Escape Clear command line Left Right F3 Replay Command Screen Keys. Alt+S Toggle Screen Swapping Alt+F5 View Output Screen Window Keys. Up Cursor up Down Cursor down PgUp Scroll up one screen. PgDn Scroll down one screen. Shift+Up Move secondary window up one line Shift+Down Move secondary window down one line Shift+PgUp Scroll secondary window up one screen Shift+PgDn Scroll secondary window down one screen Ctrl+Home Cursor to Top Ctrl+End Cursor to Bottom Window Control. F6 Change Window Ctrl+F2 Toggle Horizontal Register Window. Alt+F2 Toggle Vertical Register Window. Ctrl+G Expand Command Window Ctrl+T Shrink Command Window Assembler Window. Ctrl+Right Byte Adjust Up Ctrl+Left Byte Adjust Down Ctrl+O Origin Ctrl+N New CS:IP Ctrl+P NOP Instruction Debugging. F2 Toggle Breakpoint F4 Go To Cursor F7 Trace F8 Proceed F9 Run Help. F1 Help Tab Next Topic Link Ctrl+F1 Next Topic Alt+F1 Previous Topic Alt+B Sequential Next Topic Alt+F Sequential Previous Topic ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 11 Operator Precedence Reference ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ These tables summarise the various operators supported by MegaDebugger. These operators are listed in decreasing precedence, and operators that are grouped together have the same precedence. All the languages support the use of parentheses. None of the memory reference operators are supported by MMD (assembler [] or C * ). 11.1 Assembler Language Operators Operator Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - Unary Minus + Unary Plus NOT Bitwise NOT ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ * Multiplication / Division MOD Modulus SHL Left shift SHR Right shift ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + Addition - Subtraction ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ EQ Equality NE Inequality LT Less than LE Less than or equal to GT Greater than GE Greater than or equal to ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AND Bitwise AND ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ XOR Bitwise XOR OR Bitwise OR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The NOT operator in both MASM and TASM is defined to have the same precedence as the AND operator. However the debugging assumes that all unary operators have a higher precedence than binary operators. All logical Assembler operators return 0FFFFh for a true result and 0 for false. digitsH Hexadecimal digitsD Decimal digits digitsB Binary digits digitsO Octal digits digitsQ Octal 11.2 C Language Operators Operator Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - Unary Minus ! Logical Negation ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ * Multiplication / Division % Modulus ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + Addition - Subtraction ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ << Left shift >> Right shift ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ < Less than <= Less than or equal to > Greater than >= Greater than or equal to ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ == Equality != Inequality ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ & Bitwise AND ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ^ Bitwise XOR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ | Bitwise OR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ && Logical AND ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ || Logical OR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ No assignment operators are supported by MMD including the C auto assignment operators (++ and --). 0Xdigits Hexadecimal 0Ndigits Decimal 0digits Octal 11.3 Pascal Language Operators Operator Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - Unary Minus + Unary plus NOT Bitwise NOT ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ * Multiplication / Division DIV Division MOD Modulus AND Bitwise AND SHL Left shift SHR Right shift ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + Addition - Subtraction OR Bitwise OR XOR Bitwise XOR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ < Less than <= Less than or equal to > Greater than >= Greater than or equal to = Equality <> Inequality ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ MMD supports only the INTEGER forms for each operator, therefore there are no equivalents for the BOOLEAN logical and and or operators. Although the type of the / division operators result is defined as REAL in Pascal, MegaDebugger does not support this data type and so the result will be integer. $digits Hexadecimal #digits Decimal 11.4 A86 Language Operators Operator Description ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ - Unary Minus + Unary Plus NOT Bitwise NOT ! Logical NOT BIT Bit Number ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ * Multiplication / Division MOD Modulus SHL Left shift SHR Right shift ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ + Addition - Subtraction ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ EQ Equality NE Inequality LT Less than LE Less than or equal to GT Greater than GE Greater than or equal to ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ AND Bitwise AND ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ XOR Bitwise XOR OR Bitwise OR ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The NOT operator in A86 is defined to have the same precedence as the AND operator. However MMD assumes that all unary operators have a higher precedence than binary operators. All logical Assembler operators return 0FFFFh for a true result and 0 for false. 0digits Hexadecimal digitsH Hexadecimal digitsD Decimal digitsB Binary digitsO Octal digitsQ Octal digitsXH Hexadecimal digitsXD Decimal digitsXB Binary digitsXO Octal digitsXQ Octal The underscore '_' character can be used to separate digits. 12 Error Messages ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 12.1 Initialisation Errors All error messages MMD displays on the output screen are prefixed with the '' string to distinguish them from any possible target output. þ Cannot find target file : "xxx" This means that MMD cannot find the target file you specified on the command line. Check that path and file name and try again. þ Conflicting command line switches. When processing the command line options you supplied MegaDebugger found two switches that conflicted. For example specifying Screen mode and DOS mode together (/S /D) or two language specifiers. þ Failure loading target file in DOS LOADEXEC. DOS could not run the target program. The most common cause of this is that the program is too large to fit into the remaining free memory. Other causes are that the file is not a valid EXE or COM file, the memory allocation chain is corrupted or MMD has insufficient access rights to execute the file. þ Internal memory allocation failure. This error message should never appear, as MMD makes only one call to the DOS memory block. If this message does appear it is likely that your system memory has been corrupted (not unusual when debugging an errant program), reboot and try again. þ Invalid PIC base interrupt : "xx" The valid range for the new PIC base interrupts are from D8-F0h. þ Missing or invalid configuration file : "xxx" The configuration file specified with the /C command line option could not be found or was not a valid MMD configuration file. þ PIC has already been reprogrammed by another VCPI client. When EMM386 or a similar memory manager is running MMD is required to notify the protected mode manager when it reprograms the PIC controller to the new interrupt base. However if another program has already changed the settings then MMD is not allowed to make any further changes. þ Target is not an executable file : "xxx" The target file specified in the command line is not a file. þ Unknown language type specified. Only four languages are supported by MMD /LA; Assembler, /LC; C, /LP; Pascal and /L8; A86. þ Unknown screen height specified : "xx" MMD supports only 25 and 43 line modes on EGA cards and 25,28,43 and 50 with VGA. MDA and CGA support only 25 line modes. þ Unknown switch : "xx" Use MMD /? for a list of valid command line switches. þ VCPI did not allow PIC to be reprogrammed. For some reason the call to notify the VCPI protected mode manager of the changes to the hardware interrupts failed. 12.2 Command Errors þ Bad Expression The expression that you have entered cannot be evaluated by MMD. This is usually caused when an operator is misplaced or a register name is misspelt in the expression. þ Bad Flag There are two possible causes for this error: - The flag string you supplied to the Register command contained a value that was not the name of a flag. - The string contained conflicting values for the same flag. þ Bad Format Character The character supplied after an expression or in the Dump command is not one of the format characters MegaDebugger recognises. þ Bad Register The register name given as a parameter to the Register command was not a valid 16-bit register name. þ Breakpoint Error This error occurs when using the Set Breakpoint command, and you try to set a new breakpoint at the same address as another breakpoint þ Closing Quote Character is Missing When evaluating either a quoted character constant in an expression, or in a set of values MMD reached the end of input string before it found a closing quote character. þ Divide by Zero The value derived for the right hand side of a division or modulus operator was equal to zero. The result of a division by zero is mathematically undefined. þ Extra Characters on Line MMD has fulfilled the parameters for a particular command but there are still excess characters remaining on the line. þ File Error This error occurs when MMD cannot open, write to, or close the file given for the W;Write File or WL;Write Listing commands. þ MCBs Corrupted This occurs when the Memory Information command detects an error in the structure of the DOS memory allocation system. This is a serious error and it is unlikely that you will be able to exit without the system crashing. þ No Free Watches MegaDebugger limits the number of watches you can define to 10, this error is caused if you attempt to add another watch after this limit has been reached. þ Syntax Error A syntax error occurs when MMD cannot convert the parameters of a command into the required format. There are four conditions that will cause this error: - The start address in a range is larger than the final address. - One of the items in the list cannot be converted, lists can contain only values between 0 and 9. - One of the items in a set of values cannot be converted, or the value exceeds one maximum number that can be stored in one byte; 255. - An incorrect number of parameters was supplied, usually when a complete range is not given. þ Unbalanced Parenthesis While evaluating an expression the end of the string was reached and there were unclosed parenthesis. There must be a matching closing parenthesis ')' for each opening parenthesis '(' and vice versa. þ Unknown Command The first non space character on the command line did not match any of MMD's command names. 13 Known Bugs ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ /KP does have occasional problems with memory manages such as EMM386 and QEMM. Dual monitor support has not been used with two actual monitors, but has been thoroughly tested as far as possible on a single monitor. MMD does not install its own critical error handler so when writing files from MMD the target's handler will be invoked if a DOS error occurs. Swapping does not support Hercules graphics mode and cannot properly handle text modes which use custom (non-BIOS) fonts. Not all 286 instructions are support by the A; Assemble command, namely the extended shift instructions, 3 operand MUL and all protected mode instructions. Maths coprocessor instructions are also not supported. MegaDebugger does not restore the entire hardware state. If the target program is using any critical system interrupts when the Reload Target Program or Quit commands are used then these interrupts will be left containing addresses that point to unused memory locations that will be overwritten when next file is loaded. In order to avoid crashing the computer when using this command always ensure that either: - The target program has terminated or has not begun execution. When the target program exits it should always return the system to a safe state. - If the target program is still executing then ensure that it is not using any of the critical interrupts. This can be done using the Memory Information command, if any block that is owned by the target program is using any of the interrupts between 00f and 2Fh then it is unsafe to use the Reload Target Program or Quit commands. When comparing MMD to commercial debuggers (TurboDebugger 3.00 and CodeView 2.00) it was interesting to see how poorly they handle fundamental debugging operations: - MMD can handle breakpoints at normalised addresses (same physical address, but different segment:offset address). Both CodeView and TurboDebugger will crash if a breakpoint is executed when set a normalised address, MMD does all its internal address comparisons with 32 bit physical address values. - MMD handles graphics modes much better then TD and CV, especially ModeX. TurboDebugger has a stupid 'smart' screen swapping which will swap unnecessarily. CodeView does not have smart swapping. - MMD handles the interaction between WatchPoints and all forms of breakpoint consistently. For example: CodeView will not update breakpoints with pass counts when watchpoints are set; TurboDebugger will not acknowledge a true watchpoint if a breakpoint exists on the line which makes the watchpoint true. 14 Registering ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ I really want MMD to be the most useful debugger tool available and so would very much like to hear all comments, suggestions, criticisms you have. You can contact me at the following addresses: Internet: n1360906@student.fit.qut.edu.au [until December 1994] No Net Address: Mark Thomas 8 Herronbee Street Toowoomba, Queensland Australia 4350. Other software by the same author: 2OBJ110 2Obj v1.10: Converts binary files directly to OBJ files. Can decode GIF, PCX, LBM and CEL files and their palettes. Freeware. DIV0 Divide by Zero: the first demo by Sivris. DNC100 DOOM Network Copier: Copies DOOM files from a single computer to up to four other machines simultaneously. MCD100 MegaChangeDirectory: Replacement for Norton's CD. Can create NCD compatible TreeInfo files. Configurable. Extended directory matching. To Be Released Soon. 15 Future Enhancements ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ While this version of MMD is complete there is still a great deal I wish to add, which will require almost a complete rewrite of all the current code. This list is in approximate order of priority: - 386 support. The first priority is simply adding 386 instruction and register support. Of course adding 386 debugging register and v86 mode support is very important. (I have only recently upgraded from a 286) - Commands: I have a long list of commands to be included in the next version. The main areas are searching (forward and backward global searches, case-insensitive string searches, instruction searches) and debugging commands (Breakpoint on entry or exit into interrupts, Go to RET, Trace into Interrupt). - Improved memory management. Most important is allowing MMD to use high memory to free more memory under 640k but also to use XMS and EMS. - Remote debugging. I have already written the communications drivers for serial, parallel, NETBIOS and IPX links but all the MMD commands will have to be re-written to work with the remote link interface. - Better interface: pull down menus, mouse support, resizing etc (and stack and memory and output screen windows). I personally prefer to have a command line interface for debugging so it will still be available. - Symbolic Debugging. The original idea of MMD was to provide a alternative to the large symbolic debuggers but now it seems a waste not to include it. MMD will still be primarily a low-level debugger. I am looking for information on the following: - The EXE debug information format used by CodeView and TurboDebugger (and Watcom, Symantec etc) and details of any debugging hooks placed in executables. - Detecting and using 8 bit interrupt driven parallel I/O. - Interfacing with the NMI, particularly about building a cheap and safe NMI breakout switch that plugs into the bus. - System Management Mode. One of the most interesting ideas I have seen is to use the SMM of 386SL and 486SL for a debugger. SL chips are used mainly in laptops but apparently all new i486 CPUs have this mode. [END]