Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Which statement is true about what will happen when the example code runs? 1: ma

ID: 3699297 • Letter: W

Question

Which statement is true about what will happen when the example code runs?

1: main PROC

2: mov  eax,60
3: push eax
4: push 40
5: call GoEanglesSup
6: INVOKE ExitProcess, 0

7: main ENDP
8:

9: GoEanglesSup
10: pusha
11: mov eax, 10
12: popa
13: ret
14: GoEanglesSup ENDP

The program will halt with a runtine error on Line 13

EAX will equal 60 on line 6

EAX will equal 10 on line 6

The program will halt will a runtine error on Line 6

a)

The program will halt with a runtine error on Line 13

b)

EAX will equal 60 on line 6

c)

EAX will equal 10 on line 6

d)

The program will halt will a runtine error on Line 6

Explanation / Answer

1: main PROC

2: mov  eax,60
3: push eax
4: push 40
5: call GoEanglesSup
6: INVOKE ExitProcess, 0

7: main ENDP
8:

9: GoEanglesSup
10: pusha
11: mov eax, 10
12: popa
13: ret
14: GoEanglesSup ENDP

When the above code is run , the statement true about it is :

EAX will equal 60 on line 6

In the assembly program the value 60 is moved to register eax , the value of eax is written into the stack by push eax , but the call GoEanglesSup instruction on line 5 places one more element into the stack, the return address for the subroutine. The return address is the address of the instruction immediately after the call instruction, Therefore here the return address is the address of line 6. Inthe given program subroutine pops the return address from the stack, it pops 60 from the stack into eax, and puts the return address back in the stack, and returns. Hence , eax will hold 60 .

b)

EAX will equal 60 on line 6