fix(cartridge): specify intentional overflow in MBC5
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-08-19 16:09:58 -05:00
parent 0af95a1dd3
commit 8b78b2943e
1 changed files with 3 additions and 1 deletions

View File

@ -372,7 +372,9 @@ impl MBCIo for MBC5 {
match addr {
0x0000..=0x3FFF => Address(addr as usize),
0x4000..=0x7FFF => Address(0x4000 * self.rom_bank as usize + (addr as usize - 0x4000)),
0x4000..=0x7FFF => {
Address(0x4000u16.wrapping_mul(self.rom_bank) as usize + (addr as usize - 0x4000))
}
0xA000..=0xBFFF if self.mem_enabled => {
Value(self.memory[0x2000 * self.ram_bank as usize + (addr as usize - 0xA000)])
}