home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
sysutl
/
proctype.arc
/
PROCTYPE.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-10-30
|
2KB
|
66 lines
; TITLE PROCTYPE.ASM
;
;Assembly language routine to detect and return processor type
;Returns AX=86H, 186H, 188H, 288H, 388H, depending on
;processor type detected.
;All other regs, flags unchanged.
;
;Suggest you only call this routine once and set a global flag
;accordingly!
;
;From Micro Cornucopia magazine #37, Sep-Oct 87
;Author: Pat O'Leary
; Ardrew, Athy
; County Kildare, Ireland
;Very slightly tweaked by David Kirschbaum, Toad Hall
;
proc_type proc near
pushf ;save flags
xor ax,ax ;clear AX
push ax ;push it on the stack
popf ;zero the flags
pushf ;try to zero bits 12-15
pop ax ;recover flags
and ax,0F000H ;if 12-15 are 1
cmp ax,0F000H ;then processor is
jz Is_0_1 ;8018x or 808x
mov ax,07000H ;try to set bits 12-14
push ax
popf
pushf
pop ax
and ax,07000H ;if 12-14 are 0
jz Is_80286 ;processor is 80286
Is_80386: ;else it's an 80386
mov ax,386H ;return 386
jmp short Done ;TH added the short
Is_80286:
mov ax,286H ;return 286
jmp short Done ;TH added the short
Is_0_1: ;it's 808x or 8018x
push cx ;save CX
mov ax,0FFFFH ;set all AX bits
mov cl,33 ;will shift once on 8018x
shl ax,cl ;or 33 times on 808x
pop cx ;TH restore CX NOW! (just 1 time)
jnz Is_80186 ;nonzero bits mean 8018x
Is_8086: ;else it's an 8086
mov ax,86H ;return 86
;TH pop cx ;restore CX
jmp short Done ;TH added the short
Is_80186:
mov ax,186H ;return 186
;TH pop cx ;restore CX
Done:
popf ;restore original flags
ret
proc_type endp