Question: answer2.asm include the following. create a file and paste them. #A?list is defined here .data my_array: .word 38, 3, 71, 16, 12, 4, 8, 1,

QUESTION 2 Assume that a list A (array A) of 10 integer numbers (each integer is 4-bytes) have been stored in memory (in consecutive memory locations). MIPS register $s0 holds the base address of this list and register $sl stores the size of the array. Please write a MIPS assembly code that reverses the list. For Example: If the original list is [1, 2, 3, 4,5, 6,7,8], It should be converted to [8, 7, 6, 5,4, 3, 2,1] Note: For this question, start with the code (answer2.asm) that has been provided to you with the assignment. This code defines a list, stores the base address of the list to the register $st0 and the size of the list to the register $s1answer2.asm include the following. create a file and paste them.

#A?list is defined here .data my_array: .word 38, 3, 71, 16, 12, 4, 8, 1, 18, 83 .text la $s0, my_array # based address of list loaded into $s0 addi $s1, $zero, 10 # $s1 is set to the size of the list

# Now you have the size and the base address of the list # You should be able to reverse the numbers in list # Continue to write your code here

QUESTION 2 Assume that a list A (array A) of 10 integer numbers (each integer is 4-bytes) have been stored in memory (in consecutive memory locations). MIPS register $s0 holds the base address of this list and register $s1 stores the size of the array. Please write a MIPS assembly code that reverses the list. For Example: If the original list is [1, 2, 3, 4, 5, 6, 7, 8], It should be converted to [8, 7, 6, 5, 4, 3, 2, 1] Note: For this question, start with the code (answer2.asm) that has been provided to you with the assignment. This code defines a list, stores the base address of the list to the register $s0 and the size of the list to the register $s1

Step by Step Solution

3.32 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To reverse the array in MIPS assembly we need to iterate through the array from both ends swapping e... View full answer

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!