CS3B QUIZ 5

Ace your homework & exams now with Quizwiz!

Which instruction pushes all of the 32-bit general-purpose registers on the stack?

PUSHAD, The PUSHAD instruction pushes the 32-bit general-purpose registers on the stack, and the PUSHA instruction does the same for the 16-bit general-purpose registers. The POPAD instruction pops the stack into the 32-bit general-purpose registers, and the POPA instruction does the same for the 16-bit general-purpose registers. PUSHA and POPA should only be used for 16-bit programming.

Which statement is true about what will happen when the example code runs? 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

The program will halt with a runtime error on Line 11

The PROC directive begins a procedure and the ENDP directive ends a procedure.

True, Informally, we can define a procedure as a named block of statements that ends in a return statement. A procedure is declared using the PROC and ENDP directives.

The USES operator lets you name all registers that are modified within a procedure.

True, The USES operator, coupled with the PROC directive, lets you list all registers modified by a procedure. The assembler generates code that pushes the registers at the beginning of the procedure and pops the registers before returning.

Local variables in procedures are created on the stack.

True, The stack provides temporary storage for local variables inside subroutines.

The RET instruction pops the top of the stack into the instruction pointer.

True, When the procedure finishes, the RET (return from procedure) instruction brings the processor back to the point in the program from where the procedure was called.

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 : call Ex3Sub 6: INVOKE ExitProcess,0 7main ENDP 8: 9Ex3Sub PROC 10: pusha 11 : mov eax,80 12 : popa 13 : ret 14 :Ex3Sub ENDP

EAX will equal 30 on line 6

Which instruction pops the stack into the EFLAGS register?

POPFD, The PUSHFD instruction pushes the 32-bit EFLAGS register on the stack, and POPFD pops the stack into EFLAGS. PUSHF and POPF do the same for the 16-bit FLAGS register.

What will be the final value in EAX after these instructions execute? (Answer in decimal). push 5 push 6 pop eax pop eax

5

The ESI and EDI registers cannot be used when passing 32-bit parameters to procedures.

False

The PUSH instruction cannot have an immediate operand.

False, The PUSH instruction first decrements ESP and then copies a source operand into the stack. A 16-bit operand causes ESP to be decremented by 2. A 32-bit operand causes ESP to be decremented by 4. There are three instruction formats: PUSH reg/mem16 PUSH reg/mem32 PUSH imm32

The USES operator only generates PUSH instructions, so you must code POP instructions yourself.

False, The USES operator, coupled with the PROC directive, lets you list all registers modified by a procedure. The assembler generates code that pushes the registers at the beginning of the procedure and pops the registers before returning.

Which instruction pushes the 32-bit EFLAGS register on the stack?

The PUSHFD instruction pushes the 32-bit EFLAGS register on the stack, and POPFD pops the stack into EFLAGS. PUSHF and POPF do the same for the 16-bit FLAGS register.


Related study sets

Network+ Remote Management Facts 15.3.4

View Set

Consumer Finance Midterm 1 and 2

View Set

MGMT CH2 THE EVOUTION OF MANAGEMENT THOUGHT

View Set

N5451 Skills Lab > Video Quizzes > Module 8. Hygiene

View Set