TRS-80 - CP/M

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 Lifeboat CP/M v1.4
Model I
by Lifeboat Associates/Small System Software (1979)
Omikron CP/M v2.21 Omikron CP/M v2.21
Model I
by Omikron / Digital Research (1979)
CP/M Plus v1.00.00 CP/M Plus v1.00.00
Model 4
Radio Shack / Digital Research (1983)
Montezuma Micro CP/M Montezuma Micro CP/M 64K System
Model 4
Montezuma Micro/JBO (1984)
TPM CP/M v2.1 TPM CP/M v2.1
Model I

Importing/Exporting to CP/M Disk Images


TRSTOOLS / TRSREAD

OS: 
Windows
Date: 
Current
Author: 
Matthew Reed
Web Site: 
N/A
Download: 
N/A

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)

You can view the manual here.


CPMToolsGUI

OS: 
Windows
Date: 
Unknown
Author: 
N/A
Web Site: 
Download: 
N/A

CPMTOOLS can create a new disk image, move files in and out, and delete them. It originated from a tool on LINUX but is difficult to use for Windows users because of its command line operation. This is a GUI version of that.

It looks pretty complicated to me, requiring hex editing and specifically selecting registered format files ... but it exists, so it's here.


NWD80CPM

OS: 
CP/M
Date: 
Unknown
Author: 
Blandford Computers
Web Site: 
N/A
Download: 
N/A

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 v1.7

OS: 
MSDOS
Date: 
2007
Author: 
Jeff Post
Web Site: 
N/A
Download: 

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.

22DISK v1.44

OS: 
MSDOS
Date: 
2007
Author: 
Sydex
Web Site: 
N/A
Download: 
N/A

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 Utilities

CFX v1.3

OS: 
MSDOS
Date: 
2006
Author: 
Carson Wilson
Web Site: 
N/A
Download: 

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.

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

CommandDescription
ASMLoad the CP/M assembler and assemble the specified program from disk.
DUMPDump the contents of a file in hex.
DUPFormat and/or Duplicate a disk.
LOADLoad 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).
MOVCPMRegenerate the CP/M system for a particular memory size.
SUBMITAllows CP/M commands to be batched together for automatic processing.
UNLOADThe reverse of the LOAD Command — it converts COM files to HEX files.
XSUBThe 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.
SYSGENGenerates an initialized disk containing the CP/M Operating System. Once invoked, the user is prompted through the session.

STAT Command

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.

Command SyntaxDescription
STATCalculate and print the storage remaining on all active drives.
STAT x:Calculate the storage remaining on the specified drive x:.
STAT x:afn [$S]Scan specified files on drive x: (optional) and list those matching the reference in alphabetical order with storage requirements.
STAT x:=R/OSet drive x: to Read-Only. Cleared by a warm boot. Attempting to write triggers: BDOS ERR ON x: READ ONLY.
STAT VAL:Summarize the status commands.
STAT DEV:Display the current logical-to-physical device mapping.
STAT d:afn [$R/O | $R/W | $SYS | $DIR]Set permanent file indicators: R/O (Read-Only), R/W (Read/Write), SYS (System), or DIR (Non-System).
STAT ld1=pd1, ld2=pd2, ... Change logical-to-physical device assignments.
Logical (ld): CON: (Console), RDR: (Reader), PUN: (Punch), LST: (List).
Physical (pd): TTY:, CRT:, BAT:, UC1:, PTR:, PTP:, UR1:, UR2:, UP1:, UP2:, LPT:, UL1:.
STAT d:DSK:List characteristics of disk d: (or all active disks if d: is omitted).
STAT USR:List the current User Number and all User Numbers containing files on the currently addressed disk.

PIP Command

(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:

Command SyntaxDescription
PIPEngage PIP and enter interactive mode (indicated by *). Exit by entering an empty line (Carriage Return) or pressing Ctrl-C as the first character.
PIP x:=y:afnCopy all files matching afn from drive y: to drive x:. If y: is omitted, the current logged-in drive is used.
PIP x:ufn=y:Copy the specific file ufn from drive y: to drive x:. If x: is omitted, the current logged-in drive is used.
PIP x:afn=y:afnGeneral copy syntax for matching file references. If x: or y: are omitted, the system defaults to the currently logged-in drive.
PIP ld=pd Copy data from a physical device (pd) to a logical device (ld).
Logical (ld): CON:, RDR:, PUN:, LST:
Physical (pd): TTY:, CRT:, UC1:, PTR:, PTP:, UR1:, UR2:, UP1:, UP2:, LPT:, UL1:

ED Command

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:

SymbolError Message / Meaning
?Unrecognized Command
>Memory buffer full
#Cannot apply command the number of times specified
OCannot open LIB file in R command

ED Control Characters

InputFunction / Meaning
^CSystem reboot
^EPhysical CR/LF (not entered in command)
^HCharacter delete (backspace)
^ILogical tab
^JNew line (line feed)
^LLogical CR/LF in search and substitute strings
^MNew line (carriage return)
^ULine delete
^XLine delete and backspace
^ZString terminator
RuboutCharacter delete
BreakDiscontinue command

ED Commands

CommandDescription
nAAppend lines
+/- BBeginning/Bottom of buffer
+/- nCMove character positions
+/- nDDelete characters
EExit
nFs^ZFind string
HEnd edit, close and reopen files
Is^ZInsert characters
nJPlace strings in juxtaposition
+/- nKKill (delete) lines
+/- nLMove down/up lines
nMMacro definition
OReturn to original file
+/- nPMove and print pages
QQuit with no file changes
RRead library file
nSs1^Zs2^ZSubstitute s2 for s1
+/- nTType lines
+/- UTranslate lower to upper case if U; none if -U
+/- VEngage/disengage line numbers (verify)
0VPrint memory buffer info (free/total usage)
nWWrite lines
nXTransfer n lines to X$$$$$$$.LIB
0XEmpty X$$$$$$$.LIB
nZSleep
+/- nMove and type (equivalent to +/- nLT)
n:Move to absolute line (requires V engaged)
:nProcess from current line to specified line (requires V engaged)

DDT Command

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:

CommandDescription
AsPerform inline assembly starting at the specified address s.
DDisplay memory from the current address for 16 display lines.
DsDisplay memory from address s for 16 display lines.
Ds,fDisplay memory from address s to address f.
Fs,f,cFill memory from start address s to final address f with byte c.
GStart execution at the current value of the PC (Program Counter).
GsStart execution at the specified address s.
Gs,bStart execution at address s and set a breakpoint at address b.
Gs,b,cSame as above, but with breakpoints at both b and c.
G,bStart execution at the current PC with a breakpoint at b.
G,b,cSame as above, but with breakpoints at both b and c.
IfInsert a file name f into the default FCB (File Control Block).
LList 12 lines of disassembled code from the current address.
LsList 12 lines of disassembled code from the specified address s.
Ls,fList lines of disassembled code from address s to f.
Ms,f,dMove the block of memory from address s through f to destination address d.
RRead the file specified in the FCB into memory at 100H.
RbRead the file specified in the FCB into memory with an offset b from 100H.
SsSet (examine and alter) memory starting at address s.
TTrace (execute) the next instruction.
TnTrace the next n instructions.
UUntrace — execute instructions like Trace, but without displaying intermediate steps.
XExamine all registers and flags.
XrExamine the specified register or flag r.

CP/M File Extensions

ExtensionDescription
AINALGOL 60 Intermediate
ALGALGOL 60 Source File
ASMAssembler Source File
BAKBackup File
BASBASIC Source File
CC Source File
COBCOBOL Source File
COM"Command" File (Executable)
FORFORTRAN IV Source File
HEXIntel "hex" code file
HLPHELP File
INTBASIC Intermediate File
LSTListing File
MACMACRO-80 Source File
PASPASCAL Source File
PRNAssembler Listing File
RELRelocatable Module
SRCPASCAL/MT Source File
SUBSUBMIT File
SYMSymbol File
TCTiny-C Source File
TFSTFS Source File
TXTText 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.

OffsetNameContents
00HXLTAddress of parameters used for sector skew translation. Pass to SECTRAN in BIOS; 0000h if no skew is used.
02HBDOS work area (6 bytes).
08HDIRBUFAddress of a 128-byte buffer in BIOS used for directory I/O. Shared by all DPH blocks.
0AHDPBAddress of the Disk Parameter Block describing the drive and disk type.
0CHCSVAddress for the directory check vector built during disk login. Size defined in DPB.
0EHALVAddress for the allocation vector built during disk login. Size determined by capacity in 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.

OffsetNameContents
00hSPTNumber of 128-byte "sectors" (records) per track.
02hBSHBlock Shift factor. Number of right shifts to convert a record number to an allocation block number (base-2 log of records per block).
03hBLMBlock Mask. ANDed with a record number to find its index within a block (2BSH - 1).
04hEXMExtent Mask. Determines the number of logical extents per directory entry.
05hDSMHighest allocation block number (total blocks = DSM + 1).
07hDRMHighest directory entry number (total entries = DRM + 1).
09hAL0, AL1Allocation bit-map for directory check. Leading 1-bits reserve blocks for the directory.
0BhCKSCheck area size. (DRM + 1) / 4 for removable media; 0000h for fixed disks (MSB may indicate fixed status).
0DhOFFTrack Offset. Number of reserved system tracks at the beginning of the disk.