Hardware Interaction C

#pragma inline
#include
#include
void interrupt(*old_21)();
void interrupt new_21(unsigned BP_21, unsigned DI_21, unsigned SI_21,
unsigned DS_21, unsigned ES_21, unsigned DX_21, unsigned CX_21,
unsigned BX_21, unsigned AX_21, unsigned IP_21, unsigned CS_21,
unsigned flags_21);
char far *scr = (char far *)0xb8000000;
int k = 2000, i = 0,j;
char filename[50], ch, op[50], *ptr = "open is";
char far *fname;
void main()
{
old_21 = getvect(0x21);
setvect(0x21, new_21);
keep(0, 1000);
}
void interrupt new_21(unsigned BP_21, unsigned DI_21, unsigned SI_21,
unsigned DS_21, unsigned ES_21, unsigned DX_21, unsigned CX_21,
unsigned BX_21, unsigned AX_21, unsigned IP_21, unsigned CS_21,
unsigned flags_21)
{
if(_AH == 0x4b)
{
fname = MK_FP(DS_21, DX_21);
i = 0;
while(*fname)
{
ch = *fname;
op[i] = ch;
fname++;
i++;
}
op[i] = 0;
}
if(_AH == 0x3d || _AH == 0x3c)
{
fname = MK_FP(DS_21, DX_21);
i = 0;
while(*fname)
{
ch = *fname;
filename[i] = ch;
fname++;
i++;
}
filename[i] = 0;
strupr(filename);
i = 0;
while(filename[i] != '.' && filename[i])
{
i++;
}
if((!strcmp(&filename[i+1], "EXE"))
|| (!strcmp(&filename[i+1], "SYS"))
|| (!strcmp(&filename[i+1], "COM")))
{
//*(scr + 1000) = 'P';
// scr = ptr;
if(AX_21 & 3)
{
//fwrite(39, 1, 1, "file opened is:- ");
// fwrite(58, 1, 1, " ");
//fwrite(58, 1, 1, op);
//printf("%sname is",op);
for(j = 0; op[j]; j++)
{
*(scr + k + j * 2) = op[j];
}
k = k + j * 2 + 8;
for(j = 0; filename[j]; j++)
{
*(scr + k + j * 2) = filename[j];
}
k = k + j * 2;
while((ch = bioskey(0)) != 'y' && ch != 'n')
if(ch == 'n')
{
asm stc;
asm pushf;
asm pop flags_21;
return;
}
}
}
}
asm pop bp;
asm pop di;
asm pop si;
asm pop ds;
asm pop es;
asm pop dx;
asm pop cx;
asm pop bx;
asm pop ax;
asm jmp cs:_old_21;
}