Fix MBC rom bank select
This commit is contained in:
parent
023b9ff0e4
commit
9508244447
@ -62,7 +62,6 @@ impl Cartridge {
|
||||
MemoryBankControllerType::MBC1 => Box::new(super::mbc::mbc1::MBC1::new(rom, ram)),
|
||||
MemoryBankControllerType::MBC2 => Box::new(super::mbc::mbc2::MBC2::new(rom, ram)),
|
||||
MemoryBankControllerType::MBC3 => Box::new(super::mbc::mbc3::MBC3::new(rom, ram)),
|
||||
// _ => panic!("{:?} not implemented", mbc_type),
|
||||
};
|
||||
|
||||
Cartridge {
|
||||
|
||||
@ -19,7 +19,7 @@ impl MBC1 {
|
||||
MBC1 {
|
||||
rom: rom,
|
||||
ram: ram,
|
||||
rom_bank_no: 0,
|
||||
rom_bank_no: 1,
|
||||
bank_mode: BankMode::RomBankMode,
|
||||
bank_no_high: 0,
|
||||
|
||||
@ -29,7 +29,7 @@ impl MBC1 {
|
||||
|
||||
fn active_rom_bank(&self) -> u8 {
|
||||
match self.bank_mode {
|
||||
BankMode::RomBankMode => self.rom_bank_no | self.bank_no_high << 5,
|
||||
BankMode::RomBankMode => self.rom_bank_no | (self.bank_no_high << 5),
|
||||
BankMode::RamBankMode => self.rom_bank_no
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ impl MBC2 {
|
||||
MBC2 {
|
||||
rom: rom,
|
||||
ram: ram,
|
||||
rom_bank_no: 0,
|
||||
rom_bank_no: 1,
|
||||
ram_enable: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ impl MBC3 {
|
||||
MBC3 {
|
||||
rom: rom,
|
||||
ram: ram,
|
||||
rom_bank_no: 0,
|
||||
rom_bank_no: 1,
|
||||
ram_bank_no: 0,
|
||||
ram_rtc_enabled: false,
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user