for(int i=initial;i<final;i++) {
population[p4].child[i] = population[p2].child[i];

The problem I have is I'm trying to change this to asm...

It's not the for loop that has me but how to select the specific structure...


can you do that in asm?

I usually do something like:

push esi
mov eax, OFFSET Population
mov esi, eax

push ecx

;Do calculations

add esi, SIZE GENE
pop ecx
inc ecx
cmp ecx, Howmanytimes
jnz @loop1

ASSUME esi:nothing

But in the example i need to know acess 2 separate structures and loop through them... how can this be done?

Posted on 2002-01-17 16:37:17 by Sliver
Didn't we do this dance before?

You can either maintain an index and multiply it by the size of the structure, or keep a running offset that you add the size of the array to it each loop. This value could be a local and just loaded when needed, or you could keep it in a register.
Posted on 2002-01-17 16:41:40 by bitRAKE
:) Ok, ok...

I actually thought about it and looked at the examples in the last program you helped me on... It just didn't click in...

I kept thinking I'd have to do two for loops storing the values of one forloop in a temporay array and the nrun another for loop and store the values into the other structure... obviously I'm very very silly..

Thanks bitRack for helping out again... Can't wait to show you the program when it's done...

Posted on 2002-01-18 00:56:39 by Sliver