Search This Blog

Loading...

C Program to save the Interrupt Vector Table IVT in a file

Write a program to save the Interrupt Vector Table (IVT) in a file.
Code for Program to save the Interrupt Vector Table (IVT) in a file in C Programming
 # include <stdlib.h>
 # include  <stdio.h>
 # include  <conio.h>
 # include    <dos.h>

 int main( )
 {
    unsigned long far* ptrIVT=(unsigned long far*)0x00000000;
    unsigned int uiSegment;
    unsigned int uiOffset;

    int iCount;

    FILE* oFile=fopen("IVT.txt","wt");

    if(oFile==NULL)
    {
       clrscr( );

       printf("Error : Unable to create IVT.txt file.");
       printf("Press any key to exit.");

       getch( );
       exit(1);
    }

    fprintf(oFile,"Interrupt Number  --->  Vector (Segment:Offset)\n");
    fprintf(oFile,"    ( Hex )                 ( Hex )   \n\n");

    for(iCount=0;iCount<256;iCount++)
    {
       uiSegment=FP_SEG(*ptrIVT);
       uiOffset=FP_OFF(*ptrIVT);

       fprintf(oFile,"INT 0x%02X---> %4X:%X\n",iCount,uiSegment,uiOffset);
       ptrIVT++;
    }

    fclose(oFile);

    return 0;
 }

No comments:

Post a Comment