Question: please help. show your modified code below. do not copy and paste from chegg they are all wrong .. Modify this C2A2E3_StackDiagram.txt Recursive Stack Diagram

please help. show your modified code below. do not copy and paste from chegg they are all wrong ..

please help. show your modified code below. do not copy and paste

from chegg they are all wrong .. Modify this C2A2E3_StackDiagram.txt Recursive Stack

Diagram Rel Abs Stack Description Item Adr Adr Value Size ------------------------ startup

Modify this C2A2E3_StackDiagram.txt Recursive Stack Diagram

Rel Abs Stack Description Item Adr Adr Value Size ------------------------ startup -------------------------

---------------------------------------------------------- Sample Stack Diagram Rel Abs Stack Description Item Adr Adr Value Size ------------------------ startup ------------------------- BP+7h 93Ch 20AFh Function Return Address (7 bytes) BP 935h 0h Previous Frame Address (7 bytes) -------------------------- main -------------------------- BP+Eh 931h ?? Return Object (4 bytes) BP+7h 92Ah ?? Function Return Address (7 bytes) BP 923h 935h Previous Frame Address (7 bytes) BP-4h 91Fh ?? x (4 bytes) -------------------------- Ready ------------------------- BP+7h 918h 505h Function Return Address (7 bytes) BP 911h 923h Previous Frame Address (7 bytes) ------------------------- Recur 1 ------------------------ BP+Eh 90Dh 24 value (4 bytes) BP+7h 906h 104h Function Return Address (7 bytes) BP 8FFh 911h Previous Frame Address (7 bytes) ------------------------- Recur 2 ------------------------ BP+Eh 8FBh 12 y (4 bytes) BP+7h 8F4h 218h Function Return Address (7 bytes) BP 8EDh 8FFh Previous Frame Address (7 bytes) ------------------------- Recur 3 ------------------------ BP+Eh 8E9h 0 y (4 bytes) BP+7h 8E2h 218h Function Return Address (7 bytes) BP & SP 8DBh 8EDh Previous Frame Address (7 bytes) -----------------------------------------------------------

C2A2E3 (6 points - Table only - No program required) Figure 8 of note 12.4D and figure 5 of note 12.6C in the course book illustrate the final state of call stacks before any function returns have begun. Your task is to create a similar diagram in instructor-supplied text file C2A2E3_StackDiagram.txt to represent the operation of the program below. Assume: - Any necessary header files and prototypes are present. - " C " calling convention - short: 3 bytes, int: 6 bytes, long: 7 bytes, addresses(pointers): 8 bytes int main() f The "startup return 0 ; short ready() \{ ready(): int temp =gcd(125,50); long gcd(int x, short y) \{ if (y=0) return x; return gcd(y,x%y) : int main() The "startup" function calls main. Procedure and Requirements: Please refer to file C2A2E3_StackDiagram.txt while reading the following requirements. It contains: 1. A title block. 2. An empty stack diagram for your stack information. 3. A sample stack diagram (for a different program) that illustrates the required format and syntax. IMPORTANT: The assignment checker analyzes your diagram and provides an error report. If you do not use the required format and syntax, the report may be inaccurate and you could lose significant credit. 1. Modify the C2A2E3_StackDiagram.txt title block to contain your own information and add the following two-item "startup" stack frame to the empty stack diagram: BP+8hBP82Ch824h1017h0hFunctionReturnAddressPreviousFrameAddress(8bytes)(8bytes) 2. After reading the "Optional Suggestion" on the next page, complete the stack diagram by pushing items for any additional frames: a. There must be a dividing line before each frame that indicates the name of the function it represents. If the function is being used recursively, that name must be followed by a space and a number indicating the frame's recursive level. b. If a stack item represents a variable, place its name in the "Description" column. Continued on the next page... 3. Numeric values must be decimal or hexadecimal according to the guidelines below. Decimal values do not have a suffix while hexadecimal values must have an h suffix. a. The values of variables x and y and the number of bytes in each item must be decimal. b. All addresses must be hexadecimal. c. The BP offset values of relative addresses may be decimal or hexadecimal. 4. Use a double question mark for the values of: a. All return objects. b. Variables that are assigned values after a function returns. c. Values for which insufficient information is provided. 5. General formatting: a. "Hard" tab characters are not allowed. b. Columns must be aligned and there must be nothing between them but spaces. c. Do not number lines or add additional information. d. No line may exceed 80 columns. 6. Before submitting your modified C2A2E3_StackDiagram.txt file to the assignment checker, delete everything in it except your modified title block and completed stack diagram. Waypoints: Verifying the following can help you determine if there might be a problem: 1. There should be exactly 25 items on the stack. 2. There should be exactly 8 double question mark stack values. 3. The gcd function should have 3 stack frames, each containing 5 items. 4. The absolute address of the last item in the last stack frame should be 78E. Optional Suggestion: As each item is pushed onto the stack, I suggest only populating its "Description" and "Item Size" fields. Once this is complete, go back through the items again and populate just the "Abs Adr" field, then do it twice more for the "Rel Adr" and "Stack Value" fields. I recommend this order because the "Rel Adr" BP offset values depend upon values in other fields. The only downside of this approach is that slightly more effort is needed to align columns

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