Question: # Program: mlQuadratic.asm # Author: *********** # Date: ***** # Purpose: Practice floating point calculations #---------------------------------------------------------------- # Create assembler for the Quadratic solving # #include

# Program: mlQuadratic.asm

# Author: ***********

# Date: *****

# Purpose: Practice floating point calculations

#----------------------------------------------------------------

# Create assembler for the Quadratic solving

# #include

# #include

# using namespace std;

#

# 2x^2 -8x - 24 = 0

#

# -b +- SQR( b^2 - 4ac)

# x = ---------------------

# 2a

#

# x = 6.0, -2.0

#

# void main()

# {

# float a = 2.0, b = -8.0, c = -24.0;

# float sqroot = sqr( b*b - 4*a*c );

# float root1 = (-b + sqroot)/2*a;

# float root2 = (-b - sqroot)/2*a;

# cout << "Root1:\t" << root1 << endl;

# cout << "Root2:\t" << root2 << endl;

# }

# OUTPUT:

# Root1: 6

# Root2: -2

# THIS IS THE EXAMPLE OF WHAT THE CODE SHOULD DO IN C++ ABOVE

.data

.eqv SYS_PRINT_FLOAT 2 #float

.eqv SYS_PRINT_TEXT 4 #text (zero terminated)

.eqv SYS_EXIT 10 #terminate

endl: .asciiz " "

lblRoot1: .asciiz "Root1:\t"

lblRoot2: .asciiz "Root2:\t"

a: .float 2.0

b: .float -8.0

c: .float -24.0

mytwo: .float 2.0

myfour: .float 4.0

.text

.globl main

main:

#ANSWER THIS PORTION PLEASE in MIPS Assembly------------------

#

# Get Determinate: b^2 - 4ac into $f0(THIS).

#

#get square root(THIS).

jal sqrt #f0 input; f1 output

#

# plus root in $f0(THIS).

#-b + sqrt(b^2 - 4ac)

# /2a

#

# minus root in $f1(AND THIS).

#-b - sqrt(b^2 - 4ac)

# /2a

#

#END HERE -------------------------------------

# PRINT root1 in $f0

li $v0, SYS_PRINT_TEXT

la $a0, lblRoot1 #label

syscall

li $v0, SYS_PRINT_FLOAT #print

mov.s $f12, $f0

syscall

li $v0, SYS_PRINT_TEXT

la $a0, endl #endl

syscall

# PRINT root2 in f1

li $v0, SYS_PRINT_TEXT

la $a0, lblRoot2 #label

syscall

li $v0, SYS_PRINT_FLOAT #print

mov.s $f12, $f1

syscall

li $v0, SYS_PRINT_TEXT

la $a0, endl #endl

syscall

#------------------------

# terminate program.

li $v0, SYS_EXIT # call code for terminate

syscall # system call

#.end main

The bolded parts of the code that are commented out is there to describe what is being done and what to solve in the program its asking to make a quadratic solver in MIPS assembly using a float point technique like the commented c++ code is showing. The example outputs a 6, and -2. Please fill in the code so that it does what the comments are explaining in c++ but in MIPS code. The section needing to be solved is marked by #ANSWER THIS PORTION PLEASE IN MIPS ASSEMBLY
and
#END HERE.
That section is all.

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 Databases Questions!