Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 timesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started