Introduction:

CP/M was an operating system which was a precursor to MS-DOS and uses quite a few of the same commands. It loads starting from 0000H so TRS-80 Model I’s and III’s cannot run CP/M without modification. A Model 4 can run CP/M without modification. While I make no representations that it works, and take no responsibility for those who try, a possible modification to a Model I to allow it to run CP/M can be found here.

A detailed discussion of CP/M, its origins and operation, are well beyond the scope of this site. For those interested, there is a Wikipedia page on the topic and www.cpm.z80.de is hosting a CP/M Plus Manual.

There were a number of CP/M Operating Systems available for the TRS-80, including:

Lifeboat CP/M v1.4
Model I
by Lifeboat Associates/Small System Software (1979)

Omikron CP/M v2.21
Model I
by Omikron / Digital Research (1979)

CP/M Plus v1.00.00
Model 4
Radio Shack / Digital Research (1983)

Montezuma Micro CP/M 64K System
Model 4
Montezuma Micro/JBO (1984)

TPM CP/M v2.1
Model I



Importing/Exporting to CP/M Disk Images


TRSTOOLS / TRSREAD

Matthew Reed’s TRSTools (and TRSREAD) utility can be used to import and export CP/M files to and from a PC. It supports the following CP/M versions:

  • Montezuma Micro CP/M (Model 4)
  • Radio Shack CP/M Plus (Model 4)
  • Omikron Mapper CP/M (Model I and III)
  • Holmes Engineering CP/M (Model I and III)
  • Lifeboat CP/M (Model I)
  • Lobo CP/M (MAX80)
  • LNW Research CP/M (LNW80)

The current version of TRSTools, and more information, can be found on Matthew’s TRSTools Page.


NWD80CPM

A program called NWD80CPM, written by Blandford Computers for CP/M on the Genie III, is a CP/M program which will allow you to copy a file from a designated NEWDOS/80 Source Disk to a designated CP/M Destination Disk. This program, however, is of extremely limited use for large scale conversations as:

  • It does not permit wildcards. Each filename must be entered, one at a time, each followed by two confirmations.
  • It does not import, into CP/M, filenames which are not valid under NEWDOS/80, even if they are valid under CP/M.
  • If not exited gracefully, the CP/M disk is rendered unreadble and you must start again, filename by filename.
  • It will crash for a number of reasons, including running out space on the CP/M disk. It will not say what caused the crash, only that it crashed.
  • It seems to have a maximum file size (I could not transfer a 131KB LBR file onto a CP/M disk which had far more free space than that).
  • It cannot copy 0 length files.

DSKDIR

Jeff Post’s DSKDIR utility can be used to allow the user to extract files from a .dsk image file and write them to the host filesystem. The program is a work in progress, but this subset is being released so that users can determine what files are in a .dsk image file.

The current version of DSKDIR can be found Here.


22DISK

One method of extracting files from CP/M disks to a PC is to use 22DISK, once made by Sydex, which is a set of programs for DOS to perform operations on CP/M formatted disks.

There appears to be some level of controversy over distributing 22DISK these days (a good write up is here), but I suspect it has to do with Sydex putting up a web page offering to read old disks for people (something I do on this site at no charge). That said, a simple google search will produce many sites hosting this file. The most recent copy is v1.44 from October, 1996.

However, 22DISK requires “disk definitions” to read each disk. Larry Kraemer has prepared a set of “disk definitions” to enable 22DISK to read Model 4 Montezuma Micro CP/M to DOS, as follows:

Model 4,4P Montezuma System 170K – SSDD 48 tpi 5.25″

BEGIN TRSG TRS-80 Model 4,4P Montezuma System 170K – SSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 1 SECTORS 18,256
SIDE1 0 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
BSH 4 BLM 15 EXM 1 DSM 84 DRM 127 AL0 0C0H AL1 0 OFS 2
END

Model 4,4P Montezuma Data 200K – SSDD 48 tpi 5.25″

BEGIN TRSH TRS-80 Model 4,4P Montezuma Data 200K – SSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 1 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
BSH 4 BLM 15 EXM 1 DSM 99 DRM 127 AL0 0C0H AL1 0 OFS 0
END

Model 4,4P Montezuma System 350K – DSDD 48 tpi 5.25″

BEGIN TRSI TRS-80 Model 4,4P Montezuma System 350K – DSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 2 SECTORS 18,256
SIDE1 0 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
SIDE2 1 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
ORDER EAGLE
BSH 4 BLM 15 EXM 1 DSM 174 DRM 127 AL0 0C0H AL1 0 OFS 2
END

Model 4,4P Montezuma Data 400K – DSDD 48 tpi 5.25″

BEGIN TRSJ TRS-80 Model 4,4P Montezuma Data 400K – DSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 2 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
SIDE2 1 1,3,5,7,9,2,4,6,8,10
ORDER EAGLE
BSH 4 BLM 15 EXM 1 DSM 199 DRM 127 AL0 0C0H AL1 0 OFS 0
END

Model 4,4P Montezuma System 350K – SSDD 96 tpi 5.25″

BEGIN TRSK TRS-80 Model 4,4P Montezuma System 350K – SSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 1 SECTORS 18,256
SIDE1 0 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
BSH 4 BLM 15 EXM 1 DSM 174 DRM 127 AL0 0C0H AL1 0 OFS 2
END

Model 4,4P Montezuma Data 400K – SSDD 96 tpi 5.25″

BEGIN TRSL TRS-80 Model 4,4P Montezuma Data 400K – SSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 1 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
BSH 4 BLM 15 EXM 1 DSM 199 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma System 710K – DSDD 96 tpi 5.25″

BEGIN TRSM TRS-80 Model 4,4P Montezuma System 710K – DSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 2 SECTORS 18,256
SIDE1 0 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
SIDE2 1 1,3,5,7,9,11,13,15,17,2,4,6,8,10,12,14,16,18
ORDER SIDES
BSH 4 BLM 15 EXM 0 DSM 354 DRM 127 AL0 0C0H AL1 0 OFS 2

Model 4,4P Montezuma Data 800K – DSDD 96 tpi 5.25″

BEGIN TRSN TRS-80 Model 4,4P Montezuma Data 800K – DSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 2 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
SIDE2 1 1,3,5,7,9,2,4,6,8,10
ORDER SIDES
BSH 4 BLM 15 EXM 0 DSM 399 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma Extend System 190K – SSDD 48 tpi 5.25″

BEGIN TRSO TRS-80 Model 4,4P Montezuma Extend System 190K – SSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 1 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
BSH 4 BLM 15 EXM 1 DSM 94 DRM 127 AL0 0C0H AL1 0 OFS 2

Model 4,4P Montezuma Extend System 390K – SSDD 48 tpi 5.25″

BEGIN TRSP TRS-80 Model 4,4P Montezuma Extend System 390K – SSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 2 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
SIDE2 1 1,3,5,7,9,2,4,6,8,10
ORDER SIDES
BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2

Model 4,4P Montezuma Extend System 390K – SSDD 96 tpi 5.25″

BEGIN TRSQ TRS-80 Model 4,4P Montezuma Extend System 390K – SSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 1 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
BSH 4 BLM 15 EXM 0 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2

Model 4,4P Montezuma Extend System 790K – DSDD 96 tpi 5.25″

BEGIN TRSR TRS-80 Model 4,4P Montezuma Extend System 790K – DSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 2 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
SIDE2 1 1,3,5,7,9,2,4,6,8,10
ORDER SIDES
BSH 4 BLM 15 EXM 0 DSM 394 DRM 127 AL0 0C0H AL1 0 OFS 2

Model 4,4P Montezuma Super Data 220K – SSDD 48 tpi 5.25″

BEGIN TRSS TRS-80 Model 4,4P Montezuma Super Data 220K – SSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 1 SECTORS 6,1024
SIDE1 0 1,3,5,2,4,6
BSH 4 BLM 15 EXM 1 DSM 109 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma Super Data 440K – DSDD 48 tpi 5.25″

BEGIN TRST TRS-80 Model 4,4P Montezuma Super Data 440K – DSDD 48 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 40 SIDES 2 SECTORS 6,1024
SIDE1 0 1,3,5,2,4,6
SIDE2 1 1,3,5,2,4,6
ORDER EAGLE
BSH 4 BLM 15 EXM 1 DSM 219 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma Super Data 440K – SSDD 96 tpi 5.25″

BEGIN TRSU TRS-80 Model 4,4P Montezuma Super Data 440K – SSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 1 SECTORS 6,1024
SIDE1 0 1,3,5,2,4,6
BSH 4 BLM 15 EXM 1 DSM 219 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma Super Data 880K – DSDD 96 tpi 5.25″

BEGIN TRSV TRS-80 Model 4,4P Montezuma Super Data 880K – DSDD 96 tpi 5.25″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 2 SECTORS 6,1024
SIDE1 0 1,3,5,2,4,6
SIDE2 1 1,3,5,2,4,6
ORDER SIDES
BSH 4 BLM 15 EXM 0 DSM 439 DRM 127 AL0 0C0H AL1 0 OFS 0

Model 4,4P Montezuma System 400K – SSDD 96 tpi 3.5″

BEGIN TRSW TRS-80 Model 4,4P Montezuma System 400K – SSDD 96 tpi 3.5″
DENSITY MFM, LOW
CYLINDERS 80 SIDES 1 SECTORS 10,512
SIDE1 0 1,3,5,7,9,2,4,6,8,10
BSH 4 BLM 15 EXM 1 DSM 199 DRM 127 AL0 0C0H AL1 0 OFS 0
END


Useful PC-Based CP/M Utilties

CFX

If there is a CP/M disk with squeezed files, it is probably a lot easier to extract them outside of the emulator environment, not only for speed, but for disk capacity. Carson Wilson wrote CFX (CP/M File eXpress) for this purpose.

CFX is a universal utility written in the C programming language, whose main purpose in life is to make access to files stored under the CP/M operating system accessible to users of other operating systems.

CFX will extract to screen or disk normal, squeezed (typical CP/M filename extension, .?Q?), crunched (.?Z?), CrLZH (.?Y?), and library (.LBR) files. It will also display library file directory information and embedded compressed file datestamps and comments. CFX is an interactive, integrated utility, and as such can prompt the user before displaying files, page the screen, etc.

The most recent version of CFX (July, 2006) can be found can be found Here.


CP/M Built-In Command Reference

DIR [d:][filespec]

Display a list of files in the specified, or current drive.


ERA [d:]<filespec>

Erase specified files. filematch *.* can be used to match all files in the current drive.


REN [d:]newname.ext = oldname.ext

Change the name of a disk file from oldname.ext to newname.ext


SAVE n [d:]filename.ext

Save the specified n number of pages of the transient program area to disk under the specified file name.


TYPE [d:]filename.ext

Display the contents of the specified file on the display screen.


USER n

Switches to one of 16 specified user area in a disk drive.

A user area is a physical area on a disk which has its own directory and which is managed seperately from the rest of the disk. Data cannot be read from or written to any user area other than that in which CP/M is currently operating.

Upon cold boot, the user is automatically logged in to User Area 0, which is compatable with CP/M 1.4 directories. The USER command allows the user to move to another logical area within the same directory; areas are numbered 0-15. The ERA, DIR, REN, SAVE, and TYPE commands apply to the current User Area.


CP/M Commands

Stat
List the number of bytes of storage and data on the currently logged-in disk, provide statistical information about particular files, and display or alter device assignment.
STAT
Calculate the storage remaining on all active drives and print.
STAT
Calculate the storage remaining on all active drives and print
STAT x:
Calculate the storage remaining on the specified drive
STAT x:afn [$S]
Scan the specified files on the specified drive (x: is optional), and list all files which satisfy the unambiguous reference in alphabetical order with storage requirements.
STAT x:=R/O
Set the specified drive to Read Only. This is cleared by a warm boot. When a disk is Read Only, the message BDOS ERR ON x: READ ONLY will appear if there is an attempt to write to it.
STAT VAL:
Summarize the status commands
STAT DEV:
Display the current logical to physical device mapping
STAT d:afn [$R/O or $R/W or $SYS or $DIR]
Set the various permanent file indicators. R/O=Read/Only, R/W=Read/Write, SYS=System, DIR=Non-System
STAT ld1=pd1, ld2=pd2, …
Change the logical to physical device assignments. Logical device ld1 is assigned to physical device pd1, etc. The valid logical device names are — CON: [The system console device], RDR: [The paper tape reader device], PUN: [The paper tape punch device], LST: [The output list device]. The valid physical device names are — TTY: [Slow speed output device (teletype)], CRT: [High speed output device (cathode ray tube)], BAT: [Batch processing (CON: input is RDR:, CON: output is LST:)], UC1: [User-defined console], PTR: [Paper tape reader], PTP: [Paper tape punch], UR1: [User-defined reader #1], UR2: [User-defined reader #2], UP1: [User-defined punch #1], UP2: [User-defined punch #2], LPT: [Line printer], UL1: [User-defined list device #1]
STAT d:DSK:
List the characteristics of the disk named “d:”; if “d:” is not specified, list the characteristics of all active disks
STAT USR:
List the User Number the user is currently in and the User Numbers which have files on the currently addressed disk.

PIP
(Peripheral Interchange Program) is the CP/M transient which implements the basic media conversion operations necessary to load, print, punch, copy, and combine disk files. PIP is initiated by one of the following forms:
PIP
Engage PIP, prompt the user with ‘*’, and read command lines directly from the console. PIP used in this way is exited by either typing an empty command line (just a carriage return) or a Ctrl-C as the first character of the line.
PIP x:=y:afn
Copy all files satisfying afn from drive y to drive x. ‘y’ may be omitted, and, if so, the currently logged-in drive is selected.
PIP x:ufn=y:
Copy the file given by ufn from y to x. ‘x’ may be omitted, and, if so, the currently logged-in drive is selected.
PIP x:afn=y:afn
Like the above, but x and/or y may be omitted; the default drive is selected for the omitted drive(s).
PIP ld=pd
Copy from the specified physical device to the specified logical device. Valid logical devices are: CON:, RDR:, PUN:, LST: and Valid physical devices are: TTY:, CRT:, UC1:, PTR:, PTP:, UR1:, UR2:, UP1:, UP2:, LPT:, UL1:

ED
The ED Program is the CP/M system context editor, which allows creation and alteration of ASCII files. The following are the error indicators given by ED:
?
Unrecognized Command
>
Memory buffer full
#
Cannot apply command the number of times specified
O
Cannot open LIB file in R command

 
The following are the control characters recognized by ED:
^C
System reboot
^E
Physical CR/LF (not entered in command)
^H
Character delete (backspace)
^I
Logical tab
^J
New line (line feed)
^L
Logical CR/LF in search and substitute strings
^M
New line (carriage return)
^U
Line delete
^X
Line delete and backspace
^Z
String terminator
Rubout
Character delete
Break
Discontinue command

 
The following are the commands recognized by ED
nA
Append lines
+/- B
Beginning/Bottom of buffer
+/- nC
Move character positions
+/- nD
Delete characters
E
Exit
nFs^Z
Find string
H
End edit, close and reopen files
Is^Z
Insert characters
nJ
Place strings in juxtaposition
+/- nK
Kill (delete) lines
+/- nL
Move down/up lines
nM
Macro definition
O
Return to original file
+/- nP
Move and print pages
Q
Quit with no file changes
R
Read library file
nSs1^Zs2^Z
Substitute s2 for s1
+/- nT
Type lines
+/- U
Translate lower to upper case if U; none if -U
+/- V
Engage/disengage line numbers (verify)
0V
Print memory buffer info (free/total usage)
nW
Write lines
nX
Transfer n lines to X$$$$$$$.LIB
0X
Empty X$$$$$$$.LIB
nZ
Sleep
+/- n
Move and type (+/- nLT)
n:
Move to absolute line (V engaged)
:n
Process from current line to specified line (V engaged)

SUBMIT
Allows CP/M commands to be batched together for automatic processing.

XSUB
The XSUB command extends the power of the SUBMIT facility. When specified as the first line of a SUBMIT File, it self-relocates directly below the CCP. All subsequent SUBMIT command lines are processed by XSUB, so that programs which read buffered console input (BDOS Function 10) receive input directly from the SUBMIT File. While XSUB is in memory, it prints the message “(xsub active)” on each warm boot.

ASM
Load the CP/M assembler and assemble the specified program from disk.

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 (this loaded program becomes a new command under the CCP).

UNLOAD
The reverse of the LOAD Command — it converts COM files to HEX files

DDT
The DDT Program allows dynamic interactive testing and debugging of programs generated in the CP/M environment. DDT responds to the normal CP/M input line editing characters. DDT responds to the following commands:
As
Perform inline assembly starting at the specified addresses.
D
Display memory from the current address for 16 display lines.
Ds
Display memory from address s for 16 display lines.
Ds,f
Display memory from address s to address f.
Fs,f,c
Fill memory from start address s to final address f with byte c.
G
Start execution at the current value of the PC.
Gs
Start execution at the specified address s.
Gs,b
Start execution at the specified address s and set a breakpoint at the address b.
Gs,b,c
Same as above with breakpoints at b and c.
G,b
Start execution at the current value of the PC with breakpoint b.
G,b,c
Same as above with breakpoints at b and c.
If
Insert a file name f into the default FCB.
L
List 12 lines of disassembled code from the current address.
Ls
List 12 lines from the specified address s.
Ls,f
List lines of disassembled code from s to f.
Ms,f,d
Move the block from address s to f to destination at address d.
R
Read file in FCB into memory at 100H.
Rb
Read file in FCB into memory with offset b from 100H.
Ss
Set (examine and alter) memory starting at address s.
T
Trace the next instruction.
Tn
Trace the next n instructions.
U
Untrace — like Trace, but intermediate steps are not displayed.
X
Examine all registers and flags.
Xr
Examine specified registers or flag

DUMP
Dump the contents of a file in hex.

SYSGEN
Generates an initialized disk containing the CP/M Operating System. Once invoked, the user is prompted through the session.

MOVCPM
Regenerate the CP/M system for a particular memory size.

DUP
Format and/or Duplicate a disk.

CP/M File Extensions

AIN
ALGOL 60 Intermediate
ALG
ALGOL 60 Source File
ASM
Assembler Source File
BAK
Backup File
BAS
BASIC Source File
C
C Source File
COB
COBOL Source File
COM
“Command” File
FOR
FORTRAN IV Source File
HEX
Intel “hex” code file
HLP
HELP File
INT
BASIC Intermediate File
LST
Listing File
MAC
MACRO-80 Source File
PAS
PASCAL Source File
PRN
Assembler Listing File
REL
Relocatable Module
SRC
PASCAL/MT Source File
SUB
SUBMIT File
SYM
Symbol File
TC
Tiny-C Source File
TFS
TFS Source File
TXT
Text File
$$$
Temporary File

Disk Parameter Header (DPH)

The address of the DPH is obtained by calling the SELDSK entry of the BIOS, which returns its address in the HL register pair.


Offset
Name
Contents
00h
XLT
Address of parameters used for skew translation. Pass the address when calling the SECTRAN entry to the BIOS, unless it is 0000h meaning that the drive does not use sector skew.
02h
—–
BDOS work area (6 bytes)
08h
DIRBUF
Address of a 128-byte buffer, located in the BIOS, used for directory I/O by the BDOS. Only one buffer is provided; all DPH blocks address it.
0Ah
DPB
Address of the Disk Parameter Block (DPB) that describes this drive and the disk mounted in it. There will be a single DPB for each disk type in the system. (note: not if you expect to be able to individually change drive parameters!)
0Ch
CSV
Address of an area where the BDOS builds a directory check vector when it logs in the disk on this drive. The size of the area is given in the DPB, and may be zero, in which case this field is ignored.
0Eh
ALV
Address of an area where the BDOS builds an allocation vector when it logs in the disk on this drive. The size of the area is determined from the disk capacity, which appears in the DPB.

Disk Parameter Block (DPB) Map

The address of the DPB is obtained with BDOS service request 31, Get Disk Parameters. The table is located in the BIOS.


Offset
Name
Contents
00h
SPT
“Sectors” (128-byte records) per track.
02h
BSH
Number of times a record number should be shifted right to yield its allocation block number (or, the base-2 log of the number of records in a block). Get the size of an allocation block by doubling 128 BSH times.
03h
BLM
Mask which, if ANDed with a record number, yields its index within an allocation block (or, 2^BSH – 1).
04h
EXM
Number of times a logical extent number should be shifted right to yield a physical extent (directory entry) number (or, the base-2 log of the numberof logical extents per entry).
05h
DSM
Highest allocation block number (count of blocks is one greater). Get disk capacity in records by shifting DSM+1 left BSH times.
07h
DRM
Highest directory entry number (count of entries is one greater). Shift right twice for number of records in the directory; shift BSH times fir number of blocks.
09h
ALn
Initial value for the first two bytes of the allocation vector, with a leading 1-bit for each directory block.
0Bh
CKS
Number of bytes in the directory check area. Either (DRM + 1) / 4, one byte per directory record, or 0000h to signify no checking of a fixed disk. MP/M 2 (and CP/M 3?): Most significannt bit is set to 1 to show that this drive’s disk is fixed, not removable.
0Dh
OFF
Count of reserved tracks, usually 2 or 3 for diskettes, but may be large when a rigid disk is partitioned into logical drives.