Contents of the XE.DOC file
565 Dorothy Dr. Apt. 1
Des Plaines, IL. 60016
CompuServe : 71043,117
GEnie : R.STUNTZ
--- heXEdit ------------------------------------- Page 1 ---
THIS SOFTWARE AND MANUAL ARE DISTRIBUTED "AS IS" AND WITHOUT
WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER
WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS
HARDWARE AND SOFTWARE ENVIRONMENTS INTO WHICH THIS PROGRAM MAY BE
PUT, NO WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED AND
ALL LIABILITY IN THE USE AND AFFECTS OF THIS PROGRAM SHALL REST
WITH THE USER.
THIS PROGRAM HAS THE ABILITY TO ALTER YOUR FILES! YOU ARE
RESPONSIBLE! (Sorry, but I have to warn you ...)
--- heXEdit ------------------------------------- Page 2 ---
TABLE OF CONTENTS
A. Introduction .................................................. 4
B. Starting heXEdit .............................................. 4
C. Command Line Options .......................................... 4
D. Loadfile box .................................................. 5
1. File Attributes ............................................. 6
E. Main display .................................................. 6
F. Commands ...................................................... 6
1. Help ........................................................ 7
2. ASCII chart ................................................. 8
3. Base convert ................................................ 8
4. Colors ...................................................... 9
5. Decimal offset #'s .......................................... 9
6. Edit ........................................................ 9
7. Goto offset ................................................. 11
8. Hexadecimal offset #'s ...................................... 11
9. Load new file ............................................... 11
10. Mark position .............................................. 11
11. Search again ............................................... 12
12. Octal offset #'s ........................................... 12
13. Retrieve position .......................................... 12
14. Search ..................................................... 12
15. Clear marker entries ....................................... 13
16. Alt+1 thru Alt+9 ........................................... 13
G. Other Notes ................................................... 13
H. Comments ...................................................... 14
A. Version history ............................................. 14
B. Trademark information ....................................... 16
--- heXEdit ------------------------------------- Page 3 ---
heXEdit (XE) is a program that will allow you to display and/or
edit any file. It doesn't have a fancy interface but serves my
purposes perfectly. I wrote this program because I became
frustrated with a couple of other commercial programs. They
either had some annoying peculiarities or required too much
thought on my part just to search for and change a couple of
heXEdit was written using Turbo Pascal v6.0, although it
doesn't use any of Borland's object libraries. It does however
write directly to the screen for speed when scrolling thru the
file. If you're using a CGA monitor you may see some 'snow' as
I don't check for the vertical retrace period before writing to
heXEdit will keep no more than 1760 bytes of the file you load
in memory at a time, as I didn't feel like messing with a
variable amount of memory available. heXEdit requires about
110k bytes of free memory in order to execute.
B. Starting heXEdit
To start heXEdit, enter
XE [option] [:]
The drive designator, filename and option are ... optional on
the command line. If only a drive designator is specified, XE
will show you the files from that drive's current directory.
If a file is specified XE will try to load that file, if not,
you will see a list of files from the current directory. All of
the available command line options are explained in the
C. Command Line Options
Available command line options are as follows :
This option tells XE to use it's default color set.
--- heXEdit ------------------------------------- Page 4 ---
This option tells XE to use black and white colors; for
3. ? or /? or /H
Any of these three options will display a short (very short)
message about the start-up syntax.
D. Loadfile box
If you did not specify a file on the command line when you
started XE, you will next see a list of files. To load one of
these files simply use the UP and DOWN arrow keys to move the
highlight bar to the file you want to load, then press ENTER.
You can also use the PAGEUP and PAGEDOWN keys to scroll thru
the list of files a page at a time. Pressing the HOME key will
move you to the top of the list, pressing END moves you to the
end of the list.
Pressing ENTER on a directory entry or a drive letter will
change to that directory or drive.
The files and directories in the Loadfile box are sorted.
Directories are listed first followed by the files.
At the end of the list of files you will see one or more drive
designators. The available drives you can choose from are all
the drives up to and including the drive specified by the
lastdrive statement in your CONFIG.SYS file. Selecting one of
these will show you the files in that drive's current
While using the Loadfile box, you may encounter an error, for
one reason or another. Generally speaking, you will be given
one, some or all of the options below :
1 - (A)bort : if you press 'A' XE will abort the operation.
2 - (R)etry : press 'R' to retry the operation. (Maybe the
drive door was opened before you hit ENTER to load the
3 - (Q)uit XE : press 'Q' to quit XE and return to the DOS
prompt (or wherever it was that you came from).
4 - Any other key : if you hit any other key than the ones
described above you will be returned to the Loadfile box.
While in the Loadfile box, pressing ESC will exit the
Loadfile box and either 1) return you to the last file you were
--- heXEdit ------------------------------------- Page 5 ---
editing, or if no file was previously loaded 2) exit XE
1. File Attributes
One last feature of the Loadfile box is that you can change the
attributes of a file simply by pressing F5-F8 (providing the
file is available; i.e., the disk is in the drive etc.) Move
the highlight bar to file you want to work with and then simply
hit one of the following, depending on what you want to do.
F5 - toggles the Archive bit
F6 - toggles the System bit
F7 - toggles the Hidden bit
F8 - toggles the Read_Only bit
If the attribute change was successful you will hear a high
pitch tone, otherwise you will hear a lower tone indicating that
the attribute could not be changed for one reason or another.
You should also see the attribute change in the Loadfile box if
the change was successful.
*** NOTE : Be sure you know what affect changing an attribute
will have on your system. Some programs act on the attributes
of a file or may even require certain attributes to be set.
E. Main Display
Once the file is loaded you will see the main display. At the
top is the name of the file loaded. On the left side of the
display are numbers (in hexadecimal,decimal or octal)
indicating the offset into the file. In the middle are 22 rows
of 16 bytes which are the file's contents. On the right, the
ASCII character for each byte in that row. In the ASCII portion
of the display, any characters past the EOF (end-of-file) are
shown as a '.' (ASCII #249). On the bottom is a status word
indicating your current operation, a three letter abbrev
indicating whether the offset display is in 'hex'adecimal,
'dec'imal, or 'oct'al, the percentage into the file from the
top line, and the size of the file in decimal.
Following is a list of commands once you are in XE and then a
brief explanation of each :
F1 - Help
--- heXEdit ------------------------------------- Page 6 ---
A/Alt+A - ASCII table
B/Alt+B - Base conversion (decimal-hexadecimal-binary)
C - Change colors
D - Change offset display to Decimal
E - Edit the file
G - Goto offset
H - Change offset display to Hexadecimal
L - Bring up the Loadfile box
M - Push position on marker stack
N - Search again (using the last used search string)
O - Change offset display to Octal
R - Retrieve position from marker stack
S - Search (for text or a byte string)
Z - Clear all entries from marker stack
ALT+1 thru ALT+9 - Goto marked position
UP/DOWN arrow keys - scroll up and down one line at a time
PAGEUP/PAGEDOWN - move up/down one page at a time
HOME - move to the beginning of the file
END - move to the end of the file
ESC/Alt+X - quit XE
1. F1 - Help
Pressing F1 will display a help screen. You now have the
following command available :
F1 : Help on Help
F2 : Display index (keywords) for items in the help file
F3 : Goto the previous screen (limited)
F5 : Zoom/Unzoom the help screen
ENTER : Get help on a highlighted keyword
Arrow keys : Scroll the help screen contents left, right,
up and down
ESC : Exits help
TAB / SHFT+TAB : Highlight the next/previous visible
PAGEUP/PAGEDOWN : Move up and down a page at a time
HOME/END : Goto the beginning/end of the help info for
the current item
In the upper left corner of the help screen (in the border),
you may see a number and possibly one of three arrow
characters. The number is the left column, of the help info,
you are at. If you are at column one, it will not be displayed.
The arrow characters indicate if there is more info either
above or below (or both) of your position.
--- heXEdit ------------------------------------- Page 7 ---
A couple of notes on the help file.
1. heXEdit expects the help file (XE.HLP) to be in the
directory that XE.EXE is in. If it is not, you will
get an error message when you invoke help.
2. If you modify the help file, make sure your keywords
are capitalized and start in column one. It will
probably be easier to just look at the help file that
came with heXEdit to see how it's done.
3. There is a limit of 75 lines of information per
4. Keyword information begins with it's keyword and
ends with a slash (#47).
5. To create a keyword in a help screen, precede the
keyword with a tilde (#126) and end it with a
2. A or Alt+A - Display ASCII chart.
ASCII chart commands :
LEFT arrow key : go back 16 characters
RIGHT arrow key : go forward 16 characters
PAGEUP : go back 128 characters
PAGEDOWN : go forward 128 characters
D : display numbers in decimal
H : display numbers in hexadecimal
ESC or ENTER : exits ASCII chart
3. B or Alt+B - Convert a number from either decimal, hexadecimal or
binary to the other two.
Base convert commands :
UP/DOWN arrow keys : select the base of the input number
ENTER : convert the number
ESC : exit the base convert routine
Using the arrow keys, move the highlight bar to the
base of the input number and then either 1) press
ENTER and enter the number or 2) just start typing
the number. After the number has been converted, press
any key to select the base for another conversion or
press ESC to exit.
When you enter the number, I only check for validity
with the first character. If you try to convert an
invalid number an error message will be displayed. The
largest number that can be accurately converted is a 32
--- heXEdit ------------------------------------- Page 8 ---
bit number. It has a very simple input routine, so
don't be surprised if you can enter an invalid number.
The conversion will be incorrect of course. I leave
it mostly up to you to enter a valid number.
4. C - Change colors
This command will allow you to change the color of just about
anything. You can also save the colors you choose so that XE
will startup with those colors.
Simply select the area you want to change the color in
by pressing a letter 'A' thru 'O'. A colorbox of all
possible colors will appear. The current color of the
item you selected will have two white bars on either
side of an 'X'. You can now move those white bars
around with the arrow keys to select a new color. With
the white bars around the color scheme you want, press
ENTER. If you change your mind and don't want to
change the color after all, press ESC.
There are a couple areas that have a color selection
restriction. Area 'G', Altered bytes background, you
can only select the background, the foreground is the
same as the main bytes (area 'A'). And the border for
Help, only the foreground can be selected as it's
background is the same as the Help text (area 'L').
Color Change Commands :
F1 : get help
A-O : select the area you want to change
S : save the currently selected colors to XE.EXE
ESC/ENTER : exit the color change screen
The 'S' command will save the currently selected colors
to the executable file (XE.EXE). If XE.EXE is not
available where it was started from, an error message
will be displayed to that effect, which means your
colors have not been saved.
If you want the default colors back, start-up XE with
the /C option. If you want to retain the default colors
make sure you then save the colors, otherwise the next
time you start XE you will have whatever colors were
last saved in XE.EXE.
5. D - Change the offset display to base 10, decimal.
6. E - Edit
--- heXEdit ------------------------------------- Page 9 ---
Begin editing the file at the current position. If the file is
a READ ONLY file, a short message to that affect will appear
and you will be returned to the view mode. Of course, you could
just press 'L' to bring up the Loadfile box and change the READ
ONLY attribute of the file with F8. And then go back and edit.
But, it might be READ ONLY for a reason ...
If you had previously searched the file successfully (meaning
you found an item) then if that exact item is displayed on
screen when you go to edit mode, then the cursor will be
positioned at the first character of that item. When I say
exact item, I mean the last item that you found in your search.
Also, shown at the bottom is the offset of the cursor position.
Edit commands :
F1 : get help
Alt+A : displays the ASCII chart
Alt+B : base number conversion
BACKSPACE/LEFT arrow key : move cursor left 1 byte
RIGHT arrow key : move cursor right 1 byte
PAGEUP : move cursor to first line on page
PAGEDOWN : move cursor to last line on page
HOME : move cursor to beginning of line
END : move cursor to end of line
TAB : toggle cursor position between the hexadecimal display
and the ASCII display of the file. The above editing
commands will move the cursor within the area the
cursor is in. You can edit the file making changes in
both areas at the same time, if so desired.
ENTER : quit editing. If you made changes to whole bytes you
will be prompted to save the changes or not. Press
'Y' to save the changes or 'N' to lose the changes.
Only the portion of the file that is in memory is
actually saved. So don't worry about waiting for a
long save if you are editing a large file. You are
then returned to the View mode.
ESC : quit editing. This will return you to the View mode and
will not save any changes you made.
To change a value when in the hexadecimal portion, just
type in it's new value. The background of the character
will change, indicating which bytes have been changed.
Valid values are '00' - 'FF'. Obviously, pressing a key
like 'P' will do nothing because 'P' is not a valid
To change a value when in the ASCII portion of the
display, simply press the key of the new value. Or,
hold down the ALT key while typing the ASCII code
of the character you want, then release the ALT
--- heXEdit ------------------------------------- Page 10 ---
key. Using the ALT key in this area, you can
enter a value from 32-255. Again, the background will
change indicating a change.
7. G - Goto an offset in the file.
You are prompted for an offset to go to. You can enter
either a decimal number or a hexadecimal number. If you
press ESC while entering a number you will be placed
back in the View mode with no repositioning taking
place. The BACKSPACE key can be used to edit your
entry. If you enter an offset that is beyond the
EOF (or < 0) you will be prompted again for a
To enter a decimal number just type in the number, no
commas, and press ENTER.
To enter a hexadecimal number, type a '$' as the first
character and then continue entering the hex number.
Also, if at anytime while entering a number, you enter
an 'A' through 'F' a '$' will be inserted into your
number at the beginning and your entry will be taken as
a hexadecimal number. For example:
8. H - Change the offset display to base 16, hexadecimal.
9. L - Load a new file
You will enter the Loadfile box in order to select a new file
(as described earlier in this document under D. Loadfile box.)
Since you can't leave the edit mode without either saving any
changes or losing changes, you needn't worry about saving the
current file before loading a new one.
10. M - Push position on marker stack.
Your current position in the file can be saved with this
command and then be retrieved later on.
Your position is saved on a stack. If the stack is full the
--- heXEdit ------------------------------------- Page 11 ---
oldest position will be deleted and the rest of the entries
will move down the stack to make room for the new entry. The
maximum number of positions you can save is 100. Also, when
your position is saved, it's location on the stack is reported
to you so you can see how full the marker stack is.
This command can also be used while searching. If the search
string is found, you can press 'M' to save that position on the
marker stack and then continue searching.
11. N - Search again using the last used search string
If there is no previous search string, you will be prompted, as
if you pressed 'S', to enter a search string.
12. O - Change the offset display to base 8, octal.
13. R - Goto (retrieve) position
While viewing the file, if you do this command you
will be moved to the location specified by the top
marker stack entry. Once you have been moved to the new
location, the entry you retrieved will be deleted
from the marker stack. If there are no markers on the
stack, then nothing will happen.
14. S - Search the file for a byte or text sequence.
You will be prompted for the type of search (B)yte or
For a byte sequence, enter the bytes in hexadecimal
notation then press ENTER. As with editing, you
must enter a complete byte, for the search to work
correctly, although I don't check for that here. You
can use the BACKSPACE key to go back and make
corrections. The maximum length for a byte sequence is
9 bytes. I think that is plenty long enough, even 4
bytes would probably be enough to find what you're
looking for. For example, you might see this prompt :
Enter search bytes :
Now you would just hit the numbers that make up the
bytes you want to search for, like :
D3 45 FF 00 C4 6E
There is no need to enter a space between each byte as
--- heXEdit ------------------------------------- Page 12 ---
I do that for you while you're entering your numbers.
For a text sequence, just type in the text to search
for, no quotes are needed, and press ENTER. The
maximum length for a text sequence is 25 characters.
The search is case insensitive.
If the search string is found, the display will move to
that string's location in the file and will be high-
lighted at the top of the screen. You can now press any
key to continue the search, press 'M' to Mark the
position or press ESC to stop searching.
While XE is searching, you can press any key to interrupt
and stop the search.
Just to make things simple for myself, every search
starts at the beginning of the file. Even on large
files, starting at the beginning to find something you
know is near the end doesn't take very long at all (at
least not on my 40Mhz 386!)
And beginning with v3.5, the searching is done using the
Boyer-Moore algorithm. This should significantly speed up
searching; on ANY computer.
15. Z - Clear all entries from marker stack
This command will delete all entries from the marker stack.
Careful, there is no turning back from the results of this
16. Alt+1 thru Alt+9 - Goto marked position
Using these commands will move you to a previously marked
position without deleting the mark information. The retrieve
command 'R' moves you to the last position and deletes the
mark, using Alt+1 - Alt+9 does not delete the mark. Alt+1 moves
you to the first marked position, Alt+2 moves you to the second
marked position, etc etc. If you try to move to a position that
has not been marked yet, nothing will happen except a message
telling you so.
G. Other Notes
If for some reason you rename XE.EXE you will need to rename
the help file (XE.HLP). For example, if you rename XE.EXE to
XEDIT.EXE, the help file should be renamed to XEDIT.HLP.
And if for some other reason you have XE.EXE loaded under XE,
and then save the colors, you may need to force a re-read of
--- heXEdit ------------------------------------- Page 13 ---
the last part of the file to get the correct information
The Loadfile box has a limit of 300 files or directories that
it can display for you. If you change to a directory with more
than 300, you will not see all of the files. Because of the way
I wrote that part of the program, 300 is about as high as I can
go due to stack space limitations. If you want to load a file
that is in a directory with more than 300 files, you'll have to
specify that filename on the command line when you start XE.
XE does not support any video modes other than 80x25 text and
will work with a monochrome monitor. Just don't forget to
include the '/M' option on the command line and then save the
color configuration to retain the monochrome 'colors'.
I would strongly suggest that you make a backup copy of any
file you're going to modify, just in case you decide later
you want the original file back. You should have a backup copy
anyway as a matter of safeguarding your files in case of
I have a 40Mhz 386 AT running MS-DOS 5.0. XE should work
with most system configurations though.
Also, I don't expect any payment for use of this program. Feel
FREE to use it how you like, but be careful :).
A. Version History
v1.0 04-08-91 - Initial writing
v1.1 05-16-91 - Minor internal changes
v1.2 07-04-91 - added Marker commands
v1.21 08-03-91 - increased marker stack size to 100
added Z command; clear marker stack
v1.3 08-12-91 - added Goto Offset command
fixed a bug or two
v2.0 09-25-91 - added Loadfile box (instead of typing in
set to video page 0 at startup
(this was done in case you shell out from
another program and that program puts you
in a video page other than 0, like Turbo
--- heXEdit ------------------------------------- Page 14 ---
Debugger. XE needs to be in video page
0. XE returns to the video page you
where at before it started when you exit)
added backspace key use while editing (acts
like left arrow key)
added 'D', 'H' and 'O' commands while viewing
changed Help command to 'F1' from 'H'
made Search command case insensitive
added ability to enter a drive designator
on cmd line to start Loadfile box on that drive
and of course fixed some bugs ...
v2.1 10-19-91 - decided I better try and trap most of the
I/O, as opposed to only some, for errors,
to avoid a possible run-time error
allow loading of read-only files
allow entry of ASCII chars 32-255 when
editing in ASCII portion of display
check for and handle extremely long path names
swapped ability to change Help screen color
with Base convert
search command now highlights found text,
(no flashing arrow!)
hidden files (and directories) are lowercase
in Loadfile box
and the usual bug fixes ...
v2.11 10-21-91 - fixed base convert color saving and loading
from cfg file
v3.0 11-11-91 - fixed pagedown problem of going past EOF on
display for files with a length approaching
that of the buffer size
added '%' into file indicator
you can now call up the ascii chart and
base convert from edit mode with
in edit mode, Pg Up/Dn now just goto first/
last line. column position is not changed
totally new help system (yea!)
v3.01 11-12-91 - fixed extra '%' char left when going from
100% to <100%
allow config file to take on same name as
executable; in case you rename XE.EXE
v3.02 11-18-91 - fixed bug when executing from second level
or deeper sub-dir.
v3.1 11-25-91 - fixed configuration file saving problem
added ALT+1 thru ALT+9 commands (goto
restricted input length for base conversion
v3.2 01-23-92 - added colorbox for color selection, instead
of entering numbers.
v3.3 01-29-92 - XE.CFG file is now history. Color
information is saved in the executable
added cmd line options /C, /M, /?, ?, /H
--- heXEdit ------------------------------------- Page 15 ---
slight (very) improvement in display speed
restore cursor from a Ctrl-Brk input
no more editing past the EOF
v3.31 02-05-92 - fixed byte search problem with char case
v3.32 02-07-92 - fixed byte search problem with char case
(this time for real. haste makes waste...)
v3.33 02-23-92 - change Loadfile box to show files in the
current directory of a drive (previously
v3.4 04-04-92 - added ability to abort searching
update '%' into file indicator during search
added Alt+A for ASCII chart cmd from View mode
added Alt+B for Base convert cmd from View mode
cursor is positioned at location of last search
item when going to edit mode; if that search
item is visible on screen in same file
changed default colors a little
file list in Loadfile box is now sorted by name
fixed PgUp bug in Loadfile box
v3.5 04-23-92 - implemented the Boyer-Moore search algorithm
for a definite improvement in search
v3.51 06-10-92 - fixed search routine bug
v3.52 06-29-92 - ditto
v3.53 08-10-92 - allow 'C' (change colors) command in mono;
so you can save the mono colors to XE.
v3.54 12-10-92 - allow ESC while editing when only half of
a byte has been changed.
v3.6 02-06-93 - show offset of cursor when editing, line
wrap cursor when moving
B. Trademark information
'Turbo Pascal' and 'Turbo Debugger' are registered trademarks
of Borland International, Inc.
--- heXEdit ------------------------------------- Page 16 ---