From 6941716b734200c25e77658af13c29f92feb4409 Mon Sep 17 00:00:00 2001 From: reiyawea Date: Sun, 18 Aug 2024 10:25:28 +0800 Subject: [PATCH] Fix calculation of Segment Address (Record 02) Record 02 only changes bits 0-19 of linear address (where bits 0-3 are zero and bits 4-19 are specified). Bits 20-31 should not be modified. --- intelhex/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intelhex/__init__.py b/intelhex/__init__.py index 34c28c6..38902a1 100644 --- a/intelhex/__init__.py +++ b/intelhex/__init__.py @@ -158,7 +158,7 @@ def _decode_record(self, s, line=0): # Extended 8086 Segment Record if record_length != 2 or addr != 0: raise ExtendedSegmentAddressRecordError(line=line) - self._offset = (bin[4]*256 + bin[5]) * 16 + self._offset = (self._offset & 0xFFF00000 ) | ((bin[4]*256 + bin[5]) * 16) elif record_type == 4: # Extended Linear Address Record