Documentation ¶
Index ¶
- Constants
- Variables
- type APU
- func (apu *APU) FetchFrameIRQFlag() bool
- func (apu *APU) FetchFrameMode() int
- func (apu *APU) FetchFrameStep() int
- func (apu *APU) FetchNewFrameCounterVal() int
- func (apu *APU) FetchPulse1LC() int
- func (apu *APU) FetchWriteDelayFC() byte
- func (apu *APU) PeekStatus() byte
- func (apu *APU) PowerUp()
- func (apu *APU) Reset()
- func (apu *APU) Step()
- type CPU
- type CPUBus
- type CPUOption
- type Cassette
- type DMA
- type DMCDMAState
- type IRQInterruptLine
- type IRQSource
- type Joypad
- type Mapper
- type MirroringType
- type Mnemonic
- type NES
- type NMIInterruptLine
- type OAMDMAState
- type PPU
- func (ppu *PPU) FetchBuffer() byte
- func (ppu *PPU) FetchV() uint16
- func (ppu *PPU) FetchVBlankStarted() bool
- func (ppu *PPU) PeekRegister(addr uint16) byte
- func (ppu *PPU) PowerUp()
- func (ppu *PPU) ReadRegister(addr uint16) byte
- func (ppu *PPU) Reset()
- func (ppu *PPU) Step()
- func (ppu *PPU) WriteRegister(addr uint16, val byte)
- type Player
- type Renderer
- type SpriteEvaluationState
- type Trace
- func (t *Trace) AddCPUByteCode(v byte)
- func (t *Trace) AddCPUCycle(v int)
- func (t *Trace) NESTestString() string
- func (t *Trace) Reset()
- func (t *Trace) SetCPUAddressingResult(v string)
- func (t *Trace) SetCPUInstructionReadByte(v *byte)
- func (t *Trace) SetCPUOpcode(v opcode)
- func (t *Trace) SetCPURegisterA(v byte)
- func (t *Trace) SetCPURegisterP(v byte)
- func (t *Trace) SetCPURegisterPC(v uint16)
- func (t *Trace) SetCPURegisterS(v byte)
- func (t *Trace) SetCPURegisterX(v byte)
- func (t *Trace) SetCPURegisterY(v byte)
- func (t *Trace) SetPPUVBlankState(v bool)
- func (t *Trace) SetPPUX(v uint16)
- func (t *Trace) SetPPUY(v uint16)
Constants ¶
View Source
const ( ButtonA = (1 << iota) ButtonB ButtonSelect ButtonStart ButtonUP ButtonDown ButtonLeft ButtonRight )
https://www.nesdev.org/wiki/Controller_reading_code
View Source
const ( ScreenWidth = 256 ScreenHeight = 240 )
View Source
const ( // ref: https://www.nesdev.org/wiki/CPU#Frequencies // NTSC CPUClockFrequency = 1789773 )
Variables ¶
View Source
var Palette [64]color.Color
Functions ¶
This section is empty.
Types ¶
type APU ¶
type APU struct {
// contains filtered or unexported fields
}
func (*APU) FetchFrameIRQFlag ¶
func (*APU) FetchFrameMode ¶
func (*APU) FetchNewFrameCounterVal ¶
func (*APU) FetchPulse1LC ¶
func (*APU) FetchWriteDelayFC ¶
type CPU ¶
type CPU struct { // registers A byte // Accumulator X byte // Index Y byte // Index PC uint16 // Program Counter S byte // Stack Pointer P processorStatus // contains filtered or unexported fields }
func NewCPU ¶
func NewCPU(bus *CPUBus, nmiLine *NMIInterruptLine, irqLine *IRQInterruptLine, opts ...CPUOption) *CPU
func (*CPU) PowerUp ¶
func (cpu *CPU) PowerUp()
ref: http://users.telenet.be/kim1-6502/6502/proman.html#92
Cycles Address Bus Data Bus External Operation Internal Operation 1 ? ? Don't Care Hold During Reset 2 ? + 1 ? Don't Care First Start State 3 0100 + SP ? Don't Care Second Start State 4 0100 + SP-1 ? Don't Care Third Start State 5 0100 + SP-2 ? Don't Care Fourth Start State 6 FFFC Start PCL Fetch First Vector 7 FFFD Start PCH Fetch Second Vector Hold PCL 8 PCH PCL First Load First OP CODE
type CPUBus ¶
type CPUBus struct {
// contains filtered or unexported fields
}
func (*CPUBus) RunDMAIfOccurred ¶
type Cassette ¶
type Cassette struct { PRG []byte CHR []byte Mapper byte Mirror MirroringType // contains filtered or unexported fields }
func (*Cassette) MirroingType ¶
func (c *Cassette) MirroingType() MirroringType
type DMA ¶
type DMA struct {
// contains filtered or unexported fields
}
func (*DMA) TriggerOnDMCLoad ¶
func (*DMA) TriggerOnDMCReload ¶
func (*DMA) TriggerOnOAM ¶
type DMCDMAState ¶
type DMCDMAState int
const ( DMCDMANoneState DMCDMAState = iota DMCDMAHaltState DMCDMADummyState DMCDMAAlignmentState DMCDMARunState )
type IRQInterruptLine ¶
type IRQInterruptLine int
func (*IRQInterruptLine) IsHigh ¶
func (i *IRQInterruptLine) IsHigh() bool
func (*IRQInterruptLine) IsLow ¶
func (i *IRQInterruptLine) IsLow() bool
func (*IRQInterruptLine) SetHigh ¶
func (i *IRQInterruptLine) SetHigh(src IRQSource)
func (*IRQInterruptLine) SetLow ¶
func (i *IRQInterruptLine) SetLow(src IRQSource)
type Joypad ¶
type Joypad struct { Strobe bool ButtonIndex byte ButtonStatus byte // contains filtered or unexported fields }
func (*Joypad) SetButtonStatus ¶
type Mapper ¶
type Mapper interface { Read(addr uint16) byte Write(addr uint16, val byte) MirroingType() MirroringType String() string Reset() }
func NewMapperFromCassette ¶
type MirroringType ¶
type MirroringType int
const ( MirroringVertical MirroringType = iota MirroringHorizontal MirroringFourScreen )
func (*MirroringType) IsFourScreen ¶
func (m *MirroringType) IsFourScreen() bool
func (*MirroringType) IsHorizontal ¶
func (m *MirroringType) IsHorizontal() bool
func (*MirroringType) IsVertical ¶
func (m *MirroringType) IsVertical() bool
type Mnemonic ¶
type Mnemonic int
const ( UnknownMnemonic Mnemonic = iota LDA LDX LDY STA STX STY TAX TAY TSX TXA TXS TYA ADC AND ASL BIT CMP CPX CPY DEC DEX DEY EOR INC INX INY LSR ORA ROL ROR SBC PHA PHP PLA PLP JMP JSR RTS RTI BCC BCS BEQ BMI BNE BPL BVC BVS CLC CLD CLI CLV SEC SED SEI BRK NOP KIL SLO ANC RLA SRE ALR RRA ARR SAX XAA AHX TAS SHY SHX LAX LAS DCP AXS ISB )
type NES ¶
type NES struct {
// contains filtered or unexported fields
}
func (*NES) PeekMemory ¶
func (*NES) SetButtonStatus ¶
type NMIInterruptLine ¶
type NMIInterruptLine int
func (*NMIInterruptLine) IsHigh ¶
func (i *NMIInterruptLine) IsHigh() bool
func (*NMIInterruptLine) IsLow ¶
func (i *NMIInterruptLine) IsLow() bool
func (*NMIInterruptLine) SetHigh ¶
func (i *NMIInterruptLine) SetHigh()
func (*NMIInterruptLine) SetLow ¶
func (i *NMIInterruptLine) SetLow()
type OAMDMAState ¶
type OAMDMAState int
const ( OAMDMANoneState OAMDMAState = iota OAMDMAHaltState OAMDMAAlignmentState OAMDMAReadState OAMDMAWriteState )
type PPU ¶
func NewPPU ¶
func NewPPU(renderer Renderer, mapper Mapper, mirror MirroringType, nmiLine *NMIInterruptLine) *PPU
func (*PPU) FetchBuffer ¶
func (*PPU) FetchVBlankStarted ¶
func (*PPU) PeekRegister ¶
func (*PPU) ReadRegister ¶
ReadRegister is called from CPU Memory Mapped I/O
func (*PPU) WriteRegister ¶
WriteRegister is called from CPU Memory Mapped I/O
type SpriteEvaluationState ¶
type SpriteEvaluationState byte
const ( InitAndScanPrimaryOAMState SpriteEvaluationState = iota ScanPrimaryOAMState CopySpriteState CheckSpriteOverflowState DoneSpriteEvaluationState )
type Trace ¶
type Trace struct { A byte X byte Y byte PC uint16 S byte P byte ByteCode []byte Opcode opcode AddressingResult string InstructionReadByte *byte Cycle int PPUX uint16 PPUY uint16 PPUVBlankState bool }
func (*Trace) AddCPUByteCode ¶
func (*Trace) AddCPUCycle ¶
func (*Trace) NESTestString ¶
func (*Trace) SetCPUAddressingResult ¶
func (*Trace) SetCPUInstructionReadByte ¶
func (*Trace) SetCPUOpcode ¶
func (t *Trace) SetCPUOpcode(v opcode)
func (*Trace) SetCPURegisterA ¶
func (*Trace) SetCPURegisterP ¶
func (*Trace) SetCPURegisterPC ¶
func (*Trace) SetCPURegisterS ¶
func (*Trace) SetCPURegisterX ¶
func (*Trace) SetCPURegisterY ¶
func (*Trace) SetPPUVBlankState ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.