From 99cae5a5a37f41f878a84857361eda47910303ba Mon Sep 17 00:00:00 2001 From: crecher Date: Tue, 13 Oct 2026 01:13:13 +0200 Subject: sprites!!!!!! --- ppu/ppu.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'ppu/ppu.go') diff --git a/ppu/ppu.go b/ppu/ppu.go index 322cf3d..42b3b4c 100644 --- a/ppu/ppu.go +++ b/ppu/ppu.go @@ -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 -- cgit v1.2.3