home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / fli106c / blgetkey.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-11  |  1.0 KB  |  60 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.06c
  4. // Copyright (C) 1990, 1991, 1992
  5. // Software Dimensions
  6. //
  7. // BlazeClass
  8. //
  9.  
  10. #ifndef __BCPLUSPLUS__
  11. #pragma inline
  12. #endif
  13.  
  14. #include "fli.h"
  15.  
  16. #ifdef __BCPLUSPLUS__
  17. #pragma hdrstop
  18. #endif
  19.  
  20. #define I asm
  21.  
  22. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  23. //
  24. // GetKey()
  25. //
  26. // Gets a keystoke and wait if one isn't available
  27. //
  28. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  29.  
  30. int BlazeClass::GetKey()
  31. {
  32.   I xor ah,ah
  33.   I int 16h
  34.   I mov bx,ax
  35.   I and bx,00ffh
  36.   I and ax,0ff00h
  37.   I xchg al,ah
  38.   I or bx,bx
  39.   I je UseAX
  40.  
  41.   I mov ah,2   // Get the key flags...
  42.   I int 16h    // These flags must be intercepted since the
  43.                // standard keyboard function really doesn't do
  44.                // a great job with keycodes
  45.  
  46.   if (!(_AL&8) || _BX!=32)
  47.     goto BackUp;
  48.  
  49.   return kbAltSpace;
  50.  
  51. BackUp:
  52.  
  53.   return _BX;
  54.  
  55. UseAX:
  56.  
  57.   I add ax,256
  58.   return _AX;
  59. }
  60.