title: Problems with inline assembly in visual studio c++
body: <p>I'm new to assembly and I decided to implement some simple functions for graphs using the inline assembly, I started with the constructor which is supposed to initialise all elements of the adjacency matrix to 0, but I don't understand what I did wrong</p>
  
  <pre><code>struct graph {
  int el[MAX_V][MAX_V];
  int noVert;
  int noEdges;
  bool directed;
  
  graph() {
      _asm {
  
      mov     ebx, 0
      mov     esi, MAX_V
      mov     edi, this
  START_L1:
      cmp     ebx, MAX_V
      je      END_L1
  
      mov     ecx, 0
      START_L2:
      cmp     ecx, MAX_V
      je      END_L2
  
      mov     eax, ebx
      imul    esi
      add     eax, ecx
      mov     [edi + eax*4], dword ptr 0
  
      inc     ecx
      jmp     START_L2;
      END_L2:
  
      inc     ebx
      jmp     START_L1
  END_L1:
  
      }
  }
  }
  </code></pre>
  
  <p>When I use the debugger I find that the int element of the <code>el</code> array that I'm updating contains a non zero value after this instruction is executed:</p>
  
  <pre><code>mov     [edi + eax*4], dword ptr 0
  </code></pre>
  
  <p>Why am I getting non-zero int value placed in the <code>el</code> array after this instruction? I'm expecting the integer at the index I am updating to be set to zero.</p>