Question: 4. subroutine (10 pts) [MSP430 Microcontroller Basics, section 4.6] a. When a subroutine is called, what happens to the stack? b. What would happen if
![4. subroutine (10 pts) [MSP430 Microcontroller Basics, section 4.6] a. When](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39a300c560_75166f39a2f853b9.jpg)
4. subroutine (10 pts) [MSP430 Microcontroller Basics, section 4.6] a. When a subroutine is called, what happens to the stack? b. What would happen if a subroutine changes the top value of the stack? c. What instruction enters a subroutine? d. What instruction returns from a subroutine? e. How do you pass parameters to a subroutine? .text #1, R10 #4215h,R8; #38A6h,R9; mov.W data data 1 2 push.w R8 push. R9 call pop.w pop.w #subroutine R9 R8 ending subroutine: ; subroutine adds value in R10 to data values on stack add.W R10,2(SP add.w R10,4(SP) ret ending: jmp ; infinite loop to end program f. In this program, why are 2(SP) and 4(SP) used to address the values on the stack? g. In this program, how were parameters passed to the subroutine
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
