Question: This problem explores two strategies for sequentially accessing the elements of a word array to implement an assembly language subroutine Total according to these specifications.
This problem explores two strategies for sequentially accessing the elements of a word array
to implement an assembly language subroutine Total according to these specifications.
Accepts a pointer to an array of signed words in register R
Accepts a word value in register R which indicates the number of array elements.
Returns the total, ie sum of array elements in register R
On return, preserves contents of all registers, other than return result register and PSR
a
Write an assembly language subroutine to implement Total as follows.
Use displacement mode addressing to access each element: R #
Manually update the array pointer to access the next element: ADDS R
Use a down counter to control iteration count from R down to
b Write an assembly language subroutine to implement Total as follows.
Use the autoincrement form of load multiple LDM to access each array element and
update the array pointer in one instruction.
Use a down counter to control iteration count from R down to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
