Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DisplayWidth is the width of the display in pixels. DisplayWidth = 64 // DisplayHeight is the height of the display in pixels. DisplayHeight = 32 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Display ¶
type Display [DisplayHeight][DisplayWidth]byte
Display represents the display of the CHIP-8 virtual machine.
type Renderer ¶
type Renderer interface { // Render renders the display. Render(display Display) error // Beep makes an audible beep. Beep() error }
Renderer represents the abstract renderer for the CHIP-8 virtual machine.
type VirtualMachine ¶
type VirtualMachine struct {
// contains filtered or unexported fields
}
VirtualMachine emulates the CHIP-8 virtual machine.
func (*VirtualMachine) LoadROM ¶
func (vm *VirtualMachine) LoadROM(rom []byte) error
LoadROM loads the ROM's data, in bytes, into the virtual machine's memory.
func (*VirtualMachine) PressKey ¶
func (vm *VirtualMachine) PressKey(idx int)
PressKey signals the virtual machine that the key was pressed.
func (*VirtualMachine) ReleaseKey ¶
func (vm *VirtualMachine) ReleaseKey(idx int)
ReleaseKey signals the virtual machine that the key was released.
func (*VirtualMachine) Reset ¶
func (vm *VirtualMachine) Reset()
Reset resets the virtual machine to its initial state.
func (*VirtualMachine) Start ¶
func (vm *VirtualMachine) Start()
Start starts executing the virtual machine.
func (*VirtualMachine) Stop ¶
func (vm *VirtualMachine) Stop()
Stop stops executing the virtual machine.
Click to show internal directories.
Click to hide internal directories.