Documentation ¶
Index ¶
- Constants
- Variables
- func MirrorAddress(mode byte, address uint16) uint16
- type APU
- type CPU
- type Cartridge
- type Console
- func (console *Console) BackgroundColor() color.RGBA
- func (console *Console) Buffer() *image.RGBA
- func (console *Console) Load(decoder *gob.Decoder) error
- func (console *Console) LoadState(filename string) error
- func (console *Console) Reset()
- func (console *Console) Save(encoder *gob.Encoder) error
- func (console *Console) SaveState(filename string) error
- func (console *Console) SetAudioChannel(channel chan<- float32)
- func (console *Console) SetAudioSampleRate(sampleRate float64)
- func (console *Console) SetButtons1(buttons [8]bool)
- func (console *Console) SetButtons2(buttons [8]bool)
- func (console *Console) Step() int
- func (console *Console) StepFrame() int
- func (console *Console) StepSeconds(seconds float64)
- type Controller
- type DMC
- type Filter
- type FilterChain
- type FirstOrderFilter
- type Mapper
- func NewMapper(console *Console) (Mapper, error)
- func NewMapper1(cartridge *Cartridge) Mapper
- func NewMapper2(cartridge *Cartridge) Mapper
- func NewMapper225(cartridge *Cartridge) Mapper
- func NewMapper3(cartridge *Cartridge) Mapper
- func NewMapper4(console *Console, cartridge *Cartridge) Mapper
- func NewMapper7(cartridge *Cartridge) Mapper
- type Mapper1
- type Mapper2
- type Mapper225
- type Mapper3
- type Mapper4
- type Mapper7
- type Memory
- type Noise
- type PPU
- type Pulse
- type Triangle
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 )
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 MirrorAddress ¶
Types ¶
type CPU ¶
type CPU struct { Memory // memory interface 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 }
func (*CPU) PrintInstruction ¶
func (cpu *CPU) PrintInstruction()
PrintInstruction prints the current CPU state
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 }
func LoadNESFile ¶
LoadNESFile reads an iNES file (.nes) and returns a Cartridge on success. http://wiki.nesdev.com/w/index.php/INES http://nesdev.com/NESDoc.pdf (page 28)
func NewCartridge ¶
type Console ¶
type Console struct { CPU *CPU APU *APU PPU *PPU Cartridge *Cartridge Controller1 *Controller Controller2 *Controller Mapper Mapper RAM []byte }
func NewConsole ¶
func (*Console) BackgroundColor ¶
func (*Console) SetAudioChannel ¶
func (*Console) SetAudioSampleRate ¶
func (*Console) SetButtons1 ¶
func (*Console) SetButtons2 ¶
func (*Console) StepSeconds ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) Read ¶
func (c *Controller) Read() byte
func (*Controller) SetButtons ¶
func (c *Controller) SetButtons(buttons [8]bool)
func (*Controller) Write ¶
func (c *Controller) Write(value byte)
type Filter ¶
func HighPassFilter ¶
func LowPassFilter ¶
sampleRate: samples per second cutoffFreq: oscillations per second
type FilterChain ¶
type FilterChain []Filter
func (FilterChain) Step ¶
func (fc FilterChain) Step(x float32) float32
type FirstOrderFilter ¶
type FirstOrderFilter struct { B0 float32 B1 float32 A1 float32 // contains filtered or unexported fields }
First order filters are defined by the following parameters. y[n] = B0*x[n] + B1*x[n-1] - A1*y[n-1]
func (*FirstOrderFilter) Step ¶
func (f *FirstOrderFilter) Step(x float32) float32
type Mapper ¶
type Mapper interface { Read(address uint16) byte Write(address uint16, value byte) Step() Save(encoder *gob.Encoder) error Load(decoder *gob.Decoder) error }
func NewMapper1 ¶
func NewMapper2 ¶
func NewMapper225 ¶
func NewMapper3 ¶
func NewMapper4 ¶
func NewMapper7 ¶
type Mapper4 ¶
type Mapper4 struct { *Cartridge // contains filtered or unexported fields }
func (*Mapper4) HandleScanLine ¶
func (m *Mapper4) HandleScanLine()
type PPU ¶
Click to show internal directories.
Click to hide internal directories.