C128‐CPM - Maverick-Shark/retroGuru GitHub Wiki

Keys (Key mapping)

PC Key C128
F10 =

CP/M

  • Copy files, PIP.com
    PIP [d:][newfile.ext]=[d:][filespec][
    Copy files between peripherals whilst performing optional conversion.

     pip <dest>=<source>
     PIP A:=B:*.COM
    
     Copy file from drive to drive: C> PIP H:=A:INFO.DAT
     Copy file to new name: C> PIP A:NEW.DAT=A:INFO.DAT
     Copy file to printer: C> PIP LST:=A:LETTER.TXT
    
  • Erase files, ERASE.com

     ERASE A:FILE.COM
    

CP/M files

  • C128 CP/M boot disk version 28 May 87: 28may87-1.d64.gz & 28may87-2.d64.gz

     Side 1 is the boot disk itself and side 2 has other system utilities.
     In side 2 there is also a file named ZPM+.SYS which is CPM+.SYS with ZPM3 installed.
     You have just to rename it to CPM+.SYS and replace the original one.
     Get the zpm3n10.pma file for knowing more about ZPM3.
     These disks are quite different from the ones shipped by Commodore.
    

Running CP/M on the C128

Source: https://celso.io/posts/2024/03/03/c128-cpm/

The CP/M, short for Control Program/Monitor, was one of the first operating systems of the personal computer revolution. It was launched in 1974, and it celebrates 50 years this year. It was ported and made available for many 8-bit machines with different CPUs and was related to running productivity software. If you ever used CP/M, then, well, I hate to say it, but you’re old.

I had a brief encounter with CP/M when I was 14 or 15 years old; I can’t remember exactly. At the time, I was in high school in Aveiro, and the local computer shop, which I visited daily on my way to the train station, just to stare at the window, the same way a pilgrim would visit and contemplate at a shrine, had two beautiful machines on display: the brand-new Amiga 1000 and a C128D.

I owned a C64 and was familiar with the C128, but this one was odd. It wasn’t running any games, color graphics or playing music. Instead, it was connected to a monochrome monitor which always displayed either a weird command line prompt or what seemed to be some boring professional writing software.

I soon came to find that it was running CP/M and WordStar, one of the first word processors for microcomputers. My daily obsessive visits to the computer shop led to some friendship with the owner, to the point that he’d let me in and play with the machines. So, I played with CP/M and learned how to use WordStar.

Well, in case you didn’t notice, I own a C128DCR now. This blog is about how I got CP/M, WordStar, and other fun ancient software apps running on it.

CP/M for the C128

The C128 came bundled with CP/M 3.0 Plus, which could be run in either 40-column (using the VIC-IIe) or 80-column mode (using the VDC video chip and the RGBi output). Due to numerous bad design decisions and portability issues, CP/M ran notoriously slow on the C128 compared to other Z80 systems running at similar clock speeds. Linards Ticmanis, the author of CPMFAST, a “speed-improved and generally-fixed CP/M distribution for the C128.” launched in 1999, explains the problems in detail.

Another later variant of CP/M for the C128 was this ZPM3 BootDisk released just a few years ago. The original BDOS (short for Basic Disk Operating System, which is a kind of CP/M kernel) distributed by Digital Research was coded for the Intel 8080. While the Z80 is backward compatible with the 8080, ZPM3 is a BDOS replacement optimized for Z80 opcodes. Furthermore, this bootdisk distribution has other tools and patches that improve the 80-column fast mode performance and can use a REU expansion.

Let’s try to boot ZPM3.

It boots and it works. I run Microsoft Basic-80, the “most extensive implementation of BASIC available for the 8080 and Z80 microprocessors.” I type a very simple program and run it.

I end up preferring CPMFAST to ZPM3 though, as it seems more compatible with some of the software I tested.

Now, something more advanced. If you read my last blog, I have an Ultimate-II+ cartridge, a cycle-accurate implementation of the Commodore 1541/71 Floppy Disk Drive with many extras, plugged into my C128DCR. Let’s try to take advantage of that.

When I was sharing about my C128 adventures in the Everything C64 discord server, I chatted with Xander Mol, a retro enthusiast, blogger, and skilled developer who also owns a C128 and an Ultimate II+. It turned out that he’s the author of CPMUTools, a suite of tools to help using the Ultimate II+ cartridge from within CP/M, one of which is called CPM UMount, an application that enables to mount disk images on the UII+ filesystem directly from CP/M, which I will be using.

Now I need CP/M software to play with and I need to build CP/M disk images with it. Retroarchive has an extensive collection of downloadable CP/M software to get us started, but how do I get the files into C128 CP/M MFM disk images? Enter ctools, a collection of command line utilities for accessing C64 and C128 CP/M disk images. I clone the Github repo and compile the source code, no issues.

Turbo Pascal

  1. Attach cpm3.0.622-5002336.d81 as drive 8 (A: on CP/M).
  2. Attach Turbo Pascal 3.0 (from TP_301A.ZIP, you will need ctools to create .d71 file) as drive 9 (B: on CP/M).
  3. And boot CP/M3.0 cpm3.0.622-5002336.d81 in 80 col mode.
  4. Download mktris source code for Turbo Pascal 3.0 under CP/M (Commodore 128) from https://github.com/makarcz/mktetr_tp3.
  5. Append the download files (.pas) to .d71 file (where Turbo Pascal 3.0 for CP/M is) using the ctools.
  6. Run Turbo Pascal:
A> B:
B> turbo
  1. In compiler Options, select compile -> Com-file.
  2. Add as Main file: MKTRIS.PAS.
  3. Add as Work file: MKTET01.PAS.
  4. And Compile it...
  5. Finally, run the game:
B> mktris

Running WordStar

WordStar was one of the first word processors I used on any computer, so I had to start with it. The illustration above is from the WordStar Reference Manual.

I download a copy of WordStart 3.0 from Retroarchive and unzip the files, then I use cformat and ctools to create a CP/M disk image and I copy the files to it.

$ ./cformat -2 wordstar.d71
$ ./ctools wordstar.d71 p ~/Downloads/WS30/*
./ctools: put /Users/celso/Downloads/WS30/INSTALL.COM
./ctools: put /Users/celso/Downloads/WS30/MAILMRGE.OVR
./ctools: put /Users/celso/Downloads/WS30/MERGPRIN.OVR
./ctools: put /Users/celso/Downloads/WS30/WIMSGS.OVR
./ctools: put /Users/celso/Downloads/WS30/WS.COM
./ctools: put /Users/celso/Downloads/WS30/WSMSGS.OVR
./ctools: put /Users/celso/Downloads/WS30/WSOVLY1.OVR
./ctools: put /Users/celso/Downloads/WS30/WSU.COM

I then take the wordstar.d71 image file, put it my UltimateII+ USB stick, boot CP/M and the use CPMUTools’ UMount utility to mount the image on the CP/M drive B:.

I then switch to drive B: and run the INSTALL command. During the installation, I was asked a few questions about stuff I hadn’t heard in decades. I answer then the best I can.

When the installation is over, WordStar runs, and I get flashbacks. I remember the same screen and menus from that computer shop in the 80s. It just works.

I also ran dBase II, Turbo Pascal, SuperCalc, everything worked.

CP/M

**Source:**http://www.discordia.org.uk/px4/cpm.html

Key:
d: - A drive letter
filematch - an extact filename, or a wildcard match for files.
Items such as [item] are optional, ones such as <item> are compulsary.

DIR [d:][filematch]
Display a list of files in the specified, or current drive.

ERA [d:]<filematch>
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. Display is only meaningful if the file contents was ASCII text.

USER n
Switches to the 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.  
A disk can be divided up into a maximum of 16 user areas.

PIP [d:][newfile.ext]=[d:][filespec][ Copy files between peripherals whilst performing optional conversion .

Copy file from drive to drive: C> PIP H:=A:INFO.DAT
Copy file to new name: C> PIP A:NEW.DAT=A:INFO.DAT
Copy file to printer: C> PIP LST:=A:LETTER.TXT

CP/M Games

Even though CP/M was mostly known for productivity and business software, several game titles were also published.

Here’s MyChess drawing a chess board in ASCII using terminal sequences.

Of course you could run Infocom text adventures. Here’s Zork1.

Blue Bastards from Outer Space is more “recent,” from 1999. It was coded in Turbo Pascal and shows off the C128’s VDC chip and sound capabilities from CP/M.

Easter Egg

The C128 had a few easter eggs. In CP/M you can trigger one where the authors are shown from some hidden data in the Z80 ROM by typing the following sequence and pressing return:

A> (ESC)=88(ESC)e

That’s it, folks. CP/M does indeed run on the C128.

Transferring CP/M Programs on the C128

Source: https://retrocomputerman.weebly.com/transferring-cpm-programs-to-the-c128.html#

Note: This is a sub menu of Retro Computers. Be sure to visit the Retro computer web page

One of the unique features of the Commodore C128 is that it will read CP/M disks from Kaypro, Osborne and IBM. So all you need is DOS software to create a readable CP/M disk in the C128. This process I use requires a PC with a 5 1/4" floppy drive and running full screen DOS. I use Windows 95. The DOS software that I used is called 22DISK available here: http://www.cpm80.com/

  1. Download 22DISK and your CP/M programs from the internet.

  2. Transfer the program to a floppy drive. The CP/M 80 version of Turbo Pascal V3.01A is available here: http://www.retroarchive.org/cpm/lang/lang.htm

Since most modern PC's don't have floppy drives, I had to put the CP/M program on a flash drive. I then had to use an intermediary computer as my Windows 95 machine does not have USB for the flash drive. Fortunately, my Windows Vista machine has USB and a 3 1/2" floppy. After copying the program on a 3 1/2" drive, I inserted that disk in the Windows 95 machine. It has both 3 1/2" and 5 1/4" drives. The CP/M program is transferred to a directory that 22DISK will access.

  1. The 22DISK program is installed in the root directory. As the Commodore C128 will read Kaypro II disks, I prefer to use it. Format a 5 1/4" Kaypro II disk. Set up 22DISK to read in DOS and write in Kaypro II Single Side, double density (SS/DD) or Kaypro IV (DS/DD) disk format. When finished, the Commodore will read the Kaypro disk and those files can be copied to a C128 CP/M formatted disk.

You should be able to be get programs like Turbo PASCAL V3.01A to work in the C128 CP/M mode using this process. I have also successfully ported over MBASIC to the C128. Below is an image of the Pascal menu

Links

Compile ctools

Download ctools source code from https://github.com/mist64/ctools.
NOTE: Down use v0.4a (it fails under g++ v4.8 and up).

$ make install

**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
⚠️ **GitHub.com Fallback** ⚠️