title: Indirect Addressing and Arrays
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>section .data
  matrix dw 1,2,3,4,5
         dw 6,7,8,9,10
         dw 11,12,13,14,15
         dw 16,17,18,19,20
         dw 21,22,23,24,25
  ;defined as word in order to be used in stack as well as ASCII representing numbers in 2 bytes(1 byte for each digit)
  
  msg db "The smallest value in this matrix is:",10
  msgL equ $-msg
  
  
  
  section .bss
  
  
  smallVal resw 2
  
  section .text
  global _start
  _start:
  
  mov edi, 0 ;will be used in order to indicate when end of matrix has been reached
  mov esi,0 ; will be used to indicate when end of row has been reached
  
  mov ecx, [matrix + edi +esi*2]</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am working on a program which takes a matrix and tries to find the smallest value in the matrix. I am very new to programming,only having started programming java for about 4 months now and am now learning ASM as well. My question is regarding indirect addressing. What would the following statement actually do [eax + edx](given any arbitrary value stored in eax and edx). According to a website I found it effectively finds the effective address, but I am not sure what this means. </p>
  
  <p>Thanks</p>
  
  <p>Thanks for the quick responses. My problem really lies in how indirect addressing works for registers. I have attached a code snippet to the top of this thread. My problem lies on the line mov ecx,[matrix+edi+esi*2]. I am not sure effectively what this line does.</p>