Question

Use STACK for storing the return address for a procedure return of the following program given...

Use STACK for storing the return address for a procedure return of the following program given below. Show the contents of stack following each CALL and RETURN instructions:

Main Program

Memory Address

Instructions

6000H

-----

6050H

CALL Proc 1

----

6080H

CALL Proc 2

END

Procedure 1

Memory Address

Instructions

5000H

---

5060H

CALL Proc 2

RETURN

Procedure 2

Memory Address

Instructions

2000H

---

2030H

CALL Proc 3

-----

RETURN

Procedure 3

Memory Address

Instructions

3000H

RETURN

…..

Homework Answers

Answer #1

Greetings!!

Please note that the while returning the return address is taken from the top of the stack.

Hope this helps

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the program below The initial value of the Stack Pointer ESP = 0018 FF8C. What...
Consider the program below The initial value of the Stack Pointer ESP = 0018 FF8C. What is the value of the STACK POINTER (ESP) after each CALL instruction and each RET instruction below. INCLUDE Irvine32.inc .DATA .CODE main PROC mov ax,val1 call proc1 (1) ESP=____________(After the CALL) nop exit main ENDP proc1 PROC ;Begin Procedure nop call proc2 (2) ESP=____________(After the CALL) nop ret (3) ESP=____________(After the RET) proc1 ENDP proc2 PROC ;Begin Procedure nop call proc3 (4) ESP=___________(After the...
A program’s instructions are loaded into memory: From the stack pointer and loaded down in memory...
A program’s instructions are loaded into memory: From the stack pointer and loaded down in memory From the base pointer and loaded up in memory From a physical Page address and loaded up in memory On the IA32 stack and grows downward in memory Which of the following is a valid stack frame for a procedure call: a) Caller Function Stack Frame b) Caller Function Stack Frame c) Caller Function Stack Frame d) Caller Function Stack Frame argument1 argument2 argument2...
Given main() complete the Stack class by writing the methods push() and pop(). The stack uses...
Given main() complete the Stack class by writing the methods push() and pop(). The stack uses an array of size 5 to store elements. The command Push followed by a positive number pushes the number onto the stack. The command Pop pops the top element from the stack. Entering -1 exits the program. Ex. If the input is Push 1 Push 2 Push 3 Push 4 Push 5 Pop -1 the output is Stack contents (top to bottom): 1 Stack...
6. (True/False): The RET instruction pops the top of the stack into the instruction pointer. 8....
6. (True/False): The RET instruction pops the top of the stack into the instruction pointer. 8. (True/False): In protected mode, each procedure call uses a minimum of 4 bytes of stack space. 1. Which instruction pushes all of the 32-bit general-purpose registers on the stack? 20. What values will be written to the array when the following code executes? .data array DWORD 4 DUP(0) .code main PROC mov eax,10 mov esi,0 call proc_1 add esi,4 add eax,10 mov array[esi],eax INVOKE...
7. (True/False): Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator...
7. (True/False): Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator is used in the procedure definition. 15. What will be the final value in EAX after these instructions execute? push 5 push 6 pop eax pop eax 3. Which instruction pops the stack into the EFLAGS register? 17. Which statement is true about what will happen when the example code runs? 1: main PROC 2: mov eax,30 3: push eax 4: push 40 5:...
program has to be written in X86 processor assy language. Write a program that find the...
program has to be written in X86 processor assy language. Write a program that find the minimum number of coins that can represent an amount of money under $1. The amount of money is a random number between 0 and 99 (cents). The randomRange procedure is used to get a random number. Review the sample code in lab4.asm and run it to see how randomRange works. Each time randomRange is called, it creates a random number between 0 and the...
In assembly masm use the code below! Write a program that reverse a string using indirect...
In assembly masm use the code below! Write a program that reverse a string using indirect addressing (may not use the stack - push/pop). The string will be given by the user and be up to 64 characters long INCLUDE Irvine32.inc INCLUDE macros.inc MAX = 64 .data source BYTE MAX DUP('#'),0 destination BYTE LENGTHOF source DUP('*'),0 actual_length DWORD ? ask BYTE "Enter a String: ",0 .code main proc ; ask user for input mov edx, OFFSET ask call WriteString ;...
C program. Given the following code: int add_and_double(int a, int b) { int result = (a...
C program. Given the following code: int add_and_double(int a, int b) { int result = (a + b) * 2; return result; } int main() {   int val; val = add_and_double(12, 40); return 0; } where the function main() (i.e. the caller) calls the function add_and_double() (i.e. the callee). Which of the following actions are taken when main() calls the function add_and_double()?  Select all that apply. a. Once the callee returns, the caller frees the stack memory for the callee's function...
Use MIPS assembly language program to swap two of the integers in an integer array. The...
Use MIPS assembly language program to swap two of the integers in an integer array. The program should include the Swap function to swap the integers and the main function to call the Swap function. The main function should: • Pass the starting address of the array in $a0. • Pass the indices of the two elements to swap in $a1 and $a2. • Preserve (i.e. push onto the stack) any T registers that it uses. • Call the Swap...
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a...
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a program that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2). .386 .model flat,stdcall .stack 4096 ExitProcess PROTO,dwExitCode:DWORD .data    ; define your variables here .code main PROC    ; write your assembly code here    INVOKE ExitProcess,0 main...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT