Skip to content
suborb edited this page Mar 16, 2024 · 35 revisions

An Introduction to Z88DK

Z88DK is a complete development toolkit for the 8080, 8085, gbz80, z80, z180, z80n, kc160 and Rabbit processors.

It contains two C compilers, an assembler / linker / librarian, data compression tools and a utility for processing the raw binaries into forms needed by specific targets.

It comes with an extensive library of functions written in assembly language that implements the C standard and many extensions. It holds the largest repository of z80 code on the internet.

Development in assembly language or C is completely integrated; projects can be 100% assembler, 100% C or any mixture of the two. The toolset treats both as first-class languages and is designed to make it very easy to mix them at will with C and asm functions being able to call each other or make use of the hand-optimized library functions.

The toolset is modern and has modern features. Most z80 assembly tools are simple in that they assume a small memory space (confined to 64k) or lack linking capability. Z88DK is able to generate ROMable code and code for multiple memory banks (bank assignment still requires human direction) and the linking capability means large bodies of code or data can be shared in libraries between projects with the linker only drawing out code and data that is actually used by the program being linked.

We compare Z88DK with other commercial and non-commercial offerings using benchmarks to identify where Z88DK can be improved. Z88DK compares favourably and you can see that for yourself by investigating the benchmarks if you are interested.

Libraries

z88dk supports two different library implementations, they are being slowly merged and much of the standard C library is now shared between the implementations.

Classic library

The classic library is z88dk's traditional library and is written with in a mix of assembler and C.

Supported Platforms

The classic library supports over 100 platforms and provides many extensions (graphics, sound etc) as well as broadly supporting the C library standard.

Newlib

The new C library aims to implement as large a subset of C11 as is reasonable on an 8-bit target. The library does not confine itself to the standard and adds many non-standard functions drawn from BSD and GNU, as well as libraries aiming to support text, graphics and sound among other things. The library is slowly being merged into the classic library.

Supported Platforms

The new library supports a restricted number of targets, and notably doesn't (yet) support file I/O. The supported targets are: +cpm, +hbios, +rc2014, +scz180, +sms, +yaz180, +z80, +z180, +zx, +zxn

Tools

This is a quick overview of the tools included in Z88DK.

  • zcc is the toolchain's front end. zcc can generate an output binary out of any set of input source files.

  • z88dk-scc80 is z88dk's native c compiler. sccz80 is derived from small c but has seen much development to the point that it is nearly c89 compliant as well features from later standards.

  • z88dk-zsdcc is z88dk's customization of the sdcc optimizing c compiler. Our patch makes sdcc compatible with the z88dk toolchain, gives it access to z88dk's extensive assembly language libraries and ready-made crts, addresses some of sdcc's code generation bugs and improves on sdcc's generated code. It has very good standards compliance with c89, some c99 and a little c11.

  • z88dk-z80asm (not to be confused with several external projects called z80asm) is a fully featured assembler / linker / librarian implementing sections.

  • z88dk-z80nm is z80asm's companion library dumper. It can provide a listing of functions or data encoded in an object or library file.

  • z88dk-zobjcopy allows object and library files built by Z80ASM to be manipulated.

  • z88dk-appmake processes the raw binaries generated by the toolkit into a form suitable for specific target machines. For example, it can generate intel hex files, tapes, ROMs, disc images etc.

  • z88dk-ticks is a command line z80 emulator and debugger that can be used to time execution speed of code fragments.

  • z88dk-gdb provides the debugger interface from ticks and connects to a gdbserver to permit line-by-line debugging of software in emulators or on real hardware.

  • z88dk-dis is a command line disassembler for 8080, 8085, gbz80, Z80, Z180, Z80N, R800, KC160 and Rabbit 2000/3000/4000. It can additionally read map files generated by z80asm to provide a more symbolic output.

  • z88dk-lib is an installer for third party libraries. It manages installation, removal and listing of available libraries.

  • z88dk0-zx0 and z88dk-zx7 are PC side data compression tools with companion decompression functions in the z80 library.

  • z88dk-dzx0 and z88dk-dzx7 are PC-side decompressor counterparts to the z88dk-zx0 and z88dk-zx7.

These tools are not normally directly invoked by the user:

  • m4 acts as z88dk's macro preprocessor and can optionally process files ahead of the c preprocessor or assembler.

  • z88dk-ucpp is the c preprocessor invoked for sccz80 and for zsdcc.

  • z88dk-zpragma is used by the toolchain to process pragmas embedded in c source.

  • z88dk-copt is a regular expression engine that is used as peephole optimizer for sccz80 and as a post-processing tool for both sccz80 and zsdcc.

Clone this wiki locally