Class: NADOLDos

Inherits:
FileSystem show all
Defined in:
lib/file_systems/NADOLDos.rb

Overview

low byte hi byte

Class Method Summary collapse

Methods inherited from FileSystem

all_file_systems, code_for_tests, compatability_score, is_valid_file_system_if, matching_score, non_matching_score

Methods included from SubclassTracking

extended

Class Method Details

.files(file_system_image) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/file_systems/NADOLDos.rb', line 46

def NADOLDos.files(file_system_image)
  files=FileContainer.new
  track=0
  sector=3
  while (sector<=9) do
    sector_data=file_system_image.get_sector(track,sector)
    (0..15).each do |slot_no|
      slot_offset=slot_no*0x10
      file_descriptive_entry=sector_data[slot_offset..slot_offset+0x10]
      if (file_descriptive_entry[0]!=0xFF && file_descriptive_entry[0]!=0x00) then # skip deleted /empty files
        filename=""
        file_descriptive_entry[0..11].to_s.each_byte{|b| filename+=(b.%128).chr} #strip off high bit
        filename.sub!(/ *$/,"") #strip off trailing spaces
        file_size=file_descriptive_entry[0x0D]*256+file_descriptive_entry[0x0C]
        if (file_size>0) then
          contents=""
          ts_list_track_no=file_descriptive_entry[0x0E]
          ts_list_sector_no=file_descriptive_entry[0x0F]
          ts_list_sector=file_system_image.get_sector(ts_list_track_no,ts_list_sector_no)
  
          for entry_number in 0..0x7f    
            data_track_no=ts_list_sector[entry_number*2]
            data_sector_no=ts_list_sector[entry_number*2+1]
            if( (data_track_no!=0 || data_sector_no!=0)   && data_sector_no<=0x0f) then                
              contents<<file_system_image.get_sector(data_track_no,data_sector_no)
            end
          end
          contents=contents[0,file_size]
          files<<NativeFileType.best_fit(file_system_image,filename,contents)
        end
      end
    end
  sector+=1
  end

  files
end

.host_systemObject



32
33
34
# File 'lib/file_systems/NADOLDos.rb', line 32

def self.host_system
  Apple2
end