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

Method Write

nes/mapper1.go:77–90  ·  view source on GitHub ↗
(address uint16, value byte)

Source from the content-addressed store, hash-verified

75}
76
77func (m *Mapper1) Write(address uint16, value byte) {
78 switch {
79 case address < 0x2000:
80 bank := address / 0x1000
81 offset := address % 0x1000
82 m.CHR[m.chrOffsets[bank]+int(offset)] = value
83 case address >= 0x8000:
84 m.loadRegister(address, value)
85 case address >= 0x6000:
86 m.SRAM[int(address)-0x6000] = value
87 default:
88 log.Fatalf("unhandled mapper1 write at address: 0x%04X", address)
89 }
90}
91
92func (m *Mapper1) loadRegister(address uint16, value byte) {
93 if value&0x80 == 0x80 {

Callers

nothing calls this directly

Calls 1

loadRegisterMethod · 0.95

Tested by

no test coverage detected