Question

In MIPS Create array of 11 float numbers, Call the procedures findLargestFloat, findSmallestFloat, and rangeFloat. Range...

In MIPS

Create array of 11 float numbers, Call the procedures findLargestFloat, findSmallestFloat, and rangeFloat. Range float is the difference between largest float and smallest float. Also, Create a recursive procedure to find the largest (call it findLargestRecursive), to find largest float in array

0 0
Add a comment Improve this question Transcribed image text
Answer #1

.data
max: .word 3
temp: .word 1
num: .space 96
input1: .asciiz "Enter a number:\n" #prints the statement
output1: .asciiz "The number that is repeated more often than any other is "
output2: .asciiz " with "
output3: .asciiz " repititions.\n"
output4: .asciiz "The array contains the following: \n"

.text

.globl main
main:
lw $t1, temp # loop counter
lw $t2, max # upper bound
la $t0, num # address of array

Loop:
# print input prompt
la $a0, input1
li $v0, 4   
syscall

# get value from the user
li $v0, 6
syscall

# move user provided value from $f0 to array
s.s $f0, 0($t0)

# move to the next position in the array, increment loop counter
addi $t0, $t0, 4
addi $t1, $t1, 1
ble $t1, $t2, Loop

# restore loop counter, and array address for printing
lw $t1, temp
la $t0, num

# print output prompt
la $a0, output4
li $v0, 4
syscall
print_loop:
# print number from the array
l.s $f12, 0($t0)
li $v0, 2
syscall

# print space
la $a0, 32
li $v0, 11
syscall

# increment loop counter and move to next value
addi $t1, $t1, 1
addi $t0, $t0, 4
ble $t1, $t2, print_loop

======================================================
Here is how it work

Enter a number:
2.3
Enter a number:
3.14
Enter a number:
5.55
The array contains the following:
2.3 3.14 5.55

Add a comment
Know the answer?
Add Answer to:
In MIPS Create array of 11 float numbers, Call the procedures findLargestFloat, findSmallestFloat, and rangeFloat. Range...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT