System information

Section 2
The CP/M Editor
2.1 Introduction to ED
ED is the context editor for CP/M, and is used to create and alter CP/M source files. To start ED,
type a command of the following form:
ED filename
or
ED filename.typ
Generally, ED reads segments of the source file given by filename or filename.typ into the
central memory, where you edit the file and it is subsequently written back to disk after
alterations. If the source file does not exist before editing, it is created by ED and initialized to
empty. The overall operation of ED is shown in Figure 2-1.
2.1.1 ED Operation
ED operates upon the source file, shown in Figure 2-1 by x.y, and passes all text through a
memory buffer where the text can be viewed or altered. The number of lines that can be
maintained in the memory buffer varies with the line length, but has a total capacity of about
5000 characters in a 20K CP/M system.
Edited text material is written into a temporary work file under your command. Upon termination
of the edit, the memory buffer is written to the temporary file, followed by any remaining
(unread) text in the source file. The name of the original file is changed from x.y to x.BAK so
that the most recent edited source file can be reclaimed if necessary. See the CP/M commands
ERASE and RENAME. The temporary file is then changed from x.$$$ to x.y, which becomes
the resulting edited file.
1.8 Operation of CP/M on the MDS CP/M Operating System Manual
2-1