Results 1 to 2 of 2

Thread: Timers or Clock Ticks

  1. #1
    ChimpFace9000
    Guest

    Post

    Is there anyway to see how may clock ticks have passed after ive executed some code? Or seconds, or anything?

  2. #2
    Junior Member
    Join Date
    Jun 2000
    Posts
    28
    for the timer, get the dword at 40:6C in real mode, dunno about protected mode
    save it, then subtract it from the next value and divide it by 18.2 (approx) to get the number of seconds
    (exact is 65536/3600)

    in protected mode (like win32) just go
    rdtsc ;read timer
    mov [__int64],eax
    mov 4[__int64],edx
    then do the same thing as per the timer, except that you must divide the the result by your clock speed

    x dq 0
    clockspeed dq 400000000.0

    rdtsc
    mov [x],eax
    mov 4[x],edx
    ...code...
    rdtsc
    sub eax,[x]
    sbb edx,4[x] ;less 1 if carry
    mov [x],eax
    mov 4[x],edx ;now x should contain the number of clock ticks
    fild qword ptr [x]
    fdiv qword ptr [clockspeed]
    fistp qword ptr [x] ;now x contains the number of seconds - for more accuracy, store the result in a float or double - fstp qword ptr [double]

    this can be done in REAL real mode too, but not v86

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width