2015. január 11.

CP/M on Commodore 128

CP/M modified by ME, booted up
I have downloaded the original release of CP/M for Commodore 128, and also tested Microsoft Multiplan on it, which is the predecessor for Excel. The speed was more than unsatisfying. You can imagine the situation sitting in front of your computer, waiting the initial screen to appear, and watch the screen displayed line by line, character by character following the movement of the cursor with your eyes. It is sloooow. Not just comparing to today's computing experience, but I would have been upset back at those days as well. The C64 version of Multiplan was lightning fast compared to what CP/M produced.

But before we deep dive into things, let's take a look at what that "seepeeperem" is. Originally developed by Digital Research Ltd for Intel's 8080 CPU in 1973, it was a console based operating system, much like the DOS, or the Linux. In fact, it was the predecessor of Microsoft DOS in some way, since Microsoft wanted to provide some functional compatibility for CP/M on the x86 systems. The Zilog Z80 CPU is an Intel 8080 binary compatible CPU, extended with several instructions, and some registers. This Z80 CPU is also part of the C128. Yes! The Commodore 128 has two different CPUs: MOS 8502 (which is an enhanced 6510, which is developed for the C64), and a Z80. The Z80 is only used for running CP/M.

Compiling CP/M in C128 VICE
When CP/M boots up from floppy, it provides a command prompt, much like DOS did later, with some familiar commands, like DIR, ERASE, etc... However there are differences as well, the COPY command in CP/M is called PIP. Also, CP/M didn't supported directories yet, it instead used some kind of user partitioning of directory entries from USER 0 to USER 15 (no passwords, or anything, so it is much like numbered directories of some kind).

CP/M run on a lot of 8080 and Z80 CPU based computers of it's time, having very different hardware architectures. Digital Research designed the OS that way, to make it possible. The basic concept was, to have a hardware specific BIOS (also loaded from disk), which is some kind of an hardware abstraction layer, on top of it sits the BDOS, which is invariant, and these two loads CCP.COM which is the COMMAND.COM for CP/M, handling the command prompt, user inputs, command and program execution, etc. Under the BIOS, there are the ROM based routines to handle screen, disk IO, and booting CP/M from disk.

Fortunately enough, Commodore made open source their BIOS version, to allow anyone to modify it's source according to their need. I readily found a so called Fast BIOS R6.2 on the net, which eliminated a good portion of unnecessary code from the BIOS, and made some shortcuts on the display parts to make screen handling faster. This code is dated back to 1993. However, it wasn't fast enough for me. So, I decided to speed it up even more. I also managed to get the source of the ROM functions found in the C128, so everything were at hand to make C128 CP/M a better world to live. But this will be an other post.

MS Multiplan, predecessor of Excel
I finally managed to introduce some tricks in the BIOS, which made a nice speed up in display times (by a factor of at least 50%), which is getting closer to acceptable speed.

I wonder, what is the reason of this slow CP/M functionality on Commodore 128. Probably the problems are manyfold:
- Z80 and 6502 assembly developers that time hated each others' architecture like hell (comparable to the Linux vs Windows flames experienced in the early 2000's)
- The star of CP/M already started to diminish the time, when Commodore came up with the C128
- The new OS for IBM XT was MSDOS, instead of CP/M
- Good, knowledgeable developers were rare that time
- The user base of C128 CP/M was too small, which made the developers to turn away from C128 CP/M development
- The Z80 CPU run at an effective speed of 2MHz, instead of 4MHz, which would have been comparable to the 1MHz mode of 8502 CPU, or to other CP/M running HW that time

Nincsenek megjegyzések:

Megjegyzés küldése