diff --git a/biostools/analyzers.py b/biostools/analyzers.py index 19f11a3..f827017 100644 --- a/biostools/analyzers.py +++ b/biostools/analyzers.py @@ -332,8 +332,12 @@ class AMIAnalyzer(Analyzer): self._precolor_block_pattern = re.compile(b'''\(C\)(?:[0-9]{4}(?:AMI,404-263-8181|TGem-HCS,PSC,JGS)|( Access Methods Inc\.))''') # "Date:-" might not have a space after it (Intel AMI) self._precolor_date_pattern = re.compile(b'''(?:(?: Date:- ?|AMI- )[0-9]{2}/[0-9]{2}/[0-9]{2}|DDaattee(?:::| )--(?: )?([0-9])\\1([0-9])\\2//([0-9])\\3([0-9])\\4//([0-9])\\5([0-9])\\6)''') - # Decoded: "\xFE([^-]{4}-(?:[^-]{4}-)?[^-]{6})" - self._precolor_string_pattern = re.compile(b'''\\xFE([\\x00-\\x95\\x97-\\xFF]{4}\\x96(?:[\\x00-\\x95\\x97-\\xFF]{4}\\x96)?[\\x00-\\x95\\x97-\\xFF]{6})''') + # Variable gap between sync bytes (first bytes of the ROM) and the date. + self._precolor_core_date_pattern = re.compile(b'''\\xAA\\x55[\\x00-\\xFF]{1,16}([0-9]{2}/[0-9]{2}/[0-9]{2})''') + # Decoded: "\xFE([^-]{4}-(?:[0-9]{4}-)?[0-9]{6})" + self._precolor_string_pattern = re.compile(b'''\\xFE([\\x00-\\x95\\x97-\\xFF]{4}\\x96(?:[\\x7E\\x76\\x6E\\x66\\x5E\\x56\\x4E\\x46\\x3E\\x36]{4}\\x96)?[\\x7E\\x76\\x6E\\x66\\x5E\\x56\\x4E\\x46\\x3E\\x36]{6})''') + # Decoded: "\xFE([0-9]{4}-[0-9]{5}.)" + self._precolor_string_accm_pattern = re.compile(b'''\\xFE([\\x7E\\x76\\x6E\\x66\\x5E\\x56\\x4E\\x46\\x3E\\x36]{4}\\x96[\\x7E\\x76\\x6E\\x66\\x5E\\x56\\x4E\\x46\\x3E\\x36]{5}[\\x00-\\xFF])''') self._precolor_signon_pattern = re.compile(b'''BIOS \(C\).*(?:AMI|American Megatrends Inc), for ([\\x0D\\x0A\\x20-\\x7E]+)''') # Decoded: "\(C\)AMI, \(([^\)]{11})\)" self._8088_string_pattern = re.compile(b'''\\xEC\\x5F\\x6C\\x60\\x5A\\x5C\\xEA\\xF0\\xEC([\\x00-\\x6B\\x6D-\\xFF]{11})\\x6C''') @@ -408,7 +412,9 @@ class AMIAnalyzer(Analyzer): return False elif self._precolor_date_pattern.search(file_data): # Check date, using a different pattern to differentiate core date from build date. - match = self._date_pattern.search(file_data) + match = self._precolor_core_date_pattern.search(file_data) + if not match: + match = self._date_pattern.search(file_data) if match: # Extract date as the version. self.version = match.group(1).decode('cp437', 'ignore') @@ -421,6 +427,8 @@ class AMIAnalyzer(Analyzer): # Locate the encoded string. match = self._precolor_string_pattern.search(file_data) + if not match: + match = self._precolor_string_accm_pattern.search(file_data) if match: # Extract string. buf = []