MCPcopy Create free account
hub / github.com/fogleman/nes / Read

Method Read

nes/mapper3.go:37–55  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

35}
36
37func (m *Mapper3) Read(address uint16) byte {
38 switch {
39 case address < 0x2000:
40 index := m.chrBank*0x2000 + int(address)
41 return m.CHR[index]
42 case address >= 0xC000:
43 index := m.prgBank2*0x4000 + int(address-0xC000)
44 return m.PRG[index]
45 case address >= 0x8000:
46 index := m.prgBank1*0x4000 + int(address-0x8000)
47 return m.PRG[index]
48 case address >= 0x6000:
49 index := int(address) - 0x6000
50 return m.SRAM[index]
51 default:
52 log.Fatalf("unhandled mapper3 read at address: 0x%04X", address)
53 }
54 return 0
55}
56
57func (m *Mapper3) Write(address uint16, value byte) {
58 switch {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected