Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MIPS assembly instructions 1) Modify the piece of code so it can add 3 numbers. 2). What modifications were needed to add the 3 numbers?

MIPS assembly instructions

1) Modify the piece of code so it can add 3 numbers.

2). What modifications were needed to add the 3 numbers?

-----MIPS Code-----

.data # variable declarations follow this line

.text # instructions follow this line

main:

## Code Part 1: Get first number from user, put into $t0.

ori $v0, $0, 5 # OUR CODE BEGINS HERE: load syscall read_int into $v0.

syscall # make the syscall.

addu $t0, $0, $v0 # move the number read into $t0.

## Get second number from user, put into $t1.

ori $v0, $0, 5 # load syscall read_int into $v0.

syscall # make the syscall.

addu $t1, $0, $v0 # move the number read into $t1.

add $t2, $t0, $t1 # compute the sum.

## Print out $t2.

addu $a0, $0, $t2 # move the number to print into $a0.

ori $v0, $0, 1 # load syscall print_int into $v0.

syscall # make the syscall.

ori $v0, $0, 10 # syscall code 10 is for exit.

syscall # make the syscall.

## end of add2.asm.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

What are the characteristics of a strong statement of cash flows?

Answered: 1 week ago

Question

KEY QUESTION Refer to the table in question

Answered: 1 week ago