Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

.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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions