Skip to content

Introduction

DCC C Compiler is an open source C compiler for CP/M 2.2 on the Z80. It supports C89 plus CP/M-relevant C99/C11 features. For every source file it accepts, the DCC C Compiler translates the .c file to M80 assembly; M80 assembles the result, and L80 links it into a CP/M .COM program.

The DCC C Compiler runs on Windows, macOS, and Linux, but the programs it builds run under CP/M. The ntvcm emulator and other popular CP/M Z80 emulators run those programs, as do real Z80 CP/M 2.2 and 3.0 systems.

DCC C Compiler banner

Integrated VS Code debugging

Debug DCC programs directly in Visual Studio Code with source breakpoints, source and instruction stepping, call stacks, variables and watches, memory inspection, and linked Z80 disassembly. See VS Code debugging for setup and usage.

DCC source debugging in VS Code with a breakpoint, local variables, Z80 registers, call stack, and debug controls

This manual describes the language accepted by the DCC C Compiler, the runtime library, and the build path from C source to .COM file.

Runtime

DCCRTL.MAC is the runtime. It is Z80 assembly in M80/L80 syntax. It supplies:

  • the start entry point, which sets up the heap and calls main,
  • command-line parsing for argc and argv,
  • the supported C library routines,
  • integer and floating-point helpers used by generated code.

Normal builds trim the runtime before linking. Unused routines are left out of the final .COM file. The build steps are shown in Building and linking; the trimming details are in the dccrtlstrip appendix.

Single source of truth

Functions that are declared in the standard headers but are not part of the linked runtime are called out explicitly in Limitations so a missing function never surprises you at link time.

Performance Snapshot

The chart compares .COM programs produced by the DCC C Compiler with CP/M-era and modern CP/M-targeting compilers. Times come from ntvcm -p cycle counts converted to the emulator's approx ms at 4Mhz value for Z80-mode runs. Sizes are CP/M file sizes rounded to 128-byte records. Lower is better for ms and bytes.

CP/M 2.2 benchmark comparison

The benchmark names are the test programs: strings and memory (tstring), sieve, digits of e, allocation (tm), tic-tac-toe (ttt), hexadecimal pi digits (pihex), and matrix multiply (mm). Rows labelled xcomp are DCC C Compiler output before dccpeep; rows labelled dccpeep optimized are after the optimizer pass.

Engineering Notes

DCC C Compiler was engineered agentically using VS Code GitHub Copilot and Claude Code for VS Code, with plenty of human intelligence, supervision, experience, and patience. It is unit tested against baselines grounded in modern C compilers and a platform-appropriate subset of the community-driven c-testsuite.

Contributions and Feedback Welcome

This is an open source C compiler. Community contributions are welcome; please report issues through the project's GitHub Issues page.

Star the Repository

If the DCC C Compiler is useful to you, please consider starring the GitHub repository. It helps other CP/M and Z80 developers find the project.