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
(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...
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 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)
In Scala How would I turn an integer like 509 into a list like (5,0,9)
In Scala How would I turn an integer like 509 into a list like (5,0,9)
Write a program that takes n integer numbers from the user, and then counts the number...
Write a program that takes n integer numbers from the user, and then counts the number of even numbers and odd numbers and print them to the screen. Sample Output: Enter how many numbers you have: 10 Enter the 10 numbers: 1 3 19 50 4 10 75 20 68 100 The number of even numbers is: 6 The number of odd numbers is: 4 (( in java ))
1) Write a java programming using a while loop where you will add numbers and when...
1) Write a java programming using a while loop where you will add numbers and when you press number 0 it will add all your numbers and display the results. Use Scanner object. Steps: 1) Declare variables integer called sum which is equal to zero   2) Declare Scanner object   3) Declare while condition where is true   4) Inside of that condition prompt the user to enter the numbers   5) Declare variable integer called number and input the number statement   6)...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT