Class: RsDos
- Inherits:
-
FileSystem
- Object
- FileSystem
- RsDos
- Defined in:
- lib/file_systems/RsDos.rb
Overview
sector 2 contains File Allocation Table.
Constant Summary collapse
- FDE_SIZE =
0x20
Class Method Summary collapse
-
.directory_track ⇒ Object
standard RSDOS has directory on track 17.
- .files(file_system_image) ⇒ Object
- .host_system ⇒ Object
- .sectors_per_granule(file_system_image) ⇒ Object
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
Class Method Details
.directory_track ⇒ Object
standard RSDOS has directory on track 17
35 36 37 |
# File 'lib/file_systems/RsDos.rb', line 35 def self.directory_track 0x11 end |
.files(file_system_image) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/file_systems/RsDos.rb', line 73 def self.files(file_system_image) files=FileContainer.new granule_allocation_table=file_system_image.get_sector(directory_track,2) return files if granule_allocation_table.nil? # file_system_image.volume_name="RSDOS Disk" (file_system_image.sectors_in_track(directory_track)-[1,2,12,13,14,15,16,17,18]).each do |sector_no| fde_sector=file_system_image.get_sector(directory_track,sector_no) (fde_sector.length/FDE_SIZE).times do |fde_number| fde=fde_sector[fde_number*FDE_SIZE,FDE_SIZE] next if fde[0]==0 break if fde[0]==0xff filename_base=fde[0,8].unpack("A8") filename_extension=fde[8,3].unpack("A8") filename="#{filename_base}/#{filename_extension}" file_type, ascii_flag, granule, last_sector_bytes = fde[11,5].unpack("CCCS") contents="" granules = [] # puts "#{filename}: first gran:#{granule} file type #{file_type} ascii flag #{ascii_flag}" while granule < 67 break if granules.include?(granule)==true granules << granule track_no = Integer(granule/2) (track_no += 1) if granule>33 start_sector = (granule % 2) == 0 ? 1 : 10 #puts "Start sector: #{start_sector}" granule_value = granule_allocation_table[ granule ] if granule_value < 68 then 9.times {|i| contents<<file_system_image.get_sector(track_no,start_sector+i)} else count = (granule_value & 0b00011111) - 1 count.times {|i| contents<<file_system_image.get_sector(track_no,start_sector+i)} contents<<(file_system_image.get_sector(track_no,start_sector+count))[0,last_sector_bytes] end #puts "#{granule} = #{granule_value}" granule = granule_value end files<<NativeFileType.best_fit(file_system_image,filename,contents,file_type,ascii_flag) end end files end |
.host_system ⇒ Object
30 31 32 |
# File 'lib/file_systems/RsDos.rb', line 30 def self.host_system Coco end |
.sectors_per_granule(file_system_image) ⇒ Object
39 40 41 |
# File 'lib/file_systems/RsDos.rb', line 39 def self.sectors_per_granule(file_system_image) 9 end |