I'm trying to write a code for finding sum of two 2-digit numbers without push or pop.
i use "nasm -f elf sum2.asm","ld -s -o sum2 sum2.o","./sum2" for executing
i dont get proper output.cant understand why.pls help me out
section .text
global _start:
_start:
mov eax,4
mov ebx,1
mov ecx,prompt
mov edx,pl
int 80h
mov eax,4
mov ebx,1
mov ecx,prompt1
mov edx,p1l
int 80h
mov eax,3
mov ebx,0
mov ecx,dig11
mov edx,1
int 80h
mov eax,3
mov ebx,0
mov ecx,dig10
mov edx,2
int 80h
mov eax,4
mov ebx,1
mov ecx,prompt2
mov edx,p2l
int 80h
mov eax,3
mov ebx,0
mov ecx,dig21
mov edx,1
int 80h
mov eax,3
mov ebx,0
mov ecx,dig20
mov edx,2
int 80h
sub byte[dig11],30h
sub byte[dig10],30h
sub byte[dig21],30h
sub byte[dig20],30h
mov al,[dig11]
mov bl,10
mul bl
add al,[dig10]
mov [num1],al
mov al,[dig21]
mov bl,10
mul bl
add al,[dig20]
mov [num2],al
mov al,0
add al,byte[num1]
add al,byte[num2]
mov byte[sum],al
mov bl,10
div bl
mov [digs0],ah
mov [sumpart],al
movzx ax,[sumpart]
mov bl,10
div bl
mov [digs2],al
mov [digs1],ah
add byte[digs2],30h
add byte[digs1],30h
add byte[digs0],30h
mov eax,4
mov ebx,1
mov ecx,msgs
mov edx,msgl
int 80h
mov eax,4
mov ebx,1
mov ecx,digs2
mov edx,1
int 80h
mov eax,4
mov ebx,1
mov ecx,digs1
mov edx,1
int 80h
mov eax,4
mov ebx,1
mov ecx,digs0
mov edx,1
int 80h
mov eax,1
mov ebx,0
int 80h
section .data
prompt:db "SUM OF TWO 2-DIGIT NUMBERS",10
pl:equ $-prompt
prompt1:db "ENTER FIRST 2-DIGIT NUMBER",10
p1l:equ $-prompt1
prompt2:db "ENTER SECOND 2-DIGIT NUMBER",10
p2l:equ $-prompt2
msgs:db "SUM = "
msgl:equ $-msgs
section .bss
num1:resb 1
num2:resb 1
dig10:resb 1
dig11:resb 1
dig20:resb 1
dig21:resb 1
sum:resb 1
sumpart:resb 1
digs2:resb 1
digs1:resb 1
digs0:resb 1