Question
For a Computer Architecture and Organization class, we must create a calculator using MIPS/ Assembly language in which a user can add, subtract, multiply and
For a Computer Architecture and Organization class, we must create a calculator using MIPS/ Assembly language in which a user can add, subtract, multiply and divide two integers.
We must create different subprograms for:
do_add, do_sub, do_mult, do_div, a main, and also a do_math subprogram. The details are below. No algorithms... just assembly language if possible.
This is what I have so far for my main:
.data int_prompt: .asciiz "Please enter an integer: "
op_prompt: .asciiz "Please enter a character: "
#algorithm #prompt for into #read in into #prompt for op #read in op #prompt for 2nd int #read in int #call do_math
main: #prompt for integer li $v0, 4 la $a0, int_prompt syscall
li $v0, 5 syscall move $a1, $v0 #storing the first integer user inputs into the arg register
li $v0, 4 #informing assembler of.... la $a0, op_prompt syscall #prompt user to enter character
li $v0, 12 #we will be reading in operator character syscall move $a2, $v0
li $v0, 4 la $a0, int_prompt #prompt for second int syscall
li $v0, 5 syscall move $a3, $v0
File Editew Window Help Home Tools Project4Finalpdfx Sign In You have been put into a team that is working on a MIPS program that has six functions main, do_math, do_add, do_subtract, do_multiply, and do_divide The main function does the following 1. Print the following prompt message Please enter an integer: 2. Read an integer from user 3. Print the following prompt message Please enter an operator (+,,*, /): 4. Read a character from user 5. Print the following prompt message Please enter an integer: 6. Read an integer from user. 7. Call do_math. Pass the two integers and the operator using registers 8. Return 0 from main using jr (do not use the 'exi?' syscall) The do_math function takes as argument three registers and does the following 1. If the operator register contains '+', call do_add passing the two integers in registers and receiving the return values in two registers 03:37 PM 30 04/2018 Type here to searchStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started