Question: Problem 7 : Reverse the Elements of an Array ( 1 5 Minutes ) Write an ARM assembly program that reverses the order of elements

Problem 7: Reverse the Elements of an Array (15 Minutes)
Write an ARM assembly program that reverses the order of elements in a given array of 20 integers. The original array should be
stored at the label numbers, and the reversed array should be stored at the label reversed_numbers.
Requirements:
1. Create an array numbers of 20 integers in the .data segment.
2. Create an empty array reversed_numbers to store the reversed elements.
3. Implement a loop to iterate through the original array (numbers) and store the elements in reverse order in
reversed_numbers.
4. Use the following instructions: LDR, STR, ADD, SUB, CMP, BNE.
5. Store the reversed array values in a new location and display the result by printing the values in the new array.
Example Input:
Original Array: 3,7,12,5,9,15,22,8,10,14,18,16,20,11,13,19,6,2,4,17
Expected Output:
Reversed Array: 17,4,2,6,19,13,11,20,16,18,14,10,8,22,15,9,5,12,7,3
Additional Task:
Identify any logical errors in your code and provide corrections.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!