home *** CD-ROM | disk | FTP | other *** search
-
- HexEd, a Hexadecimal Editor for Binary Files,
- by Anthony F. Stuart, 1990.
-
-
- 1. Description
-
- HexEd is a fast and easy to use editor for binary files. It
- supports insert and overtype modes, character delete, and search
- and replace. Command line options let you customize it for your
- video hardware and processing preferences. HexEd uses memory
- and disk very efficiently. The executable file itself consumes
- less than 30 kb and it can edit files up to two megabytes in less
- than 100 kb of memory.
-
- HexEd uses the popular hexadecimal dump display, with address
- on the left, hexadecimal representation in the middle and character
- representation on the right. The current location in the file is
- marked by a pair of cursors, one for the hexadecimal representation
- and one for the character representation. The arrow keys, page up,
- page down, home and end select the current location in the file.
- There is also a goto command to select a specific address.
-
- Text can be inserted or overtyped as either hexadecimal or
- character codes. A single key combination switches between modes. In
- hexadecimal mode the hexadecimal cursor is active and lets you enter
- a one or two digit hex value. In character mode the character cursor
- is active and lets you enter a character. Characters can also be
- entered using decimal code by holding down the Alt key and entering
- the decimal code on the numeric keypad.
-
- HexEd makes an ideal binary file pager. The search and goto
- commands, and current address display field, let you quickly locate
- an address without having to count bytes.
-
- 2. Use
-
- To invoke HexEd with default display and processing options
- just type the command followed by an existing filename:
-
- hexed file
-
- HexEd will display its header and footer lines and the first page
- of the file. The current location is set to the first byte of the file.
- The header line contains the current address, file size, insert/
- overtype indicator and hex/ascii indicator. The footer line contains
- the file name, time and date last modified and original file size.
-
- Press function key F1 for a help display that summarizes the
- interactive commands. This display is also produced if you enter an
- invalid function or Alt key sequence. The help display is cleared by
- pressing any key.
-
- The cursor positioning keys move the cursor around the file
- in the usual way. The home key selects the beginning of the file and
- the end key selects the end of the file. Page up and page down move
- one page backward or forward.
-
- The delete key deletes the current character, and all following
- characters shift up one. The insert key toggles insert/overtype mode.
- The default mode is overtype mode. In overtype mode each character that
- is entered replaces the character that was previously there. In insert
- mode each character that is entered is inserted at the current location
- and the following characters are shifted down one. The current mode
- is indicated on the header line.
-
- HexEd recognizes a variety of Alt key sequences:
-
- Alt-D (Dos Suspend) suspends the current editing session and
- enters the DOS command processor. Return to HexEd by typing
- exit at the DOS prompt. Caution: while suspended do not delete
- or modify the file you are editing or any "hexedtmp" files.
-
- Alt-G (Goto Address) prompts for an address and makes it the
- new current location. The address can be entered in octal,
- decimal or hexadecimal format. Octal addresses must be preceded
- by a 0 and hexadecimal addresses must be preceded by a 0x. For
- example, the octal address 010770 and the hexadecimal address
- 0x11f8 are equivalent to the decimal address 4600.
-
- Alt-H (Toggle Hex/Character Mode) controls which cursor is
- active for inserting or overtyping. In hexadecimal mode the
- hexadecimal cursor is active and you can enter any of the
- digits 0123456789abcdef. In character mode you can enter any
- character that can be typed from the keyboard. Remember that
- text lines in DOS are terminated by a carriage return, line
- feed combination. This can be entered using Ctrl-M, Ctrl-J. Also
- note that most PC BIOS's support decimal entry by holding down
- the Alt key and entering a decimal code on the numeric keypad.
-
- Alt-Q (Quit) exits the editor. First you are prompted for
- whether you really want to quit or not. Then, if you have made
- changes, you are prompted for whether you want to save them.
- Note that at this point it is only possible to write the changes
- back to the original file. If you want to write the changes to
- a different file use the Write command before quitting.
-
- Alt-R (Replace) prompts for a search pattern and a replace
- string and then interactively asks you whether you would like
- to replace each occurence of the pattern. A NO response skips to
- the next occurence. A YES response replaces the current occurence.
- An ALL response replaces all remaining occurences (to the end of
- the file). A STOP response terminates the search and replace
- operation. See the search command for a description of patterns.
-
- Alt-S (Search) prompts for a search pattern and locates the
- first occurence of it following the current location. A search
- pattern consists of a sequence of one or more characters, escape
- sequences and/or wildcards. Escape sequences are described below.
- Wildcards consist of the question mark character (?) which
- matches any one character and the asterisk character (*) which
- matches zero or more characters. The asterisk will match the
- shortest string that satisfies the remainder of the pattern.
-
- Alt-W (Write) writes the current editing session to a file. First
- you are prompted for whether or not you really want to write to
- a file. Then you are prompted for the name of a file. The editing
- session is then written to the file. If you have specified the
- original file as the output file then the time and date modified
- and original file size fields of the footer line will be updated.
-
- As mentioned above, text for the search and replace commands can
- be entered as a sequence of characters and/or escape sequences. The
- escape sequences use the common convention of a backslash followed
- by a mnemonic:
-
- Sequence Description ASCII Code or Comment
- -------- ----------- ---------------------
- \a audible alert BEL
- \b backspace BS
- \f formfeed FF
- \n newline (linefeed) LF
- \r carriage return CR
- \t horizontal tab HT
- \v vertical tab VT
- \? question mark negates wildcard function
- \* asterisk negates wildcard function
- \\ backslash negates escape function
- \0nnn octal code nnn e.g. \033 is an ASCII ESC
- \dnnn decimal code nnn e.g. \d27 is an ASCII ESC
- \xnn hexadecimal code nn e.g. \x1b is an ASCII ESC
-
- The escape sequences can be intermixed with text as long as the
- end of an octal, decimal or hexadecimal sequence is not ambiguous.
-
- When entering text for the search, replace or file commands, use
- the backspace key to delete the previous character and the escape key
- to delete the entire line. You can also cancel any of these commands
- by pressing escape followed by return.
-
- 3. Limits and Error Recovery
-
- HexEd creates a temporary file that is uses to keep track of
- changes you make. The file you are editing is not updated until you
- write the changes back to it or quit and save the changes. In fact,
- the write operation first writes the changes to another temporary file
- and then renames the temporary file to the name you specified. This
- way if anything goes wrong you will not lose your original file.
-
- Keep in mind that HexEd uses temporary files and that they
- require disk space. A good rule of thumb is to only use HexEd on
- disks that have at least 2-3 times as much free space as the size of the
- file you are editing. Also keep in mind that HexEd should not be used
- to edit files over two megabytes (hex 200000). If you run out of memory
- or disk space for temporary files the editor aborts and your changes
- are lost.
-
- 4. Defaults and Command Line Options
-
- HexEd lets you customize the way it operates by specifying
- command line options. If you want to use certain options every time
- you edit, create a batch file that invokes HexEd with the desired
- options. The following list summarizes the command line options. You
- can get a summary of this list by specifying the HexEd command without
- a filename. Note that command line options should be entered in lower
- case. Also, for options that require a parameter, there should be no
- space between the option and the parameter.
-
- -b creates a backup file before writing changes. The backup
- file uses the same base name and a .bak suffix. Caution: the
- new backup file will replace any existing file with the same
- name.
-
- -c<c> specifies the color to use for the cursor and help
- display. The method for specifying colors is described
- below. The default is -ckw for both monochrome and color.
-
- -d<d> specifies the display character to use for characters
- outside the printable ASCII character set. This character
- can be represented using the escape sequence notation
- described above. If no character is specified then the
- character from the PC character set is displayed. The
- default is -d\xfa for the centered dot.
-
- -e<f> specifies the fill character to use when characters are
- added beyond the end of the file. The default is -e\x0, i.e.
- fill from end of file to the current location with zeros.
-
- -f<c> specifies the color to use for the footer line. The default
- is -fkw for monochrome and -fyr for color.
-
- -h<c> specifies the color to use for the header line. The default
- is -hkw for monochrome and -fyr for color.
-
- -m<c> specifies the color to use for the message line. The default
- is -mwk for both monochrome and color.
-
- -s specifies silent mode. Invalid keys are ignored. The default
- is to produce a tone when an invalid key is entered.
-
- -t<c> specifies the color to use for the text area. The default
- is -twk for monochrome and -tck for color.
-
- -u<n> specifies the number of memory buffers to use. Specifying
- a large number makes editing faster but limits editing to
- smaller files. Specifying a small number slows down editing
- but lets you edit larger files. The default is -u8. The
- minimum is -u4.
-
- -v specifies use of the video BIOS instead of direct video
- access. Use this option if you have any problems with the
- display. The video BIOS is slower than direct access.
-
- Colors are specified as a two character sequence. The first
- character represents the foreground color. The second character
- represents the background color. Colors are abbreviated:
-
- b = blue, g = green, c = cyan, r = red,
- m = magenta, y = yellow, w = white, k = black
-
- For example, to specify a text area of white on black, use -twk.
-
- 5. Distribution
-
- HexEd is not copyrighted. It may be freely copied and
- distributed. All I ask is that you give me credit if you copy and
- distribute it and that you do not distribute copies that have
- been modified in any way or that are missing this documentation.
-
- My objective is to make HexEd the number one binary editor. Please
- distribute it to anyone who can benefit from it.
-
- HexEd is distributed as-is with no warranties, for use at
- your own risk. Every effort has been made to produce a robust and
- reliable program, but there are undoubtedly some bugs left in it. If
- you find a bug, try to reduce it to its simplest case and send me a
- description. I would also like to hear general comments or
- suggestions for new features. My name and address:
-
- Anthony F. Stuart
- 21042 Thoreau Court
- Sterling, VA 22170
-
- The source to HexEd consists of about 3000 lines of 'C' language
- source code. It would make good reading for anyone who would like to
- learn more about editor data structures and file manipulation. If you
- would like a copy of the latest source code for HexEd, on 360 kb
- diskette, send a brief note and $10.00 to the above address. Note that
- the source code to HexEd is copyrighted and may not be redistributed
- in any format. Also note that this offer may withdrawn without notice.
-