I have to write an assembly program that will find the minimum of array of ints (fed into the program from C as a pointer)
Can anyone tell me how to do it ? or at least how to store/access the array in assembler ?
Normally the variables are accessed by consecutive buffors e.g. :
subcc %i0, 2, %l0
but I don’t have a clue how to do it with arrays.
Rebember that in C expression
arr[i]is in fact equivalent to*(arr + i).To access value in array you need to calculate it’s address – it’s
arr + i * sizeof(int). Then you can useld,stinstructions to read or write.