Category : C Source Code
Archive   : C-FDC.ZIP
Filename : TSTFMT.C
Output of file : TSTFMT.C contained in archive : C-FDC.ZIP
#include
#include "fdc.h"
extern int secsize[];
extern int errno;
main()
{
int i;
char *calloc();
char *buf;
struct ati *sp, *getati();
int drive, head, track;
int sides, max_sect;
int sect_type;
sp = getati(1);
drive = 0;
track = 20;
switch(sp->media_type & 0xff) {
case 0xff:
sides = 2;
max_sect = 8;
break;
case 0xfe:
sides = 1;
max_sect = 8;
break;
case 0xfd:
sides = 2;
max_sect = 9;
break;
case 0xfc:
sides = 1;
max_sect = 9;
break;
case 0xf9:
sides = 2;
max_sect = 15;
break;
case 0xf8:
printf("Trying to fdc the hard disk, eh?\n");
exit(0);
default:
printf("Hummmm. I don't recognize the disk type, %x.\n",
sp->media_type);
exit(0);
}
buf = calloc(sp->sector_size * max_sect, sizeof(char));
if(buf == NULL) {
printf("fucked it\n");
exit(1);
}
for(i = 0; i < (sp->sector_size * max_sect); ++i)
buf[i] = i % 10;
for(i = 0; secsize[i]; ++i)
if(sp->sector_size == secsize[i]) {
sect_type = i;
break;
}
for(head = 0; head < 2; ++head) {
printf("format/write/verify drive %d, head %d, track %d, max sect %d, sector type %d\n",
drive, head, track, max_sect, sect_type);
if(fmtrack(drive, head, track, max_sect, sect_type)) {
printf("screwed format! errno = %x\n", errno);
exit(1);
}
if(wrtrack(drive, head, track, 1, max_sect, buf)) {
printf("screwed write! errno = %x\n", errno);
exit(1);
}
if(vertrack(drive, head, track, 1, max_sect, buf)) {
printf("screwed verify! errno = %x\n", errno);
exit(1);
}
}
exit(0);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/