Category : C Source Code
Archive   : C-FDC.ZIP
Filename : CHECKD.C

 
Output of file : CHECKD.C contained in archive : C-FDC.ZIP
#include
#include
#include
#include
#include "fdc.h"

int main()
{

int i, j, drive, head, track, start_sect, max_sect, type;
int times;
long size;
int sector;
char buf[BUFSIZ * 9 + 1];
char buf1[BUFSIZ * 9 + 1];
int fd;

size = (long)(360l * 1024l);

if((fd = mopen(size)) != -1) {
fprintf(stderr, "Can't open the output file!\n");
exit(1);
}
for(times = 0; times < 1; ++times) {
if(!times) {
printf("insert the first diskette into the drive & hit enter ");
gets(buf);
} else {
lseek(fd, 0l, 0);
printf("insert the second diskette into the drive & hit enter ");
gets(buf);
}
drive = 0; /* set drive to A */
type = 2; /* set 320/360K disk in 1.2 M drive */
start_sect = 1;
max_sect = 9;
if(setdasd(drive, type)) {
fprintf(stderr, "Can't set the dasd for drive A!\n");
close(fd);
exit(1);
}

for(track = 0; track < 40; track++)
for(head = 0; head < 2; head++)
for(sector = 1; sector < 10; sector++)
for(i = 0; i < 3; i++) {
if(rdtrack(drive, head, track, sector, 1, buf) == 0) {
if(!times) {
write(fd, buf, BUFSIZ);
} else {
read(fd, buf1, BUFSIZ);
for(j = 0; j < BUFSIZ; j++)
if(buf1[i] != buf[i]) {
printf("difference at head %2d, track %2d, byte %5d \
%x %x\n", head, track, i, buf1[i], buf[i]);
}
}
} else {
fprintf(stderr, "failure %d on head %d, track %d, sector %d\n", i, head,
track, sector);
}
}
}
close(fd);
printf("done\n");
exit(0);

}



  3 Responses to “Category : C Source Code
Archive   : C-FDC.ZIP
Filename : CHECKD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/