您的位置:首页 >> 编程开发 >> 汇编 >> 汇编技术资料 >> 正文
汇编技术资料 RSS
 

侦测CPU型号

http://www.rdxx.com 05年04月29日 00:00 我要投稿

关键词: CPU型号

_PROCESSOR DETECTION SCHEMES_
by Richard C. Leinecker

[LISTING ONE]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  Detect the Processor Type -- by Richard C. Leinecker                 ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

_PTEXT      SEGMENT PARA PUBLIC 'CODE'
        ASSUME  CS:_PTEXT, DS:_PTEXT

        public  _Processor
; This routine returns the processor type as an integer value.
; C Prototype
; int Processor( void );
; Returns: 0 == 8088, 1 == 8086, 2 == 80286, 3 == 80386, 4 == 80486
; Code assumes es, ax, bx, cx, and dx can be altered. If their contents
; must be preserved, then you'll have to push and pop them.
_Processor  proc    far

        push    bp          ; Preserve bp
        mov bp,sp           ; bp = sp

        push    ds          ; Preserve ds
        push    di          ; and di

        mov ax,cs           ; Point ds
        mov ds,ax           ; to _PTEXT

        call    IsItAn8088      ; Returns 0 or 2

        cmp al,2            ; 2 = 286 or better
        jge AtLeast286      ; Go to 286 and above code

        call    IsItAn8086      ; Returns 0 or 1

        jmp short ExitProcessor ; Jump to exit code
AtLeast286:
        call    IsItA286        ; See if it's a 286

        cmp al,3            ; 4 and above for 386 and up
        jl  short ExitProcessor ; Jump to exit code
AtLeast386:
        call    IsItA386        ; See if it's a 386
ExitProcessor:
        pop di          ; Restore di,
        pop ds          ; ds,

共6页  第1页 第2页 第3页 第4页 第5页 第6页


 
 
标签: CPU型号 打印本文
 
 
  相关资讯
RSS
 
无相关新闻
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站