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
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education