CP/M-386 – CP/M for 386 protected mode, derived from CP/M‑68K

Aug 03, 2026 07:38 AM - 4 hours ago 3

CP/M‑386 is CP/M for 386 protected mode, derived from CP/M‑68K.


  • Overview
  • Hardware support
  • CP/M compatibility
  • Build requirements
  • Downloads
  • Compilation
  • Build output
  • QEMU testing
  • QEMU notes
  • Included utilities
  • Contributing
  • Future plans
  • Code statistics
  • Mirrors
  • License

CP/M‑386 is presently successful the very early improvement stages.

  • Full 32‑bit protected mode implementation with Ring‑3 TPA.
  • Bootable via 3.5" 1.44MB floppy disk MBR aliases GRUB Multiboot kernel.
  • Supports VGA text (0xB8000) and/or COM1 serial (9600/N/8/1, 0x3F8) consoles.
  • No floppy/hard disk/CD/USB/network/sound/other drivers (yet).
  • Compatible pinch 386 (and later systems) pinch 2MB (or more) memory.
  • Systems utilizing either PC BIOS aliases UEFI (with CSM) are supported.
  • VGA, 8042 PS/2, 8250/16450/16550 UART, CMOS RTC, and 8253/8254 PIT are supported.

CP/M‑386 should beryllium highly source‑compatible pinch different implementations:

System BDOS coverage
CP/M‑68K 1.3 100%
CP/M 2.2 100%
CP/M‑Plus 71%
DOS‑Plus 62%
MP/M 2.1 50%

The strategy presently reports BDOS 2.2 to applications.

  • The CP/M‑386 BDOS is astatine afloat parity pinch CP/M‑68K 1.3 and CP/M 2.2.
  • A ample mostly of the CP/M‑Plus (CP/M 3) BDOS is also supported.
  • More than 60% of the DOS‑Plus additions person been implemented.
  • Approximately half of the MP/M extensions person been completed.
    • The missing functionality is mostly the multi‑user, multi‑tasking, message queuing, and process power calls that don't use to a single‑user CP/M implementation.
  • Unique CP/M‑386‑specific BDOS extensions person been added to accommodate new features for illustration nonstop video access, high‑resolution timing, PRNG, etc.

The pursuing limitations are required to compile CP/M‑386:

  • AWK
  • Cpmtools†
  • GNU Binutils
  • GNU Coreutils
  • GNU GCC aliases LLVM Clang
  • GNU Make
  • NASM
  • QEMU (required only for testing)

†Be judge to usage cpmtools type 2.23 aliases later. Older versions whitethorn appear to activity but person respective known bugs.

  • Download the current CP/M‑386 build.
  • View the GitLab CI/CD logs.

Building CP/M‑386 is supported connected existent releases of NetBSD and FreeBSD‡, and astir caller Linux distributions.

The pursuing are the minimum versions of Linux distributions that person been verified to build CP/M‑386 successfully: CentOS Stream 9, Fedora 36, Debian 12, Ubuntu 18.04 (with gcc-16 from ppa:ubuntu-toolchain-r/test), Ubuntu 22.04, Alpine 3.24, and OpenSUSE Leap 15.4.

  • GCC build (recommended):
    make -Orecurse -j "$(nproc 2> /dev/null || printf '%s' 1)" make test
  • Clang build:
    make -Orecurse -j "$(nproc 2> /dev/null || printf '%s' 1)" CC="clang"
  • It is recommended to usage GCC arsenic Clang‑compiled i386 codification is larger.
  • Be judge to make cleanable if switching compilers aliases adjusting compiler flags.
  • 32‑bit support libraries are required to tally the trial suite (make test).
  • ‡At the clip of writing, FreeBSD is shipping non‑functional cpmtools2 packages pinch surgery mkfs.cpm functionality. To successfully build connected FreeBSD, you must rebuild cpmtools and guarantee it is not linked pinch libdsk. If you person a Disc rejected by driver correction on FreeBSD from mkfs.cpm, your devices are broken and cannot beryllium utilized to build CP/M‑386.
  • The build produces 2 superior artifacts:

    File Description
    cpm386.elf Multiboot kernel image
    floppy.img Bootable 3.5" 1.44MB floppy disk image

You tin download pre‑compiled binaries above.

  • Multiboot kernel (recommended):
    qemu-system-i386 -m 2M -serial stdio -monitor nary -kernel "cpm386.elf"
  • Floppy MBR loader:
    qemu-system-i386 -m 2M -serial stdio -monitor nary -drive if=floppy,format=raw,file="floppy.img" -boot a
  • Use -nographic -display nary -vga nary to disable VGA video (and usage only serial console).
  • Use -serial nary to disable the serial UART (and usage only VGA console).
Program Description
ACLOCKDV.386 aclock (VGA matter console version)
ACLOCKVT.386 aclock (ANSI terminal version)
BIG.386 Multi‑extent loading trial executable
CLEARTPA.386 Clears (zeros) and optionally verifies the TPA
CLS.386 Clear surface (BDOS 221)
DELAY.386 Delay trial (BDOS 141)
DEMO.SUB SUBMIT demonstration
DUMPDIR.386 Directory introduction dump inferior (BDOS 17/18)
DUMPFCB.386 File power artifact dump inferior (BDOS 15)
ENV.DAT Environment information file
FPARSE.386 F_PARSE trial (BDOS 152)
GETSN.386 Display serial number (BDOS 107)
GFXTEST.386 Graphics and framebuffer demo (BDOS 229/230/231/233)
HD.386 Hex dump utility
HELLO.386 Hello world (the very first CP/M‑386 program!)
ILLEGAL.386 Ring‑3 protection and objection handler test
IOTEST.386 File I/O BDOS tests
JULIA.386 Draw a Julia group fractal (terminal version)
LRBC.386 Query and/or group Last Record Byte Count
LS.386 List files (with sizes)
MANDEL.386 Draw a Mandelbrot group fractal (terminal version)
ALVTST.386 Get Allocation Vector trial (BDOS 27)
MEM.386 Memory representation inferior (BDOS 227/228)
MORE.386 UNIX more‑style pager
OD.386 Octal dump utility
PAUSE.386 Wait for keypress
PRINTENV.386 Print situation and strategy data
PRNG.386 PRNG trial and demo inferior (BDOS 253/254)
PROFILE.SUB SUBMIT book (automatically executed astatine boot)
RC.386 Return codification trial and query (BDOS 108)
README.TXT Sample matter file
REBOOT.386 Reboot inferior (BDOS 220)
RM.386 UNIX rm‑like interactive record deletion utility
SEROFF.386 Disable serial console (BDOS 223)
SERON.386 Enable serial console (BDOS 223)
STAT.386 STAT (A larboard of Zilog CP/M‑Z8000 STAT v1.0C 01/03/84)
SYNC.386 Synchronize disks (BDOS 48)
TEST211.386 Numeric format trial (BDOS 211)
TEXTMODE.386 Query and group the console matter mode (BDOS 229/230/231)
TICKS.386 High‑resolution timer tests (BDOS 225/226)
TOD.386 Get (and set) Time of Day timepiece (BDOS 104/105)
TOUCH.386 Create an quiet file
TRUNCATE.386 File truncation inferior (LRBC aware)
TRUNCTST.386 Truncation tests (BDOS 99)
TSEC.386 Get day and clip (BDOS 155)
VER.386 Display OS type (BDOS 163)
VGAFONT.386 Load a text console font aliases reconstruct the ROM font (BDOS 232)
VGAOFF.386 Disable VGA matter console (BDOS 222)
VGAON.386 Enable VGA matter console (BDOS 222)
VGATEXT.386 VGA matter nonstop entree demo (BDOS 224)
  • Do not unfastened propulsion requests pinch ample amounts of LLM‑generated code. These will beryllium instantly rejected.
  • There is presently no AI‑generated codification successful the operating strategy astatine this time (though location are immoderate AI tests, comments, and analysis), arsenic the project is intended to beryllium arsenic overmuch of a learning acquisition for maine arsenic it is a useful OS port.
  • Usage of AI (artificial intelligence) devices by contributors is currently permitted, taxable to the aforesaid position and conditions arsenic the LLVM AI Tool Use Policy, but this support whitethorn beryllium withdrawn astatine immoderate clip and without notice.

See FUTURE.md.

Language Files Lines Blank Comment Code Complexity Bytes Uloc C 65 31160 6146 4379 20635 4356 730364 10665 C Header 22 3054 551 1233 1270 13 111663 1558 Makefile 2 1570 300 201 1069 331 52823 773 Assembly 6 1351 235 266 850 1 31040 700 Markdown 2 478 58 0 420 0 21907 378 Linker Script 2 169 34 0 135 0 3923 82 YAML 1 80 6 15 59 0 3196 63 Total 100 37862 7330 6094 24438 4701 954916 14146
  • The canonical location of this package is https://gitlab.com/johnsonjh/cpm386, with a reflector connected GitHub.
  • CP/M‑386 is distributed nether the position of the permissive MIT License.
  • Bryan W. Sparks of DRDOS, Inc. dba DeviceLogics LLC, successor in liking to Digital Research, Inc.’s CP/M assets, explicitly grants an unlimited authorization to use, distribute, modify, enhance, and otherwise make disposable CP/M technology, including the CP/M operating systems and their derivatives.
More