This are the instructions that I have:
global _start
_start:
mov ecx, 0x12
mov ebx, 0x2
label:
add ebx, ebx
dec ecx
cmp ecx, 0
jg label
mov eax, 1
int 0x80
I am new to assembly and am essentially trying to multiply two numbers. I am compiling the above code with nasm -f elf32 ./ex1.asm && ld -m elf_i386, running the output binary ./a.out and checking the return value with echo $? right after I run ./a.out. I get 0 as a return value however I am expecting to get what is stored in ebx as a return value. Furthermore, when I replace 0x12 and 0x2 with 0x2, 0x3, respectively, I get the return value of 12. I tried increasing this numbers and until certain point I get some unrelated value as a return value and then I only get 0.
Furthermore, when I replace 0x12 and 0x2 with 0x2, 0x3, respectively, I get the return value of 12. I tried increasing this numbers and until certain point I get some unrelated value as a return value and then I only get 0.