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

  1. /* ------------------------------------------------------ */
  2. /*                    HERCULES.C                          */
  3. /*                                                        */
  4. /* lädt MSHERC.COM automatisch, wenn man eine             */
  5. /* Hercules-Karte besitzt und MS-Grafikroutinen           */
  6. /* verwendet werden sollen. Der Treiber MSHERC.COM muß    */
  7. /* sich in einem von der Umgebungsvariable PATH           */
  8. /* angegebenen Verzeichnis befinden.                      */
  9. /*                                                        */
  10. /* Returncode: 0 - MSHERC.COM nicht notwendig             */
  11. /*             1 - MSHERC.COM wurde geladen               */
  12. /*             2 - MSHERC.COM konnte nicht geladen werden */
  13. /*                                                        */
  14. /*        (c) 1992 Michael Winter & DMV-Verlag            */
  15. /* ------------------------------------------------------ */
  16.  
  17. #include <bios.h>
  18. #include <graph.h>
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <process.h>
  22.  
  23. /* --- Funktionsprototypen ------------------------------ */
  24.  
  25. int main ( void );
  26. int msherc( void );
  27. int hercules( void );
  28.  
  29. /* --- Hauptprogramm ------------------------------------ */
  30.  
  31. int main ( void )
  32. {
  33.   printf("\nHercules");
  34.   printf(" - (c) 1992 Michael Winter & DMV-Verlag\n");
  35.   if ( (msherc() == 0) && (hercules() == 1) )
  36.   {
  37.     printf("\nProgramm MSHERC.COM wird geladen ...\n\n");
  38.     if ( spawnvp( P_WAIT, "MSHERC.COM", NULL ) == -1)
  39.     {
  40.       printf("\n\nKonnte MSHERC.COM nicht laden : %d ",
  41.              errno);
  42.       exit(2);
  43.     }
  44.     exit(1);
  45.   }
  46.   printf("\nProgramm MSHERC.COM muß nicht geladen werden.");
  47.   exit(0);
  48. }
  49.  
  50. /*
  51.  
  52. INT 10 - VIDEO - MSHERC.COM - INSTALLATION CHECK
  53. Aufruf   : AH = EFh
  54. Rückgabe : DL = Grafikkartentyp
  55.   00h original Hercules
  56.   01h ???  \ möglicherweise Hercules Plus
  57.   02h ???  / Hercules InColor
  58.   FFh keine Hercules Karte
  59.   DH = "HALF" oder "FULL" Modus ?
  60.     01h "HALF" Modus
  61.     03h "FULL" Modus
  62. */
  63.  
  64. int msherc( void )
  65. {
  66.   union REGS regs;
  67.  
  68.   regs.h.ah = 0xEF;
  69.  
  70.   int86( 0x10, ®s, ®s );
  71.  
  72.   if ( (regs.h.dl == 0x00) || (regs.h.dl == 0x01) ||
  73.        (regs.h.dl == 0x02) || (regs.h.dl == 0xFF) )
  74.     return 1;
  75.   else
  76.     return 0;
  77. }
  78.  
  79. int hercules( void )
  80. {
  81.   struct videoconfig vc;
  82.  
  83.   _getvideoconfig( &vc );
  84.  
  85.   if ( (vc.adapter == _HGC) || (vc.adapter == _MDPA) )
  86.     return 1;
  87.   else
  88.     return 0;
  89. }
  90. /* ------------------------------------------------------ */
  91. /*               Ende von HERCULES.C                      */
  92.