Added enhanced density VTOC2 segment

This commit is contained in:
Rob McMullen 2016-02-07 18:37:38 -08:00
parent c99f6d38ff
commit 4093077e3c

View File

@ -419,6 +419,7 @@ class AtrDiskImage(object):
self.header = None self.header = None
self.first_vtoc = 360 self.first_vtoc = 360
self.num_vtoc = 1 self.num_vtoc = 1
self.vtoc2 = 0
self.first_data_after_vtoc = 369 self.first_data_after_vtoc = 369
self.total_sectors = 0 self.total_sectors = 0
self.unused_sectors = 0 self.unused_sectors = 0
@ -496,6 +497,11 @@ class AtrDiskImage(object):
self.num_vtoc = num self.num_vtoc = num
self.total_sectors = values[1] self.total_sectors = values[1]
self.unused_sectors = values[2] self.unused_sectors = values[2]
if self.header.image_size == 133120:
# enhanced density has 2nd VTOC
self.vtoc2 = 1024
extra_free = self.get_sectors(self.vtoc2)[122:124].view(dtype='<u2')[0]
self.unused_sectors += extra_free
def get_directory(self): def get_directory(self):
dir_bytes = self.get_sectors(361, 368) dir_bytes = self.get_sectors(361, 368)
@ -595,6 +601,10 @@ class AtrDiskImage(object):
start, count = self.get_contiguous_sectors(self.first_vtoc, self.num_vtoc) start, count = self.get_contiguous_sectors(self.first_vtoc, self.num_vtoc)
segment = self.get_raw_sectors_segment(self.first_vtoc, self.num_vtoc, count, self.bytes[start:start+count], name="VTOC") segment = self.get_raw_sectors_segment(self.first_vtoc, self.num_vtoc, count, self.bytes[start:start+count], name="VTOC")
segments.append(segment) segments.append(segment)
if self.vtoc2 > 0:
start, count = self.get_contiguous_sectors(self.vtoc2, 1)
segment = self.get_raw_sectors_segment(self.vtoc2, 1, count, self.bytes[start:start+count], name="VTOC2")
segments.append(segment)
return segments return segments
def get_directory_segments(self): def get_directory_segments(self):