target-cpm

Guides z88dk CP/M target builds across classic and newlib C libraries.

1.1k|206|Updated Mar 16, 2016
One-click install
npx skills add https://github.com/z88dk/z88dk --skill target-cpm-z88dk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: target-cpm
Source: https://github.com/z88dk/z88dk/tree/main/.agents/skills/target-cpm
Command: npx skills add https://github.com/z88dk/z88dk --skill target-cpm-z88dk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building CP/M programs with z88dk involves confusing choices between classic and newlib C libraries, CPU variants (8080/8085/Z180), and over 100 machine subtypes, and mixing the two library cores causes broken binaries. ## Core Features & Use Cases - Classic vs Newlib Selection: Distinguishes the two CP/M library worlds, their CRTs, headers, and disk I/O stacks, and enforces the rule of one open owner per binary. - Subtype and CPU Guidance: Explains that subtypes are mostly packaging options (.com output via -Cz+cpmdisk), while some subtypes force specific CPU or clib settings. - Use Case: You need to compile a hello-world program for an 8085-based CP/M machine; the Skill directs you to zcc +cpm -clib=8085 -vn hi.c -o hi -create-app and warns that 8085 CP/M has no newlib product. ## Quick Start Ask the assistant to compile a C file for the z88dk +cpm target and specify whether you want the classic or newlib library.

Frequently Asked Questions about target-cpm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compile a C program for CP/M with z88dk?

Use zcc with the +cpm target, for example `zcc +cpm -vn hi.c -o hi -create-app`, which builds a classic Z80 binary and packages it as a .com file. Add `-clib=new` or `-clib=sdcc_iy` for newlib builds.

What is the difference between classic and newlib CP/M libraries in z88dk?

Classic is the default with its own CRT, headers, and FCB fcntl disk support across multiple CPUs including 8080 and 8085. Newlib (`-clib=new`, sdcc_ix/sdcc_iy) uses a different CRT and header tree and supports Z80-class CPUs only.

Can I use newlib for an 8085 CP/M target?

No. 8085 CP/M is classic-only; newlib supports Z80-class CPUs only. Use `-clib=8085` for 8085 machines, which links the cpm8085_clib library.

Why does my CP/M binary fail when mixing classic and newlib code?

Classic fcntl and newlib file handling each own the `open` implementation, so linking both into one binary causes conflicts. Keep one `open` owner per binary as documented in libsrc/target/cpm/README-mixed-tree.md.

What do z88dk CP/M subtypes actually do?

Subtypes are mostly disk and packaging options (e.g. `-Cz+cpmdisk`, .com output), not newlib selectors. Some subtypes force a specific CPU or clib, so check the subtype line in lib/config/cpm.cfg or run `zcc +cpm -h`.