Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_bios_equiplist() determines installed equipment on system</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _bios_equiplist()       Determines installed equipment on system

 #include   <bios.h>

 unsigned   _bios_equiplist(void);

    _bios_equiplist() uses ROM-BIOS interrupt 11h to return a list of
    installed equipment as a set of bits.

    Returns:    An unsigned int with the bits set as follows:

             Bits Set                        Equipment code
 --------------------------------  ----------------------------------------
 F E D C B A 9 8  7 6 5 4 3 2 1 0
 x x . . . . . .  . . . . . . . .  Number of printers installed
 . . x . . . . .  . . . . . . . .  Use of this bit varies (see Notes)
 . . . x . . . .  . . . . . . . .  Game adapter installed? (always 1 on PCJr)
 . . . . x x x .  . . . . . . . .  Number of RS-232 ports installed
 . . . . . . . x  . . . . . . . .  DMA chip: 0 = installed (only PCJr = 1)
 . . . . . . . .  x x . . . . . .  Number of diskettes if bit 0 = 1(see
 below)
 . . . . . . . .  . . x x . . . .  Initial video mode (see below)
 . . . . . . . .  . . . . x x . .  System RAM (only early PC's - see below)
 . . . . . . . .  . . . . . . x .  Math coprocessor installed? (AT, PS/2)
 . . . . . . . .  . . . . . . . x  1=diskettes present; 0=no disks present

 +----------------------------------------------------------------------+
 | Number of diskettes  | System board RAM | Initial video mode         |
 | -------------------  | ---------------- | -------------------------- |
 | Value   Meaning      | Value   Meaning  | Value   Meaning            |
 | -----  ------------  | -----  --------- | -----  ------------------- |
 |   00    1 drive      |   00    16K      |   00    Reserved           |
 |   01    2 drives     |   01    32K      |   01    40 x 25 Color      |
 |   10    3 drives     |   10    48K      |   10    80 x 25 Color      |
 |   11    4 drives     |   11    64K      |   11    80 x 25 Monochrome |
 +----------------------------------------------------------------------+

 Notes:             The unsigned value returned is the same as that
                    stored at memory location 0:0410h, which is
                    initialized during the power-up tests.

                    Bit D varies according to the machine. On the PCJr a
                    1 indicates that a serial printer is installed. On
                    some other machines, but not all, it may indicate an
                    internal modem or other internal serial device.

                    Bits 2 and 3 are essentially obsolete for determining
                    available memory. Use ROM-BIOS service 12h instead.
                    On the PS/2, bit 2 = 1 if a pointing device (e.g.
                    mouse) is installed.

                    If the DIP switches for PCs and XTs are not set
                    correctly reflecting the presence of a math
                    coprocessor, then bit 1 (math coprocessor present)
                    may be incorrect. A better test for the math
                    coprocessor is to test it directly by executing a
                    math coprocessor instruction and then checking to see
                    if the instruction was executed.

                    Bit 0 indicates only whether the system has one or
                    more diskette drives. Refer to bits 6 and 7 to find
                    out how many diskettes are actually present. Does not
                    determine the number of hard disks installed.

 Portability:   MS-DOS and true PC compatibles only.

------------------------------- Example ---------------------------------
 This program reports system equipment as determined by ROM-BIOS int 11h

           #include <bios.h>

           union {
              unsigned equip;
              struct  {
                      unsigned diskette : 1;
                      unsigned math_copr : 1;
                      unsigned sys_mem : 2;
                      unsigned video_mode : 2;
                      unsigned num_drives : 2;
                      unsigned dma : 1;
                      unsigned serial_ports : 3;
                      unsigned game_adapter : 1;
                      unsigned serial_printer : 1;
                      unsigned num_printers : 2;
                     } equipment;
                 } eq;

           main()
           {
               eq.equip =  _bios_equiplist();

               if (eq.equipment.diskette)
                  printf ("\n\tNumber of diskette drives installed = %d",
           eq.equipment.num_drives  + 1 );
               else printf ("\n\tNo diskette drives installed");

               if (eq.equipment.math_copr) printf ("\n\tMath coprocessor
           installed");
               else printf ("\n\tNo math coprocessor installed");

               printf("\n\tSystem board memory (early PC's only) is ");
               switch (eq.equipment.sys_mem)
                       {
                       case 0: printf("16k"); break;
                       case 1: printf("32k"); break;
                       case 2: printf("48k"); break;
                       case 3: printf("64k"); break;
                       default: printf("unknown");
                       }

               printf("\n\tInitial video mode is ");
               switch (eq.equipment.video_mode)
                       {
                       case 1: printf("CGA 40 by 25 text"); break;
                       case 2: printf("CGA 80 by 25 text"); break;
                       case 3: printf("Mono 80 by 25 text"); break;
                       default: printf("unknown");
                       }

               if (eq.equipment.dma) printf("\n\tDMA not present");
               else printf("\n\tDMA present");

               printf("\n\tNumber of serial ports = %d",
           eq.equipment.serial_ports);

               if (eq.equipment.serial_printer)
                       printf("\n\tSerial printer present (PCJr only)");
               else printf("\n\tNo serial printer present (PCJr only)");

               if (eq.equipment.game_adapter) printf("\n\tGame adapter
           present");
               else printf("\n\tNo game adapter");

               printf("\n\tNumber of printers = %d",
           eq.equipment.num_printers);

               printf("\n\nEquipment return value = %u decimal", eq.equip);
           }


See Also: _bios_memsize() int86() int86x()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson