x86 assembly addition big numbers with carry -


adding 2 big numbers (128bit).

sysexit = 1 exit_success = 0  .data number1:     .long 0x10304008, 0x701100ff, 0x45100020, 0x08570030 number2:     .long 0xf040500c, 0x00220026, 0x321000cb, 0x04520031  .text .global _start _start:   addition:     movl $4, %ecx     clc add_loop:     movl %ecx, %edx     decl %edx     movl number1(,%edx,4), %eax     movl number2(,%edx,4), %ebx     adcl %eax, %ebx     pushl %ebx     loop add_loop   mov $sysexit, %eax mov $exit_success, %ebx int $0x80 

i check under gdb using x/5wx $esp , have 00000001 in beginning 5th word, if change number2 0x1040500c, 0x00220026, 0x321000cb, 0x04520031 prevent carry. what's wrong?

you store 4 words, why expect 5th 1 have specific value?

by way, 1 should number of arguments passed program, first argument customarily name of program itself.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -