Class: AcornDFS

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

Overview

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



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/file_systems/AcornDFS.rb', line 29

def self.files(file_system_image)
	files=FileContainer.new
	
	sector_0=file_system_image.get_sector(0,0)
	sector_1=file_system_image.get_sector(0,1)
	volume_name=sector_1[0..3]+sector_0[0..7]+" (#{"%02x" % sector_1[4].to_i})"
	file_system_image.volume_name=volume_name.tr("\000",".")
	file_count=sector_1[5] / 8
	file_count.times do |i|
entry_start=(i+1)*8
filename="#{sector_0[entry_start+7,1]}.#{sector_0[entry_start,7]}".strip
entry=sector_1[entry_start,8]
load_address=entry[0]+(entry[1]<<8)+(0x55*((entry[6]>>2)%4)<<16)
exec_address=entry[2]+(entry[3]<<8)+(0x55*((entry[6]>>6)%4)<<16)
length=entry[4]+(entry[5]<<8)+(((entry[6]>>4)%4)<<16)
start_sector=((entry[6]% 4)<<8)+entry[7]
#		puts "%x %x %x %x #{filename}" % [load_address,exec_address,length,start_sector]
raw_bytes=""
((length+255)/0x100).times do |i|
	track = (start_sector+i)/10
	sector= (start_sector+i) % 10
	raw_bytes<<file_system_image.get_sector(track,sector)
end
file_contents=raw_bytes[0,length]
file=NativeFileType.best_fit(file_system_image,filename,file_contents,nil,load_address)
file.execute_address=exec_address
files<<file
	end
	files
end

.host_systemObject



13
14
15
# File 'lib/file_systems/AcornDFS.rb', line 13

def self.host_system
  AcornBBC
end