Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment has several questions. Each question will be weighted differently. Recall that stack is used for many purposes, among the most important is to
This assignment has several questions. Each question will be weighted differently. Recall that stack is used for many purposes, among the most important is to store return addresses for procedures and interrupts. A far procedure requires that the contents of both the code segment and instruction pointer are pushed onto the stack when the execution passed to the procedure (the RET instruction pops the two values on the top to the stack into the registers). A near procedure requires only the contents of the instruction pointer to be pushed (and then subsequently popped off the stack into the instruction pointer upon execution of the RET instruction). Consider a modular assembly program with multiple procedures. Assume the main code procedure is in a segment with CS = 0x1200. Then, assume the following procedure CALL and RET statements are executed: a. The MAIN procedure calls NEAR procedure PROC1-the offset of the next instruction CALL PROC1 instruction) is at offset is 500H b. PROC1 then calls NEAR procedure PROC2 - the address of the instruction after the CALL PROC2 instruction is 0x06A0H. c. PROC2 then calls FAR procedure PROC3-the address of the instruction after the CALL PROC3 instruction is 0xFE40H. d. Return from PROC3 to PROC2 e. PROC2 now calls NEAR procedure PROC4-the address of the instruction after the CALL PROC4 instruction is 0x09E3H f. Return from PROC4 to PROC2 g. PROC2 returns h. PROC1 returns Draw a diagram to show the contents of the stack before and after each CALL or RET instruction is executed, assuming that all stack activity arises from the calls and returns described above
Step 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