Documentation ¶
Index ¶
- Constants
- Variables
- type CGBBackgroundTileAttrs
- type CGBColor
- type CGBPalette
- type CGBPaletteSpecRegister
- type GPU
- func (g *GPU) CoincidenceLCDInterruptEnabled() bool
- func (g *GPU) DrawScanline(tilemapOffset, lineOffset types.Word, screenX, tileX, tileY int)
- func (g *GPU) DrawSpriteTileLine(s Sprite, tileId, screenYOffset, tileY int)
- func (g *GPU) Dump8x8Sprites() [40][8][8]types.RGB
- func (g *GPU) DumpTilemap(tileMapAddr types.Word, tileDataSigned bool) [256][256]types.RGB
- func (g *GPU) DumpTiles() [512][8][8]types.RGB
- func (g *GPU) HblankLCDInterruptEnabled() bool
- func (g *GPU) LinkIRQHandler(m components.IRQHandler)
- func (g *GPU) LinkScreen(screen inputoutput.Screen)
- func (g *GPU) Name() string
- func (g *GPU) Read(addr types.Word) byte
- func (g *GPU) ReadFromVideoRAM(addr types.Word) byte
- func (g *GPU) RenderBackgroundScanline()
- func (g *GPU) RenderSpritesOnScanline()
- func (g *GPU) RenderWindowScanline()
- func (g *GPU) Reset()
- func (g *GPU) Step(t int)
- func (g *GPU) UpdateSprite(addr types.Word, value byte)
- func (g *GPU) UpdateTile(addr types.Word, value byte, bank byte)
- func (g *GPU) VBlankLCDInterruptEnabled() bool
- func (g *GPU) Write(addr types.Word, value byte)
- func (g *GPU) WriteToVideoRAM(addr types.Word, value byte)
- type Palette
- type RawTile
- type Sprite
- type Sprite8x16
- func (s *Sprite8x16) GetTileID(no int) int
- func (s *Sprite8x16) IsScanlineDrawQueueEmpty() bool
- func (s *Sprite8x16) PopScanline() (int, int)
- func (s *Sprite8x16) PushScanlines(fromScanline, amount int)
- func (s *Sprite8x16) ResetScanlineDrawQueue()
- func (s *Sprite8x16) SpriteAttributes() *SpriteAttributes
- func (s *Sprite8x16) String() string
- func (s *Sprite8x16) UpdateSprite(addr types.Word, value byte)
- type Sprite8x8
- func (s *Sprite8x8) GetTileID(no int) int
- func (s *Sprite8x8) IsScanlineDrawQueueEmpty() bool
- func (s *Sprite8x8) PopScanline() (int, int)
- func (s *Sprite8x8) PushScanlines(fromScanline, amount int)
- func (s *Sprite8x8) ResetScanlineDrawQueue()
- func (s *Sprite8x8) SpriteAttributes() *SpriteAttributes
- func (s *Sprite8x8) String() string
- func (s *Sprite8x8) UpdateSprite(addr types.Word, value byte)
- type SpriteAttributes
- type Tile
Constants ¶
View Source
const ( CGB_VRAM_BANK_SELECT types.Word = 0xFF4F CGB_BGP_WRITESPEC_REGISTER = 0xFF68 CGB_BGP_WRITEDATA_REGISTER = 0xFF69 CGB_OBJP_WRITESPEC_REGISTER = 0xFF6A CGB_OBJP_WRITEDATA_REGISTER = 0xFF6B )
Colour GB graphics register addresses
View Source
const ( TILEMAP0 types.Word = 0x9800 TILEMAP1 = 0x9C00 TILEDATA0 = 0x8800 TILEDATA1 = 0x8000 )
View Source
const ( LCDC types.Word = 0xFF40 STAT = 0xFF41 SCROLLY = 0xFF42 SCROLLX = 0xFF43 LY = 0xFF44 LYC = 0xFF45 BGP = 0xFF47 OBJECTPALETTE_0 = 0xFF48 OBJECTPALETTE_1 = 0xFF49 WX = 0xFF4B WY = 0xFF4A )
Standard graphics register addresses
View Source
const DISPLAY_HEIGHT int = 144
View Source
const DISPLAY_WIDTH int = 160
View Source
const HBLANK byte = 0x00
View Source
const NAME = "GPU"
View Source
const OAMREAD byte = 0x02
View Source
const PREFIX = NAME + ":"
View Source
const Sprite8x16Mode byte = 0
View Source
const Sprite8x8Mode byte = 1
View Source
const VBLANK byte = 0x01
View Source
const VRAMREAD byte = 0x03
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CGBBackgroundTileAttrs ¶
type CGBBackgroundTileAttrs struct { HasPriority bool FlipHorizontally bool FlipVertically bool BankNo int PaletteNo int }
Represents the attribute data for a background tile
func NewCGBBackgroundTileAttrs ¶
func NewCGBBackgroundTileAttrs(attributeData byte) *CGBBackgroundTileAttrs
func (*CGBBackgroundTileAttrs) String ¶
func (cattr *CGBBackgroundTileAttrs) String() string
type CGBPalette ¶
type CGBPalette [4]CGBColor
Represents a color palette (4 colors)
func (*CGBPalette) UpdateHigh ¶
func (cp *CGBPalette) UpdateHigh(colorNo int, value byte)
func (*CGBPalette) UpdateLow ¶
func (cp *CGBPalette) UpdateLow(colorNo int, value byte)
type CGBPaletteSpecRegister ¶
type CGBPaletteSpecRegister struct { Value byte PalleteNo int PalleteDataNo int High bool IncrementOnNext bool }
Represents the write specification register for a color palette
func (*CGBPaletteSpecRegister) Increment ¶
func (psr *CGBPaletteSpecRegister) Increment()
func (*CGBPaletteSpecRegister) Update ¶
func (psr *CGBPaletteSpecRegister) Update(value byte)
type GPU ¶
type GPU struct { RunningColorGBHardware bool // contains filtered or unexported fields }
func (*GPU) CoincidenceLCDInterruptEnabled ¶
func (*GPU) DrawScanline ¶
func (*GPU) DrawSpriteTileLine ¶
TODO: Sprite precedence rules Draws a tile for the given sprite. Only draws one tile
func (*GPU) Dump8x8Sprites ¶
func (*GPU) DumpTilemap ¶
func (*GPU) HblankLCDInterruptEnabled ¶
func (*GPU) LinkIRQHandler ¶
func (g *GPU) LinkIRQHandler(m components.IRQHandler)
func (*GPU) LinkScreen ¶
func (g *GPU) LinkScreen(screen inputoutput.Screen)
func (*GPU) RenderBackgroundScanline ¶
func (g *GPU) RenderBackgroundScanline()
func (*GPU) RenderSpritesOnScanline ¶
func (g *GPU) RenderSpritesOnScanline()
func (*GPU) RenderWindowScanline ¶
func (g *GPU) RenderWindowScanline()
func (*GPU) UpdateTile ¶
Update the tile at address with value
func (*GPU) VBlankLCDInterruptEnabled ¶
type Sprite8x16 ¶
type Sprite8x16 struct { SpriteAttrs *SpriteAttributes TileIDs [2]int ScanlineDrawQueue []int CurrentTileLine int }
8x16 SPRITES!
func NewSprite8x16 ¶
func NewSprite8x16() *Sprite8x16
func (*Sprite8x16) GetTileID ¶
func (s *Sprite8x16) GetTileID(no int) int
func (*Sprite8x16) IsScanlineDrawQueueEmpty ¶
func (s *Sprite8x16) IsScanlineDrawQueueEmpty() bool
func (*Sprite8x16) PopScanline ¶
func (s *Sprite8x16) PopScanline() (int, int)
func (*Sprite8x16) PushScanlines ¶
func (s *Sprite8x16) PushScanlines(fromScanline, amount int)
func (*Sprite8x16) ResetScanlineDrawQueue ¶
func (s *Sprite8x16) ResetScanlineDrawQueue()
func (*Sprite8x16) SpriteAttributes ¶
func (s *Sprite8x16) SpriteAttributes() *SpriteAttributes
func (*Sprite8x16) String ¶
func (s *Sprite8x16) String() string
func (*Sprite8x16) UpdateSprite ¶
func (s *Sprite8x16) UpdateSprite(addr types.Word, value byte)
type Sprite8x8 ¶
type Sprite8x8 struct { SpriteAttrs *SpriteAttributes TileID int ScanlineDrawQueue []int CurrentTileLine int }
8x8 Sprites!
func NewSprite8x8 ¶
func NewSprite8x8() *Sprite8x8
func (*Sprite8x8) IsScanlineDrawQueueEmpty ¶
func (*Sprite8x8) PopScanline ¶
func (*Sprite8x8) PushScanlines ¶
func (*Sprite8x8) ResetScanlineDrawQueue ¶
func (s *Sprite8x8) ResetScanlineDrawQueue()
func (*Sprite8x8) SpriteAttributes ¶
func (s *Sprite8x8) SpriteAttributes() *SpriteAttributes
type SpriteAttributes ¶
type SpriteAttributes struct { Y int X int SpriteHasPriority bool ShouldFlipVertically bool ShouldFlipHorizontally bool NonCGBPaletteSelected int CGBBankNo int CGBPaletteNo int }
Sprite attributes
func (*SpriteAttributes) String ¶
func (s *SpriteAttributes) String() string
func (*SpriteAttributes) Update ¶
func (sa *SpriteAttributes) Update(attributeId int, fromValue byte)
Click to show internal directories.
Click to hide internal directories.