cpu

package
v0.0.0-...-8886972 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	A = iota
	B
	C
	D
	E
	H
	L
	F // Flag Register
)
View Source
const (
	AF = iota + 8 // To prevent collide register index
	BC
	DE
	HL
	HLD
	HLI
	SP
	PC
)

@see https://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html

Variables

This section is empty.

Functions

This section is empty.

Types

type CPU

type CPU struct {
	Reg  Register
	Bus  interfaces.Bus
	IRQ  *interrupt.IRQ
	Halt bool
}

func New

func New(bus interfaces.Bus, irq *interrupt.IRQ) *CPU

func (*CPU) Step

func (c *CPU) Step() uint

type OpCode

type OpCode struct {
	Code     byte
	Mnemonic string
	R1, R2   int
	Size     uint8
	Cycles   uint8
	Handler  func(*CPU, int, int)
}

type Register

type Register struct {
	R  [8]byte
	SP types.Addr
	PC types.Addr
}

func (*Register) AF

func (r *Register) AF() types.Addr

func (*Register) BC

func (r *Register) BC() types.Addr

func (*Register) DE

func (r *Register) DE() types.Addr

func (*Register) Dump

func (r *Register) Dump()

func (*Register) HL

func (r *Register) HL() types.Addr

func (*Register) R16

func (r *Register) R16(i int) types.Addr

Jump to

Keyboard shortcuts

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