def delete_file(filename)
this_files_catalog_slot=find_catalog_slot(filename)
return if this_files_catalog_slot.nil?
file_descriptive_entry=get_sector(this_files_catalog_slot.track_no,this_files_catalog_slot.sector_no)[this_files_catalog_slot.offset..this_files_catalog_slot.offset+0x22]
sector_usage_bitmap_sector=get_sector(0x11,0)
sectors_to_mark_available=get_track_sector_list(file_descriptive_entry[0x00],file_descriptive_entry[0x01])
sectors_to_mark_available<<DSKTrackSector.new(file_descriptive_entry[0x01],file_descriptive_entry[0x00])
sectors_to_mark_available.each do |ts|
offset_of_byte_containing_this_sector=0x38+(ts.track_no*4)
if ts.sector_no<8 then
offset_of_byte_containing_this_sector+=1
end
byte_containing_this_sector=sector_usage_bitmap_sector[offset_of_byte_containing_this_sector]
byte_containing_this_sector=byte_containing_this_sector|(2**(ts.sector_no%8))
sector_usage_bitmap_sector[offset_of_byte_containing_this_sector]=byte_containing_this_sector
end
set_sector(0x11,0,sector_usage_bitmap_sector)
catalog_sector=get_sector(this_files_catalog_slot.track_no,this_files_catalog_slot.sector_no)
catalog_sector[this_files_catalog_slot.offset+0x20]=catalog_sector[this_files_catalog_slot.offset]
catalog_sector[this_files_catalog_slot.offset]=0xFF
set_sector(this_files_catalog_slot.track_no,this_files_catalog_slot.sector_no,catalog_sector)
end