[comp.os.msdos.misc] What knis of PC is it?

wozniak@utkux1.utk.edu (Bryon Lape) (07/21/90)

	Does anyonw know how I can tell what type of computer my
programme is running on?  I need to know not only what type of CPU, but
also the maker (IBM, Dell, Compaq, Tandy, etc).  I need to do this in
either C or machine language.  Please answer by e-mail and only those
with a serious answer that will help need respond.


-bryon lape-

ttak@uhura.cc.rochester.edu (Timothy Takahashi) (07/21/90)

In article <1990Jul20.190056.7132@cs.utk.edu> wozniak@utkux1.utk.edu (Bryon Lape) writes:
>
>	Does anyonw know how I can tell what type of computer my
>programme is running on?  I need to know not only what type of CPU, but
>also the maker (IBM, Dell, Compaq, Tandy, etc).  I need to do this in

The suggestion of interpreting the byte at F000:FFFE (re: Peter Norton Guide)
isn't too helpful (FF = PC,FE = XT, FD=PCjr, FC=AT,2D=Compaq PC,9A=Compaq XT)

Perhaps the ROM BIOS date at F000:FFF5 is a better start
04/24/81 = PC, 10/19/81 = revised PC,08/16/82= XT, 10/27/82= new PC
11/08/82 = portable pc, 06/01/83 = pc jr, 01/10/84 = original at, etc. etc.
(again from peter norton guide)

tim

ts@uwasa.fi (Timo Salmi LASK) (07/21/90)

In article <1990Jul20.190056.7132@cs.utk.edu> wozniak@utkux1.utk.edu
(Bryon Lape) writes:
>	Does anyonw know how I can tell what type of computer my
>programme is running on?  I need to know not only what type of CPU, but
>also the maker (IBM, Dell, Compaq, Tandy, etc).  I need to do this in

See Michael Tischer, PC System Programming for Developers, Abacus,
for the CPU recognition.

...................................................................
Prof. Timo Salmi        (Moderating at anon. ftp site 128.214.12.3)
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

rschmidt@silver.ucs.indiana.edu (roy schmidt) (07/22/90)

This is not an achievable goal.  Think of all the various brands of
clones out there that use AMI or Phoenix BIOS, various combinations of
support chips, etc, not to mention the Far Eastern clones with god knows
what under the hood.  You can detect a True Blue or a Compaq, because
they make their own BIOS, but beyond that you just can't get there from
here.

Wouldn't it serve your purpose just to detect the CPU and BIOS version
(e.g., 80386, AMI Chips & Technologies BIOS)?  The clone maker, per se,
is not particularly relevant, anyway.

--------------------------------------------------------------------------
Roy Schmidt                 |  #include <disclaimer.h>     
Indiana University          |  /* They are _my_ thoughts, and you can't
Graduate School of Business |     have them, so there!  */

jrh@mustang.dell.com (James Howard) (07/22/90)

In article <8518@ur-cc.UUCP>, ttak@uhura.cc.rochester.edu (Timothy
Takahashi) writes:
> In article <1990Jul20.190056.7132@cs.utk.edu> wozniak@utkux1.utk.edu
(Bryon Lape) writes:
> >
> >	Does anyonw know how I can tell what type of computer my
> >programme is running on?  I need to know not only what type of CPU, but
> >also the maker (IBM, Dell, Compaq, Tandy, etc).  I need to do this in
> 
> The suggestion of interpreting the byte at F000:FFFE (re: Peter Norton Guide)
> isn't too helpful (FF = PC,FE = XT, FD=PCjr, FC=AT,2D=Compaq PC,9A=Compaq XT)
> 
> Perhaps the ROM BIOS date at F000:FFF5 is a better start
> 04/24/81 = PC, 10/19/81 = revised PC,08/16/82= XT, 10/27/82= new PC
> 11/08/82 = portable pc, 06/01/83 = pc jr, 01/10/84 = original at, etc. etc.
> (again from peter norton guide)

For Dell systems, the string "Dell" will appear at F000:E076.  If you
find this string,
you can then look for the bios version number, which is three bytes
long, starting at
F000:E845.  For example, A03 would be 41 30 33.  Also, each system has a
an id byte
associated with it.  It is at F000:E845.  The id bytes current used are:

02h	System 200	03h	System 300	05h	System 220
06h	System 310	07h	System 325	09h	System 310A
0Ah	System 316	0Bh	System 220E	0Ch	System 210
0Dh	System 316SX	0Eh	System 316LT	0Fh	System 320LX
11h	System 425E

Here is some MASM code to determine CPU type.  I don't know who the original 
author was, but I got it off of a bulletin board several years ago, and added
a bit to it.  It will correctly determine 8088, 80186, 80286, and 80386
processors.  It does not understand 80386SX or 80486 CPU's.  If someone can add
that code and repost it, that would be helpful.

;
; CPU.ASM -- Determine CPU Type on any IBM or Compatible
;
; DESCRIPTION: Uses particular unique attributes of 8088/86, 80188/86,
;              80286, and 80386 Microprocessors to determine CPU type
;              during runtime.  This is useful to enable specialized
;              routines to take advantage of enhanced instructions if
;              available.
;
; Notes:
;
;   8088/86
;           This CPU has a unique way of handling the instruction PUSH SP,
;           which is commonly tested from software with three instructions.
;  80188/86
;           However, it does not help in determining the existence of a
;           80186/88 processor, because it is the same as the 80286 in the
;           way it handles PUSH SP.  Instead, there is a common difference
;           in that the flag register is handled differently.  If bits 12-15
;           are always held high, it is either an 808x or 8018x processor.
;           To decide which it is after this is tested, the way the SHL CX
;           instruction is handled can be used.  On an 808x, if CX > 32 it
;           will go ahead and shift it around anyway.  On an 80x8x, the high
;           order is masked off, so SHL CX with CX=35 will really only shift
;           3 (35-32).
;     80286
;           Once you know it is not a 808x, you need to determine if it is an
;           80286 or 80386 processor.  This again can be determined by looking
;           at the flags register. If bits 12-14 are forced low, it is a 286.
;     80386
;           If it falls through, it must be an 80386 by default.
;

code            segment para public 'CODE'

assume          cs:code,ds:code

		org	100h

start:          jmp     begin

msg_88          db      'An 8088/8086 is installed$'
msg_186         db      'An 80188/80186 is installed$'
msg_286         db      'An 80286 is installed$'
msg_386         db      'An 80386 is installed$'

begin:

                xor     ax,ax                   ; zero AX
                push    ax
                popf                            ; pop AX(=0) into flags
                pushf
                pop     ax                      ; pop AX
                and     ax,0f000h               ; see if bits tied high
                cmp     ax,0f000h               ; for 8088/186
                jz      is_0_1                  ; a 8018x or 808x

                mov     ax,07000h               ; see if 12-14 tied low
		push	ax
		popf
		pushf
		pop	ax
                and     ax,07000h               ; if 12-14 are 0
                jz      is_80286                ; then is 80286

is_80386:
                mov     dx,offset msg_386       ; else it's a 80386
                jmp     short print
is_80286:
                mov     dx,offset msg_286       ; it's a 80286
                jmp     short print
is_0_1:
		push	cx
                mov     ax,0ffffh               ; set to all ones
                mov     cl,33                   ; try to shift more than 32
                shl     ax,cl                   ; 808x will shift all bits out
                jnz     is_80186                ; nonzero bit means 8018x
is_8086:
		mov	dx,offset msg_88
		pop	cx
                jmp     short print
is_80186:
		mov	dx,offset msg_186
		pop	cx

print:	        mov	ah,09h
                int     21h
		mov	ax,4c00h
		int 	21h
code		ends
                end     start


I hope this is helpful.



James Howard        Dell Computer Corp.        !'s:uunet!dell!mustang!jrh
(512) 343-3480      9505 Arboretum Blvd        @'s:jrh@mustang.dell.com
                    Austin, TX 78759-7299