At Last! CP/M For Protected Mode

If you used a serious computer pre-IBM PC, there was a fair chance its operating system was CP/M. CP/M was a staple among 8080 and Z80 computers and while there were other versions, we’ll always associate CP/M with the Z-80. There was a CP/M made for the PC which used an 8088 (a hybrid 8-bit bus with a 16-bit 8086 core), but it was overwhelmed by MSDOS. However, there was another interesting version made for the 68000, and now [johnsonjh] has ported that over to create an early version of CP/M for 80386 protected mode.

The Z-80 only had a 16-bit address bus, so it could only handle 64K of memory. It was common to “bank switch” some memory, and CP/M Plus could be made to understand that (for example, you might have 32K of common memory and three banks of 32K memory; you could address one bank at a time). However, the 386 had a full-blown memory management unit that could remap physical 4K memory pages to anywhere in a program’s virtual address space.

Ordinary CP/M couldn’t handle that, but the Motorola 68000 had a similar page management model, so it makes sense it might be easier to port CP/M-68K to the 80386 than starting from the original, even though the instruction set for the Z-80 is conceptually more similar to the 80386.

What can you do with it? We don’t know. Presumably, it will allow you to use lots of memory. Historically, CP/M software from one variant would not run on another, so you’ll have to build anything you want to use. Of course, the real killer for lots of CP/M memory was multitasking, but that takes MP/M, and only about half of that is currently working. But we won’t be surprised to see it completed soon.

While CP/M skills won’t land you many jobs these days, it is a pretty good way to get mentioned on Hackaday.

34 thoughts on “At Last! CP/M For Protected Mode

        1. Oddly enough, most of the problems with Me were due to vendors like HP loading down the systems with garbage 3rd-party stuff.

          I had an HP desktop that came with Me, and it ran horribly slow, and HTTPS just simply didn’t work at all. I was in the Me beta, and one day I got sick of it, reformatted the hard drive, and reinstalled Windows from the CD I got as part of the beta test. Just Windows, nothing else added on. Everything that was wrong with the computer was fixed.

      1. The C128D had an internal floppy drive that was very advanced.
        Even in C64 mode, loading times were better.
        The C128D chassis was re-used for the Amiga 1000 basically.
        Or vice versa. Both are very similar in shape.

      2. I never used the Z-80 (although I wanted to, since I first learned assembly on a Z-80), but the real reason I wanted a C-128D coming from the C-64 was the 80-character support.

      3. I always wanted to play with CP/M on my C128, but I only had a 1541 drive which was horribly slow with CP/M. I bought a 1571 off eBay a few years ago just so I could finally try it out, but now I can’t find the power brick for the 128. Yeah, I could cobble together a replacement, but that requires time. Damn I want to retire and play with stuff!

    1. That was CP/M Plus (CP/M 3.0), I think.
      Unlike CP/M 2.2, CP/M 3.0 had certain things borrowed from MP/M.
      I remember it had an on-line help and that it could handle more than 64KB of memory, for example.
      It also supported something analogous to DOS TSRs.

    1. CPM68K was written in C. The BIOS might be written in assembler or C, the manual gave examples of either. The BIOS is going to have to be re-written for the different hardware anyway, so it does not matter.

  1. This is different from CPM-86 from 1981. I booted a copy of v1.1 while posting this and it reports 608K of free memory. That would have been somewhat expensive back in 1981. Runs great in qemu. Its basically CPM 2.2 recompiled for the 8086 memory model. You have to get used to running AMS86 instead of ASM, etc. This is the OS that lost out to MSDOS because DRI was a little unmotivated to lock down that IBM contract and the rest is history. Its a nice OS and DRI shipped a lot of stuff for it (access manager, display manager, the usual languages). I would assume protected mode CPM is a different sort of beast.

    1. DOS Plus 1.2 at heart is CP/M-86, too. It shipped with BBC Master 512 and Amstrad/Schneider PC-1512, for example.
      It can run both CP/M-86 and DOS 2.x era executables and read/write both file systems.

    1. Well it does if you have a MC68451 MMU or MC68851. Now, truthfully, I don’t know if CP/M 68K used that, but I assume it did if one was present. There were problems with the 68000 that made it almost impossible to do virtual memory without one (same as the 80286 wasn’t quite there).

    2. The 68000 had program-counter-relative and register-indirect addressing which made possible position-independent code. Of course, the programs had to be well-behaved (not overstep their assigned memory space), so this was a somewhat crippled capability.

      1. That makes perfect sense (uClinux used the same approach, AFAIK) but the article suggests that 68000 memory management is similar to 386’s paged memory, which is far from truth.

  2. We used MP/M back in the day when the customer wanted software that typically ran on DG Nova. Since the SW was primarily written in FORTRAN IV, we also used Microsoft’s Fortran compiler. Floating point performance was a problem on the Z-80, but we were able to use an AMD AM9511 by replacing the MS FORTRAN compiler’s FP support library with a bespoke implementation that used the co-processor. While a bit slower than the NOVA version, the Z-80+AM9511 version worked well enough.

  3. All this comments are lost in time, like tears in the rain.
    Why there is nothing new and original, like a multiprocessor (tens or hundreds of them) architecture with z80 or 68000 or another obscure microprocessor from 50 years ago? Then you try to run CP/M on it.
    Do I hear “you can do it with some 555”?

  4. There was a CP/M made for the PC … but it was overwhelmed by MSDOS.

    As the story goes, around 1980 IBM approached Digital Research (owned by Gary Kildall) as well as Microsoft for an OS for the newfangled IBM PC.

    Kildall already had CP/M, so he should be ahead of Microsoft that did not have an OS — but apparently the negotiations between Kildall and IBM went awry. The story is not quite clear on this point; the one I originally heard was that Kildall (or his wife (or both)) was/were not happy to sell the rights to the source code to IBM for a one-off fee and therefore lost the deal, which went to Microsoft instead.

    Microsoft, as said, did not have an OS but the bought 86-DOS from Seattle Computer Products (that lovingly called the product QDOS (Quick and Dirty Operating System) internally), configured it for the IBM PC and PC DOS 1.0 was born. And MS-DOS was born too. Since IBM did not buy an exclusive licence to the OS, Microsoft was selling their version, MS-DOS, to whomever wanted it.

    That’s about it for “overwhelmed by MSDOS”.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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