cpu

package
v0.0.0-...-2a2c6f9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2016 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode bool

Debug mode boolean

Functions

func GetOpcode

func GetOpcode(cpu Cpu) uint16

Function to return an opCode

func ShouldPlaySound

func ShouldPlaySound(cpu Cpu) bool

Function to return if we should play a sound

Types

type Cpu

type Cpu struct {

	//Name our cpu
	CpuName string

	//boolean if we should render
	ShouldRender bool

	//Boolean for clearing the screen
	ClearScreen bool

	//Chip-8 has a 64 x 32 screen size, and only black our white display. So, create an array if a pizel is black (0) or white (1)
	GraphicsDisplay [graphics.Width][graphics.Height]uint8

	Clock *time.Ticker
	// contains filtered or unexported fields
}

func ClearGraphics

func ClearGraphics(cpu Cpu) Cpu

Function to reset our graphics display

func DecodeOpcode

func DecodeOpcode(cpu Cpu) Cpu

Function to Decode a chip-8 opCode See here for opCodes: https://en.wikipedia.org/wiki/CHIP-8#Opcode_table Please note, Values like NNN are variables, and are supposed to be replaced with the hex value

Much thanks to https://github.com/ejholmes/chip8/blob/master/chip8.go Definitely helped in understanding the operations, and what they meant

func EmulateCycle

func EmulateCycle(cpu Cpu) Cpu

Function to grab an opcode to interpret

func LoadGame

func LoadGame(fileName string, cpu Cpu) Cpu

Declare our function to load a game

func NewCpu

func NewCpu(cpuName string, gameSpeed int, debug bool) Cpu

Function to construct a new CPU

Jump to

Keyboard shortcuts

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