title: NASM - How to make array of struct pointers and access them
body: <p>so my problem is this:
  I have struct called vertex</p>
  
  <pre><code>struc vertex
    .x  resq 1
    .y  resq 1
    .z  resq 1
  endstruc
  </code></pre>
  
  <p>I want to make an array of pointers to the structs made of that definition. Like loading vertices form file and saving them in the structs and the pointers in the array so I can access them later.
  Any ideas?</p>
  
  <p>The only idea I have is use something like this:</p>
  
  <pre><code>modelVertices resb vertex_size*100
  </code></pre>
  
  <p>Make this huge "array" of all vertices and acess it like</p>
  
  <pre><code>[modelVertices+i*vertex_size]
  </code></pre>
  
  <p>where i is which vertex I want to access, how would I access the vertex elements then? 
  I am not sure now but the struct size isn't exactly just elem1_size+elem2_size... right? So I cannot access them just by adding the size of element to get to the next one no?</p>
  
  <p>Is there any common way how to achieve this?</p>
  
  <p>Thanks in advance and have a nice day</p>
  
  <p>EDIT:
  I tried this </p>
  
  <pre><code>[modelVertices + vertexNumber*vertex_size + vertex.x]
  </code></pre>
  
  <p>To read the x of vertexNumberth vertex, I understand that assembly allows me to do almost everything with the memory so it works but is this correct usage?</p>