Question

Given the following psuedocode, write the appropriate prolog in assembly for the method mysub usin frame-based linkage. main) 9) int a; a = mysub( 6 ); print( a ); int mysub( int arg) int b,c; b= arg*2; c=b+7; return cAssembly Language

0 0
Add a comment Improve this question Transcribed image text
Answer #1

9)1 .text 2 add Ste,zero,6 // unction 3 jal mySub //call function 4 move $a0,St1 //store return value to ae 5 li Sve,1 //call p

OUTPUT: 19

Source code ::

.text
add $t0,$zero,6 //set parameter for function
jal mySub //call function
move $a0,$t1 //store return value to a0
li $v0,1 //call print int method
syscall  
li $v0,10 //stop execution
syscall
mySub : //function
mul $s0,$t0,2 // b = arg*2
add $t1,$s0,7 //c = b+7
jr $ra

Add a comment
Know the answer?
Add Answer to:
Assembly Language Given the following psuedocode, write the appropriate prolog in assembly for the method mysub...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT