/// Initializing Disk By Resetting Disk System \\\
gotoxy(10,2); printf("Initializing The Disk...");
for(i=0;i<3;i++)
{
inregs.h.ah=0x00; // Function Number
inregs.h.dl=0x00; // Floppy Disk
int86(0x13,&inregs,&outregs);
}
gotoxy(10,2); printf("The Status of the Disk is as....\n");
/* Scan the Floppy Disk from 0 to 79 Tracks (Total Tracks 80) */
for(track=0;track<=79;track++)
for(head=0;head<=1;head++)
for(sector=1;sector<=18;sector++)
{
inregs.h.ah = 0x04; /// function Number
inregs.h.al = 1; /// Number of sectors
inregs.h.dl = 0x00; /// Floppy Disk
inregs.h.ch = track;
inregs.h.dh = head;
inregs.h.cl = sector;
inregs.x.bx = FP_OFF(buf);
sregs.es = FP_SEG(buf);
int86x(0x13,&inregs,&outregs,&sregs);
//// Print The Status of the Scanned Sector \\\\
switch(outregs.h.ah)
{
case 0x00:
cprintf("STATUS: No Error!!");
break;
case 0x01:
cprintf("STATUS: Bad command");
break;
case 0x02:
cprintf("STATUS: Address mark not found");
break;
case 0x03:
cprintf("STATUS: Attempt to write to
write-protected disk");
break;
|