GitHub - Mazin-O3/cpm-neo: A CP/M-inspired operating system

GitHub

3 min read Original article ↗
CP/M Neo logo

A CP/M-inspired operating system

Try it Online GitHub Repo stars GitHub forks GitHub contributors License

cpm-neo main

What is CP/M Neo?

CP/M Neo is a small CP/M-inspired operating system, designed around simplicity, portability, and a clear separation between the operating system and platform-specific hardware.

It provides a CP/M-style command environment, filesystem, system calls, application SDK, and platform interface for different hardware platforms.

Port Status

Platform Architecture Storage XIP Status
VEMU RISC-V Emulated Yes ✅ Done
TinyMCU RISC-V — — ⏳ WIP
Blackpill (F411) ARM — — ⏳ WIP

Quick Start

CP/M Neo requires a bare-metal cross-compiler toolchain for your target architecture (arch/<isa>/config.sh supplies the toolchain prefix and flags), make, and sh.

make -C sysgen
./sysgen/build/sysgen new --disk-size=2048K --platform=vemu

Everything outputs directly to sysgen/build/:

File Purpose
disk.img Final disk image
bootloader.bin Boot image
core/int/kernel.bin kernel binary
core/int/ccp.bin Console Command Processor (CCP) binary
apps/ Bundled Apps

To clean up the build environment, run:

See the User Guide for the full build and execution walkthrough.


Features

  • CP/M-style Console Command Processor (CCP)
  • Kernel syscall interface
  • BDOS-inspired filesystem
  • Hardware-independent architecture
  • Application SDK
  • sysgen tool for building and managing disk images

The Sysgen Tool

sysgen is the host utility for building and inspecting CP/M Neo disk images. Commands other than new support appending --disk=path to target a specific image; new always writes to sysgen/build/disk.img.

Command Description
new --disk-size=KBK --platform=NAME Build the OS and create a disk image (the disk is divided into 1 KB blocks; --disk-size is capped at the useful maximum: 2 MB). NAME is the 8-char max platform id declared by ID= in a platform's config.sh; the platform provides the ISA and RAM_SIZE
add <file> [--dst=Vn] [--attr=R/W|R/O|SYS] Add an external file to an image
install <folder> [--dst=Vn] [--attr=...] Compile a source folder and install the binaries
dir [Vn] List files on a volume
type <name> [Vn] Print a file
era <name> [Vn] Delete a file
ren <old> <new> [Vn] Rename a file
stat Show volume usage and metadata

Platforms are defined in platform/<name>/: config.sh plus bios.c implementing the console and storage functions from core/kernel/bios.h.

See the Developer Guide to add your own.

Documentation Library

Document Description
User Guide Build, run, and get started
CCP Reference Console Command Processor guide
Disk Format CP/M Neo disk image layout
Syscall Reference Complete syscall API and ABI specifications
Bundled Apps Auto-installed programs
Developer Guide SDK usage, compiling applications, and adding platforms
Architecture Memory layout, boot flow, and build internals

Contributing

Contributions to CP/M Neo are welcome!

If you'd like to contribute, see CONTRIBUTING.md for more info.


License

CP/M Neo is distributed under the terms of the open-source MIT.