Hello, I want to verify if a word is palindrome but I can't compare 2 memories. Can someone tell me a way to fix this?
SECTION .text
global _start
_start: ; tell linker entry point.
mov ecx, string
add ecx, len
sub ecx, 3
mov eax, string
mov ebx, len
_ciclo:
push eax
push ecx
cmp [eax], [ecx]
jnz _stampaNonPalindroma
pop ecx
pop eax
inc eax
dec ecx
dec ebx
cmp ebx,0h
jnz _ciclo
jmp _stampaPalindroma ;se uscirà "indenne" dal ciclo vuol dire che la parola è palindroma
_stampaPalindroma:
mov ecx, string2
mov edx, len2
mov ebx, 1 ; file descriptor (stdout)
mov eax, 4 ; system call number (sys_write)
int 0x80
jmp _esci
_stampaNonPalindroma:
mov ecx, string3
mov edx, len3
mov ebx, 1
mov eax, 4
int 0x80
jmp _esci
_esci:
mov eax, 1
int 0x80
section .data
string: db "anna",10,13 ;10 line feed, 13 carriage return, 0 null.
len: equ $-string
string2: db "Palindroma",10,13
len2: equ $-string2
string3: db "Non Palindroma",10,13
len3: equ $-string3