home *** CD-ROM | disk | FTP | other *** search
- #include <dos.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <bios.h>
- #include <gen.h>
- /******************************************************************************
-
- showme
-
-
- ******************************************************************************/
- void check_chips(void);
- void listdrives(void);
- void show_bios_info(void);
- void show_video_adapter(void);
- int chips( void );
- void extended_memory(void);
- void expanded_memory(void);
-
- int pause=0;
- int tech=0;
-
- main(int argc, char *argv[])
- {
-
- while (--argc)
- {
- if ( toupper(*(argv[argc]+1)) == 'P')
- pause = 1;
- if ( toupper(*(argv[argc]+1)) == 'T')
- tech = 1;
- }
-
- printf("\nSHOWME Version 2.85\n");
- printf("Copyright 1990, Crown Software Corporation\n\n");
-
- if (!tech) printf("Additional technical information can be displayed by typing 'SHOWME /T'\n");
-
- if (tech) show_bios_info();
-
- mouse_present();
-
- show_video_adapter();
-
- check_chips();
-
- if (pause) do_pause();
-
- extended_memory();
-
- expanded_memory();
-
- listdrives();
-
- putchar('\f');
- exit(0);
- }
- void check_chips()
-
- {
- char str_CPU[16], str_NDP[16]; /* to hold screen messages */
-
- int i = chips(); /* get the int return that tells the CPU and
- NDP (math coprocessor) types */
-
- /***********************************************************************
- * This first switch gives us the high order digits off the return from
- * chips() and determines the CPU type.
- **********************************************************************/
-
- switch( i / 10 ) {
- case 8:
- strcpy( str_CPU, "8088/8086" );
- break;
- case 18:
- strcpy( str_CPU, "80188/80186" );
- break;
- case 20:
- strcpy( str_CPU, "NEC V20/V30" );
- break;
- case 28:
- strcpy( str_CPU, "80286" );
- break;
- case 38:
- strcpy( str_CPU, "80386" );
- break;
- default:
- printf( "\n\t\tCPU test failed! \n\a" );
- break;
- }
-
- /**********************************************************************
- * Now.... let's figger out what kinda NDP we got by stripping off
- * all the high end digits leaving us with just the low order guy
- * with all the NDP info.....
- **********************************************************************/
-
- switch( i % 10 ) {
- case 0:
- strcpy( str_NDP, "not present" );
- break;
- case 1:
- strcpy( str_NDP, "an 8087" );
- break;
- case 2:
- strcpy( str_NDP, "an 80287" );
- break;
- case 3:
- strcpy( str_NDP, "an 80387" );
- break;
- default:
- strcpy (str_NDP, "test failed");
- break;
- }
- printf( "\nCPU type is %s.\n", str_CPU );
- printf( "Math Coprocessor is %s.\n", str_NDP );
- }
- void
- show_bios_info()
- {
- union REGS r;
- struct SREGS sr;
-
- #define EQUIP 0x11
- #define RAM 0x12
-
- #define PC 0xff
- #define XT 0xfe
- #define JR 0xfd
- #define AT 0xfc
- #define CPQ 0x2d
- #define CPQXT 0x9a
-
- int mem_size;
- int dos_major,dos_minor;
- int equipment,
- i;
- unsigned mach_type;
- char rom_date[9];
-
- mach_type = peekb(0xfffe,0xf000); /* get model id */
-
- for (i=0;i<8;i++)
- rom_date[i] = peekb(0xfff5+i,0xf000);
- rom_date[8] = '\0';
-
-
- int86 (RAM, &r, &r); /* BIOS routine - total installed memory */
- mem_size = r.x.ax;
-
- int86 (EQUIP,&r, &r); /* BIOS routine - equipment list */
- equipment = r.x.ax; /* see Norton book, p. 232 */
-
- dos_major = _osmajor;
- dos_minor = _osminor;
-
- printf("Machine class identifier: ");
- switch (mach_type)
- {
- case PC: printf("Basic PC\n");
- break;
- case XT: printf("PC-XT or Portable\n");
- break;
- case JR: printf("PCjr\n");
- break;
- case AT: printf("PC-AT\n");
- break;
- case CPQ: printf("Compaq\n");
- break;
- case CPQXT: printf("Compaq-Plus\n");
- break;
- default: printf("Unknown machine type\n");
- }
-
- printf("DOS version %d.%d\n",dos_major,dos_minor);
- printf("\nROM-BIOS release date %s\n",rom_date);
- printf("\nBIOS Equipment list: (mask = %xh)\n",equipment);
- printf(" %dK bytes of DOS (conventional) memory.\n",mem_size);
-
- if (equipment & 0x0001)
- printf(" Fixed disk.\n");
-
- if (equipment & 0x0002)
- printf(" math coprocessor.\n");
-
- // i = (equipment & 0x000c) >> 2;
- // printf(" %d 16k blocks of additional memory\n",i);
-
- i = (equipment & 0x0030) >> 4;
- printf(" Current video mode: ");
- switch (i)
- {
- case 1: printf("40x25 color.\n");
- break;
- case 2: printf("80x25 color.\n");
- break;
- case 3: printf("80x25 monochrome.\n");
- break;
- default:printf("Unknown.\n");
- }
-
- i = (equipment & 0x00c0) >> 6;
- printf(" %d diskette drive(s).\n",i+1);
-
- i = (equipment & 0x0e00) >> 9;
- printf(" %d serial port(s).\n",i);
-
- if (equipment & 0x2000)
- printf (" Serial printer.\n");
-
- i = (equipment & 0xc000) >> 14;
- i = i & 0x0003;
- printf(" %d parallel port(s).\n",i);
- }
- do_pause()
- {
-
- printf("Press any key to continue...\n");
- _bios_keybrd(_KEYBRD_READ);
- }
-