85 lines
2.9 KiB
Plaintext
85 lines
2.9 KiB
Plaintext
______ ______ ______
|
|
/\___ \ /\ __ \/\ __ \
|
|
\/__/ /_\ \ __ \ \ \/\ \
|
|
/\_____\ \_____\ \_____\
|
|
Zilog \/_____/\/_____/\/_____/ CPU Emulator v0.1
|
|
Copyright (C) 1999-2018 Manuel Sainz de Baranda y Goñi <manuel@zxe.io>
|
|
|
|
This is a Zilog Z80 CPU emulator that I wrote many years ago. It is fast, small,
|
|
easy to understand, and the code is profusely commented.
|
|
|
|
|
|
Building
|
|
========
|
|
|
|
You must first install Z <http://zeta.st>, a header-only library that provides
|
|
types and macros. This is the only dependency, the emulator does not use the C
|
|
standard library or its headers. Then add Z80.h and Z80.c to your project and
|
|
configure its build system so that CPU_Z80_STATIC and CPU_Z80_USE_LOCAL_HEADER
|
|
are predefined when compiling the sources.
|
|
|
|
If you preffer to build the emulator as a library, you can use premake4:
|
|
|
|
$ cd building
|
|
$ premake4 gmake # generate Makefile
|
|
$ make help # list available targets
|
|
$ make [config=<configuration>] [target] # build the emulator
|
|
|
|
There is also an Xcode project in "development/Xcode" with several targets:
|
|
|
|
Z80 (dynamic)
|
|
Shared library.
|
|
|
|
Z80 (dynamic module)
|
|
Shared library with a generic module ABI to be used in modular multi-machine
|
|
emulators.
|
|
|
|
Z80 (static)
|
|
Static library.
|
|
|
|
Z80 (static module)
|
|
Static library with a generic CPU emulator ABI to be used in monolithic
|
|
multi-machine emulators.
|
|
|
|
|
|
Code configuration
|
|
==================
|
|
|
|
There are some predefined macros that control the compilation:
|
|
|
|
CPU_Z80_DEPENDENCIES_H
|
|
If defined, it replaces the inclusion of any external header with this one.
|
|
If you don't want to use Z, you can provide your own header with the types
|
|
and macros used by the emulator.
|
|
|
|
CPU_Z80_HIDE_ABI
|
|
Makes the generic CPU emulator ABI private.
|
|
|
|
CPU_Z80_HIDE_API
|
|
Makes the public functions private.
|
|
|
|
CPU_Z80_STATIC
|
|
You need to define this to compile or use the emulator as a static library
|
|
or if you have added Z80.h and Z80.c to your project.
|
|
|
|
CPU_Z80_USE_LOCAL_HEADER
|
|
Use this if you have imported Z80.h and Z80.c to your project. Z80.c will
|
|
#include "Z80.h" instead of <emulation/CPU/Z80.h>.
|
|
|
|
CPU_Z80_WITH_ABI
|
|
Builds the generic CPU emulator ABI and declares its prototype in Z80.h.
|
|
|
|
CPU_Z80_WITH_MODULE_ABI
|
|
Builds the generic module ABI. This macro also enables CPU_Z80_WITH_ABI, so
|
|
the generic CPU emulator ABI will be built too. This option is intended to
|
|
be used when building a true module loadable at runtime with dlopen(),
|
|
LoadLibrary() or similar. The ABI module can be accessed via the weak symbol
|
|
__module_abi__.
|
|
|
|
|
|
Use in Proprietary Software
|
|
===========================
|
|
|
|
This library is released under the terms of the GNU General Public License v3,
|
|
but I can license it for non-free/propietary projects if you contact me.
|