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 sub1program is supposed to return the sum of two words in memory. But it has MAJOR problems. Please find and fix them. Copy the sub1 subprogram, modify this subprogram so that it correctly observe the MIPS register conventions and the use of the stack.
.data
step1: .asciiz "In Main
"
.text
.globl main
main:
1a $a0, step1 #Print "In Main"'
li $v0,4
syscall
Jal sub1
exit:
li $v0,10
syscall
# sub1 adds two words
the resuits, then jumps to sub2.
# There are MAJOR problems in this subroutine. I need you to
# fix them please.
.text
sub1:
lw $s0, word1
lw $s1, word2
add $t1, $s0, $s1
jal sub2
jr $ra
. data
word1: .word 40
word2: .word 50
step2: .asciiz "In sub1"
# sub2 is good in every way. Please, please, do not change it. sub2:
# Print Step3
la $a0, Step 3
li $v0,4
syscall
# Jump back to sub1
jr $ra
. data
step3: .asciiz "In sub2"
the following subprogram sub 1 program is

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!