#pragma inline

#include "iostream.h"

#include "dos.h"

struct INTERRUPT

      {

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

      };

void interrupt myshell(struct INTERRUPT);

void interrupt (*prev)();

unsigned char far *buffer;

int somelen;

 

main()

{

      unsigned long far *int21ptr;

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

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

      *int21ptr=(unsigned long)myshell;

      keep(0,1000);

      return 0;

}

 

void interrupt myshell(INTERRUPT r)

{

 //   if(_AH==0x0a)

       //   {

                  buffer=(unsigned char far*)MK_FP(r.ds,r.dx);

             //   cout<<"\nEnter command : ";

              //  cin>>*buffer;

              somelen=*buffer;

              cout<<somelen;

//                return;

  //        }

      asm pop bp;

      asm pop di;

      asm pop si;

      asm pop dx;

      asm pop cx;

      asm pop bx;

      asm pop ax;

      asm jmp cs:_prev;

}