ZzEmu

package
v0.0.0-...-9f88477 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const FLAG_3 = 0x08
View Source
const FLAG_5 = 0x20
View Source
const FLAG_C = 0x01

The flags

View Source
const FLAG_H = 0x10
View Source
const FLAG_N = 0x02
View Source
const FLAG_P = 0x04
View Source
const FLAG_S = 0x80
View Source
const FLAG_V = FLAG_P
View Source
const FLAG_Z = 0x40

Variables

View Source
var (
	OpcodeMap     [256]func(z *Z80, opcode byte)
	OpcodeCBMap   [256]func(z *Z80, opcode byte)
	OpcodeDDMap   [256]func(z *Z80, opcode byte)
	OpcodeDDCBMap [256]func(z *Z80, opcode byte, address uint16)
	OpcodeEDMap   [256]func(z *Z80, opcode byte)
	OpcodeDFMap   [256]func(z *Z80, opcode byte)
)

Functions

This section is empty.

Types

type BufferIO

type BufferIO struct {
	// contains filtered or unexported fields
}

func NewBufferIO

func NewBufferIO(start, size uint16) *BufferIO

func (*BufferIO) Len

func (b *BufferIO) Len() int

func (*BufferIO) LenAddress

func (b *BufferIO) LenAddress(address uint16) (int, bool)

func (*BufferIO) Read

func (b *BufferIO) Read(address uint16) (byte, bool)

func (*BufferIO) ReadAll

func (b *BufferIO) ReadAll() (uint16, byte, bool)

func (*BufferIO) Valid

func (b *BufferIO) Valid(address uint16) bool

func (*BufferIO) Write

func (b *BufferIO) Write(address uint16, value byte) bool

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

func NewBuz

func NewBuz() *Bus

func (*Bus) AddIO

func (b *Bus) AddIO(name string, device DeviceInterface)

func (*Bus) AddMemory

func (b *Bus) AddMemory(name string, device DeviceInterface)

func (*Bus) GetIO

func (b *Bus) GetIO(name string) DeviceInterface

func (*Bus) GetMemory

func (b *Bus) GetMemory(name string) DeviceInterface

func (*Bus) ReadIO

func (b *Bus) ReadIO(address uint16) byte

func (*Bus) ReadMemory

func (b *Bus) ReadMemory(address uint16) byte

func (*Bus) WriteIO

func (b *Bus) WriteIO(address uint16, value byte)

func (*Bus) WriteMemory

func (b *Bus) WriteMemory(address uint16, value byte)

type Console

type Console struct {
	CPU *Z80
	Bus *Bus
}

func NewConsole

func NewConsole() Console

func (*Console) Exec

func (console *Console) Exec()

type CpuPort

type CpuPort struct {
	Input  *BufferIO
	Output *BufferIO
}

func (*CpuPort) Read

func (port *CpuPort) Read(address uint16) (byte, bool)

func (*CpuPort) Write

func (port *CpuPort) Write(address uint16, b byte)

type DeviceInterface

type DeviceInterface interface {
	Read(address uint16) (byte, bool)
	Write(address uint16, value byte) bool
	Valid(address uint16) bool
}

type DeviceLatch

type DeviceLatch struct {
	// contains filtered or unexported fields
}

func NewDeviceLatch

func NewDeviceLatch(address uint16) *DeviceLatch

func (*DeviceLatch) Read

func (d *DeviceLatch) Read(address uint16) (byte, bool)

func (*DeviceLatch) Valid

func (d *DeviceLatch) Valid(address uint16) bool

func (*DeviceLatch) Write

func (d *DeviceLatch) Write(address uint16, value byte) bool

type DeviceMemory

type DeviceMemory struct {
	// contains filtered or unexported fields
}

func NewDeviceMemory

func NewDeviceMemory(start, size uint16) *DeviceMemory

func (*DeviceMemory) LoadRom

func (m *DeviceMemory) LoadRom(filename string) (int, error)

func (*DeviceMemory) Read

func (m *DeviceMemory) Read(address uint16) (byte, bool)

func (*DeviceMemory) Valid

func (m *DeviceMemory) Valid(address uint16) bool

func (*DeviceMemory) Write

func (m *DeviceMemory) Write(address uint16, value byte) bool

type Register16

type Register16 struct {
	// contains filtered or unexported fields
}

func (*Register16) Add

func (r16 *Register16) Add(value byte)

func (*Register16) Dec

func (r16 *Register16) Dec()

func (Register16) Get

func (r16 Register16) Get() uint16

func (*Register16) Hi

func (r16 *Register16) Hi() byte

func (Register16) Inc

func (r16 Register16) Inc()

func (*Register16) Lo

func (r16 *Register16) Lo() byte

func (Register16) Set

func (r16 Register16) Set(value uint16)

func (*Register16) SetHi

func (r16 *Register16) SetHi(h byte)

func (*Register16) SetLo

func (r16 *Register16) SetLo(l byte)

type Z80

type Z80 struct {
	A, F, B, C, D, E, H, L         byte
	A_, F_, B_, C_, D_, E_, H_, L_ byte
	IXH, IXL, IYH, IYL             byte
	I, IFF1, IFF2, IM              byte

	R7 byte // The highest bit (bit 7) of the R register
	R  uint16

	AF, BC, DE, HL     Register16
	IX, IY             Register16
	AF_, BC_, DE_, HL_ Register16

	Tstates uint16
	Halted  bool
	// contains filtered or unexported fields
}

func NewZ80

func NewZ80(bus *Bus) *Z80

creates a new Z80 instance.

func (*Z80) Adc

func (z80 *Z80) Adc(value byte)

func (*Z80) Adc16

func (z80 *Z80) Adc16(value uint16)

func (*Z80) Add

func (z80 *Z80) Add(value byte)

func (*Z80) Add16

func (z80 *Z80) Add16(value1 Register16, value2 uint16)

func (*Z80) And

func (z80 *Z80) And(value byte)

func (*Z80) Call

func (z80 *Z80) Call()

func (*Z80) Cp

func (z80 *Z80) Cp(value byte)

func (*Z80) Dec

func (z80 *Z80) Dec(ptrValue *byte)

Decrementa o conteudo do ponteiro referente ao registro

func (*Z80) DoOpcode

func (z80 *Z80) DoOpcode()

Execute a single instruction at the program counter.

func (*Z80) GetPrtRegisterValByte

func (z80 *Z80) GetPrtRegisterValByte(opcode byte) *byte

func (*Z80) GetRegisterValByte

func (z80 *Z80) GetRegisterValByte(opcode byte) byte

func (*Z80) Inc

func (z80 *Z80) Inc(ptrValue *byte)

Incrementa o conteudo do ponteiro referente ao registro

func (*Z80) Interrupt

func (z80 *Z80) Interrupt()

Interrupt process a Z80 maskable interrupt

func (*Z80) Jr

func (z80 *Z80) Jr()

func (*Z80) Load16

func (z80 *Z80) Load16() uint16

Carrega uint16 seguinte do PC em LittleEndian

func (*Z80) Load8

func (z80 *Z80) Load8() byte

Carrega byte seguinte do PC

func (*Z80) LoadIndex8

func (z80 *Z80) LoadIndex8(reg *byte)

Carrega ponteiro de byte na posicao indexada pelo PC, PC+1

func (*Z80) LoadIndexR

func (z80 *Z80) LoadIndexR(register16 *Register16)

Carrega conteudo apontado pelo PC, PC+1 no ponteido do Register16

func (*Z80) LoadR

func (z80 *Z80) LoadR(register16 *Register16)

func (*Z80) NonMaskableInterrupt

func (z80 *Z80) NonMaskableInterrupt()

Process a Z80 non-maskable interrupt.

func (*Z80) Or

func (z80 *Z80) Or(value byte)

func (*Z80) Pop

func (z80 *Z80) Pop() uint16

Carrega uint16 do stack

func (*Z80) PopR

func (z80 *Z80) PopR(register16 *Register16)

Carrgado registro do stack

func (*Z80) Push

func (z80 *Z80) Push(value uint16)

Salva uint16 no stack

func (*Z80) PushR

func (z80 *Z80) PushR(register16 Register16)

Salve registro no stack

func (*Z80) Reset

func (z80 *Z80) Reset()

func (*Z80) Rst

func (z80 *Z80) Rst(value byte)

func (*Z80) Sbc

func (z80 *Z80) Sbc(value byte)

func (*Z80) Sbc16

func (z80 *Z80) Sbc16(value uint16)

func (*Z80) StoreIndex8

func (z80 *Z80) StoreIndex8(reg byte)

Armazena bute na posicao indexada pelo PC, PC+1

func (*Z80) StoreIndexR

func (z80 *Z80) StoreIndexR(register16 Register16)

Armazena o conteudo do Register16 no endereco apontado por PC, PC+1

func (*Z80) Sub

func (z80 *Z80) Sub(value byte)

func (*Z80) Xor

func (z80 *Z80) Xor(value byte)

Jump to

Keyboard shortcuts

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