Documentation ¶
Index ¶
- Constants
- Variables
- func MirrorAddress(mode byte, address uint16) uint16
- func ReadFile(path string) (string, bool)
- func ReadMagicNumber(w io.Reader) (uint32, error)
- func RemoveDir(path string) error
- func Zip(path string) string
- type APU
- type CPU
- type CPUMemory
- type Cartridge
- type Controller
- type DMC
- type Filter
- type FilterChain
- type FirstOrderFilter
- type Mapper
- type Mapper1
- type Mapper2
- type Mapper3
- type Mapper4
- type Mapper7
- type Memory
- type NES
- type NESFileHeader
- type Noise
- type PPU
- type PPUMemory
- type Square
- type Triangle
Constants ¶
View Source
const ( BA = iota // K BB // J BSelect // F BStart // H BUp // W BDown // S BLeft // A BRight // D )
Controllers
View Source
const ( MirrorHorizontal = iota MirrorVertical MirrorSingle0 MirrorSingle1 MirrorFour )
View Source
const CPUFrequency = 1789773 // From http://wiki.nesdev.com/w/index.php/CPU
View Source
const NESMagicMumber = 0x1a53454e //"NES^Z"
View Source
const NESMagicNumber = 0x1a53454e // "NES^Z"
View Source
const Tmpdir = "tmp"
View Source
const ZIPMagicNumber = 0x04034B50 // "PK.."
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 APU ¶
type APU struct {
// contains filtered or unexported fields
}
func (*APU) ReadRegister ¶
func (*APU) WriteRegister ¶
type CPU ¶
type CPU struct { Cycles uint64 // Should be big enough PC uint16 // Program counter SP byte // Stack pointer A byte // Accumulator X byte // Index Register X Y byte // Index Register Y C byte // Carry FLag Z byte // Zero Flag I byte // Interrupt Disable D byte // Decimal Mode B byte // Break Command U byte // Ignored FLag V byte // Overflow Flag N byte // Negative Flag Memory //Memory Interface // contains filtered or unexported fields }
type Cartridge ¶
type Cartridge struct { PRG []byte CHR []byte SRAM []byte Mapper byte Mirror byte Battery byte // contains filtered or unexported fields }
func LoadNES ¶
* LoadNES function reads an iNES file from the given path and return a Cartidge * if success.
func NewCartridge ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) Press ¶
func (c *Controller) Press(button int)
func (*Controller) Read ¶
func (c *Controller) Read() byte
func (*Controller) Release ¶
func (c *Controller) Release(button int)
func (*Controller) SetPressed ¶
func (c *Controller) SetPressed(button int, pressed bool)
func (*Controller) Write ¶
func (c *Controller) Write(val byte)
type FilterChain ¶
type FilterChain []Filter
func (FilterChain) Run ¶
func (fc FilterChain) Run(x float32) float32
type FirstOrderFilter ¶
type FirstOrderFilter struct { B0 float32 B1 float32 A1 float32 // contains filtered or unexported fields }
func (*FirstOrderFilter) Run ¶
func (f *FirstOrderFilter) Run(x float32) float32
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()
type Memory ¶
type Memory interface { Read(address uint16) byte Write(address uint16, value byte) Read16(address uint16) uint16 }
func NewCPUMemory ¶
func NewPPUMemory ¶
type NES ¶
type NES struct { FileName string APU *APU Cartridge *Cartridge Controller1 *Controller Controller2 *Controller CPU *CPU PPU *PPU RAM []byte Mapper Mapper CPUMemory Memory PPUMemory Memory }
func (*NES) RunSeconds ¶
func (*NES) SetAPUChannel ¶
func (*NES) SetAPUSRate ¶
func (*NES) SetKeyPressed ¶
type NESFileHeader ¶
type PPU ¶
type PPU struct { Memory // memory interface NES *NES Cycle int // 0-340 ScanLine int // 0-261 Frame uint64 // contains filtered or unexported fields }
func (*PPU) ReadRegister ¶
func (*PPU) WriteRegister ¶
Click to show internal directories.
Click to hide internal directories.