Enhanced DEBUG for PC DOS and MS-DOS Version 1.30b

DEBUG is a DOS debugger compatible with the utility found in PC DOS and MS-DOS but with many more features. This enhanced DEBUG was originally developed by Paul Vojta and was maintained by Japheth until version 1.25.

The DEBUG package includes DEBUG.COM which is a replacement for the standard DOS DEBUG and DEBUGX.COM which can debug DPMI programs and has more features but uses more memory. The inclusion of some features are controlled by defines in the source code. DEBUG supports assembly and disassembly of all Intel x86 instructions up to the Pentium Pro (P6). Note EMS support is disabled by default because it is not useful to typical debugging. EMS support may be enabled by defining EMSCMD to 1 and rebuilding. Enabling EMS support will increase memory usage by 1.2KB.

Despite having more features than the standard DOS DEBUG, the enhanced DEBUG.COM uses less memory (though DEBUGX.COM which has even more features uses more memory):

DEBUG 1.30          20.5KB
PC DOS 7.0 DEBUG    22.9KB
MS-DOS 6.22 DEBUG   23.0KB
DEBUGX 1.30         25.5KB

The DEBUG source code may be built with JWasm or MASM. The instruction set table builder program MKTABLES.C may be built with any ANSI C compiler such as the Microsoft C compiler or the Open Watcom C compiler.

DEBUG commands:

assemble        A [address]                                     standard
compare         C range address                                 standard
dump            D[B|W|D] [range]                                standard
dump interrupt  DI interrupt [count]                            DEBUGX
dump LDT        DL selector [count]                             DEBUGX
dump MCB chain  DM                                              standard
dump ext memory DX [physical_address]                           DEBUGX   (define DXSUPP=1)
enter           E address [list]                                standard
fill            F range list                                    standard
go              G [=address] [breakpoints]                      standard
hex add/sub     H value1 value2                                 standard
input           I[W|D] port                                     standard
load file       L [address]                                     standard
load sectors    L address drive sector count                    standard
move            M range address                                 standard
set x86 mode    M [x] (x=0..6)                                  DEBUGX   (define MODESETCMD=1)
set FPU mode    MC [2|N] (2=287,N=no FPU)                       DEBUGX   (define MODESETCMD=1)
name            N [[drive:][path]filename [arglist]]            standard
output          O[W|D] port value                               standard
proceed         P [=address] [count]                            standard
proceed return  PR                                              standard
quit            Q                                               standard
register        R [register [value]]                            standard
MMX register    RM                                              DEBUGX   (define MMXSUPP=1)
FPU register    RN                                              standard (enhanced in DEBUGX with define FPTOSTR=1)
toggle 386 regs RX                                              standard
search          S range list                                    standard
trace           T [=address] [count]                            standard
trace mode      TM [0|1]                                        standard
unassemble      U [range]                                       standard
write file      W [address]                                     standard
write sectors   W address drive sector count                    standard
EMS allocate    XA count                                        special  (define EMSCMD=1)
EMS deallocate  XD handle                                       special  (define EMSCMD=1)
EMS map memory  XM logical_page physical_page handle            special  (define EMSCMD=1)
EMS reallocate  XR handle count                                 special  (define EMSCMD=1)
EMS show status XS                                              special  (define EMSCMD=1)

Enhancements for DEBUG 1.26:

  • added DB, DW and DD commands.
  • cleanup parsing of R command so spaces aren't needed.
  • added RDTSC and RDPMC instructions.
  • disassemble opcode 82h like opcode 80h.
  • fixed typos in MKTABLES.C
  • DEBUGX: removed extra dashes in MMX register dump.
  • disassemble PUSH imm without [D]WORD as the size is apparent.
  • if InDOS flag is set use BIOS instead of DOS for E command input.
  • always use BIOS input for help syntax pause.
  • DEBUGX: suppress characters > 7Eh in DX command to be consistent with D command.
  • merged lockdrive and unlockdrive routines to reduce size.
  • fixed bug in U command which sometimes caused only one line to be output for autorepeat.
  • autorepeat for P command added.
  • allow readable floating-point registers to be included in DEBUG.COM using new FPTOSTR define.
  • disassemble SAL and TEST duplicate opcodes.
  • fixed EMS help syntax message in source code.
  • removed EMS commands from default build.
  • added syntax D[type] L length to display length bytes starting from the last address displayed.
  • added PR (proceed return) command which proceeds past the next RET, RETF or IRET which is not nested without stopping.
  • removed obsolete switch character processing.
  • USESDA: verify PSP is at SDA+10h before using.
  • allow MOV seg,r/m and MOV r/m,seg to be assembled without requiring WORD PTR.
  • disassemble MOV seg,r/m and MOV r/m,seg without WORD PTR.
  • disallow invalid operand combinations in assembler.
  • updated XS command to work with EMS 3.2.
  • fixed bug in XS command report of total number of handles.
  • change line_out buffer size to 256 bytes.
  • added missing value to exponent table in FPTOSTR.INC.
  • minor size optimizations.
  • count lines for pausing in help syntax text display.

Enhancements for DEBUG 1.27:

  • don't display MCB name if < DOS 4.
  • removed set mode commands (M x and MC x) from default build.
  • minor size optimizations.
  • merged EMS help into main help and remove X? command.
  • don't display specified handle in XD command.
  • fixed bug in XS command report of handles.
  • added EMS Invalid function error message.

Enhancements for DEBUG 1.28:

  • removed obsolete instruction check.
  • added undocumented SALC and INT1 instructions.
  • added SYSENTER and SYSEXIT instructions.
  • removed unofficial FCMOVcc aliases.
  • fixed MKTABLES.C to build properly using old DOS MS C compiler.
  • fixed MKTABLES.C to properly handle machine specification with disassembly-only instruction variants.
  • include set mode commands (M x and MC x) in DEBUGX.
  • include show machine code only when MODESETCMD is defined.

Enhancements for DEBUG 1.28a:

  • added REPZ and REPNZ aliases.
  • removed incorrect FNLDCW and FNSETPM aliases.

Enhancements for DEBUG 1.28b:

  • added FFREEP and undocumented floating-point aliases.

Enhancements for DEBUG 1.28c:

  • allow DX command to be included in DEBUG.COM.

Enhancements for DEBUG 1.28d:

  • fixed typo in INSTR.ORD.
  • disallow MOV to/from CR1.
  • indicate FSTSW AX is a 287+ instruction.
  • minor source code cleanup.

Enhancements for DEBUG 1.28e:

  • cleanup MKTABLES.C to remove warnings and be ANSI C compliant.
  • minor source code cleanup.
  • disassemble 32-bit sign-extended PUSH imm.

Enhancements for DEBUG 1.28f:

  • display MMX registers in standard register format.
  • change _ITEXT segment class name so that LINK /TINY works.

Enhancements for DEBUG 1.28g:

  • ignore mod bits when disassembling MOV CRx/DRx/TRx instructions.

Enhancements for DEBUG 1.29:

  • FPTOSTR: added RNR command to display raw floating-point registers.
  • DEBUGX: trap INT 6 in real mode and protected mode.
  • ensure that help syntax pause works properly on MDA/CGA systems.
  • minor size optimizations.
  • removed unnecessary FWAITs before floating-point instructions.
  • removed last opcode from floating-point status display.
  • indicate INT1 is a 386+ instruction.
  • display FS and GS memory references.
  • don't display memory reference if LEA.
  • properly display LDS/LES/LFS/LGS/LSS memory references.
  • display CALL/JMP FAR memory reference.
  • fixed operand keys for SLDT and SMSW.
  • minor source code cleanup.

Enhancements for DEBUG 1.29a:

  • device driver version: build DEBUG.SYS instead of EXE.
  • allow INT 6, C or D to be trapped in DEBUG.COM.
  • always trap INT 6 and C in protected mode.
  • removed MAKEX.BAT; merged into MAKE.BAT.
  • fixed bug in L and W commands error message display routine.
  • properly initialize saved INT 23h and 24h values for interrupt display hack routines.

Enhancements for DEBUG 1.29b:

  • fix case bug in D[type] L length syntax parsing.
  • remove MCB define so DM command is always present.
  • ensure DM command does not display an extraneous entry.
  • check for multitasking MS-DOS 4.
  • always exit using INT 21h function 4Ch.
  • minor size optimizations.

Enhancements for DEBUG 1.29c:

  • don't use LEAVE in FloatToStr to work on 8086/8088.
  • removed non-standard SEG pseudo-op.
  • minor size optimizations.
  • cleanup device driver build.

Enhancements for DEBUG 1.29d:

  • display same error for L and W commands if no filename given.
  • minor source code cleanup.

Enhancements for DEBUG 1.29e:

  • minor size optimizations.
  • EMMS, MOVD and MOVQ now manually added to DEBUGTBL.INC for DEBUGX.COM (MMXSUPP) removing overhead from DEBUG.COM.

Enhancements for DEBUG 1.30:

  • minor size optimizations.
  • added page frame display to XS command.
  • change line_in buffer size to 130 bytes.
  • reduce resident size of device driver build.
  • use DOSKEY for input if loaded and InDOS not set.
  • drop VDD support.

Enhancements for DEBUG 1.30a:

  • don't use DOSKEY if < DOS 5.
  • DEBUGX: don't issue INT 2Fh if < DOS 3.
  • added undocumented LOADALL instruction.
  • minor source code cleanup.

Enhancements for DEBUG 1.30b:

  • don't allow set mode command (M) to set a value higher than the actual CPU.
  • don't allow set mode command (MC) to set a FPU if there isn't one.
  • minor source code cleanup.
Download DEBUG 1.30b - source and binary (150KB) - Last updated December 1, 2014

NOTE: This is standalone software which is freely available for use but should not be included as part of a collection or with any other software and should not be redistributed. Previous versions of this software are obsolete and also should not be redistributed.