flat assembler
Message board for the users of flat assembler.

Index > Main > Assembly: arithmetic operators?

Author
Thread Post new topic Reply to topic
zutokaza



Joined: 03 May 2015
Posts: 14
zutokaza
How would this be done in windows assembly? (32 bit)

Code:
int main()
{
     cout << "7 + 3 = " << 7 + 3 << endl;
     cout << "7 - 3 = " << 7 - 3 << endl;
     cout << "7 * 3 = " << 7 * 3 << endl;
     cout << "7 / 3 = " << 7 / 3 << endl;
     cout << "7.0 / 3.0 = " << 7.0 / 3.0 << endl;
     cout << "7 % 3 = " << 7 % 3 << endl;
     cout << "7 + 3 * 5 = " << 7 + 3 * 5 << endl;
     cout << "(7 + 3) * 5 = " << (7 + 3) * 5 << endl;
     return 0;
}
    
Post 06 May 2015, 09:45
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17658
Location: In your JS exploiting you and your system
revolution
X86 instructions have ADD, SUB, MUL and DIV as explained in the manuals. DIV also gives the remainder so it can be used for modulus.
Post 06 May 2015, 12:56
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.