CP/M 6502-Style

There are projects you create to share with the world, but there are also those you do just because you want something for yourself. Lucky for us, [Dietrich-L]’s 30-year-long project to create CPM-65, a CP/M-like OS for the 6502, has become both.

[Dietrich-L] does admit that the documentation is “sparse” and “for my personal needs.” Still, the OS has most of what you’d expect and runs well on the target system, a heavily-modified Elektor Junior with 57 kB of RAM. The disk structure is compatible with CP/M, although the Transient Program Area (TPA) apparently starts at $200, which is a bit different from a typical CP/M. Apparently, the system uses some low memory which necessitated the relocation. Just in case you were hoping, CPM-65 doesn’t emulate an 8080 system, so you can’t run normal CP/M programs. You just get a similar operating environment and tools.

The 31 commands listed include an assembler, BASIC, Forth, an editor, and some disk tools, along with a debugger. Xmodem is available, too. Everything is written in assembly for the CPM-65 assembler, so bootstrapping could be an issue if you need to make any changes.

Speaking of changes, there is some documentation in the docs sub-directory, including the layout of [Dietrich-L]’s system, which would be handy if you were trying to run this on your own hardware. You’ll also find basic commands for the editor, details of the assembler, and some other documents.

[Dietrich-L] notes that he was unaware when he started the project that there were other similar projects. DOS/65 (which has a port for the Commodore 64), OUP/M (which hasn’t been updated since 1983), and CPM65 (apparently no relation, but very impressive), which appeared in 2022.

If you need a 6502 computer, grab a breadboard, although adding the disk drive is an exercise left to the reader. Or, grab an FPGA but expect more work.

Thanks [Stephen Walters] for the tip!

8 thoughts on “CP/M 6502-Style

  1. “Apparently, the system uses some low memory which necessitated the relocation” – Erm, no, it’s a 6502, so the first 256 bytes is the zero page, and the second 256 bytes is the stack :D.

  2. I did the 2022 CP/M-65 — I’ve just written an assembler for it, actually. Mine uses relocatable binaries so that you can load the same programs on multiple systems with different memory maps. Currently it’ll run on the BBC Micro, C64 (very slowly due to the terrible disk system) and X16. I want to look at the Apple II and Oric next. Sadly due to physical differences you can’t use the same floppies on the different systems…

    I wish I’d know about the earlier CP/M-65, as it would have saved a tonne of time; it uses absolute binaries, making the design simpler but less flexible, which means I wouldn’t have been able to reuse the assembler but there may still be useful things I can steal. Er, borrow. It uses a 256-byte record size rather than the traditional CP/M 128 bytes in order to make the maths easier on the 6502, which may make porting trickier.

    Right now I’m working to port DOS/65’s ed clone. If you thought edlin was bad, you haven’t used CP/M ed (no relation to Unix ed). It’s very special.

  3. What an impressive project! Surely a work of love, and many hours of hard work.

    An 8080 emulator could be a great addition. That could open the door to (slowly) running a vast number of classic CP/M programs.

    I’m working on an similar project: A version of CP/M for the RCA 1802 CPU. I started by writing an 8080 emulator, so it can (slowly) run an existing CP/M-80, and am then rewriting each of its components in 1802 assembler to speed things up.

    1. It would be interesting to see if a C128 could run this a little simpler due to the MMU’s ability to relocate zero page (and the stack?) I am referring to using the 6502 of course, and not via the Z80.

      1. Certainly a C64 or a C128 can run CPM-65 just fine. You have to write an appropriate BIOS, adapt the memory map and reassemble everything. Very straightforward- only the BIOS takes real effort. I recently ported CPM-65 on my Apple II+. Borrowed BIOS code from David Given.

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.