| Line |  | 
|---|
| 1 | ; asmutil.asm Get Correct MS counter | 
|---|
| 2 | ; | 
|---|
| 3 | ; Copyright 1999 Markus Montkowski | 
|---|
| 4 |  | 
|---|
| 5 | NAME    asmutil | 
|---|
| 6 | .586p | 
|---|
| 7 | .MMX | 
|---|
| 8 |  | 
|---|
| 9 | CODE32          SEGMENT DWORD PUBLIC USE32 'CODE' | 
|---|
| 10 |  | 
|---|
| 11 | PUBLIC _GetMsCount | 
|---|
| 12 | ;---------------------------------------------------------------------------- | 
|---|
| 13 | ; ulong GetMSCount (CPU_largeInteger *t1,ULONG freq) | 
|---|
| 14 | ;---------------------------------------------------------------------------- | 
|---|
| 15 | ; Get the MS value from the High Tmr values | 
|---|
| 16 | ;---------------------------------------------------------------------------- | 
|---|
| 17 | _GetMsCount PROC NEAR | 
|---|
| 18 |  | 
|---|
| 19 | t1 EQU  EBP+8 | 
|---|
| 20 | freq  EQU  EBP+12 | 
|---|
| 21 |  | 
|---|
| 22 | push  ebp | 
|---|
| 23 | mov   ebp, esp | 
|---|
| 24 | push  ebx | 
|---|
| 25 | push  edi | 
|---|
| 26 | push  esi | 
|---|
| 27 |  | 
|---|
| 28 | mov   ecx,[t1] | 
|---|
| 29 | mov   eax,[ecx]   ; EAX := t1.low | 
|---|
| 30 | mov   edx,[ecx+4]   ; ECX := t1.high | 
|---|
| 31 | shld  edx,eax,20 | 
|---|
| 32 | shl   eax,20      ; t1 * 0x100000 | 
|---|
| 33 | div   DWORD[freq] ; (t1 * 0x100000) / freq | 
|---|
| 34 | mov   ecx,1000000 | 
|---|
| 35 | xor   edx,edx | 
|---|
| 36 | mul   ecx       ; ((t1 * 0x100000) / freq) * 1000000) | 
|---|
| 37 | shrd  eax,edx,20    ; ((t1 * 0x100000) / freq) * 1000000) / 0x100000 | 
|---|
| 38 |  | 
|---|
| 39 | pop  edi | 
|---|
| 40 | pop  esi | 
|---|
| 41 | pop  ebx | 
|---|
| 42 | cld | 
|---|
| 43 | mov  esp,ebp | 
|---|
| 44 | pop  ebp | 
|---|
| 45 | ret | 
|---|
| 46 |  | 
|---|
| 47 | _GetMsCount endp | 
|---|
| 48 |  | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | CODE32          ENDS | 
|---|
| 53 |  | 
|---|
| 54 | END | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.