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 👍
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.
Version 4.0.0 onwards of the emulator require Java 17 or above
<!-- https://mvnrepository.com/artifact/com.codingrodent.microprocessor/Z80Processor -->
<dependency>
<groupId>com.codingrodent.microprocessor</groupId>
<artifactId>Z80Processor</artifactId>
<version>4.2.0</version>
</dependency>
// https://mvnrepository.com/artifact/com.codingrodent.microprocessor/Z80Processor
compile group: 'com.codingrodent.microprocessor', name: 'Z80Processor', version: '4.2.0'
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.
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.