section .text
global _start
_start:
mov eax,'3'
sub eax,'0'
mov ebx,'4'
sub ebx,'0'
add eax,ebx
add eax,'0'
; mov [sum],eax
; mov ecx,sum
mov ecx,eax
mov eax,4
mov ebx,1
mov edx,1
int 0x80
mov eax,1
int 0x80
section .bss
sum resb 1
This x86 IA-32 Adds two numbers. When I move accumulator register result to a variable in memory and then from that variable to ecx and call interrupt it prints as expected. However If i directly move ecx,eax it doesn't work as expected.
Also when trying to print something only if second operand is from memory it works. Am i missing something.
P.S I've seen similar posts in SO, and couldn't find any duplicate