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
39 40 41 42 43 |
# File 'lib/image_formats/AcornDsk.rb', line 39 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 31 32 |
# File 'lib/image_formats/AcornDsk.rb', line 28 def sectors_in_track(track_no) def sectors_in_track(track_no) (0..@sectors_per_track).collect end end |
#track_count ⇒ Object
how many tracks could be interpreted by this image format?
35 36 37 |
# File 'lib/image_formats/AcornDsk.rb', line 35 def track_count @track_count end |