title: Nasm assembler x64 compare input string
body: <p><strong>Compare the user input string with some values.</strong><br/>
  <br/>
  In this case i want to compare the input string with the '2' and jump to the CvrtMInus if the input is '2'
  <br/>
  but nothing happends any idea?
  <br/>
  <strong>For example the user put :<br/></strong>
  <i>nasm -f elf64 -g inputCompare.asm<br/>
  gcc -o inputCompare inputCompare.o<br/>
   ./inputCompare 2</i>
  <br/></p>
  
  <pre><code>sys_Exit       equ     1 ;id codigos del sistema
  extern printf
  
  section .data
  formatoChar: db '%c', 0AH,0
  formatoDec: dq '%d', 0AH,0
  formatoStr: db '%s', 0AH, 0
  mayus: db "Convert MAYUS", 0AH,0
  minus: db "Convert MINUS", 0AH,0
  tipoCnvs: db "2",0x0A
  
  section .bss
  
  section .text
  global  main
  
  _exit:
  mov     rax,    1       ; exit
  mov     rbx,    0       ; exit status
  int     80h
  
  main:
  ;Get the input data
  
   mov rcx, rdi     ; argc
   mov r8, 0     ; offset
   add r8, 8 ; apunta al siguiente argumento
   mov rdx, qword [rsi+r8] ; argv
  
  
  
   mov [tipoCnvs],rdx;Store value in variable
     ;print input
     ;mov rdi, formatoStr ; first parameter for printf
     ;mov rsi, rdx ; second parameter for printf
     ;mov rax, 0 ; no floating point register used
     ;call printf  ; call to printf     
  
  ;Print input value
  
   mov rdi,formatoStr
   mov rsi,[tipoCnvs]
   mov rax, 0; no floating point register used
   call printf
  
  ; This is the Comparison part that I'm interested in
  
   cmp byte [tipoCnvs], '2'
   je CvrtMinus
  
   ;Convierte a Mayusculas
   CvrtMayus:
   mov rdi,mayus
   mov rax,0; no floating point register used
   call printf
   jmp _exit
  
   ;Convierte a Minusculas
   CvrtMinus:
   mov rdi,minus
   mov rax,0; no floating point register used
   call printf
   jmp _exit
  </code></pre>