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

Method Read

nes/mapper40.go:43–61  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

41}
42
43func (m *Mapper40) Read(address uint16) byte {
44 switch {
45 case address < 0x2000:
46 return m.CHR[address]
47 case address >= 0x6000 && address < 0x8000:
48 return m.PRG[address-0x6000+0x2000*6]
49 case address >= 0x8000 && address < 0xa000:
50 return m.PRG[address-0x8000+0x2000*4]
51 case address >= 0xa000 && address < 0xc000:
52 return m.PRG[address-0xa000+0x2000*5]
53 case address >= 0xc000 && address < 0xe000:
54 return m.PRG[address-0xc000+0x2000*uint16(m.bank)]
55 case address >= 0xe000:
56 return m.PRG[address-0xe000+0x2000*7]
57 default:
58 log.Fatalf("unhandled mapper40 read at address: 0x%04X", address)
59 }
60 return 0
61}
62
63func (m *Mapper40) Write(address uint16, value byte) {
64 switch {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected