Permalink
Browse files

Add ANROM

  • Loading branch information...
1 parent 1246c17 commit 1228872c677d1749113452b80ea3f06547ae6b31 Scott Ferguson committed Oct 11, 2012
Showing with 38 additions and 3 deletions.
  1. +24 −0 anrom.go
  2. +1 −1 nametable.go
  3. +13 −2 rom.go
View
@@ -0,0 +1,24 @@
+package main
+
+type Anrom Rom
+
+func (m *Anrom) Write(v Word, a int) {
+ bank := int((v & 0x7) * 2)
+
+ if v & 0x10 == 0x10 {
+ ppu.Nametables.SetMirroring(MirroringSingleUpper)
+ } else {
+ ppu.Nametables.SetMirroring(MirroringSingleLower)
+ }
+
+ WriteRamBank(m.RomBanks, bank, 0x8000, Size16k)
+ WriteRamBank(m.RomBanks, bank+1, 0xC000, Size16k)
+}
+
+func (m *Anrom) Hook() {
+ // No hooks
+}
+
+func (m *Anrom) BatteryBacked() bool {
+ return m.Battery
+}
View
@@ -42,7 +42,7 @@ func (n *Nametable) SetMirroring(m int) {
}
func (n *Nametable) writeNametableData(a int, v Word) {
- n.LogicalTables[(a&0xC00)>>10][a&0x3FF] = v
+ n.LogicalTables[(a&0xC00)>>10][a&0x3FF] = v
}
func (n *Nametable) readNametableData(a int) Word {
View
15 rom.go
@@ -227,8 +227,19 @@ func LoadRom(rom []byte) (m Mapper, e error) {
Battery: r.Battery,
Data: r.Data,
}
- case 0x44:
- fallthrough
+ case 0x07:
+ // Anrom
+ fmt.Printf("ANROM\n")
+ m = &Anrom{
+ RomBanks: r.RomBanks,
+ VromBanks: r.VromBanks,
+ PrgBankCount: r.PrgBankCount,
+ ChrRomCount: r.ChrRomCount,
+ Battery: r.Battery,
+ Data: r.Data,
+ }
+ case 0x44:
+ fallthrough
case 0x04:
// MMC3
fmt.Printf("MMC3\n")

0 comments on commit 1228872

Please sign in to comment.