title: Read 16 bits from memory in Assembly x86 NASM
body: <p>I'm trying to do a very simple exercise in assembly: sum N numbers located in contiguous memory cells. This is my actual code:</p>
  
  <pre>global _start 
  section .data
  
          array: DD 300,10,20,30,40,50    ; Allocate the numbers
          arrayLen: EQU $-array           ; Get the quantity of numbers 
  
  section .text
          _start:
  
          mov ecx, 0                       ; The counter
          mov ebx, 0                       ; The Accumulator
  
  loop:   add ebx, DWORD [array+ecx]        ; get the i-th word  and add it to the accumulator
          add ecx, 4
          cmp ecx, arrayLen
          jne loop
  
          mov eax, 1
          int 0x80
  </pre>
  
  <p>The program is compiled and executed correctly but returns an incorrect value. The result should be 450, instead I obtain 194.</p>
  
  <p>I noticed that 194 is the the same bitstream as 450, but the 9th bit is omitted.
  Debugging my program I argued that for some reason, that I can't understand, when I read </p>
  
  <pre>[array+ecx]</pre>
  
  <p>It reads only 8 bits although I specified the keyword DWORD.</p>
  
  <p>Can someone help me?
  Thanks in advance</p>