home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / os / msdos / programm / 9274 < prev    next >
Encoding:
Text File  |  1992-09-11  |  1.6 KB  |  57 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!cs.utexas.edu!usc!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!pacific.mps.ohio-state.edu!davis
  3. From: davis@pacific.mps.ohio-state.edu ("John E. Davis")
  4. Subject: int 9h
  5. Message-ID: <DAVIS.92Sep11115609@pacific.mps.ohio-state.edu>
  6. Sender: news@pacific.mps.ohio-state.edu
  7. Nntp-Posting-Host: pacific.mps.ohio-state.edu
  8. Reply-To: davis@pacific.mps.ohio-state.edu  (John E. Davis)
  9. Organization: "Dept. of Physics, The Ohio State University"
  10. Date: Fri, 11 Sep 1992 16:56:09 GMT
  11. Lines: 44
  12.  
  13. Hi,
  14.  
  15.    I need  to know how to do something very simple:  intercept interrupt 9
  16. (keyboard ready), set a flag if a certain key was pressed otherwise call the
  17. old interrupt nine handler.  I know how to do everything, EXCEPT reading the
  18. key directly from the keyboard.  So I have: (BCC++ 3.0)
  19.  
  20. void interrupt (*oldint9)();
  21. extern volatile int KeyBoard_Flag;
  22. extern int Interrupt_Char;         /* probably a scan code needed */
  23.  
  24. void init_int9_handler(void)
  25. {
  26.      oldint9 = getvect(9);
  27.      setvect(9, int9_handler);
  28. }
  29.   
  30. void restore_int9_handler(void)
  31. {
  32.      setvect(9, oldint9);
  33. }
  34.  
  35. void interrupt int9_handler(void)
  36. {
  37.      if (/* peek at key from keyboard */ == Interrupt_Char)
  38.        KeyBoard_Flag = 1;
  39.      else
  40.        (*oldint9)();
  41. }
  42.  
  43.       
  44. In the last routine, I need to know how to complete the if statement.
  45.  
  46. Any comments or suggestions will be greatly appreciated.
  47.  
  48. Thanks,
  49. --
  50.      _____________
  51. #___/John E. Davis\_________________________________________________________
  52. #
  53. # internet: davis@amy.tch.harvard.edu
  54. #   bitnet: davis@ohstpy
  55. #   office: 617-735-6746
  56. #
  57.