home *** CD-ROM | disk | FTP | other *** search
/ PC User 1997 April / PCU_APR_97.ISO / utils / cpu / cpuinfo / source / cpuinf16 / timeproc.asm < prev    next >
Encoding:
Assembly Source File  |  1995-10-26  |  2.4 KB  |  89 lines

  1. ;***************************************************************
  2. ; MASM file: timeproc.asm... for cpuinf16 DLL
  3. ;
  4. ;       This program has been developed by Intel Corporation.  
  5. ;        You have Intel's permission to incorporate this code 
  6. ;       into your product, royalty free.  Intel has various 
  7. ;        intellectual property rights which it may assert under
  8. ;       certain circumstances, such as if another manufacturer's
  9. ;       processor mis-identifies itself as being "GenuineIntel"
  10. ;        when the CPUID instruction is executed.
  11. ;
  12. ;       Intel specifically disclaims all warranties, express or
  13. ;       implied, and all liability, including consequential and
  14. ;        other indirect damages, for the use of this code, 
  15. ;        including liability for infringement of any proprietary
  16. ;        rights, and including the warranties of merchantability
  17. ;        and fitness for a particular purpose.  Intel does not 
  18. ;        assume any responsibility for any errors which may 
  19. ;        appear in this code nor any responsibility to update it.
  20. ;
  21. ;****************************************************************
  22.  
  23.  
  24.  
  25. ITERATIONS equ 4000
  26.  
  27. .8086
  28. .model medium,c
  29. .code
  30.  
  31.  
  32. .386
  33.  
  34.             ; Declare functions to be public and therefore accessible by C programs.
  35. public Time_Processor_bsf
  36.  
  37.  
  38.  
  39. ;***************************************************************
  40. ; TIME_PROCESSOR_BSF() -- Perform nITERATIONS of the BSF 
  41. ;                         instructions.
  42. ;
  43. ; Inputs: none
  44. ;
  45. ; Returns:
  46. ;    # of ticks instruction sequence ran.
  47. ;***************************************************************
  48.  
  49. Time_Processor_bsf proc    far
  50.  
  51. ;---------- Initialize and Clear Timer -------------------------
  52.  
  53.             mov al,10111000b    ; Channel 2, LSB+MSB, mode 4,
  54.             out 43h,al          ;    binary
  55.  
  56.             in    al,61h
  57.             or    al,1
  58.             out 61h,al
  59.  
  60.             xor al,al           ; Reset timer
  61.             out 42h,al
  62.             out 42h,al
  63.                             
  64.                             
  65. ;---------- Run nIterations of the BSF Instruction -------------
  66.  
  67.         mov eax,80000000h
  68.         mov bx,ITERATIONS
  69.     
  70. loop1:    bsf ecx,eax
  71.         
  72.         dec    bx
  73.         jnz    loop1
  74.                             
  75.                             
  76. ;---------- Read Timer Ticks -----------------------------------
  77.  
  78.         in    al,42h                ; MSB timer
  79.         mov    ah,al
  80.         in    al,42h                ; LSB timer
  81.         xchg    al,ah
  82.         neg    ax
  83.  
  84.          retf                    ; Set return type to be far
  85.  
  86. Time_Processor_bsf endp
  87.  
  88. end
  89.