Main SNES master clock frequencies
8pub const LOROM_CHIPSET_BYTE_ADDRESS: usize = 0x7FD6; 9 10#[derive(Debug, Clone, Default, FakeEncode, FakeDecode)] 11pub struct Rom(pub Box<[u8]>); 12 13impl Deref for Rom { 14 type Target = Box<[u8]>; 15 16 fn deref(&self) -> &Self::Target { 17 &self.0 18 } 19} 20 21pub fn lorom_map_rom_address(address: u32, rom_len: u32) -> u32 { 22 // LoROM mapping ignores A23 and A15, and A16-22 are shifted right 1 23 let rom_addr = ((address & 0x7F0000) >> 1) | (address & 0x007FFF); 24 rom_addr & (rom_len - 1) 25} 26 27macro_rules! impl_take_set_rom { 28 ($rom:ident) => { 29 #[must_use] 30 pub fn take_rom(&mut self) -> ::std::vec::Vec<u8> { 31 ::std::mem::take(&mut self.$rom.0).into_vec() 32 } 33 34 pub fn set_rom(&mut self, rom: ::std::vec::Vec<u8>) { 35 self.$rom.0 = rom.into_boxed_slice(); 36 } 37 }; 38} 39 40pub(crate) use impl_take_set_rom;