home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pcmagazi
/
1992
/
20
/
diskette
/
diskette.c
next >
Wrap
Text File
|
1992-11-04
|
1KB
|
48 lines
// diskette.c
#include<stdio.h>
#include<bios.h>
#include<ctype.h>
#include<stdlib.h>
void main(int argc, char **argv)
{
struct diskinfo_t disk;
int counter = 0;
if(argc > 1)
disk.drive = toupper(*argv[1])-'A';
else
disk.drive = 0;
disk.head = 0; // set to read beginning of disk...
disk.track = 0;
disk.sector = 1;
disk.nsectors = 1;
for(counter = 0; counter < 3; counter++)
{
_bios_disk(_DISK_RESET, &disk); // reset disk controller
// verify disk sectors
if(!(_bios_disk(_DISK_VERIFY, &disk) >> 8))
{
printf("Please remove diskette in drive %c...\n",disk.drive+'A');
// loop until disk is removed
while(!(_bios_disk(_DISK_VERIFY, &disk) >> 8))
;
break;
}
}
printf("Please insert a diskette into drive %c...\n",disk.drive+'A');
_bios_disk(_DISK_RESET, &disk); // reset controller again
// loop until disk is inserted
while(_bios_disk(_DISK_VERIFY, &disk) >> 8)
_bios_disk(_DISK_RESET, &disk);
printf("Thank you.\n");
exit(0);
}