Question

1. Rewrite this program (program #1 from last Labwork Assignment) to conform with the calling/callee standards...

1. Rewrite this program (program #1 from last Labwork Assignment) to conform with the calling/callee standards as presented in call. Write a calling program that invokes your program that conforms to the standards as well

Write a MIPS program using a loop that multiplies two positive numbers by using repeated addition. For example, to multiply 3 x 6, the program would add 3 six times, or 3+3+3+3+3+3.

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

.data
msg1:   .asciiz "Enter number1: "
msg2:   .asciiz "Enter number2: "
msg3:   .asciiz "Result: "
.text
main:

   #print msg1
   li $v0,4   #print string syscall value is 4
   la $a0,msg1   #load address of msg1 to $a0
   syscall
   #read integer
   li $v0,5   #read integer syscall value is 5
   syscall       #read value stored in $v0
   move $t0,$v0
   #print msg2
   li $v0,4   #print string syscall value is 4
   la $a0,msg2   #load address of msg2 to $a0
   syscall
   #read integer
   li $v0,5   #read integer syscall value is 5
   syscall       #read value stored in $v0
   move $t1,$v0
   li $t3,0
loop:
   # add $t2 and $t0,result stores in $t2
   add $t2,$t2,$t0
   # add $t3 and 1,result stores in $t3
   addi $t3,$t3,1
   # branch for less than,if $t3 less than $t1,jump to label loop
   blt $t3,$t1,loop  
   #print msg3
   li $v0,4   #print string syscall value is 4
   la $a0,msg3   #load address of msg3 to $a0
   syscall

   #print counter
   li $v0,1   #print integer syscall value is 1
   move $a0,$t2   #copy value in $t2 to $a0
   syscall
   #terminate the program
   li $v0, 10 #terminate the program syscall value is 10
   syscall

data msg1: msg2: msg3: .text main: asciiz Enter number1: asciiz Enter number2: asciiz Result: #print string syscallEnter numberl: 3 Enter number2: 6 Result: 181

Add a comment
Know the answer?
Add Answer to:
1. Rewrite this program (program #1 from last Labwork Assignment) to conform with the calling/callee standards...
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
  • textbook solution does not appear correct. Write a MARIE program using a loop that multiplies two...

    textbook solution does not appear correct. Write a MARIE program using a loop that multiplies two positive numbers by using repeated addition. For example, to multiply 3 × 6, the program would add 3 six times, or 3 + 3 + 3 + 3 + 3 + 3.

  • Can someone carefully explain and answer questions 1, 2, 3, 4 and 5 in detail, please!!! Multiplication can be thought...

    Can someone carefully explain and answer questions 1, 2, 3, 4 and 5 in detail, please!!! Multiplication can be thought of as repeated addition. Three times four is 4 added to itself 3 times. 1) Create an assembly program that multiplies two 8 bit integers (2's complement) together in your PIC, using the repeated summation technique 2) Add a feature to your program that detects if the answer is too big to hold in 8 bit 2's complement notation 3)...

  • Can someone carefully explain and answer questions 1, 2, 3, 4 and 5 in detail, please!!!...

    Can someone carefully explain and answer questions 1, 2, 3, 4 and 5 in detail, please!!! Multiplication can be thought of as repeated addition. Three times four is 4 added to itself 3 times. 1) Create an assembly program that multiplies two 8 bit integers (2's complement) together in your PIC, using the repeated summation technique 2) Add a feature to your program that detects if the answer is too big to hold in 8 bit 2's complement notation 3)...

  • CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1....

    CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1. Create a program named printRandomNumbers that gets input from the user and then produces a list of random numbers. 2. Import the random module 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description c. Programmer's Name (You) 4. Prompt the user for the following: a. Number of random numbers required b. Lower limit of...

  • Using c++ 1 of 2 Assignment 5 Lab Section 3 write a program create a vector...

    Using c++ 1 of 2 Assignment 5 Lab Section 3 write a program create a vector with random numbers. Use merge sort to reorder the vector Prompt user to enter a number to search in the vector. If there are more than one number in the vector equal to the search value, display the indices remove the repeated numbers. If found just one matching number, display the index. If no matching number, prompt user for 2 options: add to the...

  • 21 Write a program that asks the user to input the length and breadth of a...

    21 Write a program that asks the user to input the length and breadth of a soccer field, and then computes and returns the number of square meters of grass required to cover the field The formula for the area is the product of length and breadth (5) 22 The following program uses the break statement to terminate an infinite while loop to print 5 numbers Rewrite the program to use a while loop to display numbers from 1 to...

  • Python Help Create a program that outputs a table from 1 to 5 using what you've...

    Python Help Create a program that outputs a table from 1 to 5 using what you've learned about "for" loops. Your program will print the number and indicate if the number is odd or even. If it is not odd you will multiply 2 numbers with it: number 1 and number 2. Your program must do the multiplication for only even numbers in the table. The output of your program should look like the figure below. Hint: Create a program...

  • Can somebody help me with this assignment. I will highly appreciate. Also, please display the output...

    Can somebody help me with this assignment. I will highly appreciate. Also, please display the output as well. I need to use JAVA to to write the program. This is the sample output provided by my professor. HOME WORK: due 09.17.2019 (Rational Numbers) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class. Use integer variables to represent the private instance variables of the class- the numerator and the denominator. Provide a constructor...

  • 1.You are to write a program name search.java that will do the following: 2.You are to...

    1.You are to write a program name search.java that will do the following: 2.You are to create 3 arrays - prompt the user for a number that is greater than 100 that will serve as the size for the arrays (all 3 arrays will have the same user input size). Call them A, B & C. 3.Generate this amount of random numbers to fill these arrays – the random numbers must range from 1 to 99. 4.Write 1 sequential search...

  • C++ For this assignment you will be building on the Original Fraction class you began last...

    C++ For this assignment you will be building on the Original Fraction class you began last week. You'll be making four major changes to the class. [15 points] Delete your set() function. Add two constructors, a default constructor that assigns the value 0 to the Fraction, and a constructor that takes two parameters. The first parameter will represent the initial numerator of the Fraction, and the second parameter will represent the initial denominator of the Fraction. Since Fractions cannot have...

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