Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone explain?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I program in Delphi, and found a function that gets CPU frequency, but in delphi, you can also use assembly, and the code above was inside the function, and I dont understand any of it. I would really apreciate it if someone could just explain what it does, or even put a comment on each line. I just want to know what it does. Here is the code:


dw 310Fh
mov TimerLo, eax
mov TimerHi, edx

dw 310Fh
sub eax, TimerLo
sbb edx, TimerHi
mov TimerLo, eax
mov TimerHi, edx

("TimerLo" and "TimerHi" are DWORD variables).

Thanks alot in advance to anyone who helps me with this!
 
dw 0310Fh - opcode '00F 031' is the RDTSC operation found only in pentium processors and later

RDTSC reads the time stamp counder into edx:eax
the counter is incremented every clock cycle hence you are able to determin the speed of your processor.



"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top