Question: 4.5.4 Summing an Integer Array Theres hardly any task more common in beginning programming than calculating the sum of the elements in an array. In
4.5.4 Summing an Integer Array Theres hardly any task more common in beginning programming than calculating the sum of the elements in an array. In assembly language, you would follow these steps:
1. Assign the arrays address to a register that will serve as an indexed operand.
2. Initialize the loop counter to the length of the array.
3. Assign zero to the register that accumulates the sum.
4. Create a label to mark the beginning of the loop.
5. In the loop body, add a single array element to the sum.
6. Point to the next array element.
7. Use a LOOP instruction to repeat the loop.
The Array you declare in your program should contain AT LEAST TEN WORD-TYPE ELEMENTS.
THE SUM must be stored in a Memory.
THE ORIGINAL ARRAY and the SUM MUST BE PRINTED!
book: assembly language for x86 processors pg 126
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
