title: Invalid use of register error when using inc with esi
body: <p>I have the following assembly code : <br></p>
  <pre><code>.data
  string_2 BYTE &quot;Please enter the name of the file:&quot;,0
  filename    BYTE 80 DUP(0)
  fileHandle  HANDLE ?
  byteCount DWORD ? ; holds counter
  buffer BYTE BUFFER_SIZE DUP(?)
  freq_array dw 256 dup(0) ;ARRAY OF FREQUENCIES OF EACH ASCII CHARACTER. 
  
  
  .code
  mov edi,OFFSET buffer 
  mov ecx,LENGTHOF buffer
  
  L1: 
  mov  esi, offset freq_array
  mov  al, [edi] 
  mov  ah, 0       
  shl  ax, 1            
  add  si, ax  
  inc  [ word ptr esi ]
  add edi,TYPE BYTE 
  loop L1
  </code></pre>
  <p>The buffer contains the content of a text file read in as a string. I have tested that part.
  So not putting it here. I am getting the error <code>invalid use of register</code> at the line
  <code>inc  [ word ptr esi ]</code>. How do I resolve that?</p>