Formatting “Track 0 Bad” floppy program to format floppies which have bad sectors on their track 0 and when are formatted with DOS or windows, display error messages like “Track 0 BAD”. The program rewrites all the DBR, FAT and Root Directory information

Files Recovery Software
Home Contact Details Customer Support Download Demo Products  

 
 

Formatting “Track 0 Bad” floppy

This program is used to format those floppies which have bad sectors on their track 0 and when are formatted with DOS or windows, display error messages like “Track 0 BAD”. However you can also use it to format normal floppies.

The coding of the program has been given in the disk included with this book with the name “TTFORMAT.C”. The working logic of the program is same as the program published in PCQUEST computer magazine, in February 2003 edition.

In this program, we try to make this type of floppies reusable by formatting them. The program sounds that you can handle the floppy disk even with some bad sectors on it. However, if the first sector of the disk is bad, the floppy can not be formatted.

The program rewrites all the DBR, FAT and Root Directory information. If there are bad sectors on the surface of the disk, they are marked as bad in FAT.

In the coding of the program, the structure BPB is used to writer the BIOS Parameter Block of the DBR. The structure boot_sector is used to write the DBR of the disk. The structure address_field is used for interacting with number of cylinder, heads, and sectors per track and with the size of the sector.

Different functions used in the coding of the program and their description have been given in the table given next.

Function

Description

Random_VolumeID( )

This function provides the volume ID of the disk. (How DOS generates the serial number of the floppy has been discussed next to this table)

mark_bad( )

Mark bad sector using function 04H of INT 13H to verify the sectors.

sector_no_to_physical( )

This function is used to Convert the number of sectors into tracks, Heads and sectors

format_term( )

To terminate the formatting and exit the program

write_boot_info( )

Writes the boot sector of the disk

set_media_type_for_format( )

The function is used to Set Media Type For format using function 18H of INT 13H

volume_label( )

The function gets the volume label to write volume label of the disk

format( )

Wipes the surface of the disk during formatting as well as handling the bad sectors count.

get_drive_parameters( )

The Function uses INT 13H, Function 08H to get drive parameters.

mark_bad( )

Holds the information of bad cluster to mark in FAT

ask_for_continue( )

Function to confirm before formatting the disk

check_bad( )

Function to check if the returned status is error code for BAD sector

error( )

This function Displays Error message for Corresponding error code

lock_volume( )

The function is used to lock the Drive using INT 21H, function 44H and Sub function 0DH

unlock_volume( )

The function is used to unlock the Drive using INT 21H, function 44H and Sub function 0DH

physical_to_sector_no( )

Function is used to Calculate number of sectors from track, head and sector number

The Volume Serial Number of the Floppy disk is calculated by the DOS according to current date and time of the system clock.

The first part of the serial number is calculated by the sum of the time (seconds and hundredths of a second) and the date (month and day). The second part of the serial number is equal to the sum of the time (hours and minutes) and date (year).

All the calculations are performed in hexadecimal system. For example, let us assume that you formatted the floppy in DOS environment at 11:16:28:65 on 10/23/2003. Now let us calculate the serial number of the disk.

The time in (seconds and Hundredths of seconds) format is
= (28 and 65)
= (1CH and 41H)
Write it as 1C41

Similarly, date in (month and day) format is
= (10 and 23)
= (0AH and 17H)
Write it as 0A17

Similarly, time in (hours and minutes) format is,
= (11 and 16)
= (0BH and 10H)
Write it as 0B10

And the year will be
= 2003
= 07D3

Now, let us calculate the serial number of the floppy disk, according to the description given before. The first part of the serial number well be (1C41 + 0A17) = 2658 and the second part of the serial number will be (0B10 + 07D3) = 12E3.

Previous page

page 1 | 2 | 3 | 4 | 5 | 6

Next page
 
 
Data Recovery Book
 
Chapter 1 An Overview of Data Recovery
Chapter 2 Introduction of Hard Disks
Chapter 3 Logical Approach to Disks and OS
Chapter 4 Number Systems
Chapter 5 Introduction of C Programming
Chapter 6 Introduction to Computer Basics
Chapter 7 Necessary DOS Commands
Chapter 8 Disk-BIOS Functions and Interrupts Handling With C
Chapter 9 Handling Large Hard Disks
Chapter 10 Data Recovery From Corrupted Floppy
Chapter 11 Making Backups
Chapter 12 Reading and Modifying MBR with Programming
Chapter 13 Reading and Modifying DBR with Programming
Chapter 14 Programming for “Raw File” Recovery
Chapter 15 Programming for Data Wipers
Chapter 16 Developing more Utilities for Disks
Appendix Glossary of Data Recovery Terms
 
 
Pro Data Doctor

Home

Products

Contact Details

Customer Support

Download Demo

Terms and Conditions

 
Pro Data Doctor