CP/M on i386

I’ve been interested in CP/M for a while. The source code for CP/M from “way back in the time tunnel” is available at the CHM and multiple other places. The challenge however was that CP/M source is in assembler code for 8080 and z80. I wanted to run it on i386 hardware.

So, with the help of Claude I took on a 2-step project:

  • Have Claude reverse-engineer the CP/M assembler to C that produces, as close as possible to the same 8080 instructions when compiled.
  • Have Claude create a build that can compile the new CP/M C source for 8080, z80 and i386.

The net result is here: working CP/M compiled from C for the three different processors. Here’s a screen capture of CP/M booting on i386 in Qemu

The CP/M apps are not there yet, but that’s CP/M running in i386!

The Github project is https://github.com/teverett/CP-M-C and you can read the new “C source” of CP/M there. It has exactly the same structure as the original assembler code.

Similar Posts

  • MP/M on i386

    Following on the work to port CP/M to C, I decided to take on MP/M from 1979, since it has multi-user capability. With Claude’s help this was a 2-stage process: The net result is C code that compiles to 32-bit real mode MP/M. You can see it in QEMU here: qemu-system-i386 -drive file=build/mpm86c.img,format=raw,if=floppy -boot a…

  • CP/M on i386 part 2

    Part 1 here. Well, i discovered that none of the CP/M commands that are .com files were present. So we now have: All of the .COM’s were “back-ported” from the original assembler code to C so that they can now be compiled for different platforms. BASICBAS.COM, BASICINT.COM and BASIC.COM are the original Basic-e from 1976,…

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.