Class: G64
- Inherits:
-
D64
- Object
- ImageFormat
- D64
- G64
- Defined in:
- lib/image_formats/G64.rb
Constant Summary collapse
- CBM_GCR_CODES =
raw GCR binary representation of a 1541 diskette
References:
http://www.unusedino.de/ec64/technical/formats/g64.html http://www.baltissen.org/newhtm/1541c.htm http://www.scribd.com/doc/40438/The-Commodore-1541-Disk-Drive-Users-Guide
{ "01010"=>0x00, "01011"=>0x01, "10010"=>0x02, "10011"=>0x03, "01110"=>0x04, "01111"=>0x05, "10110"=>0x06, "10111"=>0x07, "01001"=>0x08, "11001"=>0x09, "11010"=>0x0A, "11011"=>0x0B, "01101"=>0x0C, "11101"=>0x0D, "11110"=>0x0E, "10101"=>0x0F }
Constants inherited from D64
Instance Attribute Summary
Attributes inherited from ImageFormat
Class Method Summary collapse
Instance Method Summary collapse
- #end_track ⇒ Object
- #get_sector(track_no, sector_no) ⇒ Object
-
#initialize(file_bytes) ⇒ G64
constructor
A new instance of G64.
- #track_count ⇒ Object
Methods inherited from D64
#dir_sector_no, #dir_track_no, host_system, #sectors_in_track, #set_sector
Methods inherited from ImageFormat
all_image_formats, all_possible_extensions, code_for_tests, #compatability_score, host_system, #host_system, is_valid_image_if, possible_file_systems, #sectors_in_track, #start_track, #to_s, #track_list
Methods included from SubclassTracking
Constructor Details
#initialize(file_bytes) ⇒ G64
Returns a new instance of G64.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/image_formats/G64.rb', line 45 def initialize(file_bytes) @file_bytes=file_bytes @tracks={} @end_track=0 signature,version,raw_track_count,track_length=file_bytes.unpack("A8ccv") 0.upto(raw_track_count-1) do |raw_track_no| cbm_track_no=(raw_track_no+2.0)/2 track_offset=file_bytes[0x0c+4*raw_track_no,4].unpack("V")[0] if track_offset>0 then @end_track=cbm_track_no end end end |
Class Method Details
.possible_extensions ⇒ Object
60 61 62 |
# File 'lib/image_formats/G64.rb', line 60 def self.possible_extensions ['.g64'] end |
Instance Method Details
#end_track ⇒ Object
68 69 70 |
# File 'lib/image_formats/G64.rb', line 68 def end_track @end_track end |
#get_sector(track_no, sector_no) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/image_formats/G64.rb', line 72 def get_sector(track_no,sector_no) #puts "TR #{track_no} : #{sector_no}" parse_raw_track((track_no-1)*2) if @tracks[track_no].nil? @tracks[track_no][sector_no] end |
#track_count ⇒ Object
64 65 66 |
# File 'lib/image_formats/G64.rb', line 64 def track_count @end_track end |