Contents of the EDIT.DOC file
Edit by Rick McClain
Edit functions much like DEC's EDT editor for the VAX computer. It was written
in IBM Pascal and Macro Assembler. It is fast and memory efficient. Nearly
2000 lines of code resulted in a program of 19k. As a result, Edit can be used
with as little as 48k.
Edit is compatible with BASIC (saved with the A option), all of IBM's
compilers, and the IBM assembler. The format of the files generated is
identical to that generated by Edlin.
What you see on the screen is your text. To add to it position the cursor and
type. To help locate a specific point a search function is provided which
searches forward or backward for any search string. Multiple searches can be
performed without retyping the string. To move text, a cut and paste function
is provided. Select the text to be cut by positioning the cursor and pressing
a select key. Now when you move the cursor, the selected text appears in
reverse video. You don't need to remember where you placed the select point,
you are provided instant feedback. Press the cut key and the selected text
disappears. Move the cursor, press the paste key and it reappears. Press the
paste key again and a second copy appears. To aid in formatting, Edit provides
user definable tabs as well as default settings useful for programming.
Editing takes place in memory. Edit adapts the size of the text buffer to use
all available memory. It works best when files fit within the text buffer,
because one can quickly move about the whole file. However, Edit does have
features for dealing with large files. When a file is too large for memory,
only part of it is read into the buffer. After the text in memory is edited,
some of the text buffer is written to disk, making room for more of the file.
Edit allows you to move about the text buffer quickly. Moving the cursor in
every direction proceeds at the speed of the keyboard repeat. This means you
can scroll through the text buffer at about 10 lines/second. You can page
through at 50 lines/second. Moving along a line is aided by keys to move the
cursor from word to word. Moving to the top or bottom of the text buffer is
To run, type [d:]edit
After Edit is loaded it will issue an asterisk (*) as a prompt. If you wish,
you can remove the disk, because Edit is in memory, which allows you to insert
your work disk.
Edit starts in the command mode (asterisk * prompt). At this point you may
type the commands to read files from disk and put them in the buffer, or switch
to screen mode (the S command) and begin typing new text. Command mode and
screen mode are the only modes, and you can switch between them by typing S in
command mode and CTRL-Z in screen mode.
Another way to run Edit allows you to specify the filename of an already
existing file in the command line. From DOS type [d:]edit [d:]filename.ext
Edit will load and read the file into the text buffer. Specifying the filename
in the command line is equivalent to using the other format, and then entering
an R (read) command.
When in command mode, the asterisk (*) is a prompt. At this point any command
can be entered. Commands are a single character (H,S,C,R,I,T,W,E,Q) upper or
lower case. Some of the commands require additional information, which should
be typed immediately after the command character without any spaces. Example:
RFILE.TXT will cause the file FILE.TXT to be read from disk and placed in the
Any valid DOS file name can be used.
In response to the H, Edit prints a list of commands. The help command is a
memory jogger, not a replacement for this manual.
Entering S causes Edit to switch to screen mode for entering and modifying text.
While in screen mode, what you type is entered into the text buffer to the left
of the cursor, and what you see on the screen is the format of the text file.
The screen mode is exited by typing CTRL-Z.
In response to the C command, Edit creates the file specified and copies to it
the contents of the text buffer. If the file existed prior to the command the
old contents are replaced. The C command is the normal method for initially
creating a file. Note that the content of the text buffer is not modified by
Format: *R[d:]filename.ext or *R
R is used to open and read into the text buffer a file that already exists. The
file is appended to the end of any text that is already in the text buffer. If
the text buffer becomes 90% filled then reading is suspended and the file is
left open. Edit will inform you if this happens. While the file is still open
the disk should not be removed from the drive. In order to read in the rest of
the file, memory must be freed by either using the W command or deleting text.
When memory becomes available you can continue to read from the still open file
by using the second format (*R) for the read command.
I is used to insert the contents of the specified file into the buffer. The
file is inserted into the text buffer to the left of the cursor. The I command
cannot be used if a file is still open as a result of a previous R command.
Only as much of the file as will fit into the buffer will be read. The file is
closed after reading. Thus insert should only be used if you are sure that the
whole file can be read in.
Format: *T or *TP or *TF or *TN
T sets tabs. Typing T without a modifier results in Edit prompting for the tab
settings. First Edit prints a line of column numbers. Then you type a line of
spaces and t's. Tabs are set in the columns in which you place a t. When you
are in the screen mode, pressing the tab key causes spaces to be inserted into
the text until the cursor is in a tab column.
The TP command sets tabs to the Pascal default settings (every third column
starting with column four) and the TF command set tabs to the Fortran default
settings (every third column starting with column seven).
TN turns off the tab function. Typing the tab key now causes the ASCII tab
character to be inserted into the buffer. The tab character is interpreted in
the generation of the screen display in the same manner as DOS (every eighth
column starting with column nine).
Edit starts with tabs turned off, thus there is no reason to use TN unless one
of the other tab commands is executed first.
Format: *W[d:]filename.ext or *W
W causes the file to be created and writes the text buffer up to but not
including the cursor position. If the file existed prior to the command the
contents are replaced. The text that is written out is then deleted from the
text buffer, freeing memory for more text. The file created remains open for
the rest of the session. The disk must remain in the drive. To write more
text to the file, position the cursor (in screen mode) and use the second form
of the command (W with no filename).
W is used in conjuntion with the R command when working with files which are
too large to fit into memory. The R command is used to read in some text,
which can be edited. Then the W command is used to write some text making room
for more. For smaller files, use the C and E commands for text file creation
E writes the text buffer to disk and terminates the editing session. The file
written to is determined as follows:
If a file is currently open (due to a previous W command), the entire text
buffer is written to that file. Then, if a read file is still open (due to a
previous R command), the rest of the read file is copied to the write file.
In other words, the E command is the normal method for terminating an edit of a
If no write file is open, the first file that was read, whether given in the
initial Edit command line or given in an R command, is rewritten with the
current contents of the buffer. Thus, the E command is the normal method for
terminating an edit of a file be it large or small.
If no file was read, E is equivalent to a Q (abort) command. Edit will ask you
to verify this because it results in the loss of any text generated.
The Q command causes Edit to abort the editing session. Any open files are
closed, but the contents of the text buffer is not saved. Edit will ask to
verify this command.
To switch to screen mode, type S while in command mode (in response to the *
To leave screen mode, type CTRL-Z. Edit will return to command mode and
issue a prompt (*).
When in screen mode, the top 24 lines of the screen display the contents of 24
lines of text from the buffer. The bottom (25th) line is used to display
information and to input search strings. If a line has more than 80
characters, the characters beyond the 80th character do not appear on the
screen. The number on the far right of the bottom line tells you how many
bytes of text buffer you have left before it is filled. This number is
Should you accidentally try to overfill the text buffer, Edit will transfer to
command mode and inform you that you need to make room in the text buffer to
continue. No text will be lost.
While in screen mode, text is inserted into the text buffer to the left of the
cursor position. When you hit return a new line is created and the text that
was to the right of the cursor is moved down to the new line. Return functions
like any other character except that you don't see a return character, instead,
return causes text to begin on the next line.
The labeled editing keys of the IBM keyboard can be used while in screen mode
and have the following functions:
Four cursor keys - These keys move the cursor.
Home - moves the cursor to either the beginning of the text buffer or the
end, depending on the current direction.
End - moves the cursor to the end of the next or previous line, depending
on the current direction.
Pg Up - moves the cursor up 18 lines, which provides some overlap on the
screen between adjacent pages.
Pg Dn - moves the cursor down 18 lines.
Del - deletes the character at the cursor position.
Backspace - Deletes the character to the left of the cursor.
Tab - If special tabs have been enabled then spaces are inserted into the text
until the cursor reaches the next tab stop. Otherwise, pressing the tab
character inserts an actual tab character into the text.
Ins - not used.
The 10 function keys have special meanings while in screen mode. The layout
of the keys is:
F1 - Set direction up F2 - Place select marker
F3 - Find string F4 - Cut selected text
F5 - Find next F6 - Paste in paste buffer
F7 - Move left one word F8 - Move right one word
F9 - Set direction down F10- Reset select
F1 - Set direction up
The functions associated with several of the other keys, namely F3, F5, Home,
and End, require a direction (either forward or backward in the text). F1
causes the direction flag to be set in the up direction (backwards in the text).
The direction flag is internal to Edit, and only changes when keys F1 or F9 are
F3 - Find string
When F3 is pressed, Edit prompts you on the bottom row to enter a search
string. You can then type a character string of up to 50 characters.
Terminate the input of the string by pressing one of four keys. Pressing
either return or F5 results in the search proceeding from the cursor position
in the direction defined by the direction flag. Pressing F1 causes the search
to proceed backwards through the buffer. Pressing F9 causes the search to
proceed forward through the buffer. The direction flag remains in the
direction set by F1 or F9 after the search is completed. The matching function
ignores differences in case, matching lowercase letters with their uppercase
counterparts and vice versa. When the search string is found, the cursor is
moved to the beginning of the matching string in the text. If Edit reaches the
end of the text buffer without finding the string then a message appears at the
bottom and the cursor remains where it was before the search began.
F5 - Find next
When F5 is pressed, Edit searches forward or backward (depending on the current
direction) for the string defined with the last find command. Same as F3,
except you don't type in a new string.
F7 - Move left one word
Pressing the F7 key moves the cursor to the beginning of the next word to the
left of the cursor.
F9 - Set direction down
Pressing the F9 key sets the direction flag to down (forward through the
F2 - Place select marker
Keys F2, F4, F6, and F10 are associated with cut and paste. Pressing F2
enables the select operation, placing a marker to the left of the cursor
position. After placing the select marker, movement of the cursor causes the
selected text (the text between the select marker and the current cursor
position) to appear in reverse video. The selected text can be cut by pressing
F4. To reset select mode, press F10.
F4 - Cut
F4 removes the selected text (highlighted in reverse video) from the text
buffer and places it in the paste buffer. The previous contents of the paste
buffer is deleted. Note that cut is a very useful way to delete large amounts
of text, which provides an extra degree of safety because the deleted text can
F6 - Paste
F5 copies the contents of the paste buffer into the text buffer to the left of
the cursor position. The content of the paste buffer is not modified.
F8 - Move right one word
Pressing F8 moves the cursor to the beginning of the next word to the right of
F10 - Reset select
By pressing F10 you turn off the select mode if you do not want to continue a
cut operation after pressing the select key.
For normal editing, only a subset of the commands discussed above is needed.
To create a new file, run Edit, go to screen mode with the S command, and enter
text. Then leave the screen mode with a CTRL-Z and create the file using the C
command. Leave Edit in this case using the Q command. To edit an existing file,
run Edit, this time specifying the file name in the DOS command line or by using
the R command. Go to screen mode and edit the text. Leave the screen mode and
then, to save your changes, use the E command or, to abort the editing session
without saving your changes, use the Q command. These two procedures are all
you really need to remember for most editing.
Whenever possible, work with files which fit in memory, because Edit is much
more convenient in this case. Edit uses all the memory that you have in your
system (up to 640k).
Use the cut function when deleting anything more than a small amount of text.
Not only is it faster and therefore more convenient to use, but because the
removed text is put in the paste buffer, the deletion can be recovered, at
least until another cut operation is performed.
Be careful when doing cut and paste operations on a file which fills up most
of memory. If you do a cut operation on a large chunk of text it may not be
possible to paste it all back into the main buffer, because after a paste
operation, two copies of the contents of the paste buffer exist: one is in the
main buffer and one is the paste buffer. If you should happen to get stuck it
is always possible to recover without loss of text by writing the main buffer
out with a C or W command.