this program is to
1 calculate string length
2 print reverse string
3 check palindrome
program gives segmentation fault after calculation string length
if i run only run Reverse procedure then also it gives segmentation error just after printing reverse string
it only run 1 procedure ....display its result, then hang there only till i press enter.After pressing enter it display Segmentation Fault core dump
Plz tell me which are the various condition that leads to segmentation fault
i even try to change registers then also having same error
section .data
length db 10,'length of string is::'
lengths equ $-length
msgp db 10,'palindrome'
msgps equ $-msgp
msgnp db 10,'not palindrome'
msgnps equ $-msgnp
section .bss
str12 resb 20
str1 resb 20
str1s equ $-str1
result resb 3
resv resb 20
resvs equ $-resv
len resb 6
%macro print 2
mov eax,4
mov ebx,00
mov ecx,%1
mov edx,%2
int 80h
%endmacro
%macro read 2
mov eax,3
mov ebx,1
mov ecx,%1
mov edx,%2
int 80h
%endmacro
section .text
global _start
_start:
lengh:
read str12,20
dec eax
mov [len],eax
mov ebx,eax
call disp
print length,lengths
print result,2
reverse:
read str1,20
dec eax
mov [len],eax
mov esi,str1
mov ecx,[len]
add esi,ecx
dec esi
mov edi,resv
again:
mov al,[esi]
mov [edi],al
dec esi
inc edi
dec ecx
jnz again
print resv,10
palin:
mov esi,str1
mov edi,resv
mov ecx,[len]
pln:mov al,[esi]
cmp [edi],al
jne ntp
inc esi
inc edi
loop pln
print msgp,msgps
mov eax,1
mov ebx,1
int 80h
ntp:print msgnp,msgnps
mov eax,1
mov ebx,1
int 80h
disp:mov ecx,04
mov esi,result
ck:rol bl,4
mov al,bl
and al,0fh
cmp al,09
jbe dn
add al,07h
dn:add al,30h
mov [esi],al
inc esi
loop ck
ret