Assembly Help

Reply

Join Date: May 2009
Posts: 3
Reputation: SceneZx is an unknown quantity at this point 
Solved Threads: 0
SceneZx SceneZx is offline Offline
Newbie Poster

Assembly Help

 
0
  #1
May 10th, 2009
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

  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 =].
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Assembly Help

 
0
  #2
May 10th, 2009
Do you want us to guess which processor and host OS you're using?
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: SceneZx is an unknown quantity at this point 
Solved Threads: 0
SceneZx SceneZx is offline Offline
Newbie Poster

Re: Assembly Help

 
0
  #3
May 10th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Assembly Help

 
0
  #4
May 10th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 3
Reputation: SceneZx is an unknown quantity at this point 
Solved Threads: 0
SceneZx SceneZx is offline Offline
Newbie Poster

Re: Assembly Help

 
0
  #5
May 10th, 2009
Yes im sorry, that is relevant, if you could help me i would really appreciate it.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Assembly Help

 
0
  #6
May 10th, 2009
> and outputs a message if theres a carry over
So you do the add, look at some flags, make a decision.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,529
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 190
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: Assembly Help

 
0
  #7
May 10th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC