page,132

;---------------------------Module-Header-------------------------------;
; Module Name: CCOM.ASM
;
; Copyright (c) Microsoft Corporation 1985-1990.  All Rights Reserved.
;
; History
;
; 041786   Fixed RECCOM to return be able to return nulls

.xlist
include cmacros.inc
.list

sBegin  Code
assumes cs,Code
assumes ds,Data

page

;---------------------------Module-Header-------------------------------;
; Module Name: WHATCPU.ASM
;
; Copyright (c) MicroTec Corporation .  All Rights Reserved.
;
; History
;

;.xlist
;include cmacros.inc
;.list
;sBegin  Code
;assumes cs,Code
;assumes ds,Data

;=========================================================================
;
;   ushort WhatCpu()
;
;   returns    - 0   if no type
;              - 1   8086,8088
;	           - 2   80286
;              - 3   80386
;              - 4   80486
;			   - 5   80586
;			   - 6   future
;
;=========================================================================

assumes ds,Data
assumes es,nothing

public _WHATCPU
_WHATCPU proc far

		mov dx,1
		cli
		pushf
		pushf
		pop ax
		and ax,0fffh
		or ax,5000h
		push ax
		popf
		pushf
		pop ax
		popf
		sti
		and ax,0f000h
		cmp ax,0f000h
		jne check_286
		jmp done
		
		check_286: 
		mov dx,2
		or ax,ax
		jne check_386
		jmp done

                .386
		check_386: 
		mov dx,3
		cli
		pushfd
		pushfd
		pop eax 
		mov ebx,eax
		xor eax,4000h
		push eax
		popfd
		pushfd
		pop eax
		popfd
		sti
		and eax,4000h
        and ebx,4000h
		cmp eax,ebx
		je done
		
		mov dx,4
		cli
		pushfd
		pushfd
		pop eax
		mov ebx,eax
		xor eax,200000h
		push eax
		popfd
		pushfd
		pop eax
		popfd
		sti
		and eax,200000h
        and ebx,200000h
		cmp eax,ebx
		je done
		
		mov eax,1
		db 0fh,0a2h;CPUID
		and eax,0f00h
		shr eax,8
		
		mov dx,5
		cmp eax,5
		je done
        mov dx,6
		
		done:   
		mov ax,dx

endp
page


sEnd   Code

end
 
