emulator

package
v0.0.0-...-71b1262 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DotSize       = int32(8)
	DisplayWidth  = 64
	DisplayHeight = 32
)
View Source
const (
	MemorySize   = 4096
	ProgramStart = 0x200
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPU

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

CPU represents the CHIP-8 CPU.

func NewCPU

func NewCPU() *CPU

NewCPU creates and initializes a new CHIP-8 CPU.

func (*CPU) ExecuteCycle

func (cpu *CPU) ExecuteCycle(memory *Memory, display *Display) error

ExecuteCycle executes a single cycle of the CHIP-8 CPU.

type Display

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

func (*Display) Clear

func (d *Display) Clear()

func (*Display) Close

func (d *Display) Close()

func (*Display) Draw

func (d *Display) Draw() error

func (*Display) Get

func (d *Display) Get(x, y uint16) (bool, error)

func (*Display) Init

func (d *Display) Init() error

func (*Display) Set

func (d *Display) Set(x, y uint16, value bool) error

type Emulator

type Emulator struct {
	Memory  *Memory
	Display *Display
	CPU     *CPU
}

func NewEmulator

func NewEmulator() *Emulator

func (*Emulator) Cleanup

func (e *Emulator) Cleanup()

func (*Emulator) Init

func (e *Emulator) Init() error

func (*Emulator) LoadROM

func (e *Emulator) LoadROM() error

func (*Emulator) Run

func (e *Emulator) Run() error

type Memory

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

func (*Memory) Load

func (m *Memory) Load(data []byte) error

load a segment to memory

func (*Memory) Opcode

func (m *Memory) Opcode(address uint16) (uint16, error)

fetch an opcode from memory

func (*Memory) Read

func (m *Memory) Read(address uint16) (byte, error)

read a byte from memory

func (*Memory) Write

func (m *Memory) Write(address uint16, value byte) error

write a byte to memory

Jump to

Keyboard shortcuts

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