Class: Ti99Dsk

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

Overview

TI99 DSK

Direct Known Subclasses

Pc99Dsk, V9T9Dsk

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



16
17
18
# File 'lib/image_formats/Ti99Dsk.rb', line 16

def self.host_system
    Ti99
end

.possible_extensionsObject



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)
    
#  puts "looking for LOGICAL TRACK:$%02X SECTOR:$%02X " % [track,sector]    
  #track sector 0 as a special case, since to get to any other sector we need to know some values (e.g. sectors per track) that is recorded in sector 0
  if (sector==0) then
    return file_bytes[initial_header_length,256]
  end
  
  real_track=sector/sectors_per_track
  physical_sector=sector % sectors_per_track
  get_physical_sector(real_track,physical_sector)
end

#initial_header_lengthObject



24
25
26
# File 'lib/image_formats/Ti99Dsk.rb', line 24

def initial_header_length
  0
end

#sector_sizeObject



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_trackObject



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_countObject



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_sideObject



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