Question: Code in assembly programming **MIPS** Write a program that reads an array of 20 integers with an appropriate prompt, stores it, and then prints in

Code in assembly programming **MIPS**

Write a program that reads an array of 20 integers with an appropriate prompt, stores it, and then prints in three formats: - One integer per line; -All integers in a single line separated by spaces; -All in integers in a single line in the reverse order separated by spaces, - You program requests entering a positive integer n =20>

.data

array: .space 80

newLine:.asciiz " " # I will use it to start a new line

space: .asciiz " " # I will use it to have a space

Prompt: .asciiz " Enter an integer: " .globl main

.text

main:

li $t0,20 # $t0 keeps track of the number of integers to be read

la $t1,array # loading the starting address of an array

loopQ:

la $a0,Prompt

li $v0,4

syscall

li $v0,5 # reading an integer

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,loopQ # branch to read and store the next integer

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!