mirror of
https://github.com/FranLMSP/rmg-001.git
synced 2024-11-23 18:21:31 +00:00
Banking mode
This commit is contained in:
parent
d90a25e6f6
commit
0a30d9d194
@ -194,9 +194,7 @@ impl ROM {
|
|||||||
return self.data[address as usize];
|
return self.data[address as usize];
|
||||||
} else if BANK_SWITCHABLE.in_range(address) {
|
} else if BANK_SWITCHABLE.in_range(address) {
|
||||||
return self.data[((self.rom_bank as usize * 0x4000) + (address as usize & 0x3FFF)) as usize];
|
return self.data[((self.rom_bank as usize * 0x4000) + (address as usize & 0x3FFF)) as usize];
|
||||||
// return self.data[(address + (BANK_SWITCHABLE.begin() * (self.rom_bank - 1))) as usize];
|
|
||||||
} else if EXTERNAL_RAM.in_range(address) {
|
} else if EXTERNAL_RAM.in_range(address) {
|
||||||
println!("RAM read");
|
|
||||||
if !self.info.has_ram {
|
if !self.info.has_ram {
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
@ -232,7 +230,11 @@ impl ROM {
|
|||||||
// println!("RAM bank {:02X}", data);
|
// println!("RAM bank {:02X}", data);
|
||||||
self.ram_bank = data & 0b11;
|
self.ram_bank = data & 0b11;
|
||||||
} else if address >= 0x6000 && address <= 0x7FFF { // Banking mode select
|
} else if address >= 0x6000 && address <= 0x7FFF { // Banking mode select
|
||||||
// println!("Change banking mode");
|
self.banking_mode = match data & 1 {
|
||||||
|
0 => BankingMode::Simple,
|
||||||
|
1 => BankingMode::Advanced,
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
} else if EXTERNAL_RAM.in_range(address) {
|
} else if EXTERNAL_RAM.in_range(address) {
|
||||||
if !self.ram_enable || !self.info.has_ram {
|
if !self.ram_enable || !self.info.has_ram {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user