def read_catalog
catalog=get_block(2)
catalog_size=catalog[2]
3.upto(catalog_size-1) do |i|
catalog<<get_block(i)
end
volume_name_length=catalog[6]
self.volume_name=catalog[7..6+volume_name_length]
files_in_volume=catalog[0x10]
1.upto(files_in_volume) do |file_no|
file_record=catalog[file_no*0x1a..(file_no*0x1a+0x19)]
first_block=file_record[0]+file_record[1]*0x100
first_block_in_next_file=file_record[2]+file_record[3]*0x100
last_block=first_block_in_next_file-1
file_type=file_record[4]
file_name_length=file_record[6]
file_name=file_record[7..6+file_name_length]
bytes_in_last_block=file_record[0x16]+file_record[0x17]*0x100
file_contents=""
first_block.upto(last_block) do |block_no|
this_block=get_block(block_no)
if block_no==last_block then
file_contents<<this_block[0..bytes_in_last_block-1]
else
file_contents<<this_block
end
files[file_name]=PascalFile.new(file_name,file_contents,file_type)
end
end
end