title: NASM x86-32 Linux, access specific byte from file descriptor
body: <p>I am trying to understand the world of Nasm assembly and I've been stuck getting access to a simple element in an Array. I've followed the tutorial at tutorialspoint:</p>
  
  <pre><code>section .text
  global _start
  
  _start:
  
      call openFileIn         ;open the org image
      call readFromFileIn     ;read the data
  
      ;call printBuffer
  
      ;call openFileOut       ;open output file
      ;call writeToFile       ;write the data in data
      ;call closeFileOut      ;close file
      ;call closeFileIn       ;close file
  
      MOV ecx, fd_in          ;store the pointer to the data      
      INC ecx                 ;increase the counter, i++
  
      MOV ebx, [ecx]          ;store the value of that adress
  
      CMP [testWord], ebx     ;I expect ebx to hold 0x00 (one byte size)
      JE printYay             ;If they are equal, print yay to shell
  
      MOV ecx, ebx            ;store value in ebx in a desperate attempt for
                              ;getting some insight of the value i've got
  
  
  
      ;print out first element in info
      ;1. put syscall sys_write to EAX
      ;2. put an argument in EBX
      ;3. put the data into ECX
      ;4. put the size of the segment in EDX
      ;5. call kernel 
      MOV eax, 4
      MOV ebx, 1
      ;MOV ecx, char
      MOV edx, 1
      int 0x80
  
     ;The value does not give me any character or symbol in bash when program
     ;is run
  
     call exitProg            ;exit process
  </code></pre>
  
  <p>I have displayed the code which I believe I do not understand, which is memory accessing in the registers. But if you want to view all the code with syntax highlights, please follow this link: <a href="https://pastebin.com/bL9WCv7L" rel="nofollow noreferrer">pastebin</a></p>
  
  <p>I compile with:
  <code>nasm -f elf &lt;filename&gt;</code></p>
  
  <p>Link with:
  <code>ld -m elf_i386 -s -o &lt;outputName&gt; &lt;objectFile&gt;</code></p>
  
  <p>You can find the files content I get when I read from file, <a href="https://pastebin.com/bL9WCv7L" rel="nofollow noreferrer">pastebin</a></p>