home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / microcrn / issue_37.arc / TIPS-37.FIG < prev   
Text File  |  1987-06-23  |  1KB  |  53 lines

  1. ((Techtips figure 1 - Routine to Identify Intel Processors))
  2.  
  3. proc_type    proc        near
  4.  
  5.      pushf               ;save flags
  6.      xor     ax,ax       ;clear AX
  7.      push    ax          ;push it on stack
  8.      popf                ;zero the flags
  9.      pushf               ;try to zero bits 12-15
  10.      pop     ax          ;recover flags
  11.      and     ax,0f000h   ;if 12-15 are 1
  12.      cmp     ax,0f000h   ;then processor is
  13.      jz      is_0_1      ;8018x or 808x
  14.  
  15.      mov     ax,07000h   ;try to set bits 12-14
  16.      push    ax
  17.      popf
  18.      pushf
  19.      pop     ax
  20.      and     ax,07000h   ;if 12-14 are 0
  21.      jz      is_80286    ;processor is 80286
  22.  
  23. is_80386:                ;else it's an 80386
  24.      mov     ax,386h     ;return 386
  25.      jmp     done
  26.  
  27. is_80286:
  28.      mov     ax,286h     ;return 286
  29.      jmp     done
  30.  
  31. is_0_1:                  ;it's 808x or 8018x
  32.      push    cx          ;save it
  33.      mov     ax,0ffffh   ;set all AX bits
  34.      mov     cl,33       ;will shift once on 8018x
  35.      shl     ax,cl       ;or 33 times on 808x
  36.      jnz     is_80186    ;nonzero bits mean 8018x
  37.  
  38. is_8086:                 ;else it's 808x
  39.      mov     ax,86h      ;return 86
  40.      pop     cx          ;restore CX
  41.      jmp     done
  42.  
  43. is_80186:
  44.      mov     ax,186h     ;return 186
  45.      pop     cx          ;restore CX
  46.  
  47. done:
  48.      popf                ;restore original flags
  49.      ret
  50.  
  51. proc_type    endp
  52.  
  53.