Question
ARM ASSEMBLY. PLEASE LOOK AT STARTER CODE. I KEEP GETTING INCORRECT ANSWERS ARM Assembly - In this exercise you are going to use the system
ARM ASSEMBLY. PLEASE LOOK AT STARTER CODE. I KEEP GETTING INCORRECT ANSWERS ARM Assembly - In this exercise you are going to use the system stack, and the PUSH and POP directives to copy an array and reverse the elements. You are given starter code in PA4-2.s that sets up the two arrays, inArray, and outArray. inArray has data in it set up using DCD, and outArray is an empty array of 10 words created using the FILL directive. Heres what your code needs to do: Create a loop that reads each value inArray and pushes it on the stack using PUSH. Create a second loop that reads each value of the stack using POP and puts each value into subsequent locations in outArray. If you do this correctly, you will see the values in outArray will be in the opposite order from the inArray. There are many ways to accomplish this, but for this exercise you must use the the system stack with PUSH and POP to perform the reversal.
;;; Starter code for PA4-2. ;;; Your header comments go here ;;; inArray DCD 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ; input array outArray FILL 40 ; empty result array
code MOV R0, #10 ; number of items in array MOV R1, R0 LDR R2, =inArray ; address of input array in R2 LDR R3, =outArray ; address of output array in R3 ; Your code begins here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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