# File test/backup/DOSDisk.rb, line 189
def find_catalog_slot(filename)
  vtoc_sector=get_sector(17,0)
  catalog_filename=DOSFile.catalog_filename(filename.upcase) unless filename.nil?
  catalog_track_no=vtoc_sector[01]
  catalog_sector_no=vtoc_sector[02]
  
  while (catalog_track_no+catalog_sector_no>0) do
    catalog=get_sector(catalog_track_no,catalog_sector_no)    
    (0..7).each do |slot_no|
      slot_start=slot_no*0x23+0x0B
      if filename.nil? && (catalog[slot_start]==0x00)|| (catalog[slot_start]==0xFF) then        
        return DSKTrackSector.new(catalog_track_no,catalog_sector_no,slot_start)
      end
      if (!filename.nil?) && (catalog[slot_start+0x03..slot_start+0x20]==catalog_filename) then
        return DSKTrackSector.new(catalog_track_no,catalog_sector_no,slot_start)
      end
    end
    catalog_track_no=catalog[01]
    catalog_sector_no=catalog[02]    
  end
  nil
end