library-classic

Guides z88dk classic library development across multi-CPU targets with newlib isolation rules.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working in the z88dk classic library tree risks mixing classic and newlib stdio/fcntl cores, breaking 8080/8085 builds with Z80-only code, or misconfiguring console I/O on hybrid CRTs. This Skill encodes the hard rules and proven patterns that prevent those failures. ## Core Features & Use Cases - Classic vs newlib separation: Enforces list-based (*.lst) ownership isolation so classic 8080/8085/gbz80 images never pull Z80-only newlib objects. - Console I/O guidance: Documents fgets_cons cooked line input, FILE init flags (18/20), and why getline is newlib-only. - Hybrid CRT traps: Covers dual-port ttyin macro pitfalls, CP/M IOBYTE seeding, and include-order requirements for hybrid builds. - Use Case: When adding an 8085 target or debugging a hybrid rc2014-8085 console where the first getchar returns NUL, apply these rules to fix FILE flags and keep clib lists clean. ## Quick Start Ask the assistant to review your classic clib target changes using the library-classic rules before building an 8085 image.

Frequently Asked Questions about library-classic

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

FAQPage Schema
How do I implement line input on z88dk classic targets?

Use fgets on stdin, which routes to fgets_cons providing echo, DEL handling, and an optional soft cursor. The classic library has no getline; that POSIX API is newlib-only, so never expect it on 8080 or 8085 classic products.

What is the difference between z88dk classic and newlib libraries?

Classic lives in libsrc/target and libsrc/classic, supports Z80, 8080, 8085, and gbz80, and produces *_clib.lib files. Newlib is Z80-class only, selected with -clib=new, and uses console_01 with getline/getdelim for cooked input.

Can I link newlib stdio into an 8085 classic image?

No. Classic 8080/8085 images must never pull newlib objects because they contain Z80-only opcodes and calling conventions. Isolation is enforced through *.lst list ownership, never broad globs over mixed target trees.

Why does the first getchar return NUL on a hybrid classic CRT?

The FILE initialization flags are wrong. Classic expects flags 18 and 20 (_IOSYSTEM|_IOREAD and _IOWRITE); values 19 or 21 add a spurious _IOUNGETC bit that corrupts the first read on hybrid consoles.

Does assigning input = ttyin create a second serial port on classic?

No. On classic hybrids, ttyin and ttyout are macros mapping to _sgoioblk slots, not real streams. A second cooked port requires CRT initialization of that slot and a driver path, or an active-console global in fgetc_cons.