Class: SlowFat::BiosParameterBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/slowfat/bootsect.rb

Overview

BiosParameterBlock holds information from a BPB.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ BiosParameterBlock

Returns a new instance of BiosParameterBlock.



41
42
43
# File 'lib/slowfat/bootsect.rb', line 41

def initialize(data)
  (@bytes_per_logsect, @logsects_per_cluster, @reserved_logsects, @fats, @root_entries, @total_logsects, @media_descriptor, @logsects_per_fat, @physects_per_track, @heads, @hidden_logsects, @large_total_logsects) = data.unpack('vCvCvvCvvvVV')
end

Instance Attribute Details

#bytes_per_logsectObject (readonly)

Returns the value of attribute bytes_per_logsect.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def bytes_per_logsect
  @bytes_per_logsect
end

#fatsObject (readonly)

Returns the value of attribute fats.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def fats
  @fats
end

#headsObject (readonly)

Returns the value of attribute heads.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def heads
  @heads
end

#hidden_logsectsObject (readonly)

Returns the value of attribute hidden_logsects.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def hidden_logsects
  @hidden_logsects
end

#large_total_logsectsObject (readonly)

Returns the value of attribute large_total_logsects.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def large_total_logsects
  @large_total_logsects
end

#logsectsObject (readonly)

Returns the value of attribute logsects.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def logsects
  @logsects
end

#logsects_per_clusterObject (readonly)

Returns the value of attribute logsects_per_cluster.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def logsects_per_cluster
  @logsects_per_cluster
end

#logsects_per_fatObject (readonly)

Returns the value of attribute logsects_per_fat.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def logsects_per_fat
  @logsects_per_fat
end

#media_descriptorObject (readonly)

Returns the value of attribute media_descriptor.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def media_descriptor
  @media_descriptor
end

#physects_per_trackObject (readonly)

Returns the value of attribute physects_per_track.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def physects_per_track
  @physects_per_track
end

#reserved_logsectsObject (readonly)

Returns the value of attribute reserved_logsects.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def reserved_logsects
  @reserved_logsects
end

#root_entriesObject (readonly)

Returns the value of attribute root_entries.



39
40
41
# File 'lib/slowfat/bootsect.rb', line 39

def root_entries
  @root_entries
end

Instance Method Details

#media_descriptor_typeSymbol

Return the type of media this boot sector is on

Returns:

  • (Symbol)

    the type of media described by the media descriptor in the boot sector



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/slowfat/bootsect.rb', line 48

def media_descriptor_type
  case @media_descriptor_id
    when 0xE5
      :floppy_8inch
    when 0xF0
      :floppy_35inch_hd
    when 0xF8
      :fixed_disk
    when 0xFD
      :floppy_525inch_ld
    else
      :unknown
  end
end