×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can someone explain?

Can someone explain?

Can someone explain?

(OP)
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!

RE: Can someone explain?

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!"

RE: Can someone explain?

(OP)
oh, I see ... Thanks alot for the info! :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close