CP/M User Areas
The CP/M (Control Program for Microcomputers) operating system has a single directory for storing files on a disk. It does not have a directory structure (or directory tree) as in other modern operating systems. However, it allows organizing files into user areas, within the same directory. As the name suggests, this feature is particularly useful when multiple users use the same computer and storage device for their own personal files. Then, each user will employ his/her own user area for the files. This feature is also useful for organizing different files into "pseudo-directories".
CP/M supports 16 user areas, with numeric values from 0 to 15. By default, the operating system boots into user area 0. The user area can be manually changed with the "USER" command. Examples:
- USER 5 - Changes to user area 5.
- USER 0 - Changes to the default user area 0.
By default there are no files in a new user area. System files are available in user area 0. When the user command is entered, the new user area is set at operating system level, for all drives. This means that system files (including transient commands) are no longer available. Usually, PIP.COM will be copied to a new user area in order to allow transferring other files as needed.
How to transfer PIP.COM to a new user area ?
Since by default no transient commands are available in a new user area, the procedure for copying PIP (or other commands) is by loading it into memory (using DDT) and then using the resident command "SAVE" to store it on disk in the new user area.
Commands:
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:
- USER 5 - Changes to user area 5.
- USER 0 - Changes to the default user area 0.
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:
- PIP TEST1.BAK=TEST1.BAS - Makes a copy of the file TEST1.BAS.
- PIP CON:=TEST1.BAS - Displays the file TEST1.BAS (similar to "TYPE TEST1.BAS").
- PIP TEST.TXT=CON: - Creates the file TEST.TXT and allows you to enter text from the console (end the file with CTRL+Z).
- PIP TEST.TXT=TEST.TXT[G0] - Copies the file TEST.TXT from user area 0 to the current user area (assuming the current user area was changed with a USER command; PIP needs to be available in the current user area).
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:
- MOVCPM - Produces and runs a CP/M system using all the available memory.
- MOVCPM 32 * - Constructs a CP/M image for 32Kb of memory and stores it in memory for SYSGEN. A message will be displayed when using the "*" parameter 'READY FOR "SYSGEN" OR "SAVE 34 CPM32.COM"'. This message actually indicates how this image may be used.
- SYSGEN - Offers a series of prompts, asking for source and destination, for transferring a CP/M image.
11. STAT
Displays disk and file information; allows setting file attributes; allows assigning peripherals. Examples:
- STAT - Displays the space available on disks.
- STAT A: DSK: - Displays detailed information about the disk in the A drive.
- STAT A:*.* - Displays detailed information about the files on the disk in the A drive.
- STAT A:TEST.TXT $R/O - Sets the "read only" attribute on the file TEST.TXT. Recognized attributes: $R/O (read only), $R/W (read write), $SYS (system, does not appear in the DIR listing), $DIR (regular file, is shown in the DIR command output). All the files are shown in the STAT command output, regardless of their attributes.
- STAT DEV: - Displays current device assignments.
- STAT CON:=TTY: - Sets the console device to TTY. If there is no device attached the system will become unresponsive.
12. LOAD
Reads a file in Intel HEX format and produces an executable COM file. Examples:
- LOAD TEST.HEX - Will create TEST.COM from the Intel HEX file.
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:
- DDT PIP.COM - Loads the file PIP.COM into memory and awaits for debugger commands.
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:
- ED TEST.TXT - Loads the file TEST.TXT into the editor.
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:
- SUBMIT CLEANUP.SUB TEST - Will submit for batch processing the file CLEANUP.SUB with the parameter TEST. The parameter can be accessed inside the CLEANUP.SUB batch file using "$1".
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:
- DUMP DUMP.COM - Displays in hexadecimal the contents of the file "DUMP.COM".
More from this site
Useful external resources
- cpmtools | Forked on GitHub | Documentation
- Man pages for cpmtools on Linux
- CP/M Games
- Wikipedia article
- Some CP/M history
- More CP/M history
- A lot of history about Digital Research, CP/M, Gary Kildall, etc.
- Information about computers running CP/M
- CP/M 2.2 Disk formats and Directory entries
- CP/M Disk formats
- cpmfs tool for disk images on Windows
- CP/M Live
- CP/M disk images (.DSK)
- Executable (.COM) programs for CP/M 2.2 (including some FORMAT commands), probably for Z80 cpu