/Z80Processor

A Zilog Z80 Processor Emulator in Java

Primary LanguageJavaApache License 2.0Apache-2.0

CodeQL Java CI with Gradle License: MIT Maven Central

Z80 Processor in Java

Z80Processor is a an implementation of the Mostek / Zilog Z80 processor in Java

The code is not designed to be nice / clean / compact - however it is designed to be fast and easily checkable with every instruction on its own switch / case statement.

If you are looking for a compact implementation, have a look at the Go implementation here

It code has been heavily profiled using Yourkit while running 'real' applications to identify hotspots.

If you find this project useful, you may want to Buy me a Coffee! Thanks 👍

Build

Windows

gradlew clean build test

Linux

./gradlew clean build test

The build may take a few minutes as it includes a comprehensive test suite for the Z80 instruction set.

Java Version

Version 4.0.0 onwards of the emulator require Java 17 or above

Include Using Maven

<!-- https://mvnrepository.com/artifact/com.codingrodent.microprocessor/Z80Processor -->
<dependency>
    <groupId>com.codingrodent.microprocessor</groupId>
    <artifactId>Z80Processor</artifactId>
    <version>4.2.0</version>
</dependency>

Include Using Gradle

// https://mvnrepository.com/artifact/com.codingrodent.microprocessor/Z80Processor
compile group: 'com.codingrodent.microprocessor', name: 'Z80Processor', version: '4.2.0'

Undocumented instruction

The code attempts to faithfully reproduce the numerous undocumented instructions in the Z80. I have tested against a real device but if you find any issues, let me know.

How to make a machine

To make a machine you need three components, the CPU, Memory and I/O. To see a simple example, look at the test in Z80CoreTest.java.