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

Method Read

nes/memory.go:80–94  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

78}
79
80func (mem *ppuMemory) Read(address uint16) byte {
81 address = address % 0x4000
82 switch {
83 case address < 0x2000:
84 return mem.console.Mapper.Read(address)
85 case address < 0x3F00:
86 mode := mem.console.Cartridge.Mirror
87 return mem.console.PPU.nameTableData[MirrorAddress(mode, address)%2048]
88 case address < 0x4000:
89 return mem.console.PPU.readPalette(address % 32)
90 default:
91 log.Fatalf("unhandled ppu memory read at address: 0x%04X", address)
92 }
93 return 0
94}
95
96func (mem *ppuMemory) Write(address uint16, value byte) {
97 address = address % 0x4000

Callers

nothing calls this directly

Calls 3

MirrorAddressFunction · 0.85
readPaletteMethod · 0.80
ReadMethod · 0.65

Tested by

no test coverage detected