import argparse import struct FLAG_ORDER = 'RWLDErweP_' TWEAK_OFFSET = -0x4800 # Why? I don't know # The ADFS docs say that the sector size is either 256 or 1024 bytes. # But the Domesday images have addresses given in bytes, not sectors. class DirectoryEntry: def __init__(self, f): self.name = '' self.flags = '' for i in range(10): c = f.read(1)[0] if c & 0x7F: self.name += chr(c & 0x7F) if c & 0x80: self.flags += FLAG_ORDER[i] self.name = self.name.strip() if ' ' in self.name: raise ValueError("Unlikely to be a directory entry") self.load_address = struct.unpack('