fn rom_size(header: &[u8; HEADER_LEN]) -> Result<usize, ParseCartridgeError> {
            let code = header[ROM_SIZE];
            match code {
                0..=8 => Ok(2 << code),
                0x52..=0x54 => {
                    let low = (code & 0xf) as usize;
                    let high = ((code & 0xf0) >> 4) as usize;
                    let banks = (2 << low) + (2 << high);
                    warn!("Oddball rom size of {} banks is not supported", banks);
                    Err(ParseCartridgeError::UnrecognizedRomSizeCode(code))
                }
                _ => Err(ParseCartridgeError::UnrecognizedRomSizeCode(code)),
            }
        }
/// Size of the rom in number of banks.
Size of the rom in number of banks.
Size of the rom in number of banks .
fn rom_size(header: &[u8; HEADER_LEN]) -> Result<usize, ParseCartridgeError> {
            let code = header[ROM_SIZE];
            match code {
                0..=8 => Ok(2 << code),
                0x52..=0x54 => {
                    let low = (code & 0xf) as usize;
                    let high = ((code & 0xf0) >> 4) as usize;
                    let banks = (2 << low) + (2 << high);
                    warn!("Oddball rom size of {} banks is not supported", banks);
                    Err(ParseCartridgeError::UnrecognizedRomSizeCode(code))
                }
                _ => Err(ParseCartridgeError::UnrecognizedRomSizeCode(code)),
            }
        }
fn rom_size ( header : & [ u8 ; HEADER_LEN ] ) -> Result < usize , ParseCartridgeError > { let code = header [ ROM_SIZE ] ; match code { 0 ..= 8 => Ok ( 2 << code ) , 0x52 ..= 0x54 => { let low = ( code & 0xf ) as usize ; let high = ( ( code & 0xf0 ) >> 4 ) as usize ; let banks = ( 2 << low ) + ( 2 << high ) ; warn ! ( " " banks ) ; Err ( ParseCartridgeError :: UnrecognizedRomSizeCode ( code ) ) } _ => Err ( ParseCartridgeError :: UnrecognizedRomSizeCode ( code ) ) , } }
Size of the rom in number of banks.
Size of the rom in number of banks .
header
&[u8; HEADER_LEN]
header
&[u8; HEADER_LEN]