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

Method Read

nes/mapper4.go:82–99  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

80}
81
82func (m *Mapper4) Read(address uint16) byte {
83 switch {
84 case address < 0x2000:
85 bank := address / 0x0400
86 offset := address % 0x0400
87 return m.CHR[m.chrOffsets[bank]+int(offset)]
88 case address >= 0x8000:
89 address = address - 0x8000
90 bank := address / 0x2000
91 offset := address % 0x2000
92 return m.PRG[m.prgOffsets[bank]+int(offset)]
93 case address >= 0x6000:
94 return m.SRAM[int(address)-0x6000]
95 default:
96 log.Fatalf("unhandled mapper4 read at address: 0x%04X", address)
97 }
98 return 0
99}
100
101func (m *Mapper4) Write(address uint16, value byte) {
102 switch {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected