Permalink
Browse files

Force correction on bank selection

  • Loading branch information...
1 parent 8878861 commit fbc02ce7335d835c84f6bd8f3597d8bca7aaf6d0 @scottferg committed Oct 29, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 rom.go
View
10 rom.go
@@ -17,7 +17,7 @@ type Mapper interface {
Write(v Word, a int)
BatteryBacked() bool
Hook()
- LatchTrigger(a int)
+ LatchTrigger(a int)
}
// Nrom
@@ -35,25 +35,33 @@ type Unrom Rom
type Cnrom Rom
func WriteRamBank(rom [][]Word, bank, dest, size int) {
+ bank %= len(rom)
+
for i := 0; i < size; i++ {
Ram[i+dest] = rom[bank][i]
}
}
// Used by MMC3 for selecting 8kb chunks of a PRG-ROM bank
func WriteOffsetRamBank(rom [][]Word, bank, dest, size, offset int) {
+ bank %= len(rom)
+
for i := 0; i < size; i++ {
Ram[i+dest] = rom[bank][i+offset]
}
}
func WriteVramBank(rom [][]Word, bank, dest, size int) {
+ bank %= len(rom)
+
for i := 0; i < size; i++ {
ppu.Vram[i+dest] = rom[bank][i]
}
}
func WriteOffsetVramBank(rom [][]Word, bank, dest, size, offset int) {
+ bank %= len(rom)
+
for i := 0; i < size; i++ {
ppu.Vram[i+dest] = rom[bank][i+offset]
}

0 comments on commit fbc02ce

Please sign in to comment.