P&H 3rd edition, read Chapter 6 through the end of 6.6.
In P&H 2nd edition, read Chapter 6 through 6.7.
add $3, $4, $2 sub $5, $3, $1 lw $6, 200($3) add $7, $3, $6
Implement a quad(a,b,c,x)
that computes the integer value ax2 + bx + c for integer arguments a, b, c, and x.
You should use the standard MIPS function calling- and register usage-conventions discussed in class and described in the book.
Then write a main program that calls your quad function several
times and prints out the result of each function call on a separate line. Optionally,
you can add labels and identifying text to the output, but this is not required.
See the example programs linked to the course calendar web page for some examples
of
how
to use the syscall
instruction to produce output. Appendix A of
the book has more information.
Your main program should call the quad
function three times
with the following parameter values, and print out the value returned.
a=3, b=5, c=2, x=5
a=1, b=-7, c=23, x=-6
a=7, b=9, c=-1, x=15
Hand in a printout of your code and the console output along with your answers to the written questions. You should also submit a copy of your program (only) online using this link to the online turnin page.