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) Reset()
- func (console *Console) SetAudioChannel(channel chan float32)
- 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 Mapper
- type Mapper1
- type Mapper2
- 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) 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 Mapper ¶
func NewMapper1 ¶
func NewMapper2 ¶
func NewMapper3 ¶
func NewMapper4 ¶
func NewMapper7 ¶
type Mapper4 ¶
type Mapper4 struct { *Cartridge // contains filtered or unexported fields }
func (*Mapper4) HandleScanLine ¶
func (m *Mapper4) HandleScanLine()
Click to show internal directories.
Click to hide internal directories.