Question: Assembly Language (MIPS) please. Look at the code I have and modify it to meet the prompt please. Write a program that reads an array
Assembly Language (MIPS) please.
Look at the code I have and modify it to meet the prompt please.
Write a program that reads an array of 20 integers with an appropriate prompt, stores it, and then prints in two formats:
-a) All in integers in a single line in the reverse order separated by spaces.
-b) You program requests entering a positive integer n <=20 and then prints the 20 integers, n integers (separated by space) per line.
the following code:
.data
array: .space 80
newLine: .asciiz " "
Prompt: .asciiz " Enter an integer "
.text
main: li $t0, 20
la $t1, array
loopR: la $a0, Prompt
li $v0, 4
syscall
li $v0,5
syscall
sw $v0,0($t1) # storing the integer entered
add $t0,$t0,-1 # decrement the number of integers by one
add $t1,$t1,4 # load the address of the next integer
bgtz $t0,loopR # branch to read and store the next integer
li $t0, 20
la $t1,array
loopP: lw $a0,0($t1 )
li $v0,1
syscall
add $t0,$t0,-1
add $t1,$t1,4
la $a0, newLine# start a new line
li $v0,4
syscall
bgtz $t0,loopP
li $v0, 10
li $t0, 20
la $t1, array
syscall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
