home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 328_02 / windos.c < prev    next >
C/C++ Source or Header  |  1991-03-17  |  893b  |  33 lines

  1. /* w_inDOS: test for inDOS flag.
  2.  * NOTE: for programs that use int 0x21 to read the keyboard,
  3.  *      this routine will return TRUE when waiting for input.
  4.  *     The window programs call wgetc() or wreadc()
  5.  *           which bypasses DOS, reaading keyboard directly.
  6.  *
  7.  *    Otherwise, one could install an int 0x28 handler
  8.  *    which DOS calls whenever waiting for a keypress,
  9.  *    and the handler could somehow communicate back that
  10.  *    state is inDOS but waiting for keys...
  11.  */
  12. #ifndef __TURBOC__ 
  13.     #error  SORRY, does not compile under Microsoft C.
  14. #endif
  15.  
  16. #include "wsys.h"
  17.  
  18.  
  19. char w_inDOS (void)
  20.     {
  21.     unsigned  int seg, off;
  22.     char far *flag;
  23.  
  24.     _AH = 0x34;            /* function x34 = get inDOS flag addr */
  25.     INTERRUPT (0x21);    /* interrupt DOS */
  26.     off = _BX;
  27.     seg = _ES;            /* NOTE: must be TURBOC not Microsoft */
  28.  
  29.     flag = MK_FP ( seg,off );
  30.  
  31.     return ( *flag );    /* inDOS */
  32.     }
  33.