chip

package
v0.0.0-...-61aa0d1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package chip provide functionality for the chip-8 interpreter

Package chip provide functionality for the chip-8 interpreter

Package chip provide functionality for the chip-8 interpreter

Package chip provide functionality for the chip-8 interpreter

Package chip provide functionality for the chip-8 interpreter

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncTime

func IncTime()

IncTime increments timer by one second

func Load

func Load(f string)

Load Rom into memory

func Start

func Start()

Start the interpreter

func Tick

func Tick()

Tick executes an instruction at pc

func Update

func Update()

Update the current the state of the machine

Types

type Chip

type Chip struct{}

Chip represents chip-9 interpreter

type Screen

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

Screen is a monochrome display

func NewScreen

func NewScreen(width, height, windowWidth, windowHeight int,
	update func()) (s *Screen)

NewScreen creates a new Screen if no previous screen was created. It ensures that only one screen exists (singelton). width: logical Screen width height: logcial screen height windowWidth: The displayed window width windowHeight: The displayed window height update: Update function that handles logic and is called every tick

func (*Screen) Draw

func (s *Screen) Draw(x, y int, write bool)

Draw a white pixel at given position or erase it

func (*Screen) PixelAt

func (s *Screen) PixelAt(x, y int) bool

PixelAt retrieve if pixel is writen at given coordinates

func (*Screen) Reset

func (s *Screen) Reset()

Reset clears the screen

func (*Screen) SetPixels

func (s *Screen) SetPixels(pix []byte)

SetPixels update the pixels matrix

func (*Screen) Show

func (s *Screen) Show()

Show the window and start main loop

type Sound

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

Sound used to play a beep or stop from playing one

func NewSound

func NewSound() (s *Sound)

NewSound create a new reference for sound expected asset file is in /assets directory This method should only be called once in the life of the app

func (*Sound) PlaySound

func (s *Sound) PlaySound()

PlaySound plays a beep

func (*Sound) StopSound

func (s *Sound) StopSound()

StopSound stops a beep

Jump to

Keyboard shortcuts

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