Question: Consider the following global variable declarations: Consider the following global variable declarations: A) Write the main program that will call the subroutine SUB and will
Consider the following global variable declarations:

Consider the following global variable declarations: A) Write the main program that will call the subroutine SUB and will pass data items DATA1 and DATA2 to that subroutine using "call-by-reference over the stack". The subroutine will pass back a 1-byte data item through "call-by-value in register". The main program will then store the data item passed back from the subroutine into RESULT (do not forget to initialize any crucial processor registers and to terminate your program correctly with an infinite loop.) B) Write the subroutine SUB that will retrieve the data items passed by the main program using "call-by-reference over the stack" (that you implemented in A) and pass the 1-byte sum of those data items through "call-by-value in register" back to the main program. The subroutine must not use the labels DATA1, DATA2, or RESULT. Also, make sure that the stack will not grow infinitely or will suffer from underflow in case the subroutine is called multiple times. Consider the following global variable declarations: A) Write the main program that will call the subroutine SUB and will pass data items DATA1 and DATA2 to that subroutine using "call-by-reference over the stack". The subroutine will pass back a 1-byte data item through "call-by-value in register". The main program will then store the data item passed back from the subroutine into RESULT (do not forget to initialize any crucial processor registers and to terminate your program correctly with an infinite loop.) B) Write the subroutine SUB that will retrieve the data items passed by the main program using "call-by-reference over the stack" (that you implemented in A) and pass the 1-byte sum of those data items through "call-by-value in register" back to the main program. The subroutine must not use the labels DATA1, DATA2, or RESULT. Also, make sure that the stack will not grow infinitely or will suffer from underflow in case the subroutine is called multiple times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
