device

package
v0.0.0-...-19e7a64 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Contains structs and methods for the chip-8 memory.

Index

Constants

View Source
const RamStartLocation = 0x200

Variables

This section is empty.

Functions

func DecodeKey

func DecodeKey(keyboardMask uint16) byte

Decode which key is pressed, emulator Does not support multiple key presses and the rightmost will be selected.

func NewKeyboard

func NewKeyboard(keyboardBuffer *uint16) *chip8Keyboard

Initialise a new keyboard whose buffer is shared Between emulator logic and device logic.

func NewRegisters

func NewRegisters(soundBuffer *bool) *chip8Registers

Initialise a new register with a sound buffer.

Types

type CarryFunction

type CarryFunction func(byte, byte) byte

This type of function is used to determine VF.

type LogicalInstructionType

type LogicalInstructionType uint8
const (
	Load LogicalInstructionType = iota
	Or
	And
	Xor
	Add
	Sub
	Shr
	Subn
	Shl = 0xE
)

type OperationFunction

type OperationFunction func(byte, byte) byte

This type of function is used to operate on register values.

type Processor

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

Main processor of the Chip-8

func NewProcessor

func NewProcessor(screenBuffer *[32]uint64, keyboardBuffer *uint16, soundBuffer *bool) *Processor

func (*Processor) Cycle

func (p *Processor) Cycle()

Run a CPU Fetch/Execute cycle.

func (*Processor) LoadETIProgram

func (p *Processor) LoadETIProgram(program []byte, programSize uint16)

Load an ETI program to the memory and set the program counter accordingly.

func (*Processor) LoadProgram

func (p *Processor) LoadProgram(program []byte, programSize uint16)

Load a standard Chip-8 Program to the memory And set the program counter accordingly.

func (*Processor) ShouldHalt

func (p *Processor) ShouldHalt() bool

Returns true if the processor should halt.

Jump to

Keyboard shortcuts

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