home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / graphuti / vesamode.zip / VESAMODE.CPP < prev    next >
Text File  |  1993-07-17  |  2KB  |  49 lines

  1. //
  2. //      VESAMODE
  3. //
  4. //      A utility for setting VESA modes on VESA-capable
  5. //      video cards.
  6. //
  7. //      Copyright (c) July, 1993 by Jack Courtney, Compuserve 70322.1500.
  8. //
  9. //      Placed in the public domain, July, 1993.
  10. //
  11.  
  12. #include <iostreams.h>
  13. #include <strstream.h>
  14. #include <dos.h>
  15.  
  16. #define VIDEO   0x10
  17.  
  18. main( int argc, char *argv[] )
  19. {
  20.         if( argc<2 ) {
  21.  
  22.             cerr << "SYNTAX: vesamode <mode>"                    << endl
  23.                                                                  << endl
  24.                  << "where <mode> is any 'C'-formatted integer." << endl
  25.                  << "For example, executing the command"         << endl
  26.                                                                  << endl
  27.                  << "> VESAMODE 0x10c"                           << endl
  28.                                                                  << endl
  29.                  << "sets VESA mode 10C, a 60x132 text mode."    << endl;
  30.         }
  31.         else {
  32.            unsigned    mode;
  33.            REGS        iregs, oregs;
  34.            istrstream  arg1( argv[1] );
  35.  
  36.            arg1 >> mode;
  37.  
  38.            iregs.x.ax=0x4f02;           // Setmode is VESA function #2.
  39.            iregs.x.bx=mode;
  40.  
  41.            int86( VIDEO, &iregs, &oregs );
  42.  
  43.            if( oregs.h.al != 0x4F )
  44.                cerr << "VESA setmode function not supported." << endl;
  45.  
  46.            if( oregs.h.ah == 0x01 )
  47.                cerr << "Unable to set requested mode."        << endl;
  48.         }
  49. }