Documentation
¶
Overview ¶
Package z80 emulates Zilog's Z80 CPU.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBreakPoint = errors.New("break point reached")
ErrBreakPoint shows PC is reached to one of break points.
Functions ¶
This section is empty.
Types ¶
type CPU ¶
type CPU struct { States Memory Memory IO IO // RETNHandle is called when CPU execute a RETN op. RETNHandler RETNHandler // RETIHandle is called when CPU execute a RETI op. RETIHandler RETIHandler // Interrupt is a signal to interrupt. When you set non-nil value, then // CPU.Step and CPU.Run treat it as one of Z80 interruptions. Interrupt *Interrupt BreakPoints map[uint16]struct{} // HALT indicates whether the last Run() is terminated with HALT op. HALT bool }
CPU is the core of Z80 emulator.
type DumbMemory ¶
type DumbMemory []uint8
DumbMemory provides Memory interface as wrapper of []uint8
func (DumbMemory) Get ¶
func (dm DumbMemory) Get(addr uint16) uint8
Get gets a byte at addr of memory.
func (DumbMemory) Put ¶
func (dm DumbMemory) Put(addr uint16, data ...uint8) DumbMemory
Put puts "data" block from addr.
func (DumbMemory) Set ¶
func (dm DumbMemory) Set(addr uint16, value uint8)
Set sets a byte at addr of memory.
type Flag ¶ added in v0.10.1
type Flag uint8
Flag is the flag value used for GetFlag etc. Each value can be combined with the OR (|) operator.
const ( FlagC Flag = 0x01 // FlagC is carry flag. FlagN Flag = 0x02 // FlagN is subtract flag. FlagPV Flag = 0x04 // FlagPV is parity/overflow flag. FlagH Flag = 0x10 // FlagH is half carry flag. FlagZ Flag = 0x40 // FlagZ is zero flag. FlagS Flag = 0x80 // FlagS is sign flag. Flag3 Flag = 0x08 // Flag3 is undefined flag, at 3rd from LSB. Flag5 Flag = 0x20 // Flag5 is undefined flag, at 5th from LSB. )
type GPR ¶
GPR is general purpose reigsters, pair of four registers AF, BC, DE and HL.
func (GPR) GetFlag ¶ added in v0.10.1
GetFlag gets a flag status. For available flags, see Flag type. When multiple flags are combined, if any one of them is true, this returns true.
type INT ¶
type INT interface { // CheckINT should return valid interruption data if maskable interruption // made. The data is used for interruption codes or as a vector depending // on interruption mode. CheckINT() []uint8 // ReturnINT is called when "RETI" op is executed. ReturnINT() }
INT is interface for maskable interrupt.
type Interrupt ¶ added in v0.10.0
type Interrupt struct { Type InterruptType Data []uint8 }
Interrupt is interruption signal. Put a point of Interrupt to CPU.Interrupt, when you want to make an interrupt.
func IM0Interrupt ¶ added in v0.10.0
IM0Interrupt creates an Interrupt object for IM0.
func IM1Interrupt ¶ added in v0.10.0
func IM1Interrupt() *Interrupt
IM1Interrupt creates an Interrupt object for IM1.
func IM2Interrupt ¶ added in v0.10.0
IM2Interrupt creates an Interrupt object for IM2.
func NMIInterrupt ¶ added in v0.10.0
func NMIInterrupt() *Interrupt
NMIInterrupt creates a Interrupt objct for NMI.
type InterruptType ¶ added in v0.10.0
type InterruptType int
InterruptType is type of interruption.
const ( // NMIType is a type of NMI interruption. NMIType InterruptType = iota // IMType is a type of normal interruptions. IMType )
type MapMemory ¶
MapMemory implements Memory interface with a map.
type NMI ¶
type NMI interface { // CheckNMI should return true if non-maskable interruption made. CheckNMI() bool // ReturnNMI is called when "RETN" op is executed. ReturnNMI() }
NMI is interruption for non-maskable interrupt.
type RETIHandler ¶ added in v0.10.0
type RETIHandler interface {
RETIHandle()
}
RETIHandler will be called before execute RETI opcode.
type RETNHandler ¶ added in v0.10.0
type RETNHandler interface {
RETNHandle()
}
RETNHandler will be called before execute RETN opcode.
type Register ¶
Register is 16 bits register.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
tinycpm
Package tinycpm provides minimal CP/M compatible BIOS to run Z80 Exerciser tests.
|
Package tinycpm provides minimal CP/M compatible BIOS to run Z80 Exerciser tests. |
zex
Package zex provides test cases of Z80 Exerciser.
|
Package zex provides test cases of Z80 Exerciser. |