Question

Hi, I need help with this MIPS Problem. Thanks! (2 pts) Modify your program from exercise...

Hi, I need help with this MIPS Problem. Thanks!

(2 pts) Modify your program from exercise 1. Now, instead of having the variables x and y in your .data section, you should ask the user for two numbers. Each time you ask for a number, you should print:

Enter number: 

You should add the two numbers typed at the console and print the sum.

In this program, you'll need to make use of system calls 1, 4, and 5. I would recommend having a variable in your .data section for your prompt. It should be of type .asciiz.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

.data
   prompt:       .asciiz "Enter number: "
   output:       .asciiz "Sum: "
  
.text

   la $a0, prompt
   li $v0, 4
   syscall
  
   li $v0, 5
   syscall
  
   addi $t0, $v0, 0
  
   la $a0, prompt
   li $v0, 4
   syscall
  
   li $v0, 5
   syscall
  
   add $t0, $v0, $t0
  
   la $a0, output
   li $v0, 4
   syscall
  
   addi $a0, $t0, 0
   li $v0, 1
   syscall


Enter number 4 Enter number: 8 Sum: 12 program is finished running (dropped off bottom)

Add a comment
Know the answer?
Add Answer to:
Hi, I need help with this MIPS Problem. Thanks! (2 pts) Modify your program from exercise...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT