libz80 is a simple and clean Z80 emulation library. It is developed on Linux but is written in pure ANSI C, so it
should be easy to port to other platforms.
It's intended to be part of bigger emulation projects, such as a Gameboy emulator. Therefore, it doesn't have an
user interface, but it's flexible enough to use it in a wide range of applications. For example, all I/O is done
through user-supplied functions which emulate the data bus and whatever hardware is outside.
This library is released under the GPL license. Basically, it means you can do whatever you want with it, except
claiming that you wrote it (that is, you don't have the copyright). It also means it is free and will continue to
be free. Finally, if you use it in your projects, these projects must be GPL too.
History of the emulator
I first wrote a Z80 emulator in 1999, as part of the emulation of an educational computer we were using at
my university. The emulator is currently being used in many courses there. As
a side note, the university itself has never ever said something like "thanks" (on the other hand, the teachers who
are using it did acknowledge my efforts :) ). Anyway, that emulator
(let's call it 1.0) was writen in C++ and wasn't extremely fast (it was, however, pretty accurate).
I'm ashamed to say this, but it's the truth - that emulator runs in Windows. Three years later, I've found the
time and motivation to correct that terrible mistake, so I decided to port it to Linux and make it open source. As
it happens when you read old code, I quickly decided that it would be better to do a total rewrite.
Extensibility
This time, the approach is much smarter (at least, I want to think that!). All the decode tables and the
implementation of the opcodes is automatically generated from an opcode table and a specification table consisting
in regular expressions and C-code templates. This has two benefits; first, there are less manually-written lines
of code to make mistakes in; second, it makes *very* easy to add or modify opcodes. Even the prefixes tree is
automatically generated from the opcodes list. So it should be very easy to modify the input files to emulate
other similar processors (Z180?) or maybe even different processors.
Download
You can download libz80 from the project page at
SourceForge.
The current version is 1.99. It's the full rewrite. When enough people test it and the [hopefully] few bugs are
removed, it will be 2.0.
Final notes
The source code is doxygen-friendly, so you can generate the documentation directly from the sources.