Page 1 of 1

On MARS, write a MIPS assembly program that emulates an integer calculator. The numbers and symbols are entered from the

Posted: Thu May 05, 2022 1:35 pm
by answerhappygod
On MARS, write a MIPS assembly program that emulates an integer calculator. The numbers and symbols are entered from the console, and one for each line. For example, if you enter “14 / + / 6 / * / 3 / = /” (symbol “/” indicates next line), the calculator will output “32” on the console. Another example: “14 / % / 4 / = /” will generate “3 . . . . 2”. Other than the “+, -, *, %” (add, subtract, multiply, divide) at least, you can provide more operators in your calculator, such as sqrt, etc. The more sophisticated your calculator is, the higher your score will be.
Display how to use the calculator on the console right after the program starts, including the syntax and operators. Note that the end of the sequence is indicated by a “=”. Verify that the program is correct by simulation. Provide your comments in the beginning of the text file. The file should be named as studentid-midterm.s.
Submit the text file with programs to e-learning by the due day.
Bonus points: Provide another program studentid-midterm2.s that simply accepts one line for the input expression. For example, simply entering “14+6*3” will give you “32” in the next line on the console.