Jan 082018
Edit files at byte level (great!).
File FM.ZIP from The Programmer’s Corner in
Category Utilities for DOS and Windows Machines
Edit files at byte level (great!).
File Name File Size Zip Size Zip Type
FM.COM 9582 3778 deflated
FM.DOC 10844 3888 deflated

Download File FM.ZIP Here

Contents of the FM.DOC file


FM (for File Modify) is a little utility which allows you to
easily edit files at the individual byte level. It is especially
useful in situations where one might use DEBUG to modify a byte in
order to patch a program, to change the wording of messages in your
programs which bother you (its search capabilities are useful for
this) or to change color attributes in a program.

The program is invoked by typing
If FILESPEC is of the form NAME.EXT, the program with that name in
the current drive and directory will be loaded. But fm supports
other drives and full path names so if your default drive is A: and
FM.COM is on the current drive or in the DOS search path, the
command "fm B:\some directory\some filename" will work perfectly.


A description of the most important keystrokes is displayed
on the fm screen and the others are described in the help screen.
The commands involve the function keys, cursor keypad, and

The function keys have the following meanings
F1:Help F2:Search F3:NOT USED F4:NOT USED
F5:Hex/Decimal toggle F6:ASCII display toggle F7:NOT USED
F8:NOT USED F9:Sector Save F10:Sector Jump

exits the program, toggles the active cursor
between the HEX and ASCII areas, the cursor arrow keys do the
obvious things, reads the next sector, the
sector 5 sectors down and (resp. ) undo the
actions of (resp. ). Home moves the cursor to the
start of the active line and End to the end of the active line.


Fm displays the file in "sectors" of 256 bytes each in 16
lines with 16 bytes per line. The line below the main display
shows the file name, its date and time of creation or last update
and the word HEX or ASCII indicating which part of the main display
is active. The key toggles which is the active display and
in addition to status line the active display is indicated by the
block cursor. Modifications are made on the active display as will
be explained.

The first column of numbers in the active display labels the
lines by indicating the number of the first byte on the line. In
the default mode the numbers are in hexidecimal and appear in <..>.

The key toggles to a decimal numbering of the lines. The next
16 columns of data show the HEX value of each byte, the 256
possibilities for a byte corresponding to two HEX digits. The next
"column" gives the current sector number within the file and the
number of sectors. In default mode, these numbers are given in HEX
but toggles not only the line numbers but also whether these
numbers are given in HEX or decimal. This same column also reports
the current value of the HEX/decimal toggle.

The right hand columns show the individual lines in ASCII
form. In the default mode, only "text characters" are shown with
all non-text characters (ASCII numbers 0-31;129-256) are indicated
by periods. toggles to and from a mode where these characters
are shown. In the non-text mode, you can do a screen dump with

A help screen is displayed if one hits . You can exit the
help screen by hitting or .


The and keys read the next and previous
sectors. Depressing the key while hitting these keys makes
a change of 5 sectors. If the key is depressed, you are
prompted for a new sector number. Responding will move you
to the first sector (thus since unsuccessful searches will leave
you in the last sector, you'll probably want to follow an
unsuccessful search by the , combination). Otherwise,
a number should be entered and the program will jump to the
appropriate sector. If line numbers, etc are displayed in HEX
(resp decimal), the sector number should be entered in HEX (resp.


The whole point of FM is to change the file. In the default
mode, the block cursor is in the ASCII part of the screen. The
cursor can be moved with the arrow, home and end keys. If a text
character is struck, the character at the cursor is replaced by the
character struck. The key toggles to the HEX display.
Modification of the two HEX digit byte under the cursor is made by
striking the appropriate keys. Even if only one of the two digits
needs to be changed, you must enter both of them. If you have
entered the first digit, it will change on the display and flash
until the second digit is entered. If any key other than 0-9,a-e
is struck the byte returns to its initial value.

Any changes made are indicated on both the HEX and ASCII
display but they are only made in memory and NOT on the original
file. To make the changes in the original file, you must hit the

key. only saves the changes made in the currently active
sector and not any changes made previously in other sectors. If
you try to exit the program or change the sector shown and you have
made any unsaved changes, you are prompted to hit to save the
changes if you wish.


You can do a rudimentary search through the entire file
FOLLOWING the cursor (not just the current sector). Hitting the
key prompts for a search string. ASCII search strings will be
searched regardless of whether the current active mode is ASCII or
HEX. To do a HEX search, proceed the byte with a "_". Do not
place quotes around _ or around search text. You can search for
multiple HEX bytes (so _41_61 will search for Aa) and ASCII and HEX
can be mixed in the search string (so A_42C_44 will search for


One of the uses of fm is to modify itself if you wish to
change some of the defaults in the program. The twelve defaults
which can be changed occur in sectors 1 (the first eight below) and
3 in the form -. Thus, to change the
color attribute for the ASCII text display, find the string ASCII.
The byte immediately preceding it is 2D(hex) for - and the byte
before that (which is 07 for grey on black) can be modified to
change the display color. For example, changing it to 1E will make
that display as yellow on blue (on a color monitor). The color
code is the standard one set by IBM (but different from the BASIC
and ANSI.SYS color codes), namely:
0 black 4 red
1 blue 5 magenta
2 green 6 brown (yellow)
3 cyan 7 grey (white)
Adding 8(Hex) to these for the foreground color produces their
"intense" version; intense brown is yellow and intense grey is
white. Adding 8 (Hex) to the background color causes the
foreground to flash. The first HEX digit determines the background
and the second the foreground. As indicated 1E (E=6+8 Hex) is
yellow on blue while 9E would be flashing yellow on blue.

Here are the other attributes which can be modified:

LINE# Color attributes for line number; default is 04=red on black
HEX Color attributes for the HEX display; default is 06=brown on black
HEXED Color attribute for the one changed HEX digit when editing
in HEX mode and only one digit has been changed; default
is F0=flashing black on white
ACTIVE CURSOR Color attributes of the active cursor; default is
70=black on white.

PASSIVE CURSOR Color attributes of the position of the cursor on
the inactive screen (shadow cursor); default is 01=blue on black
HELP SCREEN Color attributes of Help Screen; default is 74=red on white
HELP BORDER Color attributes of Help Border; default is 1C=intense
red on blue
BOOT MODE The default is 00 which cause the ASCII screen to be the
active one when the program is loaded. Change it to 01 to
make the HEX screen active upon program loading.
BOOT DSTYLE The default is 00 which cause the line numbers, etc.
to appear in HEX upon loading. Change to 01 to make
decimal used upon loading.
GRAPHICS The default is 00 which causes only text characters to be
displayed in the ASCII display when the program is loaded.
Change to 01 to make all characters display upon loading.
HEXID The ASCII character used in a search string to preface a
HEX specification. The default is _ which has an ASCII
code of 5F. To change _ to $ for example change 5F to 24.

The three items preceding HEXID concern the initial settings
of the choices controlled by the , and toggles.
Some of the default attribute settings are chosen so the display is
useful on a monochrome monitor and you may wish to change them if you
run fm from a color monitor.


The FM program is written and copyright by Doug Schaffer.
These documentation is written by Barry Simon. While the program
has been used extensively and appears to be bug free, it is a
powerful program and the responsibility for its use and any damages
it might cause lies with the user. Any comments can be sent to:
Doug Schaffer Barry Simon
Caltech 1-78 Caltech 253-37
Pasadena, CA 91125 Pasadena, CA 91125

While the program was written at Caltech, that
institution bears no responsibility for the program.

FM.COM may be freely distributed and used, but selling FM
or bundling FM with software that is sold is not allowed. Only
unmodified copies of the original software may be distributed.

 January 8, 2018  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>