lib/file_systems/AtariDos.rb in ripxplore-0.14.1 vs lib/file_systems/AtariDos.rb in ripxplore-0.15.1
- old
+ new
@@ -13,23 +13,25 @@
def self.host_system
Atari800
end
-
-#for now, assume that anything on an Atari compatable image format is Atari DOS
-is_valid_file_system_if lambda {true}
ATARI_DOS_FILE_RECORD_LENGTH=16
ATARI_DOS_CATALOG_START_SECTOR=361
ATARI_DOS_CATALOG_END_SECTOR=368
+
+#for now, assume that anything on a large enought Atari compatable image format is Atari DOS
+is_valid_file_system_if lambda {file_system_image.image_format.sector_count>=ATARI_DOS_CATALOG_END_SECTOR}
def self.files(file_system_image)
+ return [] unless file_system_image.image_format.sector_count>=ATARI_DOS_CATALOG_END_SECTOR
files=FileContainer.new
# @file_start_sectors={}
ATARI_DOS_CATALOG_START_SECTOR.upto(ATARI_DOS_CATALOG_END_SECTOR) do |sector_no|
catalog_sector_data=file_system_image.get_sector(0,sector_no)
+ raise "invalid sector no #{sector_no} (max sector number is #{file_system_image.image_format.sector_count})" if catalog_sector_data.nil?
0.upto(7) do |record_no|
catalog_record_data=catalog_sector_data[record_no*ATARI_DOS_FILE_RECORD_LENGTH,ATARI_DOS_FILE_RECORD_LENGTH]
directory_flag,file_length,start_sector,filename_prefix,filename_ext=catalog_record_data.unpack("CvvA8A3")
file_name="#{filename_prefix}.#{filename_ext}"
# puts "%08b %02x %02x %s" % [directory_flag,file_length,start_sector,file_name]