aboutsummaryrefslogtreecommitdiff
path: root/ppu/ppu.go
diff options
context:
space:
mode:
authorcrecher <crecher@crecher.net>2026-10-13 01:13:13 +0200
committercrecher <crecher@crecher.net>2026-10-13 01:13:13 +0200
commit99cae5a5a37f41f878a84857361eda47910303ba (patch)
tree31c8665ca991f95e09e93bb2e6ec91d81d2427ff /ppu/ppu.go
parent96ff6d8eda2ba434682909f4ff4ce350d78b2273 (diff)
downloadgones-99cae5a5a37f41f878a84857361eda47910303ba.tar.gz
gones-99cae5a5a37f41f878a84857361eda47910303ba.zip
sprites!!!!!!
Diffstat (limited to 'ppu/ppu.go')
-rw-r--r--ppu/ppu.go15
1 files changed, 11 insertions, 4 deletions
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