/z80

A Z80 Processor Emulator In Go. It covers all instructions including undocument, and accurately emulates unused bits in the flag register

Primary LanguageGoMIT LicenseMIT

Z80 Processor in Go / Golang

build CodeQL License: MIT

This is an implementation of the Mostek / Zilog Z80 processor NMOS version in Go

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

How to use

Get the library

Add this:

go get  github.com/codesqueak/z80@v1.2.0 

In project code

Add this (depending on what bits you need)

import (
	"github.com/codesqueak/z80/processor/pkg"
	"github.com/codesqueak/z80/processor/pkg/hw"
)

github.com/codesqueak/z80/processor/pkg - contains processor methods

github.com/codesqueak/z80/processor/pkg/hw - contains interface definitions for Memory and I/O

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 core_instructions_test.go.