Adding the sum of elements in a 2-dimensional array

husslela2's Avatar
Newbie Member
How do I add the elements in a two-dimensional array and return the sum into register $v0?

Thanks,
Husslela
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Here's the general procedure. A true array is contiguous in memory. Set the accumulator value ($v0, in this instance) to zero. Set an index register to the first element, add that element to the accumulator, increment the index, repeat for the entire length of the array (nRows * nColumns).
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
This may also help you to some extent. 8085 Assembly language programming code for beginners.