The project

I have been fascinated by the Commodore CBM-II computers for a long time, especially with their expansion architecture that allows attaching a second CPU (such as an 8088 or Z80) and running alternate operation systems such as MS-DOS or CP/M.

This project was conceived when I obtained an 8088 card for the CBM-II, running MS-DOS 1.25. I wanted to see if it was possible to run different PC applications on it, and it quickly turned out that nothing that I tried worked. I learned that there was a huge difference between “MS-DOS compatible” and “PC compatible”, and that MS-DOS was ported to many hardware architectures other than the PC, so that just being able to run MS-DOS does not mean that the applications written for the PC will work.

But I was persistent. Surely, it wouldn’t be so difficult to add some PC compatibility to the platform, right? So I started by analyzing the MS-DOS 1.25 source code and learning how it took advantage of the dual-CPU architecture of the CBM-II. I disassembled the 6502 part of MS-DOS, learning how it uses the Commodore KERNAL I/O functions, and I analyzed the inter-processor communication code in order to learn how to call the 6502 code from the 8088 side. It was a great journey in which I was aided by the original creator of MS-DOS as well as several members of the cbm-hackers group.

With this knowledge I wrote a simple implementation of a few INT 10h functions that ran as a TSR program inside the MS-DOS 1.25 (and by “simple”, I really mean simple – for example, the function 02h “set cursor position” was implemented by outputting the ”home” PETSCII code, and then appropriate number of “cursor down” and “cursor right” control codes). This allowed me to run same Microsoft BASIC demos for the PC. Hooray!

However, it soon turned out that there were only very few PC programs that ran under DOS 1.25. Most software expects at least DOS 3.2. How could I make it boot on the Commodore? Well, I needed to write more PC BIOS functions. Specifically, I had to create my own INT 13h implementation, which would allow reading Commodore disks as if they were PC disks, which was no small task (the PC uses 512 byte sectors, whereas the Commodore disk drives use 256 bytes, and they also have a variable number of sectors per track). And more INT 10h functions so that the DOS could write to the screen, and INT 16h functions so that it could accept keyboard input, and INT 11h so that it would know how much memory it has, and…

Finally, at some point, I achieved the critical mass of PC BIOS functions that allowed the DOS to boot. Due to the slow IEEE disk interface and the fact that for every disk access, two 256-byte sectors need to be read to simulate a 512-byte sector, it took 2 minutes to boot DOS 3.2. But it worked.

fast forward a few years…

Today, the PC compatibility projects has achieved enough maturity to be released into the wild. FreeDOS boots in a few seconds from the SD card, which emulates an 8 GB hard drive. Applications such as Norton Commander or Turbo Pascal work without any major problems. In fact, I am writing some of the PC compatibility software on the Commodore itself, compiling it with Turbo Assembler.

So, this page is a short description of what I have achieved in these years. Stay tuned to the news, where I will share further updates!