More weird Atari stuff improvements

This commit is contained in:
RichardG867
2022-03-18 16:01:37 -03:00
parent fc7ba5d514
commit 29e898ebbd

View File

@@ -334,10 +334,8 @@ class AMIAnalyzer(Analyzer):
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)''')
# 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])''')
# 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})''')
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''')
@@ -418,6 +416,7 @@ class AMIAnalyzer(Analyzer):
if match:
# Extract date as the version.
self.version = match.group(1).decode('cp437', 'ignore')
date_start = match.start(0)
# Check pre-Color identification block.
match = self._precolor_block_pattern.search(file_data)
@@ -426,13 +425,11 @@ class AMIAnalyzer(Analyzer):
id_block_index = match.start(0)
# Locate the encoded string.
match = self._precolor_string_pattern.search(file_data)
if not match:
match = self._precolor_string_accm_pattern.search(file_data)
match = self._precolor_string_pattern.search(file_data[date_start:])
if match:
# Extract string.
buf = []
for c in file_data[match.start(1):]:
for c in file_data[date_start + match.start(1):]:
c = ~c & 0xff
c = (c << 5) | (c >> 3)
buf.append(c & 0x7f)