Appendix D: CP/M Cheat Sheet¶
Note
This cheat sheet summarizes the essential commands for CP/M (Control Program for Microcomputers), the first disk operating system for personal computers. It covers the core built-in commands, important control keys, and a quick reference to the BDOS (Basic Disk Operating System) functions.
Control Keys¶
CP/M uses several control keys for system interaction. To use them, hold the
CTRL key and press the appropriate letter.
Key |
Function |
|---|---|
|
Re-initialize the system. Use after changing diskettes so CP/M recognizes the new disk. |
|
Toggle printer echo on/off. When active, all console output is also sent to the printer. |
|
Pause screen output (freeze scrolling). Press any key to resume. |
|
Erase the current command line. |
|
Delete the entire current line. |
|
Retype the current command line on a new line. |
|
Physical end of line (carriage return without executing the command)[citation:6]. |
|
Delete and echo the last character typed. |
Built-in Commands¶
These commands are part of the CCP (Console Command Processor) and are
available directly from the CP/M prompt (e.g., A>).
Command |
Function |
|---|---|
|
Display a list of files on the specified disk. If no drive given, uses current drive. |
|
Use wildcards to list specific files (e.g.,
|
|
Erase (delete) a file from disk. |
|
Rename a file. Include drive if needed. |
|
Display a text file on the console. |
|
Report file size or remaining disk space.
|
|
Peripheral Interchange Program: copy or move files between devices and disks. |
|
Write a copy of CP/M to a disk (to make it bootable). |
|
Save n pages (256 bytes each) from memory to a disk file. |
|
Change to a different user area (0-15) for file organization. |
drive: |
Change the logged-in drive. For example,
typing |
Hint
Filenames in CP/M follow the 8.3 format: up to 8 characters, a dot, and a
3-character extension (e.g., REPORT.TXT). Drive identifiers are letters
followed by a colon (e.g., B:).
BDOS Function Calls (Programmer’s Reference)¶
The BDOS provides system services via function calls. Programs invoke these by
loading the function number into register C and calling address 0005H
Common Function Codes¶
Code |
Function Name |
Description |
|---|---|---|
0 |
System Reset |
Return control to the CCP (warm boot). |
1 |
Console Input |
Read a character from the console, echo it. |
2 |
Console Output |
Output a character to the console. |
5 |
List Output |
Output a character to the list device. |
6 |
Direct Console I/O |
Direct character I/O (no control char
handling)
- |
9 |
Print String |
Output a string terminated by |
10 |
Read Console Buffer |
Read an edited line into a buffer |
11 |
Get Console Status |
Check if a character is ready (return 01 if yes) |
12 |
Return Version |
Return CP/M version number in HL |
13 |
Reset Disk System |
Reinitialize disk system |
14 |
Select Disk |
Select the default disk ( |
15 |
Open File |
Open a file via FCB (File Control Block) |
16 |
Close File |
Close a file via FCB |
19 |
Delete File |
Delete a file via FCB |
20 |
Read Sequential |
Read next record from an open file |
21 |
Write Sequential |
Write next record to an open file |
23 |
Rename File |
Rename a file via FCB |
25 |
Get Current Disk |
Return current default disk number in A |
Important
Many BDOS functions use a File Control Block (FCB) structure. The default
FCB for command-line arguments is at address 5CH, and the default DMA
(Disk Memory Access) buffer is at 80H.
PIP (Peripheral Interchange Program) Options¶
PIP is a powerful utility for copying and transferring files. It supports several options (typed after the command):
Option |
Function |
|---|---|
|
Verify copy operation (check for errors) |
|
Translate lowercase to uppercase |
|
Translate uppercase to lowercase |
|
Add line numbers to output |
|
Echo transferred data to the console |
|
Remove form feeds from the file |
|
Expand tabs to n spaces |
Common PIP Examples:
PIP B:=A:FILENAME.TXT– Copy a single file from drive A to drive B.PIP B:=A:*.*– Copy all files from drive A to drive B.PIP PRN:FILENAME.TXT– Send a file to the printer.
Quick Reference Card¶
Need To… |
Type This |
|---|---|
See what’s on a disk |
|
Delete a file |
|
Rename a file |
|
View a text file |
|
Copy a file |
|
Switch drives |
|
Check disk space |
|