mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2025-01-21 03:31:39 +00:00
Added SpartaDOS sector map parsing and initial directory support
This commit is contained in:
parent
ce36ea9ee6
commit
c36aebd593
28
atrcopy.py
28
atrcopy.py
@ -935,13 +935,35 @@ class SpartaDosDiskImage(DiskImageBase):
|
|||||||
segments.append(segment)
|
segments.append(segment)
|
||||||
return segments
|
return segments
|
||||||
|
|
||||||
|
def get_sector_map(self, sector):
|
||||||
|
m = None
|
||||||
|
while sector > 0:
|
||||||
|
b, _ = self.get_sectors(sector)
|
||||||
|
sector, prev = b[0:4].view(dtype='<u2')
|
||||||
|
if m is None:
|
||||||
|
m = np.copy(b[4:].view(dtype='<u2'))
|
||||||
|
else:
|
||||||
|
m = np.hstack((m, b[4:].view(dtype='<u2')))
|
||||||
|
return m
|
||||||
|
|
||||||
def get_directory_segments(self):
|
def get_directory_segments(self):
|
||||||
|
dir_map = self.get_sector_map(self.root_dir)
|
||||||
|
print dir_map
|
||||||
b = self.bytes
|
b = self.bytes
|
||||||
s = self.style
|
s = self.style
|
||||||
segments = []
|
segments = []
|
||||||
addr = 0
|
byte_order = []
|
||||||
start, count = self.get_contiguous_sectors(361, 8)
|
for sector in dir_map:
|
||||||
segment = RawSectorsSegment(b[start:start+count], s[start:start+count], 361, 8, count, name="Directory")
|
if sector == 0:
|
||||||
|
break
|
||||||
|
bytes, pos, size = self.get_raw_bytes(sector)
|
||||||
|
byte_order.extend(range(pos, pos + size))
|
||||||
|
name = "Root Directory"
|
||||||
|
if len(byte_order) > 0:
|
||||||
|
segment = IndexedByteSegment(self.bytes, self.style, byte_order, name=name)
|
||||||
|
else:
|
||||||
|
segment = EmptySegment(self.bytes, self.style, name=name)
|
||||||
|
segment.map_width = 23
|
||||||
segments.append(segment)
|
segments.append(segment)
|
||||||
return segments
|
return segments
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user