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

Method Read

nes/mapper2.go:39–56  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected