z80

package
v0.0.0-...-20a4c11 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 4 Imported by: 0

README

z80

zex_test.go

The Z80 Instruction Exerciser written by Frank D. Cringle.

Source code used to run the tests are not found in this repository. Download and place in the following location:

~/rcs/ext/zex/zexdoc.com

The original location of the exerciser seems to be here:

The sources found in the resource pack were downloaded from:

Helpful references:

Run the functional test with:

go test -v -tags=ext -timeout 60m

Run the benchmarks with:

go test -run=X -tags=ext -bench=.

Documentation

Overview

Package z80 is the Zilog Z80 processor.

Index

Constants

View Source
const (
	// FlagC is the carry flag
	FlagC = uint8(1 << 0)

	// FlagN is set after subtraction
	FlagN = uint8(1 << 1)

	// FlagV is the overflow flag (also parity)
	FlagV = uint8(1 << 2)

	// FlagP is the parity flag (also overflow)
	FlagP = uint8(1 << 2)

	// Flag3 is undefined
	Flag3 = uint8(1 << 3)

	// FlagH is the half-carry flag
	FlagH = uint8(1 << 4)

	// Flag5 is undefined
	Flag5 = uint8(1 << 5)

	// FlagZ is the zero flag
	FlagZ = uint8(1 << 6)

	// FlagS is the sign flag
	FlagS = uint8(1 << 7)
)

Variables

This section is empty.

Functions

func Formatter

func Formatter() rcs.CodeFormatter

func NewDisassembler

func NewDisassembler(mem *rcs.Memory) *rcs.Disassembler

func Reader

func Reader(e rcs.StmtEval)

Types

type CPU

type CPU struct {
	Name string

	A uint8 // Accumulator
	F uint8 // Flags
	B uint8
	C uint8
	D uint8
	E uint8
	H uint8
	L uint8

	A1 uint8 // Shadow registers
	F1 uint8
	B1 uint8
	C1 uint8
	D1 uint8
	E1 uint8
	H1 uint8
	L1 uint8

	I   uint8 // Interrupt vector base
	R   uint8 // DRAM refresh counter
	IXH uint8
	IXL uint8
	IYH uint8
	IYL uint8
	SP  uint16 // Stack pointer

	IFF1 bool // Interrupt flip flops
	IFF2 bool
	IM   uint8 // Interrupt mode
	Halt bool  // Halted by instruction

	Ports   *rcs.Memory
	IRQ     bool
	IRQData uint8
	NMI     bool
	RESET   bool

	WatchIRQ bool
	// contains filtered or unexported fields
}

CPU is the Zilog Z80 processor.

func New

func New(mem *rcs.Memory) *CPU

func (*CPU) Load

func (c *CPU) Load(dec *rcs.Decoder)

func (*CPU) Memory

func (c *CPU) Memory() *rcs.Memory

Memory is the memory that can been seen by this CPU.

func (*CPU) NewDisassembler

func (c *CPU) NewDisassembler() *rcs.Disassembler

NewDisassembler creates a disassembler that can handle Z80 machine code.

func (*CPU) Next

func (c *CPU) Next()

func (*CPU) Offset

func (c *CPU) Offset() int

Offset is the value to be added to the program counter to get the address of the next instruction. The value is 0 for this CPU since the program counter is incremented after fetching the opcode.

func (*CPU) PC

func (c *CPU) PC() int

PC returns the value of the program counter.

func (*CPU) Save

func (c *CPU) Save(enc *rcs.Encoder)

func (*CPU) SetPC

func (c *CPU) SetPC(pc int)

SetPC sets the value of the program counter.

func (*CPU) String

func (c *CPU) String() string

Jump to

Keyboard shortcuts

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