diff --git a/atrcopy/__init__.py b/atrcopy/__init__.py index 018e191..36461e5 100644 --- a/atrcopy/__init__.py +++ b/atrcopy/__init__.py @@ -8,7 +8,7 @@ except ImportError: raise RuntimeError("atrcopy %s requires numpy" % __version__) from errors import * -from ataridos import AtariDosDiskImage, AtariDosFile +from ataridos import AtariDosDiskImage, AtariDosFile, get_xex from diskimages import AtrHeader, BootDiskImage from kboot import KBootImage, add_kboot_header from segments import SegmentData, SegmentSaver, DefaultSegment, EmptySegment, ObjSegment, RawSectorsSegment, user_bit_mask, match_bit_mask, comment_bit_mask, data_bit_mask, selected_bit_mask, diff_bit_mask, not_user_bit_mask diff --git a/atrcopy/ataridos.py b/atrcopy/ataridos.py index 6a03439..7603361 100644 --- a/atrcopy/ataridos.py +++ b/atrcopy/ataridos.py @@ -346,3 +346,24 @@ class AtariDosDiskImage(DiskImageBase): except InvalidBinaryFile: log.debug("%s not a binary file; skipping segment generation" % str(segment)) return segments_out + +def get_xex(segments, runaddr): + total = 2 + for s in segments: + total += 4 + len(s) + total += 6 + bytes = np.zeros([total], dtype=np.uint8) + bytes[0:2] = 0xff # FFFF header + i = 2 + for s in segments: + words = bytes[i:i+4].view(dtype='