0

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 =].

3
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by BestJewSinceJC
0

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

0

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?

0

Yes im sorry, that is relevant, if you could help me i would really appreciate it.

0

> and outputs a message if theres a carry over
So you do the add, look at some flags, make a decision.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.