pub fn fetch_byte(&self, addr: u16) -> u8 {

        if let Some(off) = map::in_range(addr, map::ROM) {
            if self.bootrom && off < 0x100 {
                // Bootrom is still mapped, read from it
                return bootrom::BOOTROM[off as usize];
            }

            return self.cartridge.rom_byte(off);
        }

        if let Some(off) = map::in_range(addr, map::VRAM) {
            return self.gpu.vram(off);
        }

        if let Some(off) = map::in_range(addr, map::RAM_BANK) {
            return self.cartridge.ram_byte(off);
        }

        if let Some(off) = map::in_range(addr, map::IRAM) {
            return self.iram.byte(off);
        }

        if let Some(off) = map::in_range(addr, map::IRAM_ECHO) {
            return self.iram.byte(off);
        }

        if let Some(off) = map::in_range(addr, map::OAM) {
            return self.gpu.oam(off);
        }

        if let Some(off) = map::in_range(addr, map::IO) {
            return self.io(off);
        }

        if let Some(off) = map::in_range(addr, map::ZERO_PAGE) {
            return self.zpage.byte(off);
        }

        if addr == map::IEN {
            return self.it_enabled.as_register();
        }

        debug!("Read from unmapped memory {:04x}", addr);
        0xff
    }
/// Get byte from peripheral mapped at `addr`
Get byte from peripheral mapped at `addr`
Get byte from peripheral mapped at ` addr `
pub fn fetch_byte(&self, addr: u16) -> u8 {
        if let Some(off) = map::in_range(addr, map::ROM) {
            if self.bootrom && off < 0x100 {
                // Bootrom is still mapped, read from it
                return bootrom::BOOTROM[off as usize];
            }
            return self.cartridge.rom_byte(off);
        }
        if let Some(off) = map::in_range(addr, map::VRAM) {
            return self.gpu.vram(off);
        }
        if let Some(off) = map::in_range(addr, map::RAM_BANK) {
            return self.cartridge.ram_byte(off);
        }
        if let Some(off) = map::in_range(addr, map::IRAM) {
            return self.iram.byte(off);
        }
        if let Some(off) = map::in_range(addr, map::IRAM_ECHO) {
            return self.iram.byte(off);
        }
        if let Some(off) = map::in_range(addr, map::OAM) {
            return self.gpu.oam(off);
        }
        if let Some(off) = map::in_range(addr, map::IO) {
            return self.io(off);
        }
        if let Some(off) = map::in_range(addr, map::ZERO_PAGE) {
            return self.zpage.byte(off);
        }
        if addr == map::IEN {
            return self.it_enabled.as_register();
        }
        debug!("Read from unmapped memory {:04x}", addr);
        0xff
    }
pub fn fetch_byte ( & self , addr : u16 ) -> u8 { if let Some ( off ) = map :: in_range ( addr , map :: ROM ) { if self . bootrom && off < 0x100 { // Bootrom is still mapped, read from it return bootrom :: BOOTROM [ off as usize ] ; } return self . cartridge . rom_byte ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: VRAM ) { return self . gpu . vram ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: RAM_BANK ) { return self . cartridge . ram_byte ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: IRAM ) { return self . iram . byte ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: IRAM_ECHO ) { return self . iram . byte ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: OAM ) { return self . gpu . oam ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: IO ) { return self . io ( off ) ; } if let Some ( off ) = map :: in_range ( addr , map :: ZERO_PAGE ) { return self . zpage . byte ( off ) ; } if addr == map :: IEN { return self . it_enabled . as_register ( ) ; } debug ! ( " " addr ) ; 0xff }
Get byte from peripheral mapped at `addr`
Get byte from peripheral mapped at ` addr `
&self
addr
u16
&self
addr
u16