put chr-ram back in mmc1
This commit is contained in:
parent
413d9454a4
commit
ea70b592ce
|
@ -114,21 +114,25 @@ impl Mapper for Mmc1 {
|
|||
fn read(&mut self, address: usize) -> u8 {
|
||||
match address {
|
||||
0x0000..=0x1FFF => {
|
||||
let offset = address % 0x1000;
|
||||
if self.chr_bank_mode {
|
||||
// if 4K bank mode, $0000-$0FFF will be a 4K-indexed section of some CHR-ROM chunk referred to by chr_low_bank
|
||||
// and $1000-$1FFF will be the one referred to by chr_high_bank
|
||||
let bank = match address {
|
||||
0x0000..=0x0FFF => self.chr_low_bank,
|
||||
0x1000..=0x1FFF => self.chr_high_bank,
|
||||
_ => panic!("bad address read from MMC1: 0x{:X}", address),
|
||||
};
|
||||
let chunk_num = bank / 2;
|
||||
let chunk_half = if bank % 2 == 0 {0x0} else {0x1000};
|
||||
self.cart.chr_rom[chunk_num][chunk_half + offset]
|
||||
if self.cart.chr_rom_size == 0 {
|
||||
self.chr_ram_bank[address]
|
||||
} else {
|
||||
// if we're in 8K bank mode, the whole $0000-$1FFF region will be the 8K range referred to by chr_low_bank
|
||||
self.cart.chr_rom[self.chr_low_bank][address]
|
||||
let offset = address % 0x1000;
|
||||
if self.chr_bank_mode {
|
||||
// if 4K bank mode, $0000-$0FFF will be a 4K-indexed section of some CHR-ROM chunk referred to by chr_low_bank
|
||||
// and $1000-$1FFF will be the one referred to by chr_high_bank
|
||||
let bank = match address {
|
||||
0x0000..=0x0FFF => self.chr_low_bank,
|
||||
0x1000..=0x1FFF => self.chr_high_bank,
|
||||
_ => panic!("bad address read from MMC1: 0x{:X}", address),
|
||||
};
|
||||
let chunk_num = bank / 2;
|
||||
let chunk_half = if bank % 2 == 0 {0x0} else {0x1000};
|
||||
self.cart.chr_rom[chunk_num][chunk_half + offset]
|
||||
} else {
|
||||
// if we're in 8K bank mode, the whole $0000-$1FFF region will be the 8K range referred to by chr_low_bank
|
||||
self.cart.chr_rom[self.chr_low_bank][address]
|
||||
}
|
||||
}
|
||||
},
|
||||
0x6000..=0x7FFF => self.prg_ram_bank[address % 0x2000],
|
||||
|
|
|
@ -156,7 +156,6 @@ impl Cpu {
|
|||
self.apu.trigger_irq = false;
|
||||
// and mapper MMC3
|
||||
if self.mapper.borrow_mut().check_irq() && (self.P & INTERRUPT_DISABLE_FLAG == 0) {
|
||||
// println!("firing IRQ from mapper");
|
||||
self.irq();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue