home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9203 / ctrick / graph.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-14  |  1.6 KB  |  75 lines

  1. /* ------------------------------------------------------ */
  2. /*                     GRAPH.C                            */
  3. /* stellt fest, ob GRAPHICS.COM geladen wurde.            */
  4. /* Returncode : 1 -> GRAPHICS.COM geladen                 */
  5. /*              0 -> GRAPHICS.COM nicht geladen           */
  6. /*              3 -> falsche DOS-Version                  */
  7. /*         (c) 1992 Michael Winter & DMV-Verlag           */
  8. /* ------------------------------------------------------ */
  9.  
  10. #include <stdio.h>
  11. #include <dos.h>
  12. #include <stdlib.h>
  13.  
  14. /* --- Funktionsprototypen ------------------------------ */
  15.  
  16. int main( void );
  17. int graphics( void );
  18. int dr_dos();
  19.  
  20. /* --- Programm ----------------------------------------- */
  21.  
  22. int main( void )
  23. {
  24.   printf("\n\n");
  25.   printf("GRAPH - (c) 1992 Michael Winter & DMV-Verlag");
  26.  
  27.   if ( ( _osmajor < 3 ) || dr_dos() )
  28.   {
  29.     printf("\n\n");
  30.     printf("Mindestens MS-/PC-DOS 3.0 erforderlich!\n\n");
  31.     exit(3);
  32.   }
  33.  
  34.   printf("\n\nGRAPHICS.COM ");
  35.  
  36.   if ( graphics() )
  37.   {
  38.     printf("installiert\n\n");
  39.     exit(1);
  40.   }
  41.   else
  42.   {
  43.     printf("nicht installiert\n\n");
  44.     exit(0);
  45.   }
  46. }
  47.  
  48. int graphics( void )
  49. {
  50.   union REGS regs;
  51.  
  52.   if ( ( _osmajor == 4 ) && ( _osminor == 0 ) )
  53.     regs.x.ax = 0x1500;
  54.   else
  55.     regs.x.ax = 0xAC00;
  56.  
  57.   int86( 0x2F, ®s, ®s );
  58.  
  59.   if ( regs.x.ax == 0xFFFF )
  60.     return(1);
  61.   else
  62.     return(0);
  63. }
  64.  
  65. int dr_dos()
  66. {
  67.   union REGS regs;
  68.  
  69.   regs.x.ax = 0x4452;
  70.   intdos( ®s, ®s );
  71.   return !regs.x.cflag;
  72. }
  73. /* ------------------------------------------------------ */
  74. /*                   Ende von GRAPH.C                     */
  75.