nes

package
v0.0.0-...-41abf9a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2015 License: GPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvGlobal uint = 1 << iota
	EvMaster
	EvSlave
)
View Source
const DEFAULT_FPS float64 = 60.0988

Variables

View Source
var Azul3DPalette []color.RGBA = []color.RGBA{
	color.RGBA{0x66, 0x66, 0x66, 0xff},
	color.RGBA{0x00, 0x2A, 0x88, 0xff},
	color.RGBA{0x14, 0x12, 0xA7, 0xff},
	color.RGBA{0x3B, 0x00, 0xA4, 0xff},
	color.RGBA{0x5C, 0x00, 0x7E, 0xff},
	color.RGBA{0x6E, 0x00, 0x40, 0xff},
	color.RGBA{0x6C, 0x06, 0x00, 0xff},
	color.RGBA{0x56, 0x1D, 0x00, 0xff},
	color.RGBA{0x33, 0x35, 0x00, 0xff},
	color.RGBA{0x0B, 0x48, 0x00, 0xff},
	color.RGBA{0x00, 0x52, 0x00, 0xff},
	color.RGBA{0x00, 0x4F, 0x08, 0xff},
	color.RGBA{0x00, 0x40, 0x4D, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xAD, 0xAD, 0xAD, 0xff},
	color.RGBA{0x15, 0x5F, 0xD9, 0xff},
	color.RGBA{0x42, 0x40, 0xFF, 0xff},
	color.RGBA{0x75, 0x27, 0xFE, 0xff},
	color.RGBA{0xA0, 0x1A, 0xCC, 0xff},
	color.RGBA{0xB7, 0x1E, 0x7B, 0xff},
	color.RGBA{0xB5, 0x31, 0x20, 0xff},
	color.RGBA{0x99, 0x4E, 0x00, 0xff},
	color.RGBA{0x6B, 0x6D, 0x00, 0xff},
	color.RGBA{0x38, 0x87, 0x00, 0xff},
	color.RGBA{0x0C, 0x93, 0x00, 0xff},
	color.RGBA{0x00, 0x8F, 0x32, 0xff},
	color.RGBA{0x00, 0x7C, 0x8D, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xFF, 0xFE, 0xFF, 0xff},
	color.RGBA{0x64, 0xB0, 0xFF, 0xff},
	color.RGBA{0x92, 0x90, 0xFF, 0xff},
	color.RGBA{0xC6, 0x76, 0xFF, 0xff},
	color.RGBA{0xF3, 0x6A, 0xFF, 0xff},
	color.RGBA{0xFE, 0x6E, 0xCC, 0xff},
	color.RGBA{0xFE, 0x81, 0x70, 0xff},
	color.RGBA{0xEA, 0x9E, 0x22, 0xff},
	color.RGBA{0xBC, 0xBE, 0x00, 0xff},
	color.RGBA{0x88, 0xD8, 0x00, 0xff},
	color.RGBA{0x5C, 0xE4, 0x30, 0xff},
	color.RGBA{0x45, 0xE0, 0x82, 0xff},
	color.RGBA{0x48, 0xCD, 0xDE, 0xff},
	color.RGBA{0x4F, 0x4F, 0x4F, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xFF, 0xFE, 0xFF, 0xff},
	color.RGBA{0xC0, 0xDF, 0xFF, 0xff},
	color.RGBA{0xD3, 0xD2, 0xFF, 0xff},
	color.RGBA{0xE8, 0xC8, 0xFF, 0xff},
	color.RGBA{0xFB, 0xC2, 0xFF, 0xff},
	color.RGBA{0xFE, 0xC4, 0xEA, 0xff},
	color.RGBA{0xFE, 0xCC, 0xC5, 0xff},
	color.RGBA{0xF7, 0xD8, 0xA5, 0xff},
	color.RGBA{0xE4, 0xE5, 0x94, 0xff},
	color.RGBA{0xCF, 0xEF, 0x96, 0xff},
	color.RGBA{0xBD, 0xF4, 0xAB, 0xff},
	color.RGBA{0xB3, 0xF3, 0xCC, 0xff},
	color.RGBA{0xB5, 0xEB, 0xF2, 0xff},
	color.RGBA{0xB8, 0xB8, 0xB8, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
}
View Source
var RGBAPalette []color.Color = []color.Color{
	color.RGBA{0x66, 0x66, 0x66, 0xff},
	color.RGBA{0x00, 0x2A, 0x88, 0xff},
	color.RGBA{0x14, 0x12, 0xA7, 0xff},
	color.RGBA{0x3B, 0x00, 0xA4, 0xff},
	color.RGBA{0x5C, 0x00, 0x7E, 0xff},
	color.RGBA{0x6E, 0x00, 0x40, 0xff},
	color.RGBA{0x6C, 0x06, 0x00, 0xff},
	color.RGBA{0x56, 0x1D, 0x00, 0xff},
	color.RGBA{0x33, 0x35, 0x00, 0xff},
	color.RGBA{0x0B, 0x48, 0x00, 0xff},
	color.RGBA{0x00, 0x52, 0x00, 0xff},
	color.RGBA{0x00, 0x4F, 0x08, 0xff},
	color.RGBA{0x00, 0x40, 0x4D, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xAD, 0xAD, 0xAD, 0xff},
	color.RGBA{0x15, 0x5F, 0xD9, 0xff},
	color.RGBA{0x42, 0x40, 0xFF, 0xff},
	color.RGBA{0x75, 0x27, 0xFE, 0xff},
	color.RGBA{0xA0, 0x1A, 0xCC, 0xff},
	color.RGBA{0xB7, 0x1E, 0x7B, 0xff},
	color.RGBA{0xB5, 0x31, 0x20, 0xff},
	color.RGBA{0x99, 0x4E, 0x00, 0xff},
	color.RGBA{0x6B, 0x6D, 0x00, 0xff},
	color.RGBA{0x38, 0x87, 0x00, 0xff},
	color.RGBA{0x0C, 0x93, 0x00, 0xff},
	color.RGBA{0x00, 0x8F, 0x32, 0xff},
	color.RGBA{0x00, 0x7C, 0x8D, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xFF, 0xFE, 0xFF, 0xff},
	color.RGBA{0x64, 0xB0, 0xFF, 0xff},
	color.RGBA{0x92, 0x90, 0xFF, 0xff},
	color.RGBA{0xC6, 0x76, 0xFF, 0xff},
	color.RGBA{0xF3, 0x6A, 0xFF, 0xff},
	color.RGBA{0xFE, 0x6E, 0xCC, 0xff},
	color.RGBA{0xFE, 0x81, 0x70, 0xff},
	color.RGBA{0xEA, 0x9E, 0x22, 0xff},
	color.RGBA{0xBC, 0xBE, 0x00, 0xff},
	color.RGBA{0x88, 0xD8, 0x00, 0xff},
	color.RGBA{0x5C, 0xE4, 0x30, 0xff},
	color.RGBA{0x45, 0xE0, 0x82, 0xff},
	color.RGBA{0x48, 0xCD, 0xDE, 0xff},
	color.RGBA{0x4F, 0x4F, 0x4F, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xFF, 0xFE, 0xFF, 0xff},
	color.RGBA{0xC0, 0xDF, 0xFF, 0xff},
	color.RGBA{0xD3, 0xD2, 0xFF, 0xff},
	color.RGBA{0xE8, 0xC8, 0xFF, 0xff},
	color.RGBA{0xFB, 0xC2, 0xFF, 0xff},
	color.RGBA{0xFE, 0xC4, 0xEA, 0xff},
	color.RGBA{0xFE, 0xCC, 0xC5, 0xff},
	color.RGBA{0xF7, 0xD8, 0xA5, 0xff},
	color.RGBA{0xE4, 0xE5, 0x94, 0xff},
	color.RGBA{0xCF, 0xEF, 0x96, 0xff},
	color.RGBA{0xBD, 0xF4, 0xAB, 0xff},
	color.RGBA{0xB3, 0xF3, 0xCC, 0xff},
	color.RGBA{0xB5, 0xEB, 0xF2, 0xff},
	color.RGBA{0xB8, 0xB8, 0xB8, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x00, 0xff},
}

Functions

This section is empty.

Types

type ANROM

type ANROM struct {
	*ROMFile
	Registers ANROMRegisters
}

func NewANROM

func NewANROM(romf *ROMFile) *ANROM

func (*ANROM) Fetch

func (anrom *ANROM) Fetch(address uint16) (value uint8)

func (*ANROM) Mappings

func (anrom *ANROM) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*ANROM) Reset

func (anrom *ANROM) Reset()

func (*ANROM) Store

func (anrom *ANROM) Store(address uint16, value uint8) (oldValue uint8)

func (*ANROM) String

func (anrom *ANROM) String() string

func (*ANROM) Tables

func (anrom *ANROM) Tables() (t0, t1, t2, t3 int)

type ANROMRegisters

type ANROMRegisters struct {
	BankSelect uint8
}

func (*ANROMRegisters) Reset

func (reg *ANROMRegisters) Reset()

type Audio

type Audio interface {
	Input() chan int16
	Run()
	TogglePaused()
	SetSpeed(speed float32)
}

type AudioRecordEvent

type AudioRecordEvent struct{}

func (*AudioRecordEvent) Flag

func (e *AudioRecordEvent) Flag() uint

func (*AudioRecordEvent) Process

func (e *AudioRecordEvent) Process(nes *NES)

func (*AudioRecordEvent) String

func (e *AudioRecordEvent) String() string

type AudioRecorder

type AudioRecorder interface {
	Input() chan int16
	Record()
	Stop()
	Quit()
	Run()
}

type AudioStopEvent

type AudioStopEvent struct{}

func (*AudioStopEvent) Flag

func (e *AudioStopEvent) Flag() uint

func (*AudioStopEvent) Process

func (e *AudioStopEvent) Process(nes *NES)

func (*AudioStopEvent) String

func (e *AudioStopEvent) String() string

type Azul3DAudio

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

func NewAudio

func NewAudio(frequency int, sampleSize int) (audio *Azul3DAudio, err error)

func (*Azul3DAudio) Close

func (audio *Azul3DAudio) Close()

func (*Azul3DAudio) Input

func (audio *Azul3DAudio) Input() chan int16

func (*Azul3DAudio) Run

func (audio *Azul3DAudio) Run()

func (*Azul3DAudio) SetSpeed

func (audio *Azul3DAudio) SetSpeed(speed float32)

func (*Azul3DAudio) TogglePaused

func (audio *Azul3DAudio) TogglePaused()

type Azul3DVideo

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

func NewVideo

func NewVideo(caption string, events chan Event) (video *Azul3DVideo, err error)

func (*Azul3DVideo) Events

func (video *Azul3DVideo) Events() chan Event

func (*Azul3DVideo) Input

func (video *Azul3DVideo) Input() chan []uint8

func (*Azul3DVideo) Run

func (video *Azul3DVideo) Run()

func (*Azul3DVideo) SetCaption

func (video *Azul3DVideo) SetCaption(caption string)

type Bridge

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

type Button

type Button uint8
const (
	A Button = iota
	B
	Select
	Start
	Up
	Down
	Left
	Right
	One
)

func (Button) String

func (i Button) String() string

func (Button) Valid

func (btn Button) Valid() bool

type CNROM

type CNROM struct {
	*ROMFile
	Registers CNROMRegisters
}

func NewCNROM

func NewCNROM(romf *ROMFile) *CNROM

func (*CNROM) Fetch

func (cnrom *CNROM) Fetch(address uint16) (value uint8)

func (*CNROM) Mappings

func (cnrom *CNROM) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*CNROM) Reset

func (cnrom *CNROM) Reset()

func (*CNROM) Store

func (cnrom *CNROM) Store(address uint16, value uint8) (oldValue uint8)

func (*CNROM) String

func (cnrom *CNROM) String() string

type CNROMRegisters

type CNROMRegisters struct {
	BankSelect uint8
}

func (*CNROMRegisters) Reset

func (reg *CNROMRegisters) Reset()

type CPUDecodeEvent

type CPUDecodeEvent struct{}

func (*CPUDecodeEvent) Flag

func (e *CPUDecodeEvent) Flag() uint

func (*CPUDecodeEvent) Process

func (e *CPUDecodeEvent) Process(nes *NES)

func (*CPUDecodeEvent) String

func (e *CPUDecodeEvent) String() string

type ControlFlag

type ControlFlag uint8
const (
	Mirroring ControlFlag = 1 << iota

	PRGRomBankMode

	CHRRomBankMode
)

type Controller

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

type ControllerEvent

type ControllerEvent struct {
	Controller int
	Down       bool
	Button     Button
}

func (*ControllerEvent) Flag

func (e *ControllerEvent) Flag() uint

func (*ControllerEvent) Process

func (e *ControllerEvent) Process(nes *NES)

func (*ControllerEvent) String

func (e *ControllerEvent) String() string

type Controllers

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

func NewControllers

func NewControllers() *Controllers

func (*Controllers) Fetch

func (ctrls *Controllers) Fetch(address uint16) (value uint8)

func (*Controllers) KeyDown

func (ctrls *Controllers) KeyDown(controller int, btn Button)

func (*Controllers) KeyIsDown

func (ctrls *Controllers) KeyIsDown(controller int, btn Button) bool

func (*Controllers) KeyUp

func (ctrls *Controllers) KeyUp(controller int, btn Button)

func (*Controllers) Mappings

func (ctrls *Controllers) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*Controllers) Reset

func (ctrls *Controllers) Reset()

func (*Controllers) Store

func (ctrls *Controllers) Store(address uint16, value uint8) (oldValue uint8)

func (*Controllers) ValidKeyDown

func (ctrls *Controllers) ValidKeyDown(controller int, btn Button) (valid bool)

type Event

type Event interface {
	Flag() uint
	Process(nes *NES)
	String() string
}

type FPS

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

func NewFPS

func NewFPS(rate float64) *FPS

func (*FPS) Delay

func (fps *FPS) Delay()

func (*FPS) Disable

func (fps *FPS) Disable()

func (*FPS) Enable

func (fps *FPS) Enable()

func (*FPS) Resumed

func (fps *FPS) Resumed()

func (*FPS) SetRate

func (fps *FPS) SetRate(rate float64)

type FPSEvent

type FPSEvent struct {
	Rate float64
}

func (*FPSEvent) Flag

func (e *FPSEvent) Flag() uint

func (*FPSEvent) Process

func (e *FPSEvent) Process(nes *NES)

func (*FPSEvent) String

func (e *FPSEvent) String() string

type FrameEvent

type FrameEvent struct {
	Colors []uint8
}

func (*FrameEvent) Flag

func (e *FrameEvent) Flag() uint

func (*FrameEvent) Process

func (e *FrameEvent) Process(nes *NES)

func (*FrameEvent) String

func (e *FrameEvent) String() string

type FrameStepEvent

type FrameStepEvent struct{}

func (*FrameStepEvent) Flag

func (e *FrameStepEvent) Flag() uint

func (*FrameStepEvent) Process

func (e *FrameStepEvent) Process(nes *NES)

func (*FrameStepEvent) String

func (e *FrameStepEvent) String() string

type GIFRecorder

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

func NewGIFRecorder

func NewGIFRecorder() (video *GIFRecorder, err error)

func (*GIFRecorder) Input

func (video *GIFRecorder) Input() chan []uint8

func (*GIFRecorder) Quit

func (video *GIFRecorder) Quit()

func (*GIFRecorder) Record

func (video *GIFRecorder) Record()

func (*GIFRecorder) Run

func (video *GIFRecorder) Run()

func (*GIFRecorder) Stop

func (video *GIFRecorder) Stop()

type HeartbeatEvent

type HeartbeatEvent struct{}

func (*HeartbeatEvent) Flag

func (e *HeartbeatEvent) Flag() uint

func (*HeartbeatEvent) Process

func (e *HeartbeatEvent) Process(nes *NES)

func (*HeartbeatEvent) String

func (e *HeartbeatEvent) String() string

type JPEGRecorder

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

func NewJPEGRecorder

func NewJPEGRecorder() (video *JPEGRecorder, err error)

func (*JPEGRecorder) Input

func (video *JPEGRecorder) Input() chan []uint8

func (*JPEGRecorder) Quit

func (video *JPEGRecorder) Quit()

func (*JPEGRecorder) Record

func (video *JPEGRecorder) Record()

func (*JPEGRecorder) Run

func (video *JPEGRecorder) Run()

func (*JPEGRecorder) Stop

func (video *JPEGRecorder) Stop()

type LoadStateEvent

type LoadStateEvent struct {
	Data []byte
}

func (*LoadStateEvent) Flag

func (e *LoadStateEvent) Flag() uint

func (*LoadStateEvent) Process

func (e *LoadStateEvent) Process(nes *NES)

func (*LoadStateEvent) String

func (e *LoadStateEvent) String() string

type MMC1

type MMC1 struct {
	*ROMFile
	Registers MMC1Registers
}

func NewMMC1

func NewMMC1(romf *ROMFile) *MMC1

func (*MMC1) Fetch

func (mmc1 *MMC1) Fetch(address uint16) (value uint8)

func (*MMC1) Mappings

func (mmc1 *MMC1) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*MMC1) Reset

func (mmc1 *MMC1) Reset()

func (*MMC1) Store

func (mmc1 *MMC1) Store(address uint16, value uint8) (oldValue uint8)

func (*MMC1) String

func (mmc1 *MMC1) String() string

func (*MMC1) Tables

func (mmc1 *MMC1) Tables() (t0, t1, t2, t3 int)

type MMC1Mirroring

type MMC1Mirroring uint8
const (
	OneScreenLowerBank MMC1Mirroring = iota
	OneScreenUpperBank
	Vertical
	Horizontal
)

type MMC1Registers

type MMC1Registers struct {
	Load       uint8
	Control    uint8
	CHRBank0   uint8
	CHRBank1   uint8
	PRGBank    uint8
	Shift      uint8
	ShiftCount uint8
}

func (*MMC1Registers) Reset

func (reg *MMC1Registers) Reset()

type MMC2

type MMC2 struct {
	*ROMFile
	Registers MMC2Registers
}

func NewMMC2

func NewMMC2(romf *ROMFile) *MMC2

func (*MMC2) Fetch

func (mmc2 *MMC2) Fetch(address uint16) (value uint8)

func (*MMC2) Mappings

func (mmc2 *MMC2) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*MMC2) Reset

func (mmc2 *MMC2) Reset()

func (*MMC2) Store

func (mmc2 *MMC2) Store(address uint16, value uint8) (oldValue uint8)

func (*MMC2) String

func (mmc2 *MMC2) String() string

func (*MMC2) Tables

func (mmc2 *MMC2) Tables() (t0, t1, t2, t3 int)

type MMC2Registers

type MMC2Registers struct {
	PRGBank   uint8
	CHRBank0  uint8
	CHRBank1  uint8
	CHRBank2  uint8
	CHRBank3  uint8
	Mirroring uint8
	Latch0    uint8
	Latch1    uint8
}

func (*MMC2Registers) Reset

func (reg *MMC2Registers) Reset()

type MMC3

type MMC3 struct {
	*ROMFile
	Registers MMC3Registers
}

func NewMMC3

func NewMMC3(romf *ROMFile) *MMC3

func (*MMC3) Fetch

func (mmc3 *MMC3) Fetch(address uint16) (value uint8)

func (*MMC3) Mappings

func (mmc3 *MMC3) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*MMC3) Reset

func (mmc3 *MMC3) Reset()

func (*MMC3) Store

func (mmc3 *MMC3) Store(address uint16, value uint8) (oldValue uint8)

func (*MMC3) String

func (mmc3 *MMC3) String() string

func (*MMC3) Tables

func (mmc3 *MMC3) Tables() (t0, t1, t2, t3 int)

type MMC3BankSelectFlag

type MMC3BankSelectFlag uint8
const (
	BankRegister MMC3BankSelectFlag = 1 << iota
	PRGROMBankMode
	CHRA12Inversion
)

type MMC3Registers

type MMC3Registers struct {
	BankSelect    uint8
	BankData      uint8
	Mirroring     uint8
	PRGRAMProtect uint8

	IRQLatch   uint8
	IRQReload  bool
	IRQEnable  bool
	IRQCounter uint8

	CHRBank1 uint8
	CHRBank2 uint8
	CHRBank3 uint8
	CHRBank4 uint8
	CHRBank5 uint8
	CHRBank6 uint8

	PRGBankLow  uint8
	PRGBankHigh uint8
}

func (*MMC3Registers) Reset

func (reg *MMC3Registers) Reset()

type MuteEvent

type MuteEvent struct{}

func (*MuteEvent) Flag

func (e *MuteEvent) Flag() uint

func (*MuteEvent) Process

func (e *MuteEvent) Process(nes *NES)

func (*MuteEvent) String

func (e *MuteEvent) String() string

type MuteNoiseEvent

type MuteNoiseEvent struct{}

func (*MuteNoiseEvent) Flag

func (e *MuteNoiseEvent) Flag() uint

func (*MuteNoiseEvent) Process

func (e *MuteNoiseEvent) Process(nes *NES)

func (*MuteNoiseEvent) String

func (e *MuteNoiseEvent) String() string

type MutePulse1Event

type MutePulse1Event struct{}

func (*MutePulse1Event) Flag

func (e *MutePulse1Event) Flag() uint

func (*MutePulse1Event) Process

func (e *MutePulse1Event) Process(nes *NES)

func (*MutePulse1Event) String

func (e *MutePulse1Event) String() string

type MutePulse2Event

type MutePulse2Event struct{}

func (*MutePulse2Event) Flag

func (e *MutePulse2Event) Flag() uint

func (*MutePulse2Event) Process

func (e *MutePulse2Event) Process(nes *NES)

func (*MutePulse2Event) String

func (e *MutePulse2Event) String() string

type MuteTriangleEvent

type MuteTriangleEvent struct{}

func (*MuteTriangleEvent) Flag

func (e *MuteTriangleEvent) Flag() uint

func (*MuteTriangleEvent) Process

func (e *MuteTriangleEvent) Process(nes *NES)

func (*MuteTriangleEvent) String

func (e *MuteTriangleEvent) String() string

type NES

type NES struct {
	GameName string

	Paused bool

	CPU        *rp2ago3.RP2A03
	CpuDivisor float32
	PPU        *rp2cgo2.RP2C02
	PPUQuota   float32

	ROM ROM

	Tick uint64
	// contains filtered or unexported fields
}

func NewNES

func NewNES(filename string, options *Options) (nes *NES, err error)

func (*NES) LoadState

func (nes *NES) LoadState()

func (*NES) LoadStateFromReader

func (nes *NES) LoadStateFromReader(reader io.ReaderAt, size int64) (err error)

func (*NES) Pause

func (nes *NES) Pause() RunState

func (*NES) Reset

func (nes *NES) Reset()

func (*NES) Run

func (nes *NES) Run() (err error)

func (*NES) RunState

func (nes *NES) RunState() RunState

func (*NES) SaveState

func (nes *NES) SaveState()

func (*NES) SaveStateToWriter

func (nes *NES) SaveStateToWriter(writer io.Writer) (err error)

func (*NES) StepState

func (nes *NES) StepState() StepState

type NROM

type NROM struct {
	*ROMFile
}

func NewNROM

func NewNROM(romf *ROMFile) *NROM

func (*NROM) Fetch

func (nrom *NROM) Fetch(address uint16) (value uint8)

func (*NROM) Mappings

func (nrom *NROM) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*NROM) Reset

func (nrom *NROM) Reset()

func (*NROM) Store

func (nrom *NROM) Store(address uint16, value uint8) (oldValue uint8)

func (*NROM) String

func (nrom *NROM) String() string

type Options

type Options struct {
	Recorder      string
	AudioRecorder string
	CPUDecode     bool
	CPUProfile    string
	MemProfile    string
	HTTPAddress   string
	Listen        string
	Connect       string
}

type PPUDecodeEvent

type PPUDecodeEvent struct{}

func (*PPUDecodeEvent) Flag

func (e *PPUDecodeEvent) Flag() uint

func (*PPUDecodeEvent) Process

func (e *PPUDecodeEvent) Process(nes *NES)

func (*PPUDecodeEvent) String

func (e *PPUDecodeEvent) String() string

type PRGBankFlag

type PRGBankFlag uint8
const (
	PRGBankSelect PRGBankFlag = 1 << iota

	PRGRAMChipEnable
)

type Packet

type Packet struct {
	Tick uint64
	Ev   Event
}

type PauseEvent

type PauseEvent struct {
	Request PauseRequest
	Changed chan bool
}

func (*PauseEvent) Flag

func (e *PauseEvent) Flag() uint

func (*PauseEvent) Process

func (e *PauseEvent) Process(nes *NES)

func (*PauseEvent) String

func (e *PauseEvent) String() string

type PauseRequest

type PauseRequest uint8
const (
	Toggle PauseRequest = iota
	Pause
	Unpause
)

type QuitEvent

type QuitEvent struct{}

func (*QuitEvent) Flag

func (e *QuitEvent) Flag() uint

func (*QuitEvent) Process

func (e *QuitEvent) Process(nes *NES)

func (*QuitEvent) String

func (e *QuitEvent) String() string

type ROM

type ROM interface {
	rp2ago3.MappableMemory
	Region() Region
	String() string
	GameName() string
	LoadBattery()
	SaveBattery() (err error)
	GetROMFile() *ROMFile
}

func NewROM

func NewROM(filename string, irq func(state bool), setTables func(t0, t1, t2, t3 int)) (rom ROM, err error)

type ROMFile

type ROMFile struct {
	Gamename    string
	PRGBanks    uint16
	CHRBanks    uint16
	Mirroring   rp2cgo2.Mirroring
	Battery     bool
	Trainer     bool
	FourScreen  bool
	VSCart      bool
	Mapper      uint8
	RAMBanks    uint8
	RegionFlag  Region
	TrainerData []uint8
	WRAMBanks   [][]uint8
	ROMBanks    [][]uint8
	VROMBanks   [][]uint8
	// contains filtered or unexported fields
}

func NewROMFile

func NewROMFile(buf []byte) (romf *ROMFile, err error)

func (*ROMFile) GameName

func (romf *ROMFile) GameName() string

func (*ROMFile) GetROMFile

func (romf *ROMFile) GetROMFile() *ROMFile

func (*ROMFile) LoadBattery

func (romf *ROMFile) LoadBattery()

func (*ROMFile) Region

func (romf *ROMFile) Region() Region

func (*ROMFile) SaveBattery

func (romf *ROMFile) SaveBattery() (err error)

func (*ROMFile) String

func (romf *ROMFile) String() string

func (*ROMFile) Tables

func (romf *ROMFile) Tables() (t0, t1, t2, t3 int)

type RecordEvent

type RecordEvent struct{}

func (*RecordEvent) Flag

func (e *RecordEvent) Flag() uint

func (*RecordEvent) Process

func (e *RecordEvent) Process(nes *NES)

func (*RecordEvent) String

func (e *RecordEvent) String() string

type Recorder

type Recorder interface {
	Input() chan []uint8
	Record()
	Stop()
	Quit()
	Run()
}

type Region

type Region uint8
const (
	NTSC Region = iota
	PAL
)

func (Region) String

func (i Region) String() string

type ResetEvent

type ResetEvent struct{}

func (*ResetEvent) Flag

func (e *ResetEvent) Flag() uint

func (*ResetEvent) Process

func (e *ResetEvent) Process(nes *NES)

func (*ResetEvent) String

func (e *ResetEvent) String() string

type RunState

type RunState uint8
const (
	Uninitialized RunState = iota
	Running
	Quitting
)

func (RunState) String

func (i RunState) String() string

type SampleEvent

type SampleEvent struct {
	Sample int16
}

func (*SampleEvent) Flag

func (e *SampleEvent) Flag() uint

func (*SampleEvent) Process

func (e *SampleEvent) Process(nes *NES)

func (*SampleEvent) String

func (e *SampleEvent) String() string

type SavePatternTablesEvent

type SavePatternTablesEvent struct{}

func (*SavePatternTablesEvent) Flag

func (e *SavePatternTablesEvent) Flag() uint

func (*SavePatternTablesEvent) Process

func (e *SavePatternTablesEvent) Process(nes *NES)

func (*SavePatternTablesEvent) String

func (e *SavePatternTablesEvent) String() string

type SaveStateEvent

type SaveStateEvent struct{}

func (*SaveStateEvent) Flag

func (e *SaveStateEvent) Flag() uint

func (*SaveStateEvent) Process

func (e *SaveStateEvent) Process(nes *NES)

func (*SaveStateEvent) String

func (e *SaveStateEvent) String() string

type ShowBackgroundEvent

type ShowBackgroundEvent struct{}

func (*ShowBackgroundEvent) Flag

func (e *ShowBackgroundEvent) Flag() uint

func (*ShowBackgroundEvent) Process

func (e *ShowBackgroundEvent) Process(nes *NES)

func (*ShowBackgroundEvent) String

func (e *ShowBackgroundEvent) String() string

type ShowSpritesEvent

type ShowSpritesEvent struct{}

func (*ShowSpritesEvent) Flag

func (e *ShowSpritesEvent) Flag() uint

func (*ShowSpritesEvent) Process

func (e *ShowSpritesEvent) Process(nes *NES)

func (*ShowSpritesEvent) String

func (e *ShowSpritesEvent) String() string

type StepState

type StepState uint8
const (
	NoStep StepState = iota
	CycleStep
	ScanlineStep
	FrameStep
)

func (StepState) String

func (i StepState) String() string

type StopEvent

type StopEvent struct{}

func (*StopEvent) Flag

func (e *StopEvent) Flag() uint

func (*StopEvent) Process

func (e *StopEvent) Process(nes *NES)

func (*StopEvent) String

func (e *StopEvent) String() string

type UNROM

type UNROM struct {
	*ROMFile
	Registers UNROMRegisters
}

func NewUNROM

func NewUNROM(romf *ROMFile) *UNROM

func (*UNROM) Fetch

func (unrom *UNROM) Fetch(address uint16) (value uint8)

func (*UNROM) Mappings

func (unrom *UNROM) Mappings(which rp2ago3.Mapping) (fetch, store []uint16)

func (*UNROM) Reset

func (unrom *UNROM) Reset()

func (*UNROM) Store

func (unrom *UNROM) Store(address uint16, value uint8) (oldValue uint8)

func (*UNROM) String

func (unrom *UNROM) String() string

type UNROMRegisters

type UNROMRegisters struct {
	BankSelect uint8
}

func (*UNROMRegisters) Reset

func (reg *UNROMRegisters) Reset()

type Video

type Video interface {
	Input() chan []uint8
	Events() chan Event
	Run()
	SetCaption(caption string)
}

type WAVRecorder

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

func NewWAVRecorder

func NewWAVRecorder() (wr *WAVRecorder, err error)

func (*WAVRecorder) Input

func (wr *WAVRecorder) Input() chan int16

func (*WAVRecorder) Quit

func (wr *WAVRecorder) Quit()

func (*WAVRecorder) Record

func (wr *WAVRecorder) Record()

func (*WAVRecorder) Run

func (wr *WAVRecorder) Run()

func (*WAVRecorder) Stop

func (wr *WAVRecorder) Stop()

Jump to

Keyboard shortcuts

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