Class: Trs80Jv1Dsk

Inherits:
ImageFormat show all
Defined in:
lib/image_formats/Trs80Jv1Dsk.rb

Overview

TRS80 DSK in JV1 format - tim-mann.org/trs80/dskspec.html

Instance Attribute Summary

Attributes inherited from ImageFormat

#file_bytes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ImageFormat

all_image_formats, all_possible_extensions, code_for_tests, #compatability_score, #end_track, #host_system, #initialize, is_valid_image_if, possible_file_systems, #start_track, #to_s, #track_list

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from ImageFormat

Class Method Details

.host_systemObject



22
23
24
# File 'lib/image_formats/Trs80Jv1Dsk.rb', line 22

def self.host_system
    Trs80
end

.possible_extensionsObject



12
13
14
# File 'lib/image_formats/Trs80Jv1Dsk.rb', line 12

def self.possible_extensions
    ['.dsk']
end

Instance Method Details

#get_sector(track, sector) ⇒ Object



35
36
37
38
39
40
# File 'lib/image_formats/Trs80Jv1Dsk.rb', line 35

def get_sector(track,sector)
  
  #puts "invalid track request for track #{track} / sector #{sector}" unless sectors_in_track(track).include?(sector)
  start_byte=track*10*256+sector*256
  file_bytes[start_byte,256]
end

#sectors_in_track(track_no) ⇒ Object



26
27
28
# File 'lib/image_formats/Trs80Jv1Dsk.rb', line 26

def sectors_in_track(track_no)
  (0..0x09).collect
end

#track_countObject

how many tracks could be interpreted by this image format?



31
32
33
# File 'lib/image_formats/Trs80Jv1Dsk.rb', line 31

def track_count
  file_bytes.length/(2560)
end