Use the program below: Modify the program that will test whether or not the expression evaluates to a negative or positive number. This is in MIPS Assembly Language Sample OUTPUT: The output is 14 output is positive. THIS DOES NOT SHOW IN CODE #Evaluate the expression: 4x^2 - 8x + 2 .data prompt: .asciiz "Enter an input for x to evaluate 4x^2 - 8x + 2: " output: .asciiz "The output is " .text main: li$v0,4#output the prompt for user la$a0,prompt syscall li$v0,5#input the number and save it to $s0 syscall move $s0,$v0 #square the input #lw$t0, ($s0) mul$t0, $s0, $s0 #multiply by 4 mul$t0, $t0, 4 #multiply input by -8 #lw $t2, ($s0) mul $t2, $s0, -8 #add it all add$t0, $t0, $t2 add$t0, $t0, 2 li$v0,4#print the output label la$a0,output syscall li$v0,1#output the number that was entered move$a0,$t0#could also use lw $a0, $s0. Pseudo code syscall li$v0, 0xB #print newline, 0xB = 11 #which is the system call to print a single character la$a0, 0xA#0xA is the newline char syscall li$v0,10#exit program syscall
Use the program below: Modify the program that will test whether or not the expression evaluates to a negative or positive number. This is in MIPS Assembly Language Sample OUTPUT: The output is 14 output is positive. THIS DOES NOT SHOW IN CODE #Evaluate the expression: 4x^2 - 8x + 2 .data prompt: .asciiz "Enter an input for x to evaluate 4x^2 - 8x + 2: " output: .asciiz "The output is " .text main: li$v0,4#output the prompt for user la$a0,prompt syscall li$v0,5#input the number and save it to $s0 syscall move $s0,$v0 #square the input #lw$t0, ($s0) mul$t0, $s0, $s0 #multiply by 4 mul$t0, $t0, 4 #multiply input by -8 #lw $t2, ($s0) mul $t2, $s0, -8 #add it all add$t0, $t0, $t2 add$t0, $t0, 2 li$v0,4#print the output label la$a0,output syscall li$v0,1#output the number that was entered move$a0,$t0#could also use lw $a0, $s0. Pseudo code syscall li$v0, 0xB #print newline, 0xB = 11 #which is the system call to print a single character la$a0, 0xA#0xA is the newline char syscall li$v0,10#exit program syscall
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
Related questions
Topic Video
Question
Use the program below:
Modify the program that will test whether or not the expression evaluates to a negative or positive number.
This is in MIPS Assembly Language
Sample OUTPUT:
The output is 14
output is positive. THIS DOES NOT SHOW IN CODE
#Evaluate the expression: 4x^2 - 8x + 2
.data
prompt: .asciiz "Enter an input for x to evaluate 4x^2 - 8x + 2: "
output: .asciiz "The output is "
.text
main:
li$v0,4#output the prompt for user
la$a0,prompt
syscall
li$v0,5#input the number and save it to $s0
syscall
move $s0,$v0
#square the input
#lw$t0, ($s0)
mul$t0, $s0, $s0
#multiply by 4
mul$t0, $t0, 4
#multiply input by -8
#lw $t2, ($s0)
mul $t2, $s0, -8
#add it all
add$t0, $t0, $t2
add$t0, $t0, 2
li$v0,4#print the output label
la$a0,output
syscall
li$v0,1#output the number that was entered
move$a0,$t0#could also use lw $a0, $s0. Pseudo code
syscall
li$v0, 0xB
#print newline, 0xB = 11
#which is the system call to print a single character
la$a0, 0xA#0xA is the newline char
syscall
li$v0,10#exit program
syscall
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning