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

Method Write

nes/mapper225.go:60–85  ·  view source on GitHub ↗
(address uint16, value byte)

Source from the content-addressed store, hash-verified

58}
59
60func (m *Mapper225) Write(address uint16, value byte) {
61 if (address < 0x8000) {
62 return
63 }
64
65 A := int(address)
66 bank := (A >> 14) & 1
67 m.chrBank = (A & 0x3f) | (bank << 6)
68 prg := ((A >> 6) & 0x3f) | (bank << 6)
69 mode := (A >> 12) & 1;
70 if (mode == 1) {
71 m.prgBank1 = prg
72 m.prgBank2 = prg
73 } else {
74 m.prgBank1 = prg
75 m.prgBank2 = prg + 1
76 }
77 mirr := (A >> 13) & 1
78 if (mirr == 1) {
79 m.Cartridge.Mirror = MirrorHorizontal
80 } else {
81 m.Cartridge.Mirror = MirrorVertical
82 }
83
84 // fmt.Println(address, mirr, mode, prg)
85}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected