# File lib/file_systems/AtariDos.rb, line 27
def self.files(file_system_image)
  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)
                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]
                        if (start_sector>0 && start_sector<file_system_image.image_format.sector_count&& (directory_flag & 0x80 !=0x80)) then
        current_sector=start_sector
        file_contents=""
        while current_sector!=0 && current_sector<=file_system_image.image_format.sector_count
          file_sector_data=file_system_image.get_sector(0,current_sector)
          #raise "invalid sector #{current_sector} in #{file_name}" if file_sector_data.nil?
          bytes_used=(file_sector_data[127] & 0x7F)
          file_contents+=file_sector_data[0,bytes_used]
          next_sector_hi=(file_sector_data[125] & 0b00000011)
          next_sector_lo=file_sector_data[126]
          current_sector=next_sector_hi*0x100+next_sector_lo
        end
      files<<NativeFileType.best_fit(file_system_image,file_name,file_contents,filename_ext)
      end      
    end
        end  
  files
end