13

Building my own version of CP/M has always been a fascinating to-do project. Problem is that it seems that the source code is not in regular assembler, but some kind of macro-assembler like language Gary Kildall developed to ease CP/M maintenance, so:

Is there a toolchain and documented workflow that I can use to customize my own version of CP/M (both BIOS and BDOS)? Is the CP/M source code available in regular Z80 assembler (I'm most used to Z80 nmemonics than 8080's)

To clarify things, I'm looking for something like: grab this well-commented ASM source code, modify it, assemble it with PASMO (or SjASM or any other available Z80 assembler) to have a pure binary file with BIOS/BDOS/whatever. And if possible, CP/M Plus.

NOTE: I'm aware that after getting my binary, I would need some custom tools to put it in the boot sector of whatever media I use to boot the machine, but I'm not asking for that part of the workflow.

  • 2
    Some of the CP/M code is actually written in PLM, a "close-to-C and close-to-asm" language. Compilers for this language are actually available (I think that is what you are referring to as "some kind of mactro-assembler"). If you look here, cpm.z80.de/download/cpm2-asm.zip you will find a pretty well documented z80 source code disassembly of CP/M 2.2 - To my knowledge, DR never released any Z80 sources for 2.2 themselves – tofro Jun 2 '16 at 16:26
  • I'm afraid that is not Z80 assembly code, but 8080's. Besides, I'm looking towards CP/M Plus, so I can add memory banking. – mcleod_ideafix Jun 2 '16 at 22:21
  • Then you didn't look hard enough - One of the disassemblies is definitively Z80 (there's a .z80 file in the zip). But also definitely not CP/M3... – tofro Jun 3 '16 at 6:58
  • Oh! I thought the .z80 was some sort of snapshot (I'm most used to see that extension applied to a specific kind of ZX Spectrum snapshot :D ) – mcleod_ideafix Jun 3 '16 at 8:51
5

This page has quite a few variants of the source code, including compilers for PL/M, including Z80 variants, and including source marked as copyrighted by Digital Research.

There's no documented workflow to build your own system from that, and it probably needs quite a bit of fiddling, especially the PL/M part (if you manage to do it, a writeup would be nice). But at first glance, everything you need should be there.

Edit: Here is an article that describes how to modify CP/M 2.2 to set it up for a new computer. It references two other writeups on the same subject, here and here, and the latter uses a CP/M 2.2 source converted to Z80-style using an awk script.

Setting CP/M up for a new computer doesn't require recompiling the PL/M utility programs, but maybe the Z80-style source and the writeups themselves are helpful.

3

There are a few bios projects circling around the Z80 SBC homebrew scene that grew out of Andrew Lynch's N8___ computer project (name redacted as Andrew no longer wishes his radio call sign associated with the projects). I've found the developers to be exceptionally helpful when I was cluelessly building my Zeta SBC V2 (which, incidentally, has RAM banking galore, should you wish to build hardware).

The BIOS/BDOS projects include the RomWBW Firmware and UNA BIOS.

3

If you want to build CP/M Plus, the second and third links in the "CP/M 3" section at www.cpm.z80.de contain the CP/M 3 source tree and build scripts, for cross-compiling under DRDOS (second link) or UNIX (third link).

In the case of the UNIX one in particular, it should just be a matter of installing ZXCC and Thames, unpacking the source tree and typing 'make'.

3

Another option to build CP/M 2.2 is to build the sources inside a Z80 emulator as described on the z80pack site. I tried this with z80pack version 1.28:

Install the CP/M source disk images inside z80pack. Modify the cpm22src shell script:

  • change .cpm to .dsk
  • replace ./format c with mkfs.cpm disks/drivec.dsk, same for d (you need cpmtools).

Build process:

$ ./cpm22src
A>submit cmd1
A>submit cmd3
A>submit cmd4
A>submit cmd5
A>submit kernel-s

Running movcpm directly fails, so you do the workaround:

A>ddt d:movcpm.com
DDT VERS 2.2
NEXT  PC
2700 0100
-s234
0234 C2 0
0235 5A 0
0236 02 0
0237 02 .
-s2cb
02CB C2 0
02CC 5A 0
02CD 02 0
02CE 23 .
-i64 *
-g
CONSTRUCTING 64k CP/M vers 2.2
READY FOR "SYSGEN" OR
"SAVE 34 CPM64.COM"
A>save 34 d:cpm64.sys
A>d:sysgen d:cpm64.sys
SYSGEN VER 2.0
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)d
DESTINATION ON D, THEN TYPE RETURN
FUNCTION COMPLETE
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)

A>bye

Now move the disk image d to a, and boot again:

$ rm disks/drive[ab].dsk
$ mv disks/drived.dsk disks/drivea.dsk
$ ./cpmsim

There were error messages in the build process, at least some of which appear to be benign. I haven't verified any functions in the new system except that it boots, so there may very well be some problems to fix.

I also tried the two versions of the PL/M cross compiler. They compile fine under GNU Fortran, but fail on the PL/M sources for CP/M, so there appear to be some differences in the language variant used.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.