Answered step by step
Verified Expert Solution
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started