News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

I need help

Started by Vix, April 07, 2005, 07:33:08 PM

Previous topic - Next topic

Vix

Can someone please try to explain me how to add 2 32-bit numbers in 16-bit masm 

hitchhikr


nbr1 dd 1234567892
nbr2 dd 1234567892
result dd 0



mov ax, word ptr [nbr1]
add ax, word ptr [nbr2]
mov word ptr [result], ax
mov ax, word ptr [nbr1 + 2]
adc ax, word ptr [nbr2 + 2]
mov word ptr [result + 2], ax


Vix

Thanks a lot.
I am a new user of MASM and I'm not really good at this more complicated things.
Now I have general idea how to solve this problem but still I don't get it.
Can you please explain me what does this mean in few steps and is it possible to print result of adding 2 32-bit numbers.

hitchhikr

First it adds the last two words then adds the first two ones with the carry bit retrieved from the first addition (this bit is set if the result of the addition if greater than 0ffffh).

To print the result variable you need to convert it into ascii, and before you ask how to do this i suggest to use google or browse this forum to find the answer.