[comp.sys.ibm.pc] Program to determine drive types

keithe@tekgvs.TEK.COM (Keith Ericson) (03/10/88)

Here is a program a co-worker wrote to examine the BIOS table and
print out the hard disk drive types. I'll put a uuencoded copy of
the executable in the binaries newsgroup.

In case you're wondering, the "Control Byte" is 0 for drives with 7
or fewer heads and it's 8 for drives with 8 to 15 heads.

Also, I don't understand entries for drives with 8 or more heads AND
containing an entry for write precompensation: it's my understanding
that the "reduced write current" line is replaced by the third head-
select function in those (8-or more head) drives. Anybody know for
certain how this works?

keith

=======================================================================
/* Compiled with Turbo-C V-1.5 */

#include <stdio.h>
#include <dos.h>


main() {
	int	segm = 0xf000;
	unsigned baseoff = 0xe401;
	int	cyl;
	char	heads;
	int	precom;
	char	cntrl;
	int	land;
	char	sect;
	int	i;
	long	cap;
	printf("Drive  Cylind.  Heads  Write	Control  Landing   Sectors     Format.\n");
	printf("type                   precomp.  byte    zone      per track.  capac.\n");

	for(i=0;i<47;i++) {
		cyl = peek(segm, baseoff+(unsigned)(i*16));
		heads = peekb(segm, baseoff+(unsigned)(i*16+2));
		precom = peek(segm, baseoff+(unsigned)(i*16+5));
		cntrl = peekb(segm,baseoff+(unsigned)(i*16+8));
		land = peek(segm, baseoff+(unsigned)(i*16+12));
		sect = peekb(segm, baseoff+(unsigned)(i*16+14));
		cap = (long)(sect*512)*(long)(heads*cyl);
		cap /= 1000000L;
		if(precom != -1)
			printf("%3d %7d %7d %9d %7d %8d %10d %8dMb\n",i+1,cyl,
			(int)heads,precom,cntrl,land,(int)sect,(int)cap);
		else
			printf("%3d %7d %7d %9s %7d %8d %10d %8dMb\n",i+1,cyl,
			(int)heads,"none",cntrl,land,(int)sect,(int)cap);
	}
}