diff options
Diffstat (limited to 'ppu/ppu.go')
| -rw-r--r-- | ppu/ppu.go | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -3,13 +3,16 @@ package ppu import "crecher.net/gones/v2/cart" const ( - ctrlNametableMask = 0x03 - ctrlIncrement32 = 0x04 - ctrlBGPatternHigh = 0x10 - ctrlNMIEnable = 0x80 + ctrlNametableMask = 0x03 + ctrlIncrement32 = 0x04 + ctrlSpritePatternHigh = 0x08 + ctrlBGPatternHigh = 0x10 + ctrlSpriteSize16 = 0x20 + ctrlNMIEnable = 0x80 maskGreyscale = 0x01 maskShowBackgroundLeft = 0x02 + maskShowSpritesLeft = 0x04 maskShowBackground = 0x08 maskShowSprites = 0x10 @@ -59,6 +62,10 @@ type PPU struct { patternLo, patternHi uint16 attrLo, attrHi uint16 + // sprites for the line being drawn, picked at the end of the previous line + spriteLine [8]sprite + spriteCount int + nmiOutput bool // PPUCTRL bit 7 nmiLine bool // vblank && nmiOutput, latched each tick for edge detection nmiPending bool // set on nmiLine's rising edge, consumed by PollNMI |