Write command

Purpose: Writes the data being debugged to disk.


Use this command with care


Format: W [address [drive sector sector]]

Remarks: The maximum number of sectors that can be written with a
single Write command is 80h (128).

DEBUG displays a message if a disk write error occurs. You
can retry the write operation by pressing F3 to redisplay
the Write command, then press the Enter key.

The Write command has two format options:

Option 1

Use this option to write data to disk beginning at a speci-
fied address. For example:

W address drive sector sector

The data beginning at the specified address is written to
the disk in the indicated drive. The data is written start-
ing at the specified starting relative sector (first sector)
and continues until the requested number of sectors are fil-
led (second sector).

Notes:

1. Be extremely careful when you write data to absolute
sectors because an erroneous sector specification destroys
whatever was on the disk at that location.

2. If only an offset is entered for the beginning address,
the W command assumes the segment contained in the CS
register.

3. Remember, the starting sector and the sector count are
both specified in hexadecimal.

4. Option 1 cannot be used if the drive specified is a net-
work drive.

For example:

W 1FD 1 100 A

The data beginning at CS:01FDh is written to the disk in
drive B, starting at relative sector 100h (256) and conti-
nuing for 0Ah (10) sectors.


Option 2

This option allows you to use the Write command without spe-
cifying parameters or only specifying the address parameter.
For example:

W
or
W address

When issued as shown above, the Write command writes the file
(whose filespec is at CS:80h) to disk.

This condition is met by specifying the filespec when start-
ing the DEBUG program, or by using the Name command.

Note:
If DEBUG was started with a filespec and subsequent Name
commands were used, you may need to enter a new Name command
for the proper filespec before issuing the Write command.

In addition, the BX and CX registers must be set to the
number of bytes to be written. They may have been set pro-
perly by the DEBUG or Load commands, but might have been
changed by a Go or Trace command. You must be certain the
BX and CX registers contain the correct values.

The file beginning at CS:100h, or at the location specified
by address, is written to the disk in the drive specified in
filespec or the default drive if none was specified.

The debugged file is written over the original file that was
loaded into memory, or into a new file if the filename in the
FCB didn't previously exist.

Note:
An error message is issued if you try to write a file with
an extension of .EXE or .HEX. These files must be written
in a specific format that DEBUG cannot support.

If you find it necessary to modify a file with an extension
of .EXE or .HEX, and the exact locations to be modified are
known, use the following procedure:

1. RENAME the file to an extension other than .EXE or .HEX.
Back up the file first if appropriate.

2. Load the file into memory using the DEBUG or Load command.

3. Modify the file as needed in memory, but do not try to
execute it with the Go or Trace commands. Unpredictable
results would occur.

4. Write the file back using the Write command.

5. RENAME the file to its correct name.