home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / HARDWARE / SHOW285.ZIP / SHOWME.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-11  |  5.5 KB  |  224 lines

  1. #include <dos.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <bios.h>
  5. #include <gen.h>
  6. /******************************************************************************
  7.  
  8. showme
  9.  
  10.  
  11. ******************************************************************************/
  12. void check_chips(void);
  13. void listdrives(void);
  14. void show_bios_info(void);
  15. void show_video_adapter(void);
  16. int chips( void );  
  17. void extended_memory(void);
  18. void expanded_memory(void);
  19.  
  20. int pause=0;
  21. int tech=0;
  22.  
  23. main(int argc, char *argv[])
  24. {
  25.  
  26. while (--argc)
  27.    {
  28.    if ( toupper(*(argv[argc]+1)) == 'P') 
  29.       pause = 1;
  30.    if ( toupper(*(argv[argc]+1)) == 'T') 
  31.       tech = 1;
  32.    }
  33.    
  34. printf("\nSHOWME Version 2.85\n");
  35. printf("Copyright 1990, Crown Software Corporation\n\n");
  36.  
  37. if (!tech) printf("Additional technical information can be displayed by typing 'SHOWME /T'\n");
  38.  
  39. if (tech) show_bios_info();
  40.  
  41. mouse_present();
  42.  
  43. show_video_adapter();
  44.  
  45. check_chips();
  46.  
  47. if (pause) do_pause();
  48.  
  49. extended_memory();
  50.  
  51. expanded_memory();
  52.  
  53. listdrives();
  54.  
  55. putchar('\f');
  56. exit(0);
  57. }
  58. void check_chips()
  59.  
  60. {
  61.     char str_CPU[16], str_NDP[16];  /* to hold screen messages        */
  62.  
  63.     int i = chips();   /* get the int return that tells the CPU and
  64.                             NDP (math coprocessor) types              */
  65.  
  66. /***********************************************************************
  67.  * This first switch gives us the high order digits off the return from
  68.  *   chips() and determines the CPU type.
  69.  **********************************************************************/
  70.  
  71.     switch( i / 10 ) {
  72.         case  8:
  73.             strcpy( str_CPU, "8088/8086" );
  74.             break;
  75.         case 18:
  76.             strcpy( str_CPU, "80188/80186" );
  77.             break;
  78.         case 20:
  79.             strcpy( str_CPU, "NEC V20/V30" );
  80.             break;
  81.         case 28:
  82.             strcpy( str_CPU, "80286" );
  83.             break;
  84.         case 38:
  85.             strcpy( str_CPU, "80386" );
  86.             break;
  87.         default:
  88.             printf( "\n\t\tCPU test failed!  \n\a" );
  89.             break;
  90.     }
  91.  
  92. /**********************************************************************
  93.  * Now.... let's figger out what kinda NDP we got by stripping off
  94.  *   all the high end digits leaving us with just the low order guy
  95.  *   with all the NDP info.....
  96.  **********************************************************************/
  97.  
  98.     switch( i % 10 ) {
  99.         case 0:
  100.             strcpy( str_NDP, "not present" );
  101.             break;
  102.         case 1:
  103.             strcpy( str_NDP, "an 8087" );
  104.             break;
  105.         case 2:
  106.             strcpy( str_NDP, "an 80287" );
  107.             break;
  108.         case 3:
  109.             strcpy( str_NDP, "an 80387" );
  110.             break;
  111.         default:
  112.             strcpy (str_NDP, "test failed");
  113.             break;
  114.     }
  115.     printf( "\nCPU type is %s.\n", str_CPU );
  116.     printf( "Math Coprocessor is %s.\n", str_NDP );
  117. }
  118. void
  119. show_bios_info()
  120. {
  121.    union REGS r;
  122.    struct SREGS sr;
  123.    
  124.    #define EQUIP 0x11
  125.    #define RAM 0x12
  126.    
  127.    #define PC 0xff
  128.    #define XT 0xfe
  129.    #define JR 0xfd
  130.    #define AT 0xfc
  131.    #define CPQ 0x2d
  132.    #define CPQXT 0x9a
  133.    
  134.    int mem_size;
  135.    int dos_major,dos_minor; 
  136.    int equipment,
  137.        i;
  138.    unsigned mach_type;
  139.    char rom_date[9];
  140.    
  141.    mach_type = peekb(0xfffe,0xf000);    /* get model id */
  142.    
  143.    for (i=0;i<8;i++)
  144.        rom_date[i] = peekb(0xfff5+i,0xf000);
  145.    rom_date[8] = '\0';
  146.    
  147.    
  148.    int86 (RAM, &r, &r);        /* BIOS routine - total installed memory */
  149.    mem_size = r.x.ax;
  150.    
  151.    int86 (EQUIP,&r, &r);    /* BIOS routine - equipment list */
  152.    equipment = r.x.ax;        /* see Norton book, p. 232 */
  153.    
  154.    dos_major = _osmajor;
  155.    dos_minor = _osminor;
  156.    
  157.    printf("Machine class identifier: ");
  158.    switch (mach_type)
  159.        {
  160.        case PC: printf("Basic PC\n");
  161.                 break;
  162.        case XT: printf("PC-XT or Portable\n");
  163.                 break;
  164.        case JR: printf("PCjr\n");
  165.                 break;
  166.        case AT: printf("PC-AT\n");
  167.                 break;
  168.        case CPQ: printf("Compaq\n");
  169.                  break;
  170.        case CPQXT: printf("Compaq-Plus\n");
  171.                    break;
  172.        default: printf("Unknown machine type\n");
  173.        }
  174.    
  175.    printf("DOS version %d.%d\n",dos_major,dos_minor);
  176.    printf("\nROM-BIOS release date %s\n",rom_date);
  177.    printf("\nBIOS Equipment list: (mask = %xh)\n",equipment);
  178.       printf("   %dK bytes of DOS (conventional) memory.\n",mem_size);
  179.    
  180.    if (equipment & 0x0001) 
  181.       printf("   Fixed disk.\n");
  182.    
  183.    if (equipment & 0x0002)
  184.       printf("   math coprocessor.\n");
  185.    
  186. //   i = (equipment & 0x000c) >> 2;
  187. //   printf("   %d 16k blocks of additional memory\n",i);
  188.    
  189.    i = (equipment & 0x0030) >> 4;
  190.    printf("   Current video mode:  ");
  191.    switch (i)
  192.       {
  193.       case 1: printf("40x25 color.\n");
  194.               break;
  195.       case 2: printf("80x25 color.\n");
  196.               break;
  197.       case 3: printf("80x25 monochrome.\n");
  198.               break;
  199.       default:printf("Unknown.\n");
  200.       }
  201.    
  202.    i = (equipment & 0x00c0) >> 6;
  203.    printf("   %d diskette drive(s).\n",i+1);
  204.    
  205.    i = (equipment & 0x0e00) >> 9;
  206.    printf("   %d serial port(s).\n",i);
  207.    
  208.    if (equipment & 0x2000)
  209.       printf ("   Serial printer.\n");
  210.    
  211.    i = (equipment & 0xc000) >> 14;
  212.    i = i & 0x0003;
  213.    printf("   %d parallel port(s).\n",i);
  214.   }
  215. do_pause()
  216.    {
  217.    
  218.    printf("Press any key to continue...\n");
  219.    _bios_keybrd(_KEYBRD_READ);
  220.    }
  221. 
  222. 
  223. 
  224.