Is there anyway to see how may clock ticks have passed after ive executed some code? Or seconds, or anything?
Printable View
Is there anyway to see how may clock ticks have passed after ive executed some code? Or seconds, or anything?
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