Question

What will the stack contain before INVOKE ExitProcess get executed? 1: main PROC 2: push 10...

What will the stack contain before INVOKE ExitProcess get executed?

1: main PROC

2: push 10

3: push 20

4: call Ex2Sub

5: pop eax

6: INVOKE ExitProcess,0

7: main ENDP

8:

9: Ex2Sub PROC

10: pop eax

11: ret

12: Ex2Sub ENDP

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1: main PROC

2: push 10 // 1. in satck 10

3: push 20 // 2. in satck 20 10

4: call Ex2Sub // 3. call Ex2Sub so compiler jump to the function

5: pop eax // 7. poped 10 so stack is empty

6: INVOKE ExitProcess,0

7: main ENDP

8:

9: Ex2Sub PROC // 4. exicute Ex2Sub

10: pop eax // 5. in satck 10 because 20 poped prom stack

11: ret // 6. return to calling function

12: Ex2Sub ENDP

// stack is empty before INVOKE ExitProcess get executed . i give the sequence of exicution

Add a comment
Know the answer?
Add Answer to:
What will the stack contain before INVOKE ExitProcess get executed? 1: main PROC 2: push 10...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Remember to use step into when tracing a procure's call Convention el proc program mple1 Problem ...

    Write full code in microsoft virtual studio ASM only Remember to use step into when tracing a procure's call Convention el proc program mple1 Problem 2: Write and run the following program. Will the program crash? Why? push 6 push 5 call addtwo add esp,4 comment this line and see what happen ret example1 endp C Calling Convention main proc call example1 add al, 1 invoke ExitProcess, e main endp addtwo proc push ebp mov ebp,esp mov eax, [ebp+12] add...

  • Assembly MASM x86 Write a complete program that sorts dword unsigned integer array in descending order....

    Assembly MASM x86 Write a complete program that sorts dword unsigned integer array in descending order. Assume that the user doesn’t enter more than 40 integers. You MUST use the template and follow all the directions there. You can’t add any more procedures to the template. The procedures can’t use any global variables (variables that are inside .data segment). The caller of any procedures sends its argument through the stack. Inside any procedures, if you need to use a register,...

  • Write a program that turns a 32-bit numeric value (e.g., 0xFFFFh) and converts it to a...

    Write a program that turns a 32-bit numeric value (e.g., 0xFFFFh) and converts it to a byte array such that it can be printed to the screen using a system call method. A loop is necessary for converting the numeric value to ASCII for output. Again, use a system call (e.g., int 80h) to print the value to the console. Calling external functions (e.g. printf) is not allowed. You may use the starter file attached to this assignment. PLEASE WRITE...

  • 6 (10 points) What are incorrect in the following assembly program? 1 AREA myCode, CODE EXPORT...

    6 (10 points) What are incorrect in the following assembly program? 1 AREA myCode, CODE EXPORT main main PROC 4 PROC sum 5 6 ENDP 7 8 ENDP 9 END 10 AREA myData, DATA myStr DCB "mid term" DCD 1,2,3,4,5 11 12 13 Please point out the line number of the incorrect code and give correct ones. 23 6 (10 points) What are incorrect in the following assembly program? 1 AREA myCode, CODE EXPORT main main PROC 4 PROC sum...

  • Consider the following C code which implements a stack; int data[100]; int sp=0; void push(int n)...

    Consider the following C code which implements a stack; int data[100]; int sp=0; void push(int n) {data[sp++}=n;} int pop() {return(data{data[--sp]);} For the following questions, show the contents of the data array, as well as the value of sp, in the spaces provided (after all the shown instructions are executed). If the contents are unpredictable, indicate this with "?" Assume the statements are executed in order, i.e., the statements in part (b) are executed after the statements in (a) and so...

  • 6 (10 points) What are incorrect in the following assembly program? 1 AREA myCode, CODE EXPORT...

    6 (10 points) What are incorrect in the following assembly program? 1 AREA myCode, CODE EXPORT main main PROC 4 PROC sum 5 6 ENDP 7 8 ENDP 9 END 10 AREA myData, DATA myStr DCB "mid term" DCD 1,2,3,4,5 11 12 13 Please point out the line number of the incorrect code and give correct ones. 23

  • 9. Consider the code below. At the location indicated by “RIGHT HERE”, what does the stack...

    9. Consider the code below. At the location indicated by “RIGHT HERE”, what does the stack currently look like? Please draw a picture. Where will ESP and EBP currently be pointing? Add these pointers to your picture. main: push 13 push 17 call func_a add esp, 8 ret func_a: push ebp mov ebp, esp sub esp, 12 mov DWORD [ebp – 4], 19 mov DWORD [ebp – 8], 23 ; <-- RIGHT HERE. Draw a picture ; What does the...

  • Design a stack class by importing the available java.util.Stack to have the following features: push(x) --...

    Design a stack class by importing the available java.util.Stack to have the following features: push(x) -- push element x onto stack, where x is anywhere between Integer.MIN_VALUE and Integer.MAX_VALUE. pop() -- remove the element on top of the stack. top() -- get the top element. getMax() -- retrieve the max element in the stack in constant time (i.e., O(1)). Your code should have the following shape and form, all in one .java file. Note the styling and documentation API already...

  • Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF...

    Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1.    Give the new contents of AL after each of the following instructions is executed.    Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH.    Show the contents of BX and CX after...

  • C++ Carefully review Program 19-2 in your textbook, MathStack. This is a static stack, meaning that the size of the stack is set at the beginning of the program (see line 11): MathStack stack(5). I wo...

    C++ Carefully review Program 19-2 in your textbook, MathStack. This is a static stack, meaning that the size of the stack is set at the beginning of the program (see line 11): MathStack stack(5). I would like you to modify this program as follows: 1. Implement it as a dynamic stack (do not use a static stack as it is designed in the book). Use a linked list to implement this. There's code in the book. 2. Add functionality for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT