I have tried making this simple program for multiplication using successive addition alogrithm
But my program is not accepting the second number
and then it terminates and displays a message segmentation fault(core dumped)
please Help me
section .data
welcum db 10,"Welcome To successive addition"
welcum_len equ $-welcum
msg1 db 10,"Enter First Number",10
msg1_len equ $-msg1
msg2 db 10,"Enter Second Number",10
msg2_len equ $-msg2
resultmsg db 10,"The result is",10
result_len equ $-resultmsg
test1 db 10, "Test Message!!!!!",10
test_len equ $-test1
;-----------------------------------------
section .bss
result resw 1
num1 resb 2
num2 resb 2
x resb 1
count resb 1
res_buff resb 4
%macro disp 2
mov eax,04
mov ebx,01
mov ecx,%1
mov edx,%2
int 80h
%endmacro
%macro accept 2
mov eax,03
mov ebx,01
mov ecx,%1
mov edx,%2
int 80h
%endmacro
;--------------------------------
section .text
global _start
_start:
disp welcum,welcum_len
disp msg1,msg1_len
accept num1,2
mov esi,num1
call packnum2
mov byte[x],bl
disp msg2,msg2_len
accept num2,2
mov esi,num2
call packnum2
mov byte[count],bl
mov dl,byte[x]
xor ecx,ecx
mov cl,byte[count]
mov word[result],0000h
loop1:
add [result],dl
loop loop1
disp resultmsg,result_len
call disp16
mov eax,01
mov ebx,00
int 80h
packnum2:
mov ecx,2
mov bl,00
l1:
rol bl,4
mov al,[esi]
cmp al,39h
jbe sub30
sub al,07h
sub30:
sub al,30h
add bl,al
inc esi
loop l1
ret
disp16:
mov edx,[result]
mov edi,res_buff
mov cx,4
back:
rol edx,4
mov bl,dl
and bl,0fh
cmp bl,09h
jbe add30
add bl,07h
add30:
add bl,30h
mov [edi],bl
inc edi
loop back
disp res_buff,4
ret