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

Recommended Answers

Do you want us to guess which processor and host OS you're using?

Jump to Post

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?

Jump to Post

All 6 Replies

Do you want us to guess which processor and host OS you're using?

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

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?

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.