Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in MIPS assembly langauge here is what i have so far: .data array: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

in MIPS assembly langauge
here is what i have so far:
.data
array: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
wel: .asciiz "Input a size between 2 and 11: "
err: .asciiz "Size is not between 2 and 11. "
enter: .asciiz "Enter a number: "
sorted: .asciiz "The string sorted is: "
sp: .asciiz " "
.text
main:
li $v0, 4
la $a0, wel #add for size
syscall
li $v0, 5 #get input
syscall
add $s0, $v0, $0 #save input to $s0
li $t0, 2 #set t0 to 2
li $t1, 11 #set t1 to 11
blt $s0, $t0, error #if input is less than 2, error
bgt $s0, $t1, error #if input is greater than 11, error
la $s2, array
add $a0, $s0, $0 #add input
jal make
make:
li $t0, 0 #set the counter to 0
add $t1, $a0, $0 #set the max for the counter
la $s2, array
mkAr:
beq $t0, $t1, fAr #When finished getting values, go to finish
li $v0, 4
la $a0, enter #display "Enter number" string
syscall
li $v0, 5 #Read the integer
syscall
sw $v0, 0($s2) #else, store the entered number into the array
add $s2, $s2, 4
add $t0, $t0, 1 #add 1 to the counter
j mkAr
fAr:
jr $ra #return to main
image text in transcribed
Arrays Each labs worth 10 points All lab work must be initiated during the lab hour and be completed during the lab hour.Only when additional time is required, the student may show the lab instructor his uncompleted work during the lab, then complete the lab work in the following day for 2 points off I. Write a program to find the largest element of an array, the array size should be less than or equal to 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions