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)

TPM CP/M v2.1
Model I

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)

Importing to CP/M Disk Images
Using PC-Based Utilities

NWD80CPM
Using a TRS-80/Emulator
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.

  • Exporting from CP/M Disk Images
    TRSTOOLS / TRSREAD
    Matthew Reed’s TRSTools (and TRSREAD) utility can be used to extract the following files to a PC:
         
  •    Model 4 Montezuma Micro CP/M
         
  •    Model I LNW80 CP/M M
    The current version of TRSTools, and more information, can be found on Matthew’s TRSTools Page.

    TRSREAD v4.31
    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.

    DSKDIR v1.7
    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:
          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
          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
          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
          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
          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
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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
    END
          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

    22DISK v1.44

    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.

    CFX v1.3

    CP/M Commands (Built-In)
    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 (Other)
    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.

    STATCalculate 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/OSet 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:
    PIPEngage 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:afnCopy 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:afnLike the above, but x and/or y may be omitted; the default drive is selected for the omitted drive(s).
    PIP ld=pdCopy 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
    OCannot open LIB file in R command
            The following are the control characters recognized by ED:
    ^CSystem reboot
    ^EPhysical (not entered in command)
    ^HCharacter delete (backspace)
    ^ILogical tab
    ^JNew line (line feed)
    ^LLogical in search and substitute strings
    ^MNew line (carriage return)
    ^ULine delete
    ^XLine delete and backspace
    ^ZString terminator
    RuboutCharacter delete
    BreakDiscontinue command
            The following are the commands recognized by ED
    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 (+/- nLT)
    n:Move to absolute line (V engaged)
    :nProcess 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:
    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.
    GsStart execution at the specified address s.
    Gs,bStart execution at the specified address s and set a breakpoint at the address b.
    Gs,b,cSame as above with breakpoints at b and c.
    G,bStart execution at the current value of the PC with breakpoint b.
    G,b,cSame as above with breakpoints at b and c.
    IfInsert a file name f into the default FCB.
    LList 12 lines of disassembled code from the current address.
    LsList 12 lines from the specified address s.
    Ls,fList lines of disassembled code from s to f.
    Ms,f,dMove the block from address s to f to destination at address d.
    RRead file in FCB into memory at 100H.
    RbRead file in FCB into memory with offset b from 100H.
    SsSet (examine and alter) memory starting at address s.
    TTrace the next instruction.
    TnTrace the next n instructions.
    UUntrace — like Trace, but intermediate steps are not displayed.
    XExamine all registers and flags.
    XrExamine 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.
    OffsetNameContents
    ———-——–
    00hXLTAddress 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)
    08hDIRBUFAddress 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.
    0AhDPBAddress 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!)
    0ChCSVAddress 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.
    0EhALVAddress 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.
    OffsetNameContents
    ———-——–
    00hSPT“Sectors” (128-byte records) per track.
    02hBSHNumber 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.
    03hBLMMask which, if ANDed with a record number, yields its index within an allocation block (or, 2^BSH – 1).
    04hEXMNumber 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).
    05hDSMHighest allocation block number (count of blocks is one greater). Get disk capacity in records by shifting DSM+1 left BSH times.
    07hDRMHighest 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.
    09hALnInitial value for the first two bytes of the allocation vector, with a leading 1-bit for each directory block.
    0BhCKSNumber 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.
    0DhOFFCount of reserved tracks, usually 2 or 3 for diskettes, but may be large when a rigid disk is partitioned into logical drives.