Class: C64GeoWriteFile

Inherits:
C64GeosFile show all
Defined in:
lib/native_file_types/c64/C64GeoWriteFile.rb

Instance Attribute Summary

Attributes inherited from NativeFileType

#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data

Instance Method Summary collapse

Methods inherited from C64GeosFile

#contents, #header_filename, #icon_background, #icon_bitmap, #icon_foreground, #icon_format, #icon_height, #icon_tag, #icon_width, #info_block, #load_address, #meta_data, #parent_application, #record_nos, #to_hex_dump, #to_icon, #type_description

Methods inherited from CbmFile

file_system_file_types, #type_description

Methods inherited from NativeFileType

#<=>, #==, all_native_file_types, best_fit, code_for_tests, compatability_score, #data_without_header, file_type_matches?, #full_filename, #header_length, #initialize, is_valid_file_if, #load_address, load_address, matching_score, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from NativeFileType

Instance Method Details

#to_textObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/native_file_types/c64/C64GeoWriteFile.rb', line 17

def to_text
	s=""
	(1..@contents.length-1).each do |record_no|
		require 'DumpUtilities'
		page_contents=@contents[record_no]
		next if page_contents.nil?
		p=0
		until p>=page_contents.length do
			case page_contents[p]
				when 0x10 then (p+=4)  #strip out graphics escapes ($10 followed by 4 bytes)
				when 0x11 then (p+=26) #strip out ruler escapes ($11 followed by 26 bytes)
				when 0x17 then (p+=3)  #strip out NewCardSet ($17 followed by 3 other bytes)
				when 0x0d then s<<"\n"
			else begin
					c=page_contents[p]
					s<<c.chr
				end
			end
			p+=1
		end
		s<<"\n"
	end
	s
end