title: Issues with the linux read syscall
body: <p>I just started learning x86 assembly so im sorry if this question is too stupid. So heres my code that checks if a number read from stdin is even or not:</p>
  <pre><code>section .data
      even db &quot;even&quot;,10   ;even number
      odd db &quot;odd&quot;,10     ;odd number
  section .bss
      num resb 1
  section .text
      global _start
  
  _start:
      
      mov rax, 0  ;read
      mov rdi, 0  ;stdin
      mov rsi, num    ;where to store
      mov rdx, 1  ;count
      syscall
      
  
      mov eax,num ;num in eax. div requires dividend in eax
      xor edx, edx    ;clear edx
      mov ebx, 2  ;mov 2 in ebx
      div ebx     ;divide
      cmp edx, 0x00   ;remaider goes in edx
      je evenl    ;jump if equals
      
  
      mov rax, 1  ;write
      mov rdi, 1  ;stdout
      mov rsi, odd    ;message
      mov rdx, 4  ;count
      syscall 
  
      mov rax, 60 ;exit
      mov rdi, 0  ;code 0
      syscall
  
  
  evenl:
      mov rax, 1  ;write
      mov rdi , 1 ;stdout
      mov rsi , even  ;message
      mov rdx, 5  ;count
      syscall
  
      mov rax, 60 ;exit
      mov rdi, 0  ;code 0
      syscall
  </code></pre>
  <p>No matter what, it always says the number is even. even if there is no input. However, if i hardcode the value in eax at line 18, it works perfectly fine. what am i doing wrong? How may i fix this?</p>
  <p>compiled with <code>nasm -felf64</code></p>