programming_DEC_VT100_terminal.jpg
A VT100, a popular CP/M era serial terminal. From Wikipedia by user Morn CCA 2.0

CP/M was a popular operating system for Z80 based systems. It was minimal compared to operating systems like Unix or OSX (or even Windows). It was more comparable to early MS-DOS. In fact MS-DOS was initially a port of CP/M to the 8086 CPU used in the original IBM PC. That story is interesting, and depicted nicely in Pirates of Silicon Valley.

Like MS-DOS, or a command (Windows) or terminal (OSX and Linux) window, CP/M is a purely textual command-line interface commonly accessed via a serial terminal.

It is simple and small, but gives the basic functionality required to manage disks, write, assemble/compile, and run programs. It also provides system level functionality to programs. Things like reading and writing files, serial input and output, and so on.

From the CP/M manual:

CP/M is a monitor control program for microcomputer system development that uses floppy
disks or Winchester hard disks for backup storage. Using a computer system based on the Int8080 microcomputer, CP/M provides an environment for program construction, storage, and
editing, along with assembly and program checkout facilities. CP/M can be easily altered to
execute with any computer configuration that uses a Zilog Z80 or an Intel 8080 Central
Processing Unit (CPU) and has at least 20K bytes of main memory with up to 16 disk drives.

File names in CP/M are up to 8 characters for the name, followed by a period, followed by up to 3 characters for the type:

filename.typ

This is where MS-DOS got it's 8.3 filename format.

CP/M had the wildcards that we still use today when specifying filenames: ? matches a single character and * matches part or all of a file name or type.

Many commands will accept a file reference with wildcards, referred to as an ambiguous file reference (or afn) while some only allow file references without wildcards, referred to as an unambiguous file reference (or ufn). These abbreviations are used in the manual and will be used here.

Builtin Commands

ERA afn

Erase a file or files.

DIR afn (or simply DIR)

List the names of matching files.

REN ufn1=ufn2

Rename a file

TYPE ufn

Display the contents of as ASCII file. There was no unicode back then.

 

Standard Programs

There are some programs that are a standard part of CP/M. So standard that they are called Transient Commands, i.e. commands that aren't part of the CP/M core program, but are loaded, executed, and disposed of as required. Some of the more useful ones in this context are briefly described below. See the CP/M manual for more information.

STAT

Displays information on the current disk, particular files, and device assignments.

ASM

Assembles the specified program and creates an executable version. 

LOAD

Load an Intel HEX format code file and creates an executable version.

DDT

The CP/M debugger.

ED

The CP/M text editor.

SUBMIT

Submit a file of commands for batch execution.

DUMP

Display the contents of a file in hex.

This of course is a bare minimum introduction to CP/M. There is a wealth of information on, and code for, CP/M at the Tim Olmstead Memorial Digital Research CP/M Library.

This guide was first published on Jan 29, 2019. It was last updated on Jan 29, 2019. This page (CP/M) was last updated on Oct 21, 2019.