home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / alde_c / misc / lib / r_la4_01 / eqlist.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-12-29  |  1.5 KB  |  45 lines

  1. /* EQLIST.C - From page 366 of "Microsoft C Programming for     */
  2. /* the IBM" by Robert Lafore. This program lists the number     */
  3. /* of Kbytes of memory in computer and the type of equipment    */
  4. /* on the computer system.                                      */
  5. /****************************************************************/
  6.  
  7. #define EQLIST 0x410       /*Location of equipment list word*/
  8. #define MEMSIZ 0x413       /*Location of memory size word*/
  9.  
  10. main()
  11. {
  12. int far *farptr;
  13. unsigned int eq, data;
  14.  
  15.    farptr = (int far *) EQLIST;
  16.    eq = *(farptr);
  17.    data = eq >> 14;              /*printers*/
  18.    printf("\nNumber of printers is %d.\n", data);
  19.    if(eq & 0x2000)               /*serial printer*/
  20.       printf("Serial printer is present.\n");
  21.    data = (eq >> 9) & 7;         /*serial ports*/
  22.    printf("Number of serial ports is %d.\n", data);
  23.    if(eq & 1) {                  /*diskette drives*/
  24.       data = (eq >> 6) & 3;
  25.       printf("Number of diskette drives is %d.\n", data + 1);
  26.    }
  27.    else
  28.       printf("No diskette drives attached.\n");
  29.    data = (eq >> 4) & 3;         /*video mode*/
  30.    switch (data) {
  31.       case 1:
  32.          printf("Video is 40 column color.\n");
  33.          break;
  34.       case 2:
  35.          printf("Video is 80 column color.\n");
  36.          break;
  37.       case 3:
  38.          printf("Video is 80 column monochrome.\n");
  39.          break;
  40.    }
  41.    farptr = (int far *) MEMSIZ;       /*reset to mem size word*/
  42.    printf("Memory is %d Kybtes.\n", *(farptr));
  43. }
  44.  
  45.