read boot sector of floppy

C 16Bit (MS-DOS) Add comments

This program is no longer used cause no body uses a floppy… i have to update it to a 32bit program from 16bit… and manipulating a USB will be nice instead of a floppy.

This program displays the boot sector of a floppy drive. The biosdisk function can be used to manipulate a FAT32 hard drive even now. Manipulating a FAT16 and FAT12 are straight forward using absolute disk read and absolute disk write functions provided in Borland’s Turbo C IDE.

I am trying to write a program which will help me play with FAT32 in windows… using WIN32 API…

anyway here is one silly program for the strong hearts…

#include<stdio.h>
#include<conio.h>
#include<bios.h>
 
	struct
	{
		char jump[3];
		char si[8];//system id
		int bps;// no of bytes per sector
		char spc;// no of sectors per cluster
		int res;// no of reserved area
		char cof;// no of copies of fat
		int rde;//no of root directory entries
		int tos;// total no of sectors
		char md;// media discriptor
		int spf;// no of sectors per fat
		int spt;// no of sectors per track
		int sides;// no of sides
		int hs;// no of hidden sectors
		char rest[482];
 
	}zero;
 
	void display_bootsector();
 
void main()
{
	biosdisk(2,0x81,0,0,1,1,&zero);
	display_bootsector();
 
}
 
void display_bootsector()
{
	zero.jump[3]=0;
	printf("\nJump Instruction\t\t%s",zero.jump);
	zero.si[8]=0;
	printf("\nSystem Id\t\t%s",zero.si);
	printf("\nBytes per sector\t%d",zero.bps);
	printf("\nSectors per cluster\t%d",zero.spc);
	printf("\nReserved\t\t%d",zero.res);
	printf("\nCopies of fat\t\t%d",zero.cof);
	printf("\nRoot directory entries\t%d",zero.rde);
	printf("\nTotal no of sectors\t%d",zero.tos);
	printf("\nMedia discriptor\t%0x",zero.md);
	printf("\nSectors per fat\t\t%d",zero.spf);
	printf("\nSectors per track\t%d",zero.spt);
	printf("\nNo of sides\t\t%d",zero.sides);
	printf("\nNo of hidden sectors\t%d",zero.hs);
	printf("\n");
}

Leave a Reply

Entries RSS