Re: A92: Arrays.
[Prev][Next][Index][Thread]
Re: A92: Arrays.
Ok. Say you want a 10x15 array of words. Then since it's 10x15 words, it's
150 words. So you could do something like this:
array dc.w 150
I believe you can also say:
array dc.w 10*15
but I'm not sure.
Now, if you've ever programmed in C, you've seen that the indexes in an array
begin at zero. So the first dimension of the array goes 0 to 9 and the second
goes 0 to 14. There is a reason for this. To find out the data at 5,6 you
add the base address of array to 5*10 + 6, and then indirect through the
resulting address, just like you would at any other address. Now say you want
a 3d array, 10*15*20. To get the data at 2,7,1, you add the base address of
the array to 10*15*2 + 15*7 + 1 and indirect through the resulting address.
Feel free to email me back if you don't understand.