943,603 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 594
  • Assembly RSS
May 10th, 2009
0

Assembly Help

Expand Post »
Hello,

Ive just started programming in Assembly and im having a little trouble with the language itself. I wanted to make a program that takes two positive integers and adds them together, and outputs a message if theres a carry over, but i have no idea how to go about it. Ive made a assembly program thats adds together before, but i dont know how to do the rest. Any help would be appreciated.

Heres my previous program

Assembly Syntax (Toggle Plain Text)
  1. ORG 0 ;
  2. SWI GETINT;
  3. MOV R1,R0;
  4. SWI GETINT;
  5. MOV R2,R0;
  6. ADD R2,R1;
  7. MOV R0,R2;
  8. SWI PUTINT;
  9. HLT

Any help would be really appreciated, i just am trying to learn =].
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SceneZx is offline Offline
3 posts
since May 2009
May 10th, 2009
0

Re: Assembly Help

Do you want us to guess which processor and host OS you're using?
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
May 10th, 2009
0

Re: Assembly Help

Well tbh it made sound nooby, but ive been using a emulator and just Windows XP Professional.

The emulator that i am using is called Emu8086
Last edited by SceneZx; May 10th, 2009 at 11:03 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SceneZx is offline Offline
3 posts
since May 2009
May 10th, 2009
0

Re: Assembly Help

Well the 'problem' is that the code you posted doesn't look at all like x86 assembler.

I found something called BEP/16, but is that relevant?
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
May 10th, 2009
0

Re: Assembly Help

Yes im sorry, that is relevant, if you could help me i would really appreciate it.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SceneZx is offline Offline
3 posts
since May 2009
May 10th, 2009
0

Re: Assembly Help

> and outputs a message if theres a carry over
So you do the add, look at some flags, make a decision.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
May 10th, 2009
0

Re: Assembly Help

There will be a "carry over" if the result can't fit into a 32 bit integer, presumably, which will cause the carry flag to be set. Then you just need to check the carry flag, which will be 1 if there was a carry, 0 otherwise
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Division in Assembly?
Next Thread in Assembly Forum Timeline: Help..!!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC