Question: the following subprogram sub 1 program is supposed to return the sum of two words in memory. But it has MAJOR problems. Please find and
the following subprogram subprogram is supposed to return the sum of two words in memory. But it has MAJOR problems. Please find and fix them. Copy the sub subprogram, modify this subprogram so that it correctly observe the MIPS register conventions and the use of the stack.
data
step: asciiz In Main
text
globl main
main:
a $a step #Print In Main"
li $v
syscall
Jal sub
exit:
li $v
syscall
# sub adds two words
the resuits, then jumps to sub
# There are MAJOR problems in this subroutine. I need you to
# fix them please.
text
sub:
lw $s word
lw $s word
add $t $s $s
jal sub
jr $ra
data
word: word
word: word
step: asciiz sub
# sub is good in every way. Please, please, do not change it sub:
# Print Step
la $ Step
li $
syscall
# Jump back to sub
jr $
data
step: asciiz In sub
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
