chip8

package
v0.0.0-...-9199638 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instruction

type Instruction uint16
const (
	ClearScreen Instruction = 0x00E0
	Return                  = 0x00EE
)

func AddRegister

func AddRegister(to, plus uint16) Instruction

func AndRegister

func AndRegister(to, and uint16) Instruction

func Call

func Call(address uint16) Instruction

func CallRcp

func CallRcp(address uint16) Instruction

func CopyRegister

func CopyRegister(to, from uint16) Instruction

func CopyToMemory

func CopyToMemory(upTo uint16) Instruction

func DrawSprite

func DrawSprite(xRegister, yRegister, bytes uint16) Instruction

func IncrementAddressRegister

func IncrementAddressRegister(by uint16) Instruction

func IncrementRegisterBy

func IncrementRegisterBy(register, increment uint16) Instruction

func JumpTo

func JumpTo(address uint16) Instruction

func JumpWithOffset

func JumpWithOffset(to uint16) Instruction

func LoadDecimalsOf

func LoadDecimalsOf(register uint16) Instruction

func LoadDelayTimerInto

func LoadDelayTimerInto(register uint16) Instruction

func LoadDigitSprite

func LoadDigitSprite(digit uint16) Instruction

func LoadFromMemory

func LoadFromMemory(upTo uint16) Instruction

func OrRegister

func OrRegister(to, or uint16) Instruction

func RandomizeAnd

func RandomizeAnd(register, and uint16) Instruction

func SetAddressRegisterTo

func SetAddressRegisterTo(value uint16) Instruction

func SetDelayTimer

func SetDelayTimer(to uint16) Instruction

func SetRegisterTo

func SetRegisterTo(register, value uint16) Instruction

func SetSoundTimer

func SetSoundTimer(to uint16) Instruction

func ShiftLeft

func ShiftLeft(which uint16) Instruction

func ShiftRight

func ShiftRight(which uint16) Instruction

func SkipIfEqual

func SkipIfEqual(register, equalTo uint16) Instruction

func SkipIfKeyDown

func SkipIfKeyDown(which uint16) Instruction

func SkipIfKeyUp

func SkipIfKeyUp(which uint16) Instruction

func SkipIfNotEqual

func SkipIfNotEqual(register, unequalTo uint16) Instruction

func SkipIfRegistersEqual

func SkipIfRegistersEqual(r1, r2 uint16) Instruction

func SkipIfRegistersUnequal

func SkipIfRegistersUnequal(r1, r2 uint16) Instruction

func SubtractRegister

func SubtractRegister(to, minus uint16) Instruction

func SubtractReversed

func SubtractReversed(to, left uint16) Instruction

func WaitForKeyPress

func WaitForKeyPress(which uint16) Instruction

func XorRegister

func XorRegister(to, xor uint16) Instruction

type IntScreen

type IntScreen struct {
	Rows [32]uint64
}

func (*IntScreen) IsSet

func (s *IntScreen) IsSet(x, y int) bool

func (*IntScreen) Size

func (s *IntScreen) Size() (int, int)

type Interpreter

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

func NewInterpreter

func NewInterpreter() *Interpreter

func (*Interpreter) AddressRegister

func (i *Interpreter) AddressRegister() uint16

func (*Interpreter) DelayTimer

func (i *Interpreter) DelayTimer() uint8

func (*Interpreter) Execute

func (i *Interpreter) Execute(command Instruction)

func (*Interpreter) ExecuteNext

func (i *Interpreter) ExecuteNext()

func (*Interpreter) IsWaitingForKey

func (i *Interpreter) IsWaitingForKey() bool

func (*Interpreter) LoadProgram

func (chip8 *Interpreter) LoadProgram(prog []byte)

func (*Interpreter) LoadProgramToAddress

func (chip8 *Interpreter) LoadProgramToAddress(prog []byte, address uint16)

func (*Interpreter) MemoryByte

func (i *Interpreter) MemoryByte(index uint16) uint8

func (*Interpreter) Paused

func (chip8 *Interpreter) Paused() bool

func (*Interpreter) ProgramCounter

func (i *Interpreter) ProgramCounter() uint16

func (*Interpreter) Register

func (i *Interpreter) Register(which int) uint8

func (*Interpreter) Screen

func (i *Interpreter) Screen() Screen

func (*Interpreter) SetKeyEvent

func (i *Interpreter) SetKeyEvent(event KeyEvent)

func (*Interpreter) SetKeyboard

func (i *Interpreter) SetKeyboard(keyboard Keyboard)

func (*Interpreter) SetPaused

func (chip8 *Interpreter) SetPaused(paused bool)

func (*Interpreter) SetRandomizer

func (i *Interpreter) SetRandomizer(rand Randomizer)

func (*Interpreter) SetSpeakers

func (i *Interpreter) SetSpeakers(s Speakers)

func (*Interpreter) SoundTimer

func (i *Interpreter) SoundTimer() uint8

func (*Interpreter) TimerTick

func (i *Interpreter) TimerTick()

type KeyEvent

type KeyEvent interface {
	LastKey() (keyWasPressed bool, key uint8)
	ClearLastKey()
}

type Keyboard

type Keyboard interface {
	KeyDown(which uint8) bool
}

type Randomizer

type Randomizer interface {
	Next() uint8
}

type Screen

type Screen interface {
	IsSet(x, y int) bool
	Size() (w, h int)
}

type Speakers

type Speakers interface {
	Beep()
	BeQuiet()
}

Jump to

Keyboard shortcuts

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