Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Vlion

Fragging asm !

This topic is 6525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#include 
short getTime()
{
    short retval;//short instead of char so the 
    _asm
    {	
        xor  ax,ax//zeros AX out
	int  1Ah/calls the clock interrupt
	mov  BYTE PTR retval,dl//copies DL(the millisecond) 
                               //value to retval
    }
    return retval;
}

void main()
{
    short temp1,temp2;
    for(int i=0;i++;i<=20)//for some reason it jumps to the end of the for...
    {
        temp1 = temp2 = GetTime();//inisialization
        while(temp1==temp2)
        {
            temp2 =  GetTime();
        }//this way when its displayed theres a different number everytime.
        cout << temp2 << ''\n'';
    }
}
 
I came, I saw, I got programmers block. ~V''lion

Share this post


Link to post
Share on other sites
Advertisement
Hi.

Should not the following statement:

for(int i=0;i++;i<=20)//for some reason it jumps to the end of the for...

read like this instead?:

for(int i=0;i<=20;i++)//for some reason it jumps to the end of the for...

Topgoro

Share this post


Link to post
Share on other sites
This is simple C man. Exactly what the last poster said!

for(assignment, expression, assignment (usually increment/decrement) ) is the syntax.

=======================================
A man with no head is still a man.
A head with no man is plain freaky.

Share this post


Link to post
Share on other sites
ROFL

Aaaaaah Late night programming errors, how I love them when I have found them !

Share this post


Link to post
Share on other sites
*claps hand to head*
Fool me !
One day....
I use shorts becasue they take up less memory.
I`m not super interested in the speed right now, else i`d use longs. *shrug*
~V''lion

I came, I saw, I got programmers block.
~V''lion

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!