Question: Write a function that adds the three numbers in $a 0 , $a 1 , $a 2 and prints something like: 2 + 7 +
Write a function that adds the three numbers in $a $a $a and prints something like:
assuming that and were the values in a to a
Your function should do the following:
compute the sum of a a a and store it in t
Print the value in a
Print a
Print the number in a
Print a
Print the value in a
Print an
Print the sum of the numbers that you put in t
Print a linebreak
Sample Output
data
plus : asciiz
equal : asciiz
linebreak : asciiz n
text
li $s
li $s
loopstart :
beq $s $s loopend
addi $s $s
addi $s $s
addi $s $s
move $a $s # function args go in a to a
move $a $s
move $a $s
jal printFun # then call our function
j loopstart
loopend :
li $v
syscall
printFun :
# your code goes down here
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
