Question: a. When a subroutine is called, what happens to the stack? b. What would happen if a subroutine changes the top value of the

a. When a subroutine is called, what happens to the stack? b.

 

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 mov.w #1, R10 mov.w # 4215h, R8; data 1 mov.w #38A6h, R9; data 2 push.w R8 push.w R9 call #subroutine pop.w R9 pop.w R8 jmp ending subroutine: ; subroutine adds value in R10 to data values on stack add.w add.w R10,2(SP) 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

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 Programming Questions!