Class: AcornDsk
- Inherits:
-
ImageFormat
- Object
- ImageFormat
- AcornDsk
- Defined in:
- lib/image_formats/AcornDsk.rb
Overview
Acorn 8-bit series disk image
Instance Attribute Summary
Attributes inherited from ImageFormat
Class Method Summary collapse
Instance Method Summary collapse
- #get_sector(track, sector) ⇒ Object
-
#initialize(file_bytes) ⇒ AcornDsk
constructor
A new instance of AcornDsk.
- #sectors_in_track(track_no) ⇒ Object
-
#track_count ⇒ Object
how many tracks could be interpreted by this image format?.
Methods inherited from ImageFormat
all_image_formats, all_possible_extensions, code_for_tests, #compatability_score, #end_track, #host_system, is_valid_image_if, possible_file_systems, #start_track, #to_s, #track_list
Methods included from SubclassTracking
Constructor Details
#initialize(file_bytes) ⇒ AcornDsk
Returns a new instance of AcornDsk.
17 18 19 20 21 22 |
# File 'lib/image_formats/AcornDsk.rb', line 17 def initialize(file_bytes) @file_bytes=file_bytes @sector_length=256 @sectors_per_track=10 @track_count=file_bytes.length/(@sectors_per_track*@sector_length) end |
Class Method Details
.host_system ⇒ Object
24 25 26 |
# File 'lib/image_formats/AcornDsk.rb', line 24 def self.host_system AcornBBC end |
.possible_extensions ⇒ Object
13 14 15 |
# File 'lib/image_formats/AcornDsk.rb', line 13 def self.possible_extensions ['.ssd','.bbc'] end |
Instance Method Details
#get_sector(track, sector) ⇒ Object
37 38 39 40 41 |
# File 'lib/image_formats/AcornDsk.rb', line 37 def get_sector(track,sector) start_byte=track*@sectors_per_track*@sector_length+(sector*@sector_length) # puts "Track: #{track}, sector: #{sector}, start_byte: #{start_byte}" @file_bytes[start_byte,@sector_length] end |
#sectors_in_track(track_no) ⇒ Object
28 29 30 |
# File 'lib/image_formats/AcornDsk.rb', line 28 def sectors_in_track(track_no) (0..@sectors_per_track).collect end |
#track_count ⇒ Object
how many tracks could be interpreted by this image format?
33 34 35 |
# File 'lib/image_formats/AcornDsk.rb', line 33 def track_count @track_count end |