Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. This problem explores two strategies for sequentially accessing the elements of a word array to implement an assembly language subroutine Count according to
2. This problem explores two strategies for sequentially accessing the elements of a word array to implement an assembly language subroutine Count according to these specifications. Accepts a pointer to an array of signed words in register R1. Accepts a word value in register R2, which indicates the number of array elements. Returns the number, (i.e., count), of nonzero array elements in register R0. On return, preserves contents of all registers, other than return result register and PSR. a. Write an assembly language subroutine to implement Count as follows. Use displacement mode addressing to access each element: [R1, #0]. Manually update the array pointer to access each element: ADDS R1,.... Use a down counter to control iteration (count from R2 down to 0). b. Write an assembly language subroutine to implement Count 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 R2 down to 0).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Below are the assembly language subroutines for implementing the Count subroutine using the specifie...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started