CP/M

CP/M (Control Program/Monitor or Control Program for Microcomputers) is an operating system initially created in 1974 for microcomputers based on Intel 8080 CPUs, by Gary Kildall of Digital Research Inc. Version 2.0 was released in 1979, soon followed by version 2.2. Version 3.0 (also called CP/M Plus) was released in 1982. The last release was 3.1 in 1983. CP/M versions are available for systems using different CPUs, including Intel 8080, Z80, and Intel 8086.

Commands

CP/M has a number of internal commands (also called "resident" commands). In addition, any executable program (with a ".COM" extension) can be considered as a "transient" command. In this section, there will be presented the internal commands and the transient commands available on the CP/M 2.2 system disk. In order to execute a transient command, the system disk must be present in the drive and either be selected or the command must be prefixed with the drive letter (similar to any executable program). Equipment manufacturers who licensed CP/M for use with their systems may have included additional commands on the system disk. These will not be covered here.

Transient commands end with ".COM" (the normal extension for exacutable files), however when running them the extension may be ommited. Thus "PIP.COM" can also be executed by simply typing "PIP". This is true for all executables.

In the following list of commands, the first 7 are resident commands while the following are transient commands.

1. Drive selection

CP/M allows selecting a drive by specifying its letter followed by a colon sign. Example: "A:", "B:". The new drive becomes active and this is reflected in the operating system's prompt ("A>", "B>").

2. DIR

This command allows visualizing the contents of a disk. By default it will show all files without the SYS attribute from the currently selected disk. However, the command allows specifying a different disk or a pattern for displaying files. Examples:

3. TYPE

Displays the contents of a text file. Example "TYPE TEST1.BAS".

4. ERA

Deletes files from disk. By default there is no UNDELETE/UNERASE command available, therefore this command must be used with care. Read-Only files cannot be deleted with ERA. For deleting a Read-Only file, first the attribute must be removed using STAT and then ERA can be used to delete the file. Examples:

5. REN

This command renames a file. The REN command operates on a single drive. It is not possible to move a file by renaming it to another drive. Examples:

6. SAVE

The SAVE command stores a number of memory pages (256-byte blocks), starting at address 0100H, to a disk file. This is useful for moving programs to a different user area (such as moving PIP). It is also useful if a file was loaded into memory by some other program. Examples:

7. USER

Selects an user area. The default user area is 0. Possible values range from 0 to 15. A user area can be used to store user files in separate spaces, when multiple users are using the same computer, or to organize the files. Transfer between user areas can be done with PIP. Examples:

8. PIP

The main purpose of the PIP ("Peripheral Interchange Program") command is to copy files. However, it accepts also devices (such as CON:, PRN:, etc.) as input/output. This allows for other usage scenarios, like creating a file, printing a file, displaying a file, etc. Examples:

9. MOVCPM

10. SYSGEN

MOVCPM and SYSGEN allow creating a new CP/M system disk for a different memory size (the default memory size used in CP/M 2.2 is 20Kb). MOVCPM alone can create a new in-memory CP/M system for a new memory size. SYSGEN allows saving the in-memory system or just copying an existing system disk. The parameters are not checked, a command like "MOVCPM 128" may cause the system to hang. A generated SYSGEN disk may refuse to boot. The commands should be used with care and a copy of the original system disk should always be kept. Examples:

11. STAT

Displays disk and file information; allows setting file attributes; allows assigning peripherals. Examples:

12. LOAD

Reads a file in Intel HEX format and produces an executable COM file. Examples:

13. DDT

This is the CP/M debugger. Allows debugging executable files. An executable file is loaded at address 0100H. When exiting the debugger, the debugged file remains loaded, therefore it can be saved using the SAVE command. Examples:

14. ED

This is the CP/M line editor. Allows basic editing operations for files. Operations are performed by using commands (for example "I" for insert, "1:100T" display first 100 lines, "Q" exits the editor). Text entering is ended with CTRL+Z, returning to the editor command interface. Examples:

15. SUBMIT

Allows for command batching. Multiple commands are stored in a file (usually with a .SUB extension) and can be submitted for batch processing with the SUBMIT command. Command line parameters can be accessed within the batch file with $1 ... $n. The SUBMIT command actually creates a file called "$$$.SUB" on the current disk that contains the batched commands. This file will be executed when the CP/M system is booted or reloaded from the current disk. If created on the B: drive for example, the file $$$.SUB will not be executed until the disk is inserted in the A: drive and the system is loaded from it. When a new file is submitted, the contents of $$$.SUB is overwritten. Examples:

16. XSUB

This command is useful in a .SUB file to redirect console input to the following lines in the .SUB file. Following an XSUB command, the .SUB file should contain first the command to be executed and on the following lines the input for the executed command.

17. DUMP

Displays the contents of a file in hexadecimal. Examples:

More from this site

Useful external resources