Tuesday, October 16, 2012

CP/M on a C64 - fun and learning.


Hello again.

What I learned so far about CP/M for C64 by practical application:

  1. Commodore 64 will not support 2 disk drives (unless you patch it with simple BASIC program, which updates CP/M disk for 2 drive support).

    Even though bios configuration program seems to have the option to switch between 1 and 2 disk drives mode, when I switched to 2 drives mode, saved the configuration on disk and re-booted with 2 disk drives connected to my C64, attempts to switch to drive B: ended in BDOS error. My 2nd drive is 1571, however AFAIK, it works by default in 1541 mode unless explicitly reprogrammed to use extra features.

There is a remedy though. With the help of a BASIC program found here: URL, I patched CP/M disk so that C64 now is able to support 2 disk drives under CP/M.
You need to type in the BASIC program, save it on the disk (but not a CP/M disk, just your regular C64 storage for backup purposes) and then switch the disk for a CP/M one into drive 8 and run the BASIC program you just entered. Next time you need to patch up a CP/M disk, load that program from your backup, switch disk for a CP/M one and run the program again. After booting up CP/M, run your CONFIG.COM program to change the number of drives to 2 and save the current I/O setup to disk (option #6), then exit to CP/M (option #7), insert valid CP/M disk to drive B: (9) and test the functionality:

A> dir B:

Config program.

Checking disk B: stats


  1. Changing the diskette in drive.
    Changing the diskette in drive without warm restart (CTRL-C or RUN-STOP) will switch that disk to R/O mode. User will be unable to make modifications to that drive until next warm restart. With that in mind, the disk in drive must be always CP/M type with c64boot procedure on track 1, sector 5.

OK, enough learning. Now there is time for some fun.
What would be a computer without a game? Just a piece of junk, I say! Fortunately, many popular games were ported to CP/M platform. Most of them are text mode based games, due to nature of CP/M (no built in graphical support, generally incompatible across hardware platforms). However it does not matter much, because in the CP/M era, many popular games were text based. Good examples are Infocom's adventures or a famous StarTrek game (originally written in BASIC AFAIK).

I successfully created C64 CP/M ZORK1 and ZORK2 game disks (google up "ctools by Jochen Metzinger" for transferring programs to C64/C128 CP/M disk images, can also create Commodore format CP/M blank disks - an awesome tool). Even though they were designed to work with 80 column mode, since there is no fixed ASCII art or elaborate ASCII screens that depend on fixed size, similar to famous Star Trek game, the ZORK adventures are perfectly playable on C64 under CP/M. I know there is no point of playing them under CP/M, since they were released for native C64, but it is not the point of this exercise.

I have been unable to run Star Trek game though. All the files fit on one disk (MBASIC.COM, STARTREK.BAS, TREKINST.BAS), however C64 leaves insufficient memory for MBASIC.COM to load STARTREK.BAS.

Zork1 game.

Zork2 game.

So far I have a very positive experience with CP/M for C64.

In the next episode: 80 column display emulation and perhaps some more programming examples.

Cheers!

Marek
10/16/2012

1 comment: