Documentation ¶
Index ¶
- Constants
- Variables
- type MirroringOption
- type PPU
- func (p *PPU) Clock(cnt uint64) uint64
- func (p *PPU) Debug() string
- func (p *PPU) Flip()
- func (p *PPU) Front(cb func(*image.RGBA))
- func (p *PPU) Length() uint16
- func (p *PPU) MemRead(offset uint16) byte
- func (p *PPU) MemWrite(offset uint16, val byte) byte
- func (p *PPU) Ptr() uintptr
- func (p *PPU) Reset()
- func (ppu *PPU) SetCustomNametables(device memory.Handler, keys [4]byte)
- func (ppu *PPU) SetMirroring(mopt MirroringOption)
- func (p *PPU) String() string
Constants ¶
View Source
const ( // STATUS SpriteOverflow byte = 0x20 SpriteZeroHit byte = 0x40 // Set when a nonzero pixel of sprite 0 overlaps a nonzero background pixel VBlankStarted byte = 0x80 // CTRL NameTableMask byte = 0x03 // 0, 1, 2 or 3 LargeIncrements byte = 0x04 // VRAM address increment per CPU read/write of PPUDATA (0: add 1, going across; 1: add 32, going down) AltSprites byte = 0x08 // Sprite pattern table address for 8x8 sprites (0: $0000; 1: $1000; ignored in 8x16 mode) AltBackground byte = 0x10 // Background pattern table address (0: $0000; 1: $1000) WideSprites byte = 0x20 // Sprite size (0: 8x8 pixels; 1: 8x16 pixels – see PPU OAM#Byte 1) PpuMaster byte = 0x40 // PPU master/slave select (0: read backdrop from EXT pins; 1: output color on EXT pins) GenerateNMI byte = 0x80 // Generate an NMI at the start of the vertical blanking interval (0: off; 1: on) // MASK Greyscale byte = 0x01 // Greyscale (0: normal color, 1: produce a greyscale display) ShowLeftBg byte = 0x02 // 1: Show background in leftmost 8 pixels of screen, 0: Hide ShowLeftSprites byte = 0x04 // 1: Show sprites in leftmost 8 pixels of screen, 0: Hide ShowBg byte = 0x08 // 1: Show background ShowSprites byte = 0x10 // 1: Show sprites EmphasizeRed byte = 0x20 // Emphasize red (green on PAL/Dendy) EmphasizeGreen byte = 0x40 // Emphasize green (red on PAL/Dendy) EmphasizeBlue byte = 0x80 // Emphasize blue PPUCTRL = 0 PPUMASK = 1 PPUSTATUS = 2 OAMADDR = 3 OAMDATA = 4 PPUSCROLL = 5 PPUADDR = 6 PPUDATA = 7 )
Variables ¶
View Source
var Palette [64]color.RGBA
Functions ¶
This section is empty.
Types ¶
type MirroringOption ¶
type MirroringOption byte
const ( InvalidMirroring MirroringOption = iota HorizontalMirroring VerticalMirroring SingleScreenMirroring SingleScreen2Mirroring FourScreenMirroring DiagonalMirroring LShapedMirroring ThreeScreenMirroring ThreeScreenHorizontalMirroring ThreeScreenDiagonalMirroring )
type PPU ¶
type PPU struct { Memory memory.Master OAM [256]byte // can be edited by the CPU via DMA Palette [32]byte // color palette // https://www.nesdev.org/wiki/PPU_scrolling#PPU_internal_registers V uint16 // Current VRAM address (15 bits) T uint16 // Temporary VRAM address (15 bits); can also be thought of as the address of the top left onscreen tile. X byte // Fine X scroll (3 bits) W bool // First or second write toggle (1 bit) VBlankInterrupt func(byte) // Debug trace Trace io.Writer // contains filtered or unexported fields }
func (*PPU) SetCustomNametables ¶
SetCustomNametables configures nametables memory address (0x2000~0x2fff) to point to the given memory device. keys can be used to configure mirroring, allowing bits 10 and 11 of the address to be altered as needed. giving keys=[4]byte{0,1,2,3} means no rewriting happens, while other values will give various behaviors. If device is null, the PPU's internal WRAM will be used after being resized depending on the largest key provided (for example 0,1,2,3 will allocate 4kB of WRAM).
func (*PPU) SetMirroring ¶
func (ppu *PPU) SetMirroring(mopt MirroringOption)
Click to show internal directories.
Click to hide internal directories.