I"'
!
!
,
r--
I
~
I
r:
, '
,
("""'
I :
("""'
I
I '
I
! '
~
I '
i
r
!
r--'
! '
Chapter
13
THE DEBUG UTILITY
The MS-DOS DEBUG is a
utility
program to aid you
in
testing,
changing,
and
observing
the
operation of executable object files.
You
can use DEBUG to
alter
the contents of a file or register and
then immediately execute
the
program to see
if
the changes
are
valid without reassembling the program.
To
enter the DEBUG program, type:
DEBUG
[pathname]
[parameters]
I
ENTER
I
•
pathname
specifies the program file to be loaded into memory.
DEBUG loads
the
file,
starting
at
lOOR
in
the
lowest available
segment. The BX:CX registers
are
loaded
with
the number of
bytes placed into memory.
Omitting
the
pathname
lets you work with
the
current regis-
ter
contents.
To
load a file into memory, you must use the
Name
and
Load commands.
Note: When DEBUG is initialized,
it
sets a program
segment prefix (PSP)
at
Offset 0
in
the program work
area.
If
you don't specify a pathname, you may over-
write
the
default PSP.
If
you
are
debugging a .com or
.exe file, however, tampering with
the
PSP
below rela-
tive address
5CR
will cause DEBUG to terminate.
• parameters is a
list
of pathname parameters and switches
that
are
to be passed to the program when
it
is loaded.
Include parameters only
if
you included a pathname.
DEBUG displays a hyphen ( - ) to indicate
that
it
is ready to
accept a command.
At initialization,
the
DEBUG segment registers (CS, DS, DX,
and SS)
are
set
to the bottom of free memory, and the' instruc-
tion pointer (IP) is
set
to
OlOOR.
All flags
are
cleare,d, and the
remaining registers
are
set
to zero.
Do
not
restart
a program after DEBUG displays the message
Program
terminated
normally.
To
reload the program use
the
Name
and
Load
commands.
Otherwise,
it
does
not
run
properly.
263