diff --git a/src/rom.rs b/src/rom.rs index 2e86a5d..68b2ddc 100644 --- a/src/rom.rs +++ b/src/rom.rs @@ -54,10 +54,10 @@ impl Card for Rom { return NullableResult::Null; } let address = address as u16; - if address < 0x4000 { + if address < 0x8000 { self.data.get(address as usize).copied().into() } else { - self.ram.get((address - 0x4000) as usize).copied().into() + self.ram.get((address - 0x8000) as usize).copied().into() } } @@ -65,8 +65,8 @@ impl Card for Rom { if !self.enabled | ((address >> 16) as u16 != self.start) { return NullableResult::Null; } - let address = (address as u16).checked_sub(0x4000)?; - if address > self.data.len() as u16 { + let address = (address as u16).checked_sub(0x8000)?; + if address > self.ram.len() as u16 { return NullableResult::Null; } self.ram[address as usize] = data;