Question: Need MIPS CODE .data textout : .asciiz The program requests an input: .text main : # this is the start of the bit you're going
Need MIPS CODE

.data
textout: .asciiz "The program requests an input:"
.text
main:
# this is the start of the bit you're going to make into a called procedure
# print text, get an input
la $a0 textout
li $v0 4
syscall
li $v0 5
syscall
move $s0, $v0 #copy the first value to $s0
#print out some more text, read in another value
li $v0 4
syscall
li $v0 5
syscall
move $s1, $v0# move result into $s1
add $s2 $s0, $s1 #add $s1 and $s2
#end of bit you need to make into a called procedure
#done
li $v0 10
syscall
.data textout: asciiz "The program requests an input:" .text main: # this is the start of the bit you're going to make into a called procedure # print text, get an input la $a0 textout li Sy0 4 syscalt li $v0 5 syscalt move $50, $vo #copy the first value to $50 #print out some more text, read in another value li $0 4 syscalu li $v05 syscalt move $s1, $v0# move result into $s1 add $s2 $50, $sl #add $sl and $s2 #end of bit you need to make into a called procedure #done li $v0 10 syscast Lab completion for today: 1. Make the relevant portion above into a called procedure. This relevant portion' reads in two values ($s0 and $s1), and adds them up ($s2). So this procedure needs to push $so, $s1 and $s2 onto the stack, read in two values, add them up, and then restore those $50, $s1, and $s2 back to their original values).' To store values you need to get the stack pointer, then use sw to store the word To restore values you need to get the stack pointer, and load the value, in the correct order, into the right location .data textout: asciiz "The program requests an input:" .text main: # this is the start of the bit you're going to make into a called procedure # print text, get an input la $a0 textout li Sy0 4 syscalt li $v0 5 syscalt move $50, $vo #copy the first value to $50 #print out some more text, read in another value li $0 4 syscalu li $v05 syscalt move $s1, $v0# move result into $s1 add $s2 $50, $sl #add $sl and $s2 #end of bit you need to make into a called procedure #done li $v0 10 syscast Lab completion for today: 1. Make the relevant portion above into a called procedure. This relevant portion' reads in two values ($s0 and $s1), and adds them up ($s2). So this procedure needs to push $so, $s1 and $s2 onto the stack, read in two values, add them up, and then restore those $50, $s1, and $s2 back to their original values).' To store values you need to get the stack pointer, then use sw to store the word To restore values you need to get the stack pointer, and load the value, in the correct order, into the right location
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
