MCPcopy
hub / github.com/fogleman/nes / PPU

Struct PPU

nes/ppu.go:8–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6)
7
8type PPU struct {
9 Memory // memory interface
10 console *Console // reference to parent object
11
12 Cycle int // 0-340
13 ScanLine int // 0-261, 0-239=visible, 240=post, 241-260=vblank, 261=pre
14 Frame uint64 // frame counter
15
16 // storage variables
17 paletteData [32]byte
18 nameTableData [2048]byte
19 oamData [256]byte
20 front *image.RGBA
21 back *image.RGBA
22
23 // PPU registers
24 v uint16 // current vram address (15 bit)
25 t uint16 // temporary vram address (15 bit)
26 x byte // fine x scroll (3 bit)
27 w byte // write toggle (1 bit)
28 f byte // even/odd frame flag (1 bit)
29
30 register byte
31
32 // NMI flags
33 nmiOccurred bool
34 nmiOutput bool
35 nmiPrevious bool
36 nmiDelay byte
37
38 // background temporary variables
39 nameTableByte byte
40 attributeTableByte byte
41 lowTileByte byte
42 highTileByte byte
43 tileData uint64
44
45 // sprite temporary variables
46 spriteCount int
47 spritePatterns [8]uint32
48 spritePositions [8]byte
49 spritePriorities [8]byte
50 spriteIndexes [8]byte
51
52 // $2000 PPUCTRL
53 flagNameTable byte // 0: $2000; 1: $2400; 2: $2800; 3: $2C00
54 flagIncrement byte // 0: add 1; 1: add 32
55 flagSpriteTable byte // 0: $0000; 1: $1000; ignored in 8x16 mode
56 flagBackgroundTable byte // 0: $0000; 1: $1000
57 flagSpriteSize byte // 0: 8x8; 1: 8x16
58 flagMasterSlave byte // 0: read EXT; 1: write EXT
59
60 // $2001 PPUMASK
61 flagGrayscale byte // 0: color; 1: grayscale
62 flagShowLeftBackground byte // 0: hide; 1: show
63 flagShowLeftSprites byte // 0: hide; 1: show
64 flagShowBackground byte // 0: hide; 1: show
65 flagShowSprites byte // 0: hide; 1: show

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected