Write an ALP / in line code for displaying boot sector of floppy and boot record of hard disk.
Write an ALP / in line code for displaying boot sector of floppy and boot record of hard disk.
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
void main()
{
char boot[512],* ptr;
int i;
clrscr();
asm {
mov al,0;
mov cx,1;
mov dx,0;
lea bx,boot;
int 0x0025;
}
printf("\nOME no = ");
ptr=boot+0x0003;
for(i=0;i<8;i++)
{
printf(" %c",*ptr);
ptr++;
}
printf("\n*****************************");
printf("\nByte per sector:");
ptr=boot+0x000B;
printf("%d",*(int *)ptr);
printf("\n***************************");
printf("\nSector per cluster:");
ptr=boot+0x000D;
printf("%d",*ptr);
printf("\n***************************");
printf("\nNo of FAT directory entry:");
ptr=boot+0x0010;
printf("%d",*ptr);
printf("\n***************************");
printf("\nNo of Root directory entries:");
ptr=boot+0x0011;
printf("%d",*(int *)ptr);
printf("\n***************************");
printf("\nTotal Sectors:");
ptr=boot+0x0013;
printf("%d",*(int *)ptr);
printf("\n***************************");
printf("\nMedia descriptor byte:");
ptr=boot+0x0015;
printf("%2x",*(int *)ptr);
printf("\n***************************");
printf("\nNo of Sector per FAT:");
ptr=boot+0x0016;
printf("%d",*(int *)ptr);
printf("\n***************************");
printf("\nNo Sector per track:");
ptr=boot+0x0018;
printf("%d",*(int *)ptr);
printf("\n***************************");
printf("\nNo of heads:");
ptr=boot+0x001A;
printf("%d",*(int *)ptr);
getch();
}
/* OUTPUT
OME no = , < v Y 5 I H C
*****************************
Byte per sector:512
***************************
Sector per cluster:1
***************************
No of FAT directory entry:2
***************************
No of Root directory entries:224
***************************
Total Sectors:2880
***************************
Media descriptor byte:9f0
***************************
No of Sector per FAT:9
***************************
No Sector per track:18
***************************
No of heads:2
*/
0 comments:
Post a Comment