DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   Assembly Help (http://www.daniweb.com/forums/thread191456.html)

SceneZx May 10th, 2009 10:53 am
Assembly Help
 
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

ORG 0 ; 
SWI GETINT;
MOV R1,R0;
SWI GETINT;
MOV R2,R0;
ADD R2,R1;
MOV R0,R2;
SWI PUTINT;
HLT

Any help would be really appreciated, i just am trying to learn =].

Salem May 10th, 2009 10:55 am
Re: Assembly Help
 
Do you want us to guess which processor and host OS you're using?

SceneZx May 10th, 2009 10:59 am
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

Salem May 10th, 2009 11:44 am
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?

SceneZx May 10th, 2009 12:38 pm
Re: Assembly Help
 
Yes im sorry, that is relevant, if you could help me i would really appreciate it.

Salem May 10th, 2009 12:57 pm
Re: Assembly Help
 
> and outputs a message if theres a carry over
So you do the add, look at some flags, make a decision.

BestJewSinceJC May 10th, 2009 5:18 pm
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


All times are GMT -4. The time now is 7:39 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC