Saturday, October 13, 2012

CP/M on a Commodore 64.


      I've always been intrigued by CP/M operating system although I've never used it before. I possessed some knowledge about it, mostly that it was Intel CPU and Z80 oriented and how the user interface looked like and that it was a disk OS and that a lot of good professional software has been created for it. At some time in the 90-s, when I was still active (read - every day) C64 user, I made an attempt to create operating system of my own, only to learn later that the principles I chose for my OS, how it was bootstrapped, the architecture of kernel and control program and UI were very similar to these of CP/M. I liked  CP/M because it provides structure and standardization that home computers needed so much, especially in the 70s and 80s era. The standardization we now possess and take for granted in the form of PC architecture did not exist at the time with the exception of mainframe computers and for home computers, CP/M filled the niche.

I recently acquired CP/M cartridge for C64 on eBay. A great opportunity to give that OS a try when I finally had hardware that could run it in its very historical, almost original form. I knew that C64's cartridge was somewhat infamous for not delivering exactly on its promise and that it had been discontinued shortly after it was offered in retail. However I believe much of the bad rap this piece of hardware got can be attributed to the fact that it was not user friendly, or to better put it (since not a lot of software or computer hardware in the day you could call "user friendly" anyway) - not easy to use. First and foremost, the main obstacle to get the promised software base was incompatible to CP/M standard Commodore's disk format. The other - slowness. The cartridge has Z80 CPU on board with some glue logic that allows for it to use C64's resources (RAM, VIC, peripherals, CPU bus in general) together with C64's CPU - 6510 (well, not together, they switch between each other using some register, but pretty much C64 is turned into a dual CPU machine). The design of the cartridge and timing considerations forced the Commodore engineers to retard the Z80 clock, so the computer did not run too fast in CP/M mode. Another problem with the cartridge, which manifested itself later in history is that it did not work well with later versions of C64 main boards, especially with C64-C, which can be probably attributed to some peripheral chips (like VIC II) that were "fixed" in that model. Since Commodore did not produce the CP/M cartridge anymore at that time, they did not bother to produce a fix.

First, I wanted to test somewhat if the cartridge itself is not "dead". Original cartridge was sold with CP/M disk, instruction manual and some teat program in BASIC, I am not sure if it was on the disk or to be typed in from instruction manual. Since the program is pretty short, I believe it could be distributed in the form of printed copy that user could type in and run to test the cartridge without booting up the CP/M disk. Since we live in internet era, a lot of information is widely available on the net. I started the google search and quickly found the page with test program listing. I inserted the cartridge into C64, typed in the test program, saved it on disk and ran it. It all seemed to work. The interesting note here - the test program seemed to work fine on C64-C model as well, it was the CP/M itself that I could not get to work on that one and had to turn to my older model - the bread bin C64 made in 1983.
OK, so the test has passed, time to check how the actual CP/M works. However I had no original disk. No worries, in this day and era anything in electronic format is at your fingertips. I found the images here. With the help of my X1541 cable and opencbm software I transferred my image. Loaded the disk to C64. Typed in:

LOAD"CPM",8
RUN

Moment of truth...(this is C64-C) the asterisks appeared on the screen, but stopped. The system hangs. I repeat, this time I get OS startup message and UI prompt, but attempt to type in anything hangs up computer again. The next try ends up in artifacts on the screen and hang-up as well. I switched to my older bread bin C64 and now we were in business. At the prompt:

A>

I typed:

A> DIR

pressed ENTER and the directory of files has appeared. I have successfully booted up CP/M in year 2012 on my C64.

The CP/M adventures will continue in following posts, please stay tuned...

Marek
2012/10/13