[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: eof marker--and DEBUG




Is there a readily available DOS or Unix utility that will strip
the eof marker?
You can always do it with the good ol' DOS program: DEBUG. DEBUG comes with
all DOS/Windows systems. This is a bottom-level, nitty-gritty utility that
everyone should know about. Here's how to do it. Don't be put off by the
length of my discussion: the explanation is long but the steps are short.
Hmmm, let me begin by just listing the 6 essential steps, on a hypothetical
file ("myfile") that turns out to have a 1A at memory locatin 41B hex. Then
I'll explain in extensa.

1. DEBUG myfile
2. S CS:100 900 1A
3. E 41B
4. 00
5. W
6. Q

That's all. Now for the walk-through, and extra steps to check what's going on:

1. At the C: prompt do:

DEBUG myfilename
(If it doesn't find DEBUG, it's probably in \Windows\Command or Windpws\system32)
That produces the DEBUG prompt, a hyphen. For safety, you might now prompt
(a hyphen), enter a D (which means: Display). You should get a hex dump,
with ASCII translation on the right, of the first 128 bytes, covering
memory locations 0100 - 017F. Entering further Ds pages on through memory.
(You need to have some rough idea of the file's size for the next step, and
I'm assuming for my example a file of 2k.)
2. But where's the eof character (1A)? DEBUG can find it for you. Do this
at the DEBUG prompt (which is a hyphen)

s cs:100 900 1a
BTW, DEBUG is case-insensitive. The above command means: Search, in current memory image, between location 100 and location 900, for 1a.
The 900 is a fairly arbitrary number--large enough to get a little past the
end of the file (you can do the math if like using U2's @dec to prove that
700 hex minus 100 hex > 2048 bytes). You could put in any second hex number
up to DEBUG's limit, which I think is FFFF (64k). The only downside of just
putting FFFF as the search's end is that you may find a lot of whatever you
are search for--1A in this case--that is past the actual end of the file
and is just leftover garbage in some higher memory location.
That should produce a list of "hits." If there's more than one, you want
the first one.
Suppose it says that the 1a was found at 41b. Check that there's no mistake
by doing:

3. D 41b

That displays a bunch more bytes starting, at 41b

4. Make the change using the E command

E 41b

That will bring up a display that should look like this:
xxxx:041b 1A.
where the xxxx is some irrelevant number. Note that it ends in a period. That period is really a prompt, waiting for what you to enter want to change the 1A to. 00 is fine, so you just enter 00 (or whatever). You might want to check that your change "took" by re-doing a D 41b.
5. The change so far is only in the memory image of the file. To get it
written to disk enter:

W

That will display the number of bytes written.

Finally, you quit DEBUG:

Q.
I have the (now rare) set of instruction for DEBUG, if anyone wants me to scan them in and post them.


Harry Binswanger
hb@xxxxxxxx