home *** CD-ROM | disk | FTP | other *** search
- {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
- The purchaser of these procedures and functions may include them in COMPILED
- programs freely, but may not sell or give away the source text.
-
- The function Equipment returns the number of items of
- the specified type currently attached.
- "P" : Printers (0 to 3)
- "G" : Game port (0 or 1)
- "R" : RS232 port (0 to 7?)
- "D" : Diskette drives (0 to 4)
- "V" : code for initial video mode
- "M" : amount of raM on motherboard (not much use!)
-
- NOTE that any program that INCLUDEs this file MUST also include the
- type declarations contained in REGPACK.TYP.
-
- }
- function Equipment(which : char):byte;
- var
- registers : regpack;
- result : integer;
- temp : byte;
- begin
- INTR($11,registers);
- result := registers.AX;
- {NOTE: from the IBM PC Technical Reference Manual we glean
- the following about the makeup of "result". Its 16 bits are
- numbered from 15 down to 0 and have these meanings:
- 15,14 : # of printers
- 13 : not used
- 12 : 1 = Game I/O exists
- 11-9 : # of RS232 ports
- 8 : not used
- 7,6 : IF bit 0 is set, these two show one less than
- the number of drives. (00 = 1, 01 = 2, 10 = 3, 11 = 4)
- 5,4 : initial video mode:
- 00 : not used
- 01 : 40x25 BW using color card
- 10 : 80x25 BW using color card
- 11 : 80x25 BW using BW card
- 3,2 : planar board RAM -- 00 = 16K, 01 = 32K, 10 = 48K, 11 = 64K
- 1 : not used
- 0 : if set to 1, there are diskette drives
-
- If the bits we want are the X's in this picture -- "nnnnnXXnnnnnnnnn",
- to get the number represented by those bits, we SHift Right until the
- leftmost X is in the highest position ( "XXnnnnnnnnn00000" ) and
- then SHift Left until the rightmost X is in the lowest position
- ("00000000000000XX").
- }
-
- case UpCase(which) of
- 'P': temp := result shr 14;
- 'G': temp := (result shl 3) shr 15;
- 'R': temp := (result shl 4) shr 13;
- 'D': if result and 1 = 0 then
- temp := 0
- else temp := ((result shl 8) shr 14) + 1;
- 'V': temp := (result shl 10 ) shr 14;
- 'M': begin
- temp := ((result shl 12 ) shr 14);
- case temp of
- 0: temp := 16;
- 1: temp := 32;
- 2: temp := 48;
- 3: temp := 64;
- end;
- end;
- end;
- Equipment := temp;
- end;