I\'d appreciate any help! - write assembly language programs to: -perform arithm
ID: 3534997 • Letter: I
Question
I'd appreciate any help!
-write assembly language programs to:
-perform arithmetic on floating point numbers
-use syscall operations to display floating point numbers and strings on the console window
-use syscall operations to read floating point numbers from the keyboard.
Write a MIPS assembly language program which prompts for a user to enter eight floating point numbers and calls read_float to read in numbers and store them in an array. Then the program should sort the numbers in the array, and display their sorted array content on the console window.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. Here is one instruction that you might use:
c.lt.s $f2, $f4
bc1t Label1
Here if the value in the register $f2 is less than the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT less than the value in $f4, then it should be:
c.lt.s $f2, $f4
bc1f Label1
To load a single precision floating point number (instead of lw for an integer), you might use:
l.s $f12, 0($t0)
To store a single precision floating point number (instead of sw for an integer), you might use:
s.s $f12, 0($t0)
The following shows the syscall numbers needed for this assignment.
System Call System Call System Call
Number Operation Description
2 print_float $v0 = 2, $f12 = float number to be printed
4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string
6 read_float $v0 = 6; user types a float number at keyboard; value is store in $f0
8 read_string $v0 = 8; user types string at keybd; addr of beginning of string is store in $a0; len in $a1
Sample Output (User Input in Bold)
Enter a number:
3.2
Enter a number:
6.43
Enter a number:
-3.23
Enter a number:
4.32
Enter a number:
4.3
Enter a number:
-23.4
Enter a number:
-5.4
Enter a number:
3.0
The array contains the following:
-23.400000
-5.400000
-3.230000
3.000000
3.200000
4.300000
4.320000
6.430000
Explanation / Answer
No answer text found in this record.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.