home *** CD-ROM | disk | FTP | other *** search
/ 98 Driver Collection MD-0164 / DRIVER_KING_98.iso / CPU / cyrix / ID_FPU.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-04-01  |  1.9 KB  |  56 lines

  1.     public    _iscyrixfpu
  2.  
  3.         assume    cs:_TEXT
  4.  
  5. _TEXT    segment byte public 'CODE'
  6. ;**************************************************************************    
  7. ;       Function:       int iscyrixfpu()    
  8. ;       Technique:
  9. ;               On both the Cyrix and Intel math coprocessor the function
  10. ;               2^x-1 is undefined when its argument does not lie between
  11. ;               -1 and +1. Therefore, when this function is evaluated at
  12. ;               x=pi it is not surprising that the answers returned by the
  13. ;               Cyrix and Intel chips are distinct.  This program computes
  14. ;               2^PI-1 and stores the result as a single precision number
  15. ;               VALUE.  It is possible to distinguish between the Cyrix and
  16. ;               Intel math coprocessors by comparing VALUE with the known
  17. ;               value obtained when using a Cyrix or Intel math coprocessor.
  18. ;
  19. ;       Purpose:        Determine if Cyrix FPU is present
  20. ;       Inputs:         None
  21. ;       Output:         AX=1 if Cyrix FPU Present else AX=0
  22. ;**************************************************************************
  23.  
  24. _iscyrixfpu    proc    near
  25.     push    bp
  26.     mov    bp,sp
  27.     sub    sp,4                    ; get stack space
  28.     push    si                      ; use as temp
  29.     push    di                      ; use as temp
  30.  
  31.     finit                            ; inialize fpu
  32.     fldpi                            ; fpu loads pi           
  33.     f2xm1                            ; square pi           
  34.     fstp    dword ptr [bp-4]        ; get pi squared
  35.  
  36.     lea    ax, word ptr [bp-2]     ; get address of pi squared value
  37.     mov    si, ax
  38.     cmp    word ptr [si], 3FC9h    ; compare pi squared to Cyrix
  39.     jne    short not_cyrix
  40.     mov    di, 1                   ; True Cyrix FPU present
  41.     jmp    short done
  42.  
  43. not_cyrix:
  44.     mov    di, 0                   ; FALSE Cyrix FPU not present
  45.  
  46. done:
  47.     mov    ax, di                  ; return findings
  48.     pop    di
  49.     pop    si
  50.     mov    sp,bp
  51.     pop    bp
  52.     ret    
  53. _iscyrixfpu    endp
  54. _TEXT    ends
  55.     end
  56.