2016-05-02 00:11:54 +02:00
2016-05-02 00:11:54 +02:00
2015-10-31 12:06:14 +01:00
2016-05-02 00:11:54 +02:00

Zilog Z80 CPU Emulator

Copyright © 1999-2016 Manuel Sainz de Baranda y Goñi.
Released under the terms of the GNU General Public License v3.

This is a very accurate Z80 emulator I wrote many years ago. It has been used in several machine emulators by other people and has been extensivelly tested. It is very fast and small (although there are faster ones written in assembly), its structure is very clear and the code is commented.

If you are looking for an accurate Zilog Z80 CPU emulator for your project maybe you have found the correct one. I use this core in the ZX Spectrum emulator I started as hobby.

In order to compile you must install Z, its only dependency, a header only library which provides types, macros, inline functions, and a lot of facilities to detect the particularities of the compiler and the target system.

API

z80_run

Description
Runs the core for the given amount of cycles.

Declaration

zsize z80_run(Z80 *object, zsize cycles);

Parameters

Name Description
object A pointer to an emulator instance.
cycles The number of cycles to be executed.

Return value
The actual number of cycles executed.

Discusion
Given the fact that one Z80 instruction needs between 4 and 23 cycles to be executed, it is not always possible to run the core the exact number of cycles specfified.

z80_power

Description
Switchs the core power status.

Declaration

void z80_power(Z80 *object, zboolean state);

Parameters

Name Description
object A pointer to an emulator instance.
state ON / OFF

Return value
none.

z80_reset

Description
Resets the core by reinitializing its variables and sets its registers to the state they would be in a real Z80 CPU after a pulse in the RESET line.

Declaration

void z80_reset(Z80 *object);

Parameters

Name Description
object A pointer to an emulator instance.

Return value
none.

z80_nmi

Description
Performs a non-maskable interrupt. This is equivalent to a pulse in the NMI line of a real Z80 CPU.

Declaration

void z80_nmi(Z80 *object);

Parameters

Name Description
object A pointer to an emulator instance.

Return value
none.

z80_int

Description
Switchs the state of the maskable interrupt. This is equivalent to a change in the INT line of a real Z80 CPU.

Declaration

void z80_int(Z80 *object, zboolean state);

Parameters

Name Description
object A pointer to an emulator instance.
state ON = set line high, OFF = set line low

Return value
none.

History

  • v1.0.0 (2016-05-01)
    • Initial release.
Description
No description provided
Readme 510 KiB
Languages
C 89.8%
CMake 10.2%