87.0k views
5 votes
Which statement is true about what will happen when the example code runs?1: main PROC2: mov edx,03: mov eax,404: push eax5: call Ex5Sub6: INVOKE ExitProcess,07: main ENDP8:9: Ex5Sub PROC10: pop eax11: pop edx12: push eax13: ret14: Ex5Sub ENDP------------- answer -----------A. The program will halt with a runtime error on Line 10B. EAX will equal 20 on line 6C. call WriteIntD. EDX equals 40 on line 6

User Ksun
by
5.6k points

1 Answer

5 votes

Answer:

The last option is the correct answer. EDX will equal 40 on line 6

Step-by-step explanation:

An element is pushed into stack at line no. 04 and call instruction at line no. 05 pushes a return address.

The return addrees is the instruction address followed by call function.In this scenario it is the address of line 6.

Now, the subroutine pops the return address from the stack,i,e. it pops 40 from the stack into edx and then puts the return address back in the stack, and returns.

Therefore, edx contains the value 40 when it returns from subroutine,

User Quantic
by
5.4k points