#pragma inline

#include "dos.h"

struct INTERRUPT

      {

            unsigned bp,di,si,ds,es,dx,cx,bx,ax,ip,cs,fl;

      };

void interrupt disp(struct INTERRUPT);

void interrupt (*prev)();

char far *vdu=(char far*)0xb8000000l;

char str[]="S a v i t a  C h a u h a n";

char far *sname;

//char filename[127];

//char far *fname;

int i;

 

main()

{

//AIM : to display name of every file that is open when the TSR is active

      unsigned long far *int21ptr;

      int21ptr=(unsigned long far*)(0x21*4);

      prev=(void (interrupt far*)())*int21ptr;

      *int21ptr=(unsigned long)disp;

      keep(0,1000);

      return 0;

}

 

void interrupt disp(struct INTERRUPT r)

{

      char str[]="S a v i t a   C h a u h a n";

      char mychar;

      void writestr(char *,int,int,int);

//    int i=0;

      //while(str[i])

      //    {

                  writestr(str,10,10,240);

                  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:_prev;

}

 

void writestr(char *str,int row,int col, int attr)

{

      void writechr(char,int,int,int);

      while (*str)

            {

                  writechr(*str,row,col,attr);

                  str++;

                  col++;

            }

}

 

void writechr(char fchar,int row,int col,int attr)

{

      *(vdu+(row*160)+(col*2))=fchar;

      *(vdu+(row*160)+(col*2)+1)=attr;

}