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

  1. /* wdvinit.c 
  2.  *         Initialization code for DeskView aware programming.
  3.  *        Call this routine immediately after call to winit()
  4.  *        ...ie, BEFORE any direct screen writes.
  5.  *         Incompatible with multiple page display (winit_pages)
  6.  *        untested in all graphics modes.
  7.  *    
  8.  *    METHOD:    (see the deskview manual, ver 2. page 195)
  9.  *        generate an invalid request to DOS setdate.
  10.  *        DOS returns unusual error code implies DeskView is present
  11.  *        interrupt func 0x10 subfunc 0xFE to get deskview virtual buffer.
  12.  *        NOTE: this function works only if winit() does NOT write to the screen.
  13.  *
  14.  *    RETURNS: 0     = not a DeskView task
  15.  *             non_0 = a DeskView task (#is DeskView (major) version number 
  16.  */
  17.  
  18. #ifndef __TURBOC__ 
  19.     #error Sorry Microsoft users - works in TurboC only
  20. #endif     /* TURBOC */
  21.  
  22. #include "wsys.h"
  23.  
  24. int wdvinit (void)
  25.     {
  26.     unsigned int     video_ram_seg, video_ram_off;
  27.     int              major_version;
  28.     unsigned int     valid_date;
  29.     PSEUDOREGS
  30.     
  31.     _DX = 0x5351;        /* an invalid date */
  32.     _CX = 0x4445;        /* DOS set date function */
  33.     _AX = 0x2B01;
  34.     INTERRUPT ( 0x21 );
  35.     valid_date = _AL;
  36.     major_version = _BH;
  37.     
  38.     if ( valid_date != 0xff )
  39.         {
  40.         /* deskview is present */
  41.         _AH = 0xFE;
  42.         INTERRUPT ( 0x10 );        /* get deskview buffer address */
  43.         video_ram_seg = _ES;
  44.         video_ram_off = _DI;
  45.         wvideo_ram = wpage_ram = MK_FP ( video_ram_seg, video_ram_off );
  46.         }
  47.     else 
  48.         {
  49.         major_version = 0;
  50.         }
  51.     return (major_version);        /* wdvinit */
  52.     }
  53.     /*------------------- end of DeskView initialization -----------------*/
  54.