Question

In MIPS, how would you add and multiply two integer numbers like 5 & 6 and...

In MIPS, how would you add and multiply two integer numbers like 5 & 6 and display on the screen?

Homework Answers

Answer #1
.data
   num1:  .asciiz "Enter first number: "
   num2:  .asciiz "Enter second number: "
   newline: .asciiz "\n"
   sum:   .asciiz "Sum of two numbers is "
   product: .asciiz "Product of two numbers is "

.text
   
   la $a0, num1
   li $v0, 4
   syscall
   
   li $v0, 5
   syscall
   
   addi $s0, $v0, 0
   
   la $a0, num2
   li $v0, 4
   syscall
   
   li $v0, 5
   syscall
   
   addi $s1, $v0, 0
   
   add $t0, $s0, $s1
   mul $t1, $s0, $s1
   
   la $a0, sum
   li $v0, 4
   syscall
   
   addi $a0, $t0, 0
   li $v0, 1
   syscall
   
   la $a0, newline
   li $v0, 4
   syscall
   
   la $a0, product
   li $v0, 4
   syscall
   
   addi $a0, $t1, 0
   li $v0, 1
   syscall
   
   la $a0, newline
   li $v0, 4
   syscall

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I would like you to do is create a console application that will either add, subtract...
I would like you to do is create a console application that will either add, subtract or divide two numbers. The Program will have four functions one to add, subtract, multiply and divide the two numbers. The user will enter the two number and the +, -, *, / symbol and the program will display the appropriate result.
(MIPS Assembly language) Ask user for two decimal numbers and save to memory (not registers). Multiply...
(MIPS Assembly language) Ask user for two decimal numbers and save to memory (not registers). Multiply these two numbers using adding and shifting only, not the "mul" instruction and print the product to the user as both a base-10 and base-32 (again, no using div/mul/rem). Save the output to a txt file. The program should run 5 times, with no user input needed to continue the program.    
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers....
PHP calculator problem Create a calculator class that will add, subtract, multiply, and divide two numbers. It will have a method that will accept three arguments consisting of a string and two numbers example ("+", 4, 5) where the string is the operator and the numbers are what will be used in the calculation. It doesn't need an HTML form, all the arguments are put in through the method. The class must check for a correct operator (+,*,-,/), and a...
For Java programming code: Write methods to add and multiply 1) Two integers 2) Two decimals...
For Java programming code: Write methods to add and multiply 1) Two integers 2) Two decimals 3) One integer and one decimal
In regards to intersections, how would I add the events A (2, 3, 4, 5) and...
In regards to intersections, how would I add the events A (2, 3, 4, 5) and B (2, 3, 6, 7)? I know that A *inverted u like an umbrella* B will be (2, 3) because A and B both have these numbers in common What, then, happens to the rest? like A (4, 5) and B (6, 7) ? Please express to me how to write this and also the difference between the *u* between two letters or the...
You are writing a silly calculator. First, you ask the user to enter an integer. Then...
You are writing a silly calculator. First, you ask the user to enter an integer. Then you ask them if they would like to know if that number is even, for it to be squared, or for it to be multiplied with another number. The user will input "even" "square" or "multiply" for these options, respectively. For this question, we do not provide pseudocode -- consult with the sample output to determine how your program should work specifically. linux3[6]% python3...
Roll two dice and multiply the numbers. What is the probability that the product is a...
Roll two dice and multiply the numbers. What is the probability that the product is a multiple of 6? Group of answer choices A.5/12 B.3/4 C.7/12 D.2/9
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci...
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and characterized by the fact that every number after the first two is the sum of the two preceding ones: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, … The sequence Fn of Fibonacci numbers is defined by the recurrence relation: Fn = Fn-1 + Fn with seed values F1 = 1 F2 = 1 For more information on...
Write a phython program to display a menu with the following options: (1) add, (2) subtract,...
Write a phython program to display a menu with the following options: (1) add, (2) subtract, (3) multiply, (4) divide (5) mod, and (6) do nothing. If the user enters something else (except 1-6), the program should display an error message. Otherwise, it should ask the user for two numbers, perform the calculation, and display the result.
Write a function that takes two integer inputs and returns the sum of all even numbers...
Write a function that takes two integer inputs and returns the sum of all even numbers between these inputs, and another function that takes two integer inputs and returns the sum of odd numbers between these inputs .In main function, the program will asks the user to enter two integer numbers and then passes them to these two functions and display the result of each of them.         [0.5 mark] (BY USING C PROGRAM)
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT