nes

package
v0.0.0-...-27bd5f2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2017 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ButtonA = iota
	ButtonB
	ButtonSelect
	ButtonStart
	ButtonUp
	ButtonDown
	ButtonLeft
	ButtonRight
)
View Source
const (
	MirrorHorizontal = 0
	MirrorVertical   = 1
	MirrorSingle0    = 2
	MirrorSingle1    = 3
	MirrorFour       = 4
)

Mirroring Modes

View Source
const CPUFrequency = 1789773

Variables

View Source
var MirrorLookup = [...][4]uint16{
	{0, 0, 1, 1},
	{0, 1, 0, 1},
	{0, 0, 0, 0},
	{1, 1, 1, 1},
	{0, 1, 2, 3},
}
View Source
var Palette [64]color.RGBA

Functions

func Buffer

func Buffer(console *Console) *image.RGBA

func Reset

func Reset(console *Console)

Reset resets the CPU to its initial powerup state

func SetAudioChannel

func SetAudioChannel(console *Console, channel chan float32)

func SetButtons1

func SetButtons1(console *Console, buttons [8]bool)

func SetButtons2

func SetButtons2(console *Console, buttons [8]bool)

func StepSeconds

func StepSeconds(console *Console, seconds float64)

Types

type APU

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

type CPU

type CPU struct {
	Cycles uint64 // number of cycles
	PC     uint16 // program counter
	SP     byte   // stack pointer
	A      byte   // accumulator
	X      byte   // x register
	Y      byte   // y register
	C      byte   // carry flag
	Z      byte   // zero flag
	I      byte   // interrupt disable flag
	D      byte   // decimal mode flag
	B      byte   // break command flag
	U      byte   // unused flag
	V      byte   // overflow flag
	N      byte   // negative flag
	// contains filtered or unexported fields
}

type Cartridge

type Cartridge struct {
	PRG     []byte // PRG-ROM banks
	CHR     []byte // CHR-ROM banks
	SRAM    []byte // Save RAM
	Mapper  byte   // mapper type
	Mirror  byte   // mirroring mode
	Battery byte   // battery present
}

type Console

type Console struct {
	CPU         *CPU
	APU         *APU
	PPU         *PPU
	Cartridge   *Cartridge
	Controller1 *Controller
	Controller2 *Controller
	Mapper      Mapper
	RAM         []byte
}

func NewConsole

func NewConsole(path string) (*Console, error)

type Controller

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

type DMC

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

Delta Modulation Channel

type Instruction

type Instruction struct {
	Opcode     byte
	Name       string
	Mode       byte // the addressing mode
	Size       byte // the size in bytes
	Cycles     byte // the number of cycles used (not including conditional cycles)
	PageCycles byte // the number of cycles used when a page is crossed
}

type Mapper

type Mapper interface {
	Mapper()
}

type Mapper1

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

func (*Mapper1) Mapper

func (_ *Mapper1) Mapper()

type Mapper2

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

func (*Mapper2) Mapper

func (_ *Mapper2) Mapper()

type Mapper3

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

func (*Mapper3) Mapper

func (_ *Mapper3) Mapper()

type Mapper4

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

func (*Mapper4) Mapper

func (_ *Mapper4) Mapper()

type Mapper7

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

func (*Mapper7) Mapper

func (_ *Mapper7) Mapper()

type Noise

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

type PPU

type PPU struct {
	Cycle    int    // 0-340
	ScanLine int    // 0-261, 0-239=visible, 240=post, 241-260=vblank, 261=pre
	Frame    uint64 // frame counter
	// contains filtered or unexported fields
}

type Pulse

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

type Triangle

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

Jump to

Keyboard shortcuts

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