ppu

package
v0.0.0-...-5039d0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VBLANK_INTERRUPT = 0
	LCDC_INTERRUPT   = 1

	LCDC = 0xFF40 // LCD Control
	STAT = 0xFF41 // LCD Status/Mode
	SCY  = 0xFF42 // Scroll Y
	SCX  = 0xFF43 // Scroll X
	LY   = 0xFF44 // Scanline
	LYC  = 0xFF45 // Scanline Comparison
	DMA  = 0xFF46
	BGP  = 0xFF47 // Background Palette
	OBP0 = 0xFF48 // Object/Sprite Background Palette 0
	OBP1 = 0xFF49 // Object/Sprite Background Palette 1
	WY   = 0xFF4A // Window Y
	WX   = 0xFF4B // Window X

	// Color-related Addresses
	VRAMBank = 0xFF4F // VRAM Bank
	BGPI     = 0xFF68 // Background Palette Index
	BGPD     = 0xFF69 // Background Palette Data
	OBPI     = 0xFF6A // Sprite Palette Index
	OBPD     = 0xFF6B // Sprite Palette Data
	HDMA1    = 0xFF51 // New DMA Source, High
	HDMA3    = 0xFF53 // New DMA Destination, High
	HDMA2    = 0xFF52 // New DMA Source, Low
	HDMA4    = 0xFF54 // New DMA Destination, Low
	HDMA5    = 0xFF55 // New DMA Length/Mode/Start
)
View Source
const (
	MODE0 = 0x00 // HBlank
	MODE1 = 0x01 // VBlank
	MODE2 = 0x02 // OAM Access
	MODE3 = 0x03 // VRAM Acess
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Dot

type Dot struct {
	ColorIdentifier byte
	Palette         byte
	Priority        byte
	Type            DotType
}

func (*Dot) ToRGBA

func (d *Dot) ToRGBA(palette byte) color.RGBA

type DotType

type DotType int
const (
	BG     DotType = 0
	SPRITE DotType = 1
)

type Fetcher

type Fetcher struct {
	SCY byte
	LY  byte
	// contains filtered or unexported fields
}

func (*Fetcher) FirstTileLine

func (f *Fetcher) FirstTileLine() []*Dot

func (*Fetcher) NextTileLine

func (f *Fetcher) NextTileLine() []*Dot

type Fifo

type Fifo struct {
	// contains filtered or unexported fields
}

func (*Fifo) Clear

func (fifo *Fifo) Clear()

func (*Fifo) Length

func (fifo *Fifo) Length() int

func (*Fifo) PopDot

func (fifo *Fifo) PopDot() (dot *Dot)

func (*Fifo) PushDots

func (fifo *Fifo) PushDots(dots []*Dot)

type PPU

type PPU struct {
	FrameBuffer *image.RGBA

	VRAM [16384]byte

	OAM            []*Sprite
	VisibleSprites []*Sprite

	STAT *stat // LCD Status/Mode
	SCY  byte  // Scroll Y
	SCX  byte  // Scroll X
	LY   byte  // Scanline
	LYC  byte
	DMA  byte
	BGP  byte
	OBP0 byte
	OBP1 byte
	WY   byte // Window Y
	WX   byte // Window X

	// Color-related Addresses
	VRAMBank byte // VRAM Bank

	HDMA1 byte // New DMA Source, High
	HDMA3 byte // New DMA Destination, High
	HDMA2 byte // New DMA Source, Low
	HDMA4 byte // New DMA Destination, Low
	HDMA5 byte // New DMA Length/Mode/Start

	// LCD Control byte
	LCDC byte

	Cycles int // Number of cycles since the last LCD Status Mode Change
	// contains filtered or unexported fields
}

func NewPPU

func NewPPU(mmu *mmu.MMU) *PPU

func (*PPU) OAMSearch

func (ppu *PPU) OAMSearch()

func (*PPU) ReadByte

func (ppu *PPU) ReadByte(addr uint16) byte

func (*PPU) Step

func (ppu *PPU) Step(cycles int)

func (*PPU) WriteByte

func (ppu *PPU) WriteByte(addr uint16, value byte)

type Sprite

type Sprite struct {
	Y          byte
	X          byte
	TileNumber byte
	Attributes byte
}

func (*Sprite) DMGPalette

func (s *Sprite) DMGPalette() byte

func (*Sprite) GBCPalette

func (s *Sprite) GBCPalette() byte

func (*Sprite) Palette

func (s *Sprite) Palette() byte

func (*Sprite) Priority

func (s *Sprite) Priority() byte

func (*Sprite) VRAMBank

func (s *Sprite) VRAMBank() bool

func (*Sprite) XFlip

func (s *Sprite) XFlip() bool

func (*Sprite) YFlip

func (s *Sprite) YFlip() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL