title: how to sum two matrices element by element?
body: <p>I am new to assembly and I would be grateful if you would help me with a piece of code on how to add two matrices and move the result in another matrix, in assembly language x86-32bit. The matrices are declared as 1d arrays.</p>
  
  <pre><code>n dd 9
  A dd 1,2,3,4,5,6,7,8,9
  B dd 2,0,4,5,6,7,0,1,3
  sum dd dup 9(0)
  </code></pre>
  
  <p>I tried the code below, but it only works for matrices declared like that and I would need one to work for a matrices declared as 1s array.</p>
  
  <pre><code>A db 1,2,3
     db 4,5,6
  B db 7,8,9
     db 10,11,12
  .code
  start:
  mov eax , 0 
  mov esi, 0 
  mov ebx, 0 
  
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
  mov al, 0
  inc esi
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
  mov al, 0
  inc esi
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
  
  mov al, 0
  mov esi, 0
  add ebx, 3 
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
  mov al, 0
  inc esi
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
  mov al, 0
  inc esi
  add al, A[ebx][esi]
  add al, B[ebx][esi]
  mov A[ebx][esi], al
   push 0
  call exit
  end start
  </code></pre>