Commodore 128 Running CP/M

With the enormous CP/M software library and the inclusion of a Z80A CPU, Commodore created the most flexible 8-bit computer of all time, being able to run serious business software as well as games with almost 100% compatibility. Unfortunately, the C128 runs CP/M noticeably slower than most dedicated CP/M systems as the Z80A can only run at an effective speed of 2 MHz for half the time, rather than the more common 4 MHz all the time. This is because of wait states in order to allow the VIC-II video chip access to the system bus.

The Commodore 128 powers up using its Z80 microprocessor, whereupon it checks for the presence of a bootable CP/M disk in the first floppy drive. If this is not found, it switches to the 8280 micrprocessor and defaults to C128 mode unless the Commodore is held down during this process, in which case it enters C64 mode.

This page focusses on the Commodore 128's ability to run CP/M. The C128 came bundled with CP/M 3.0 (also known as CPM Plus) on floppy disk. This version is backward-compatible with CP/M 2.2 and ADM31/3A terminal emulation.

Prerequisites

In order to be able to use the Commodore 128 in CP/M mode, you need to have the following:

  • C128 connected to a monitor able to support RGB input [for 80-column mode only]*
  • A 1571 floppy disk drive**
  • A bootable CP/M floppy disk [disk image file can be found further down this page]

*The Commodore 128 can run CP/M in 40-column mode (this uses the VIC-II video chip that the C128 inherited from the C64). However, much CP/M software expects 80 columns wide to be displayed. The Commodore 128 supports 80 columns via a new display chip called the VDC (Video Display Chip). This provides a colour CGA-compatible output via the C128's RGB output socket. When using the C128 in 40-column mode you can hold down the Control key and press the cursor keys to scroll the display window left or right.

**CP/M can be run using a 1541 floppy drive, but only single-sided GCR disks can be used, and the speed of operation will be roughly one-tenth the speed of using the 1571 floppy drive. Note that because of the different encoding method used by Commodore (GCR instead of the CP/M standard which is MFM), the CP/M command to format a floppy disk, "COPYSYS", is not implemented. Instead it is replaced by the "FORMAT" command .

 

CTools

The file below contains some DOS and LINUX tools that can help you in processing Commodore CP/M disk images, including adding or extracting CP/M files from the CP/M .D64 image file:

CTools 0.4

Some examples of use on the command-line are:

... to show a directory:
C:\CPMFILES>ctools example.d64 d

... to get all files with pattern *.com from image into current directory:
C:\CPMFILES>ctools example.d64 g *.com

... to put all files with pattern *.com from current directory into image:
C:\CPMFILES>ctools example.d64 p *.com

 

CP/M 2.2 Commodore 64 Disk Reader

One utility that runs in Windows is the CP/M 2.2 Commodore 64 Disk Reader. This will read the contents of a Commodore disk image (.d64) containing CP/M files, and allows you to add new files to the disk image. Just start the program and pick up the D64 image file of a CP/M floppy. After the program shows you all directory entries, use the window slider at the right side if necessary, do not click on a row until you want to save the file.
Directory extends (always exist when the size of a file exceeds 16 KByte) are fully implemented, to save a file with one or more extends, click on the filename without an asterisk ('*') at the beginning. USER numbers/partitions are ignored.

 

CP/M Disk Images

This section below and the files available from here are mirrored from René van Belzen's CP/M pages on The Commodore 128 Page at Tripod. The only functional changes being to remove the links not associated with CP/M and I have fixed the broken external links. This collection was created by Burton Craddock. The contents are either (C) Copyright Burton Craddock 2007 or are derivative or direct works of their various authors to which the respective Copyrights apply. It is provided in the hope that it will be interesting or useful or both, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. In particular, Bill Buckels has no warranty obligations or liability resulting from its use in any way whatsoever.

These files are contained in .D64 disk files and should be copied as whole disk images to 5.25" diskettes. Only the cpm1d64 file is bootable for CP/M mode. This boot disk is enhanced with the faster ZP/M (Z80 coding, instead of 8080 coding). The original 8080 coded CP/M disk image may be downloaded as a gzipped file from here. This link is a system disk of CP/M Plus Version 3.0, Serial No. 6228151676.

  Description
cpm1d64.zip

CP/M Boot Disk

CP/M Plus based on Simeon Cran's fully compatible ZP/M system. It contains the following files:

CCP      COM     4k     25 Dir RW  
CPM+ SYS 25k 196 Dir RW
DIR COM 15k 114 Dir RW
FORMAT COM 4k 30 Dir RW
HELP COM 7k 56 Dir RW
HELP HLP 83k 664 Dir RW
KEYFIG COM 10k 75 Dir RW
KEYFIG HLP 9k 72 Dir RW
PIP COM 9k 68 Dir RW
cpm2d64.zip

CP/M Additional Utilities

Some further utilities to spice up your CP/M Plus. For a full description of all the files, see the Commodore 128 System Guide. Contains:

DATE     COM     4k     25 Dir RW  
DATEC ASM 1k 5 Dir RW
DATEC RSX 1k 3 Dir RW
DEVICE COM 8k 58 Dir RW
DIR COM 15k 114 Dir RW
DIRLBL RSX 2k 12 Dir RW
DUMP COM 1k 8 Dir RW
ED COM 10k 73 Dir RW
ERASE COM 4k 29 Dir RW
GENCOM COM 15k 116 Dir RW
GET COM 7k 51 Dir RW
INITDIR COM 32k 250 Dir RW
PATCH COM 3k 19 Dir RW
PIP COM 9k 68 Dir RW
PUT COM 7k 55 Dir RW
RENAME COM 3k 23 Dir RW
SAVE COM 2k 14 Dir RW
SET COM 11k 81 Dir RW
SETDEF COM 4k 32 Dir RW
SHOW COM 9k 66 Dir RW
SUBMIT COM 6k 42 Dir RW
TYPE COM 3k 24 Dir RW
cpm3d64.zip

More CP/M Additional Utilities

Some useful utilities for C128 CP/M Plus. Contains:
  • Juggler (JUGG.COM) is a program to format, read and write non-Commodore CP/M disk formats. You will also need JUGG.DAT and JUGG.DEF to run the program.
  • PMARC is a compressing archiver, and PMEXT is the decompressing counterpart.
  • RDCBM reads files from CBM DOS formatted diskettes.
  • Superzap edits files on disk.
cpm4d64.zip

CP/M Assembler Utilities

Many of the files on this disk are described on the CP/M Assembler Utilities Help Page. Contains:
  • ASM is an CP/M 8080 macro-assembler (usage: ASM file).
  • COPY.ASM is a sample assembly source file, which copies a file on the same drive.
  • DDT is a 8080 machine language monitor (usage: DDT file.COM).
  • DUMP displays the contents of a file in hexadecimal and ASCII format (usage: DUMP file.ext).
  • GENCOM creates a special COM file with attached RSX files. GENCOM can also restore a previously GENCOMed file to the original COM file without the header and RSX's. GENCOM can also attach header records to COM files.
  • HEXCOM generates a command file (filetype .COM) from a .HEX input file (usage: HEXCOM file.HEX).
  • HIST is an external utility of SID (see description of SID).
  • LIB creates and maintains library files that contain object modules in Microsoft REL file format. These modules are produced by RMAC, or any other language translator that pruduces modules in Microsoft REL file format.
  • LINK combines relocatable object modules such as those produced by RMAC and PL/I-80 into a .COM file ready for execution. Relocatable files can contain external references and publics. Relocatable files can reference modules in library files. LINK searches the library files and includes the referenced modules in the output file.
  • LOAD is equivalent to HEXCOM, but less versatile (usage: LOAD file.HEX)
  • MAC, the CP/M 3 macro assembler, reads assembly language statements from a file of type .ASM, assembles the statements, and produces three output files with the input filename and filetypes of .HEX, .PRN, and .SYM. Filename.HEX contains INTEL hexadecimal format object code. Filename.PRN contains an annotated source listing that you can print or examine at the console. Filename.SYM contains a sorted list of symbols defined in the program. (Usage: MAC file)
  • PIP is a copy program (see CP/M HELP file)
  • RMAC, a relocatable macro assembler, assembles .ASM files of into .REL files that you can link to create .COM files. (Usage: RMAC file)
  • SAMPLE.ASM is a sample assembly source file, which prints a question mark on the console
  • SAMPLE.SUB is a submit file to fully assemble SAMPLE.ASM (usage: SUBMIT SAMPLE.SUB)
  • SID symbolic debugger allows you to monitor and test programs developed for the 8080 microprocessor. SID supports real-time breakpoints, fully monitored execution, symbolic disassembly, assembly, and memory display and fill functions. SID can dynamically load SID utility programs to provide traceback and histogram facilities.
  • SUBMIT is a command batch utility (see CP/M HELP file; usage: SUBMIT file.SUB).
  • TRACE.UTL is an external utility of SID (see description of SID)
  • XREF provides a cross-reference summary of variable usage in a program. XREF requires the .PRN and .SYM files produced by MAC or RMAC for input to the program. The SYM and PRN files must have the same filename as the filename in the XREF command tail. XREF outputs a file of type .XRF.
  • ZDE is a Z80 file editor (see http://techtinkering.com/blog/?id=6 for the full version; to get help inside the program, type ESC, and then H)
  • ZSID is a Z80 machine language monitor (usage: ZSID file.COM; also see http://www.cpm.z80.de/manuals/zsid-m.pdf for the description)
cpm5d64.zip

Microsoft BASIC-80

MBASIC is one of the most popular BASIC dialects for the 8080 microprocessor, also referred to as BASIC-80. MBASIC came with a compiler. All this put together is so much that it wouldn't fit on one .D64 disk image, so I divided the files over two disk images. Both are contained in the ZIP-file, so you download both at the same time. You will find the "BASIC-80 Reference Manual" on the Commercial CP/M Software site (http://deltasoft.fife.wa.us/c pm/index.html). I hope to complete the conversion of the scanned pages into an HTML text document soon, and will put them in my e-document section. I got the files from several sources. First of all, the Commercial CP/M Software site (http://deltasoft.fife.wa.us/c pm/index.html), which--at the time--had a non-working BASIC compiler. The working version was graciously provided by Jack Cammell, who found it in one of his old disk boxes, which he hadn't opened for years, just like a little treasure-trove :-).

Here is an (incomplete) description of the files on both disk images:

  • BASCOM.COM is the BASIC-80 compiler. It compiles only plain ASCII texts. You can create those from your BASIC-80 listing by typing (in MBASIC):
    SAVE "filename",A
  • BASCOM.HLP and BASCOM2.HLP are help files to BASCOM.
  • C128TERM.BAS is an ASCII text source file for MBASIC; it demonstrates the ADM-3A terminal of the C128 in CP/M Plus mode.
  • C128TERM.COM is the compiled version of C128TERM.BAS. It needs BRUN.COM in the same directory as C128TERM.COM to run.
  • C128TERM.SUB is a submit file, which runs C128TERM.BAS with MBASIC.
  • MBASIC is the Microsoft Basic interpreter. It has a built-in editor, but you can also create ASCII text files with your popular text editor, and load the BASIC source text as a "flat" ASCII file. (I've included ZDE in any case.)
  • SAMPLE.BAS is an ASCII text source file for MBASIC.
  • SAMPLE.COM is the compiled version of SAMPLE.BAS. It needs BRUN.COM in the same directory as SAMPLE.COM to run.
  • SAMPLE.SUB is a submit file, which runs SAMPLE.BAS with MBASIC.
  • SUBMIT.COM is the CP/M submit command file, which executes plain ASCII files as scripts.
  • TYPE-ME contains an important message you should read by invoking:
    TYPE TYPE-ME
  • ZDE is a Z80 file editor (see funet.fi, or OAK Software Repository for the full version; to get help inside the program, type ESC, and then H)
   
   

 

 

CP/M Versions

File Description
cpmfast.zip A 1999 update to C128 CP/M, by Linards Ticmanis. This version addresses some of the CP/M driver performance limitations of the original and purports to improve 80-column screen updates by 75%.
CP/M Plus Source Code

This file contains the latest source code of C128 CP/M Plus (3.0), dated May 28th 1987. The files are as follows:-

CX80.ASM 40/80 column drivers
CXDISK.ASM Disk controller
CXEM.ASM ADM-31 terminal emulation
CXEXT.ASM External drive support
CXINTR.ASM Interrupt handler
CXIO.ASM BIOS
CXKEY.ASM Keyboard handler
CXKRNL.ASM BIOS root module
CXKYCODE.ASM Keyboard definitions
CXPRINTE.ASM Printer drivers
CXRAMDSK.ASM RAM disk driver
CXVT.ASM VT-100 terminal emulation
FAST8502.ASM 8502 drivers
GENCPM.DAT  
CPM3.LIB Macro definitions for BIOS data structures
CXEQU.LIB General macro definitions and equates
MODEBAUD.LIB Equates for mode byte
X6502.LIB Macros for 6502 assembly
Z80.LIB Macros for Z80 assembly
CZ.SUB Make batch

To generate a new CPM+.SYS file used by CP/M on the Commodore 128 follow the procedure listed below. You will need a 1581 disk drive for this task. Without a 1581, you will have to make modifications to the procedure to suit your system (refer to the MAKESYS instructions on the 5.25" diskette that accompanies the DRI manual offer). If you're lucky enough to possess a 1750 RAM expander, you could use it (drive M:) in place of the 1581 work disk. This procedure requires a 400K work space.

  1. Create a 1581 work diskette, using the FORMAT utility, or start with an empty RAMdisk (drive M:).
  2. Copy the following files to the work disk, using the PIP utility:

    From USER 0: (these are the utilities you will need)

    • RMAC.COM
    • MAC.COM
    • LINK.COM
    • GENCPM.COM
    • ADDBIOS.COM
    • SUBMIT.COM

    From USER 1: (these are the data files)

    • CX80.ASM
    • CXDISK.ASM
    • CXEM.ASM
    • CXEXT.ASM
    • CXINTR.ASM
    • CXIO.ASM
    • CXKEY.ASM
    • CXKRNL.ASM
    • CXKYCODE.ASM
    • CXPRINTE.ASM
    • CXRAMDSK.ASM
    • CXSCB.ASM
    • CXVT.ASM
    • FAST8502.ASM
    • CPM3.LIB
    • CXEQU.LIB
    • MODEBAUD.LIB
    • X6502.LIB
    • Z80.LIB
    • BNKBDOS3.SPR
    • RESBDOS3.SPR
    • CZ.SUB
    • GENCPM.DAT
  3. Enter 'SUBMIT CZ' and the rest is almost automatic. Just answer 'Y' to all the ERASE? prompts.
  4. When the process is complete, you will have a CPM+.SYS file that you can copy to any disk from which you want to be able to boot. You also need to copy the Console Command Processor (CCP.COM) from USER 0 to the disk from which you want to boot.
  5. Details regarding System Generation can be found in the DRI System Guide. There are several differences to be noted, however, such as somewhat different module names and the implementation of system utilities such as COPYSYS and CPMLDR.