Question: Complete the following code runMathOper which takes an input ( character: + , - , * , / ) and runs the appropriate routine. (

Complete the following code "runMathOper" which takes an input (character: +,-,*,/) and runs the appropriate routine. (Assume that we already defined the functions "AddNumb", "SubNumb", and "MultNumb", etc. Hence, you don't need to worry about those functions.)
Unfortunately, we have some bugs in "runMathOper" function (procedure). Please complete the code.
bash
Copy code
.data OperTable: .word AddNumb # Each entry in the table consists of the ASCII math operator .word SubNumb # followed by the address (label) of the function to branch to .word MulNumb .word DivNumb .text Main: jal runMathOper # End of Main runMathOper: lb $t1,0($a0) # Input: Math Operation (+,-,*,/) # (Its not necessary to perform any error checking) sub $t1, $t1,43 # Adjust ASCII to perform operation la $t0, OperTable # Returns (using 32-bit instruction) the appropriate routine # address using $t0 to get the base address sll $t1, $t1,2 # Shift left by 2(multiply by 4 to get word offset)[Missing Instruction Here] jr $t0
(We have a MISSING INSTRUCTION here. Provide your answer in the following space to complete the code.)

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