Class: Ti99Dsk
Overview
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
extended
Constructor Details
This class inherits a constructor from ImageFormat
Class Method Details
.host_system ⇒ Object
16
17
18
|
# File 'lib/image_formats/Ti99Dsk.rb', line 16
def self.host_system
Ti99
end
|
.possible_extensions ⇒ Object
12
13
14
|
# File 'lib/image_formats/Ti99Dsk.rb', line 12
def self.possible_extensions
['.dsk','.tidisk']
end
|
Instance Method Details
#get_sector(track, sector) ⇒ Object
TI 99 disks use a single flat list of sectors however for ease of use with code that assume there are tracks & sectors we will allow the track to be passed in
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/image_formats/Ti99Dsk.rb', line 63
def get_sector(track,sector)
if (sector==0) then
return file_bytes[,256]
end
real_track=sector/sectors_per_track
physical_sector=sector % sectors_per_track
get_physical_sector(real_track,physical_sector)
end
|
24
25
26
|
# File 'lib/image_formats/Ti99Dsk.rb', line 24
def
0
end
|
#sector_size ⇒ Object
20
21
22
|
# File 'lib/image_formats/Ti99Dsk.rb', line 20
def sector_size
256
end
|
#sectors_in_track(track_no) ⇒ Object
to be overriden in each subclass with a table showing what order logical sectors are stored
29
30
31
|
# File 'lib/image_formats/Ti99Dsk.rb', line 29
def sectors_in_track(track_no)
(track_no*sectors_per_track..((track_no+1)*sectors_per_track-1)).collect
end
|
#sectors_per_track ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/image_formats/Ti99Dsk.rb', line 43
def sectors_per_track
if @sectors_per_track.nil? then
sector_0=get_sector(0,0)
@sectors_per_track=sector_0[0x0C]
end
@sectors_per_track
end
|
#track_count ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/image_formats/Ti99Dsk.rb', line 34
def track_count
if @track_count.nil? then
sector_0=get_sector(0,0)
@track_count=sector_0[0x11]*sector_0[0x12]
end
@track_count
end
|
#tracks_per_side ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/image_formats/Ti99Dsk.rb', line 52
def tracks_per_side
if @tracks_per_side.nil? then
sector_0=get_sector(0,0)
@tracks_per_side=sector_0[0x11]
end
@tracks_per_side
end
|