z80

package
v0.0.0-...-b784547 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FC byte = 0x01
	FN byte = 0x02
	FP byte = 0x04
	FX byte = 0x08
	FH byte = 0x10
	FY byte = 0x20
	FZ byte = 0x40
	FS byte = 0x80
)

The Flag registers, F and F', supply information to the user about the status of the Z80 CPU at any particular time.

7   6   5   4   3   2   1   0
S   Z   Y   H   X   P   N   C

S = sign, Z = zero, H = half carry, P = parity/overflow, N = add/substract, C = carry

X and Y flags are undocumented.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUState

type CPUState struct {
	AF, BC, DE, HL     uint16 // standard registers
	AF_, BC_, DE_, HL_ uint16 // shadow registers
	IX, IY             uint16
	PC, SP             uint16
	I, R, IM           byte
	IFF1, IFF2         bool
}

CPU state that can be loaded or saved

type IOBus

type IOBus interface {
	Read(hi, lo byte) byte
	Write(hi, lo, data byte)
}

type TCounter

type TCounter struct {
	Total   int64 // total T states since boot or hard reset
	Current int   // T states for the current frame
	// contains filtered or unexported fields
}

Provides T states counters

func (*TCounter) Add

func (tc *TCounter) Add(t int)

Add (or subtract) specified number of T states

type Z80

type Z80 struct {
	IOBus IOBus

	Reg *registers // registers

	TC   *TCounter // T states counter
	Trap func()    // traps to execute on PC address
	// contains filtered or unexported fields
}

Represents emulated Z80 Z80

func NewZ80

func NewZ80(mem memory.Memory) *Z80

Creates a new instance of the Z80 emulator.

func (*Z80) INT

func (z80 *Z80) INT(data byte)

Emulates maskable interrupt (INT)

func (*Z80) NMI

func (z80 *Z80) NMI()

Emulates non-maskable interrupt (NMI)

func (*Z80) Reset

func (z80 *Z80) Reset()

func (*Z80) Run

func (z80 *Z80) Run(limit int)

Executes the instructions until maximum number of T states is reached. (limit equal to 0 specifies unlimited number of T states to execute)

func (*Z80) State

func (z80 *Z80) State(state *CPUState)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL