SHARE
TWEET

Untitled

a guest Jul 16th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .386
  2. .model flaT
  3. .data
  4. cadena db "anal"
  5. .code
  6. _start:
  7.    
  8.     xor ecx, ecx
  9.     mov ecx, lengthof cadena
  10.     mov eax, 0
  11.     mov ebx, lengthof cadena
  12.     sub ebx,1   ; EBX = longitud -1
  13.     check:
  14.     lea edi, [cadena+eax] ; Carga caracteres de cadcena del primero al ultimo
  15.     lea esi, [cadena+ebx] ; Carga caracteres de cadena del ultimo al primero
  16.     inc eax
  17.     dec ebx  
  18.     cmpsb ; Se compara [EDI] y [ESI]
  19.     loope check ; Salta a check si ECX!=0 y ZF=1 (Si son iguales)
  20.     secondary_check:
  21.     cmp ecx,0 ; Si ECX=0 es porque se comparó toda la cadena
  22.               ; y si eso ocurrio es porque todas son iguales
  23.     jz palindromo
  24.     jnz no_palindromo
  25.     palindromo:
  26.     jmp done
  27.     no_palindromo:
  28.     jmp done
  29.     done:
  30.     ret
  31.     end _start
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top