[comp.sys.ibm.pc] BIOS parameter block from C program

egray@fthood.UUCP (04/26/89)

Howdy netlanders....

Question: How do you get a peek at the BIOS parameter block in a C program?

I'm using Zortech C 1.07 (small model) on a Zenith 248 (AT clone) with
Zenith's DOS 3.21.  My program needs access to the floppy disk drive
parameters, so I'm using BIOS function 32h (which I understand is
somewhat undocumented).  It is suppose to return the pointer to the
drive parameter block in DS:BX.  Unfortunately, the stuff at BX is
garbage.

What gives?  Is there a better way?

Code fragment:

	static struct param_block {
		char 	drive_number;
		char	unit_number;
		int	bytes_per_sector;
		 ......
	} table

	union REGS regs;

	regs.h.ah = 0x32;		/* Get Drive Parameter Block */
	regs.h.dl = 0x01;		/* drive a: */
	intdos(&regs, &regs);

	if (regs.h.al)
		error();
					/* in small model, BX == a pointer */
	memcpy(&table, (struct param_block *) regs.x.bx, sizeof table);

	printf("bytes per sector is %d\n", table.bytes_per_sector);


Emmet P. Gray				US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray		Attn: AFZF-DE-ENV
fthood!egray@uiucuxc.cso.uiuc.edu	Directorate of Engineering & Housing
					Environmental Management Office
					Fort Hood, TX 76544-5057