C Programming Blog

 
 
 
 # include <dos.h>


 void interrupt (*OldPrinterInterruptFunction)( );
 void interrupt NewPrinterInterruptFunction( );

 void interrupt (*OldKeyboardInterruptFunction)( );
 void interrupt NewKeyboardInterruptFunction( );


 int main( )
 {
    OldPrinterInterruptFunction=getvect(0x17);
    setvect(0x17,NewPrinterInterruptFunction);

    OldKeyboardInterruptFunction=getvect(0x09);
    setvect(0x09,NewKeyboardInterruptFunction);

    keep(0,(_SS+(_SP/16)-_psp));

    getch();
    return 0;
 }



 //------------------------  Funcion Definitions  ------------------------//




 //------------------  NewPrinterInterruptFunction( )  -------------------//


 void interrupt NewPrinterInterruptFunction( )
 {
    if(_AH==0x00)
    {
       if(_AL>=\'a\' && _AL<=\'z\')
      _AL-=32;

       else if(_AL>=\'A\' && _AL<=\'Z\')
      _AL+=32;
    }

    (*OldPrinterInterruptFunction)( );
 }


 //------------------  NewKeyboardInterruptFunction( )  ------------------//


 void interrupt NewKeyboardInterruptFunction( )
 {
    if(inport(0x60)==\'@\')
    {
       setvect(0x09,OldKeyboardInterruptFunction);
       setvect(0x17,OldPrinterInterruptFunction);

       freemem(_psp);
    }

    (*OldKeyboardInterruptFunction)( );
 }