Post Office Box 579, Pacific Grove, California 93950, (408) 373-3403
Post Office Box 579, Pacific Grove, California 93950, (408) 373-3403
Digital Research
(Version 1.3)
Table of Contents
Section Page
1. GENERAL...................................1
2. FUNCTIONAL DESCRIPTION OF CP/M............2
2.1. General Command Structure...........3
2.2. File References.....................3
3. SWITCHING DISKS...........................5
4. THE FORM OF BUILT-IN COMMANDS.............5
4.1. ERA afn cr..........................6
4.2. DIR afn cr..........................6
4.3. REN ufn1=ufn2.......................6
4.4. SAVE n ufn cr.......................7
4.5. TYPE ufn cr.........................7
5. LINE EDITING..............................7
6. TRANSIENT COMMANDS........................7
6.1. STAT cr.............................8
6.2. ASM uf n cr.........................8
6.3. LOAD ufn cr.........................9
6.4. PIP cr..............................10
6.5. ED ufn cr...........................12
6.6. SYSGEN cr...........................13
6.7. SUBMIT ufn parm#l...parm#n cr.......14
6.8. DUMP ufn cr.........................15
7. OPERATION OF CP/M ON THE MDS..............15
An Introduction to CP/M Features and Facilities
1. General
1
READ read a record from a particular file
The CCP provides symbolic interface between the user's console and the
remainder of the CP/M system. The CCP reads the console device and processes
commands which include listing the file directory, printing the contents of
files, and controlling the operation of assemblers, editors, and debuggers.
The standard commands which are available in the CCP are listed in a following
section.
The last segment of CP/M is the area called the TPA. The transient
program area holds programs which are loaded from the disk under command by
the CCP. During program editing, for example, the TPA holds the CP/M text
editor machine code and data areas. Similarly, programs created under CP/M
can be checked-out by loading and executing these programs in the TPA.
The user interacts with CP/M primarily through the CCP which reads and
interprets commands input through the console. In general, the COP addresses
one of several disks which are online (the standard system addresses up to two
different disk drives). These drives are labelled disk "A" and so-forth. A
disk is "logged in" if the CCP is currently addressing the disk. In order to
clearly indicate which disk is the currently logged disk, the CCP always
prompts the operator with the disk name, followed by the symbol ">" indicating
that the CCP is ready for another command. Upon initial start up, the CP/M
system is brought in from disk A, and the CCP displays the message
2
where xx is the memory size (in kilobytes) which this CP/M system manages, and
m.m is the CP/M version number. The CCP then automatically logs-in disk A,
and prompts the user with the symbol "A>" (indicating that CP/M is currently
addressing disk "A") and waits for a command. The commands are implemented at
two levels: built-in commands and transient commands.
Built-in commands are a part of the CCP program itself, while transient
commands are loaded into the TPA from disk and executed. The built-in
commands are:
File references consist of two parts: the primary name and the secondary
name. Although the secondary name is optional, it usually is generic; that
is, the secondary name "ASM" for example, is used to denote that the file is
an assembly language source file, while the primary name distinguishes each
particular source file. The two names are separated by a "." as shown below:
pppppppp.sss
Where pppppppp represents the primary name of eight characters or less, and
sss is the secondary name of no more than three characters. As mentioned
above, the name
pppppppp
3
blanks. The characters used in specifying an unambiguous file reference
cannot contain any of the special characters
. , ; : = ? *
X?Z.C?M
is satisfied by the unambiguous file names
XYZ.COM
and
X3Z.CAM
Note that the ambiguous reference
*.*
is equivalent to the ambiguous file reference
????????.???
while
pppppppp.*
and
*.sss
are abbreviations for
pppppppp.???
and
????????.sss
respectively. As an example,
DIR *.*
is interpreted by the CCP as a command to list the names of all disk files in
4
DIR X.Y
searches only for a file by the name X.Y Similarly, the command
DIR X?Y.C?M
causes a search for all (unambiguous) file names on the disk which satisfy
this ambiguous reference.
3. SWITCHING DISKS.
The operator can switch the currently logged-in disk by typing the disk
drive name (A, B, ...) followed by a colon (:) when the CCP is waiting for
console input. Thus, the sequence of prompts and commands shown below might
occur after the CP/M system is loaded from disk A:
The file and device reference forms described above can now be used to
fully specify the structure of the built-in commands. In the description
below, assume the following abbreviations:
ufn - unambiguous file reference
afn - ambiguous file reference
cr - carriage return
Further, note that the CCP always translates lower case characters to upper
case characters internally. Thus, lower case alphabetics are treated as if
they are upper case in command names file references.
5
4.1 ERA afn cr
The ERA (erase) command removes files from the currently logqed-in disk
(i.e., the disk name currently prompted by CP/M preceding the ">"). The files
which are erased are those which satisfy the ambiguous file reference afn. The
following examples illustrate the use of ERA:
ERA X.Y the file named X.Y on the currently logged disk
is removed from the disk directory, and the space
is returned
ERA X.* all files with primary name X are removed from the
current disk
ERA *.ASM all files with secondary name ASM are removed from
the current disk
ERA X?Y.C?M all files on the current disk which satisfy the
ambiguous reference X?Y.C?M are deleted
The DIR (directory) command causes the names of all files which satisfy
the ambiguous file name afn to be listed at the console device. The command
DIR * . *
for example, lists the files on the currently logged disk. Valid DIR commands
are:
DIR X.Y
DIR X?Z.C?M
DIR ??.Y
The REN (rename) command allows the user to change the names of files on
disk. The file satisfying ufn2 is changed to ufn1. The currently logged disk
is assumed to contain the file to rename. The CCP also allows the user to
type a left-oriented arrow instead of the equal sign, if the user's console
supports this graphic character. Examples of the REN command are:
REN X.Y=Q.R The file O.R is changed to X.Y
6
REN XYZ.COM=XYZ.XXX The file XYZ.XXX is changed to XYZ.COM
The SAVE command places n pages (256 byte blocks) onto disk from the TPA
and names this file ufn. The machine code file can be subsequently loaded and
executed. Examples are:
SAVE 3 X.COM
SAVE 40 Q
SAVE 4 X.Y
The TYPE command displays the contents of the ASCII source file ufn on
the currently logged disk at the console device. Valid TYPE commands are
TYPE X.Y
TYPE X.C
TYPE XXX
The TYPE command expands tabs (clt-I characters), assumming tab positions
5. LINE EDITING.
The CCP allows certain line editing functions while typing the command.
Rubout delete and echo the last character typed at the console
ctl-U delete the entire line typed at the console
ctl-E physical end of line, carriage is returned, but line
is not sent until the carriage return key is depressed ctl-
C CP/M system reboot (warm start)
ctl-Z end-of-input from the console (used in PIP and ED)
Note that the ctl-x sequence shown above denotes that the control key and the
key x are depressed simultaneously.
6. TRANSIENT COMMANDS.
7
Transient commands are loaded from the system disk and executed in the
TPA. The transient commands defined with the CCP are:
LOAD load the file in Intel "hex" machine code format and
produce a file in machine executable form which can be
loaded into the TPA
DDT load the CP/M debugger into the TPA and start execution
Transient commands are specified in the same manner as built-in commands, and
additional commands can be easily defined by the user. The basic transient
commands are listed in detail below.
6.1. STAT cr
The STAT transient command examines the storage map for the currenly
logged diskette and prints a message in the format
the ASM command loads and executes the CP/M 8080 assembler. The ufn
specified a source file containing assembly language statements where the
secondary name is assumed to be ASM, and thus is not specified. The following
ASM commands are valid:
ASM X GAMMA
8
The two pass assembler is automatically executed. If assembly errors occur
where x is the primary name specified in the ASM command. The PRN file
contains a listing of the source program (with imbedded tab characters it
present in the source program), along with the machine code generated for each
statement and diagnostic error messages, if any. The PRN file can be listed
at the console using the TYPE command, or sent to a peripheral device using
PIP (see the PIP command structure below). The file
x.HEX
is also produced which contains 8080 machine language in Intel "hex" format
suitable for subsequent loading and execution (see the LOAD command). For
complete details of CP/M assembly language program, see the "CP/M Assembler
Language (ASM) User 5 Guide."
The LOAD command reads the file ufn, which is assumed to contain "hex"
format machine code, and produces a memory image file which can be
subsequently executed. The file name ufn is assumed to be of the form
x.HEX
and thus only the name x need be specified in the command. If a file x.HEX
does not exist, the LOAD command reads the current RDR: device instead of a
disk file. The LOAD command creates a file named
x.COM
which marks it as a machine executable code. The file is actually loaded into
memory and executed when the user types the name x immediately after the
prompting character ">" printed by the CCP.
In general, the CCP reads the name x following the prompting character
and looks for a built-in function name. If no function name is found, the CCP
searches the system disk directory for a file by the name
x.COM
If found, the machine code is loaded into the TPA, and the program executes.
Thus, the user need only LOAD a hex file once; it can be subsequently
executed any number of times by simply typing the primary name. In this way,
9
the user can "invent" new commands in the CCP. In fact, initialized disks
have the transient commands as COM files, and thus can be deleted at the users
option.
6.4. PIP cr
PIP is the CP/M Peripheral Interchange Program which implements the basic
media conversion operations necessary to load, print, punch, copy, and combine
disk files. The PIP program is initiated by typing one of the following forms
PIP cr
PIP command-line cr
In both cases, PIP is loaded into the TPA and executed. In the first case,
PIP reads command lines directly from the console, prompted with the character
"*" until an empty command line is typed (i.e., a single carriage return is
issued by the operator). Each successive command line causes some media
conversion to take place according to the rules shown below. The second form
of the PIP command is equivalent to the first, except that the single command
line given with the PIP command is automatically executed, and PIP terminates
immediately with no further prompting of the console for input command lines.
The form of each command line is
where "destination" is the file or peripheral device to receive the data, and
"source#l, ..., source#n" represents a series of one or more files or devices
which are copied from left to right to the destination. A CP/M end of file
mark (ctl-Z) is inserted as the last character if the destination is an ASCII
file (all files except ".COM" files are treated as ASCII files in the current
CP/M implementation). The equal symbol (=) can be replaced by a left-oriented
arrow if your console supports this ASCII character, to improve readability.
Lower case ASCII alphabetics are internally translated to upper case to be
consistent with OPIM file and device name conventions. Finally, the total
command line length cannot exceed 255 characters (the ctl-E control can be
used to force a physical carriage return for lines which exceed the console
width).
10
x = y cr copy to file x from file y, y
remains unchanged
x = y,z cr concatenate files y and z and
copy to file x, with y and z
unchanged
X.ASM=Y.ASM,Z.ASM,FIN.ASM cr create the file X.ASM from the
concatenation of the Y, Z, and
FIN files with type ASM
NEW.ZOT = B:OLD.ZAP cr move a copy of OLD.ZAP from drive
B to the currently logged disk,
and name the file NEW.ZOT
B:A.U = B:B.V,A:C.W,D.X cr concatenate file B.V from drive B
with C.W from drive A and D.X
from the logged disk, and create
the file A.U on drive B
PIP also allows reference to physical and logical devices which are
attached to the CP/M system. The device names are three character
identifiers, followed by the colon (:) symbol. The device names are
The RDR, LST, M]N, and CON devices are all defined within the BIOS
portion of CP/M, and thus are easily altered to any particular I/O system. The
TTY and CRT devices are present-to support the Intel "iobyte" function which
allow a simple logical to physical device mapping (see the CP/M Interface
Guide for a discussion of the iobyte function). ARD, IRD, and PRN are three
popular peripheral devices which have dedicated input/output ports in the CP/M
environment. Tab characters (ctl-I) are expanded when the destination device
is not the punch. The allowable destination devices are
When devices are used as input, the end of file is indicated by a ctl-Z (the
CP/M end of file standard) or, in the case of the ARD and IRD devices, a
sequence of 255 rubout characters which is obtained by running the reader with
no paper tape.
11
It should also be noted that PIP performs a special function if the
destination is a disk file with type "HEX" (an Intel hex formatted machine
code file), and the source is an external peripheral device, such as a paper
tape reader. In this case, the PIP program checks to ensure that the source
file contains a properly formed hex file, with legal hexadecimal values and
checksum records. When an invalid input record is found, PIP reports an error
message at the console and waits for corrective action. It is usually
sufficient to open the reader and rerun a section of the tape (pull the tape
back about 2~ inches). When the tape is ready for the re-read, type a single
carriage return at the console, and PIP will attempt another read. If the
tape position cannot be properly read, simply continue the read (by typing a
return following the error message), and enter the record manually with the ED
program after the disk file is constructed.
6.6. ED ufn cr
The ED program is the CP/M system context editor, which allows creation
and alteration of ASCII files in the CP/M environment. Complete details of
operation are given the ED user's manual "ED: a Context Editor for the CP/M
Disk System." In general, ED allows the operator to create and operate upon
source files which are organized as a sequence of ASCII characters, separated
by end of line characters (a carriage return line feed sequence). There is no
practical restriction on line length (no single line can exceed the size of
the working memory) but is instead defined by the number of characters typed
between cr's. The ED program has a number of commands for character string
searching, replacement, and insertion, which are useful in the creation and
correction of programs or text files under CP/M. Although the CP/M has a
limited memory work space area (approximately 6000 characters in a 16K CP/M
system), the file size which can be edited is not limited, since data is
easily "paged" through this work area.
12
? command) for editing. The appended data can then be displayed, altered, and
written from the work area back to the disk (see the N command). Particular
points in the program can be automatically paged and located by context (see
the N command) allowing easy access to particular portions of a large file.
X.ASM cr
X.$$$
to hold the edited data during the ED run. Upon completion of ED, the X.ASM
file (original file) is renamed to X.BAK, and the edited work file is renamed
to X.ASM. Thus, the X.BAK file contains the original (unedited) file, and the
X.ASM file contains the newly edited file. The operator can always return to
the previous version of a file by removing the most recent version, and
renaming the previous version. Suppose, for example, that the current x.ASM
file was improperly edited, the sequence of CCP command shown below would
reclaim the backup file
Note that the operator can abort the edit at any point (reboot, power failure,
ctl-C, or Q command) without destroying the original file. In this case, the
BAK file is not created, although the original file is always intact.
6.6. SYSGEN cr
13
ready.
FUNCTION COMPLETE System is copied to memory
PUT SYSTEM? (Y/N) If a new diskette is being
built, type Y; otherwise type
N. Normally type Y.
DESTINATION ON B THEN TYPE RETURN Place new diskette into drive
B, type return when ready.
FUNCTION COMPLETE New diskette is initialized
in drive B
The SYSGEN program then reboots the system from drive A. Upon completion of a
successful system generation, the new diskette contains the operating system,
and only the built-in commands are available. A factory-fresh IBM-compatible
diskette appears to CP/M as a diskette with an empty directory, and thus the
operator must copy the appropriate COM files from an existing CP/M diskette to
the newly constructed diskette using the PIP transient.
It should be noted that a SYSGEN does not destroy the files which already
exist on a diskette; it results only in construction of a new operating
system. Further, if a diskette is being used only on drive B, and will never
be the source of a bootstrap operation on drive A, the SYSGEN need not take
place, and, in fact, a new diskette needs absolutely no initialization to be
used with CP/M.
$1 $2 $3 ... $n
$$$.SUB
14
on the logged disk. When the system reboots (at the termination of the
SUBMIT), this command file is read by the CCP as a source of input, rather
than the console. If the SUBMIT function is performed on any disk other than
drive A, the commands are not processed until the disk is inserted into drive
A, and the system reboots. Further, the user can abort command Processing at
any time by typing a rubout when the command is read and echoed. In this
case, the $$$.SUB file is removed, and the subsequent commands come from the
console. Command processing is also aborted if the CCP detects an error in
any of the commands. Programs which execute under CP/M can abort Processing of
command files when error conditions occur by simply erasing any existing
$$$.SUB file.
The last command in a SUB file can initiate another SUB file, thus
allowing chained batch commands.
Suppose the file ASMBL.SUB exists on disk, and contains the prototype
commands
ASM $1
DIR $1.*
ERA *.BAK
PIP $2:=$l.PRN
ERA $l.PRN
is issued by the operator. The SUBMIT program reads the ASMBL.SUB file, and
substitutes ~ for all occurrences of $1, and •'PRN'. for all occurrences of
$2, resulting in a $$$.SUB file containing
ASM X
DIR X.*
ERA *.B~
PIP PRN:=X.PRN
ERA X.PRN
The DUMP program types the contents of the disk file given by ufn at the
console in hexadecimal form. The file contents is listed sixteen bytes at a
time, with the absolute byte address listed to the left of each line in
hexadecimal. Long typeouts can be aborted by pushing the rubout key during
printout. (The source listing of the DUMP program is given in the CP/M
interface guide, as an example of program written for the CP/M environment.)
15
This section gives operating procedures for using CP/M on the Intel MDS
microcomputer development system. A basic knowledge of the MDS hardware and
software systems is assumed.
The CP/M system can be restarted (warm start) at any time by pushing the
INT 7 switch on the front panel. The built-in Intel ROM monitor can be
initiated by pushing the INT 7 switch, except when operating under DDT, in
which case the DTT program gets control instead.
Diskettes can be removed from the drives at any time, and the system can
be shut down during operation without affecting data integrity. Note,
however, that the user must not remove a diskette and replace it with another
without rebooting the system (cold or warm start) unless the inserted diskette
is read-only.
where x is the drive name which has the permanent error. This error may occur
when drive doors are opened and closed randomly, followed by disk operations,
or may be due to a diskette, drive, or controller failure. The user can
optionally elect to ignore the error by typing a single return at the console.
The error may produce a bad data record, requiring re-initialization of up to
128 bytes of data. The operator can reboot the CP/M system and try the
operation again.
16