From 3a6afa4ec45653fe756523c9ff2f777dd8753b47 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 8 Apr 2022 21:55:37 -0300 Subject: [PATCH] Add AMPRO analyzer --- biostools/__main__.py | 1 + biostools/analyzers.py | 20 ++++++++++++++++++++ biostools/extractors.py | 1 + 3 files changed, 22 insertions(+) diff --git a/biostools/__main__.py b/biostools/__main__.py index a03838c..bc6c64e 100644 --- a/biostools/__main__.py +++ b/biostools/__main__.py @@ -490,6 +490,7 @@ def analyze_process(queue, formatter, scan_base): # less common BIOSes with no dependencies on the common part begin here # analyzers.AcerAnalyzer(), analyzers.AcerMultitechAnalyzer(), + analyzers.AmproAnalyzer(), analyzers.AmstradAnalyzer(), analyzers.CDIAnalyzer(), analyzers.CentralPointAnalyzer(), diff --git a/biostools/analyzers.py b/biostools/analyzers.py index 42936cf..5b6dbee 100644 --- a/biostools/analyzers.py +++ b/biostools/analyzers.py @@ -781,6 +781,26 @@ class AMIUEFIAnalyzer(Analyzer): return True +class AmproAnalyzer(Analyzer): + def __init__(self, *args, **kwargs): + super().__init__('AMPRO', *args, **kwargs) + + self._version_pattern = re.compile(b'''AMPRO (.+) Rom-Bios[^\\n]+\\nVersion ([^ ]+)''') + + def can_handle(self, file_data, header_data): + match = self._version_pattern.search(file_data) + if not match: + return False + + # Extract version. + self.version = match.group(2).decode('cp437', 'ignore') + + # Extract board type as a sign-on. + self.signon = match.group(1).decode('cp437', 'ignore') + + return True + + class AmstradAnalyzer(NoInfoAnalyzer): def __init__(self, *args, **kwargs): super().__init__('Amstrad', *args, **kwargs) diff --git a/biostools/extractors.py b/biostools/extractors.py index 85ab136..300662a 100644 --- a/biostools/extractors.py +++ b/biostools/extractors.py @@ -1355,6 +1355,7 @@ class InterleaveExtractor(Extractor): b'memory (parity error)', b'Copyright COMPAQ Computer Corporation', # Compaq b'Press any key when ready', # Access Methods + b'AMPRO ', # AMPRO ] # Interleave the strings.