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

Method Read

nes/mapper1.go:58–75  ·  view source on GitHub ↗
(address uint16)

Source from the content-addressed store, hash-verified

56}
57
58func (m *Mapper1) Read(address uint16) byte {
59 switch {
60 case address < 0x2000:
61 bank := address / 0x1000
62 offset := address % 0x1000
63 return m.CHR[m.chrOffsets[bank]+int(offset)]
64 case address >= 0x8000:
65 address = address - 0x8000
66 bank := address / 0x4000
67 offset := address % 0x4000
68 return m.PRG[m.prgOffsets[bank]+int(offset)]
69 case address >= 0x6000:
70 return m.SRAM[int(address)-0x6000]
71 default:
72 log.Fatalf("unhandled mapper1 read at address: 0x%04X", address)
73 }
74 return 0
75}
76
77func (m *Mapper1) Write(address uint16, value byte) {
78 switch {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected