Category : HD Utilities
Archive   : TYPENEUM.ZIP
Filename : TYPENUM.C

 
Output of file : TYPENUM.C contained in archive : TYPENEUM.ZIP
/* this program goes thru BIOS and displays the list of disk type nums */

#include
#include
#include

#define uint unsigned int
#define uchar unsigned char

typedef struct {
uint cyls;
uchar heads;
uint filler1;
uint Write_Pre_Comp;
uchar filler3;
uchar control_byte;
uchar filler4[3];
uint landing_zone;
uchar sectors;
uchar last;
} DiskParams;

char ValidDPEntry(DiskParams * DP) {
return( DP->filler1==0 &&
DP->filler3==0 &&
DP->filler4[0]==0 &&
DP->filler4[1]==0 &&
DP->filler4[2]==0 &&
DP->last==0 &&
DP->heads < 32 &&
DP->sectors < 64 &&
DP->cyls < 3000 );
}

void PrintDiskParam(DiskParams * DP, char num) {
int mb;
if (DP->cyls==0)
printf(" %2d \n", num);
else {
mb = ((long)DP->cyls * DP->heads * DP->sectors * 512) / 1000000;
printf(" %2d %4d %2d %2d %3d\n",
num, DP->cyls, DP->heads, DP->sectors, mb);
}
}

void PrintDPHeader() {
printf("Type Cyls Hd Se MB\n");
}

DiskParams *GetDPStart() {
DiskParams * DP;
DP = (DiskParams*)getvect(0x41);
if (DP==NULL) return(DP);
while (ValidDPEntry(DP)) DP--;
return(DP);
}

void main () {
DiskParams * DP;
char N=0,
ScrCnt=0;


DP = GetDPStart();
if (DP) {
PrintDPHeader();
while ( ValidDPEntry(++DP) ) {
PrintDiskParam(DP, ++N);
if (++ScrCnt==22) {
printf(". . . pause . . .");
getch();
printf("\n");
ScrCnt=0;
}
}
}
}

  3 Responses to “Category : HD Utilities
Archive   : TYPENEUM.ZIP
Filename : TYPENUM.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/