chip8

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package chip8 is a Chip-8 emulator written in Go. Chip-8 used to be implemented on 4k systems like the Telmac 1800 and Cosmac VIP where the chip-8 interpreter itself occpied the first 512 bytes of memory (up to 0x200). In modern CHIP-8 implementations (like ours here), where the interpreter is running natively outside the 4K memory space, there is no need to avoid the lower 512 bytes of memory (0x000-0x200), and it is common to store font data there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VM

type VM struct {

	// Our "CPU clock"
	Clock *time.Ticker

	// Channel for sending/receiving a shutdown signal
	ShutdownC chan struct{}
	// contains filtered or unexported fields
}

VM represents the chip-8 virtual machine

func NewVM

func NewVM(pathToROM string, clockSpeed int) (*VM, error)

NewVM initializes a Window and a VM, loads the font set and the ROM into memory, and returns a pointer to the VM or an error

func (*VM) ManageAudio

func (vm *VM) ManageAudio()

ManageAudio reads and decodes the beep.mp3, initializes the speaker, and plays a beep each time an audio event is placed on the channel

func (*VM) Run

func (vm *VM) Run()

Run starts the vm and emulates a clock that runs by default at 60MHz This can be changed with a flag.

Jump to

Keyboard shortcuts

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