How I make an addition of two numbers of 32 bits in Assembly using ADC?
Asked
Active
Viewed 3,209 times
-2
-
Which bitness is the processor? – sharptooth Jan 17 '11 at 13:57
-
I need to Add two numbers in assembly using debug, the program must accept 32 bits. – ebed Jan 17 '11 at 14:03
-
Please give an example of this operation. – ebed Jan 17 '11 at 14:07
-
1which architecture? there's not only a single one you know? – phuclv May 15 '15 at 06:23
2 Answers
1
Assuming an 8 bit processor with ld, st, adc and add and index registers X & Y which point to the values to be added, result replaces *X:
ld 3,X
add 3,Y ; The first add is without carry
st 3,X
ld 2,X
adc 2,Y ; subsequent adds propagate carry.
st 2,X
ld 1,X
adc 1,Y
st 1,X
ld 0,X
adc 0,Y
st 0,X

Richard Pennington
- 19,673
- 4
- 43
- 72
0
ADC
stands for "ADd with Carry", in fact it is like add two values and add again the value of the carry flag:
adc eax,ebx
is like:
add eax, ebx
add eax, cf
or:
add eax, ebx
jnc dont_add
inc eax
dont_add:
...

BlackBear
- 22,411
- 10
- 48
- 86