home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TANK11.ZIP / SOURCE.ZIP / GR_INT9.C < prev    next >
C/C++ Source or Header  |  1993-01-16  |  1KB  |  47 lines

  1. /**********************************************************************
  2. * gr_int9.c
  3. *
  4. * New keyboard interrupt service routine.
  5. * MUST BE COMPILED WITHOUT STACK CHECKS AND REGISTER VARIABLES
  6. **********************************************************************
  7.                     This file is part of
  8.  
  9.          STK -- The sprite toolkit -- version 1.0
  10.  
  11.               Copyright (C) Jari Karjala 1990
  12.  
  13. The sprite toolkit (STK) is a FreeWare toolkit for creating high
  14. resolution sprite graphics with PCompatible hardware. This toolkit 
  15. is provided as is without any warranty or such thing. See the file
  16. COPYING for further information.
  17.  
  18. **********************************************************************/
  19.  
  20. #include <dos.h>
  21.  
  22. #include "gr.h"
  23.  
  24.  
  25. /** Vector to the old keyboard interrupt handler **/
  26. void interrupt (*gr_old_int9)(void);
  27.  
  28. static unsigned int far *fp_kbd_tail, far *fp_kbd_head;
  29.  
  30. /** The new keyboard interrupt handler, see start_kbd_grab() in gr.c **/
  31. void interrupt gr_int9(void)
  32. {
  33.     unsigned char a;
  34.  
  35.     a = inp(0x60);              /** read key code and (re)set it to table **/
  36.     if (a & 0x80)
  37.         gr_keys[a & 0x7F] = 0;
  38.     else
  39.         gr_keys[a] = 1;
  40.  
  41.     fp_kbd_tail = MK_FP(0x40,0x1A);
  42.     fp_kbd_head = MK_FP(0x40,0x1C);
  43.     *fp_kbd_tail = *fp_kbd_head;          /** flush keyboard buffer **/
  44.  
  45.     gr_old_int9();                 /** allow old handler (eg breakon.com) **/
  46. }
  47.