• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/28

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

28 Cards in this Set

  • Front
  • Back
Which register (in protected mode) manages the stack?
ESP
How is the runtime stack different from the stack abstract data type?
The runtime stack is the only type of stack that is managed directly by the CPU. For example, it holds the return addresses of called procedures.
Why is the stack called a LIFO structure?
LIFO stands for "last in, first out." The last value pushed into the stack is the first value popped out from the stack.
When a 32-bit value is pushed on the stack, what happens to ESP?
ESP is decremented by 4
T/F. Only 32 bit values should be pushed on the stack when using the Irvine32 library.
True
T/F. Only 16-bit values should be pushed on the stack when using the Irvine16 library.
False (you can push both 16-bit and 32-bit values)
T/F. Local variables in procedures are created on the stack.
True.
T/F. The PUSH instruction cannot have an immediate operand.
False (yes, it can, from the 80186 processor onward)
Which instruction pushes all of the 32-bit general-purpose registers on the stack?
PUSHAD
Which instruction pushes the 32-bit EFLAGS register on the stack?
PUSHFD
Which instruction pops the stack into the EFLAGS register?
POPFD
Challenge: Another assembler(called NASM) permits the PUSH instruction to list multiple specific registers. Why might this approach be better than the PUSHAD instruction in MASM? Here is a NASM example:
PUSH eax ebx ecx
NASM's approach permits the programmer to be specific about which registers are to be pushed. PUSHAD, on the other hand, does not have that flexibility. This becomes important when a procedure needs to save several registers and at the same time return a value to its caller in the EAX register. EAX cannot be pushed and popped because the return value would be lost.
Challenge: Suppose there were no PUSH instruction. Write a sequence of two other instructions that would accomplish the same as PUSH EAX.
Equivalent to PUSH EAX:
sub esp, 4
mov [esp], eax
T/F. The PROC directive begins a procedure and the ENDP directive ends a procedure.
True
T/F. It is possible to define a procedure inside an existing procedure.
False
What would happen if the RET instruction was omitted from a procedure?
Execution would continue beyond the end of the procedure, possibly into the beginning of another procedure. This type of programming bug is often difficult to detect!
How are the words Receives and Returns used in the suggested procedure documentation?
Receives indicates the input parameters given to the procedure when it is called. Returns indicates what value, if any, the procedure produces when it returns it to its caller.
T/F. The CALL instruction pushes the offset of the CALL instruction on the stack.
False (it pushes the offset of the instruction FOLLOWING the call)
T/F. The CALL instruction pushes the offset of the instruction following the CALL on the stack.
True
T/F. The RET instruction pops the top of the stack into the instruction pointer.
True
T/F. Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator is used in the procedure definition.
False (there is no NESTED operator)
T/F. In protected mode, each procedure call uses a minimum of 4 bytes of stack space.
True
The ESI and EDI registers cannot be used when passing parameters to procedures.
False
T/F. The ArraySum procedure (5.5.3) receives a pointer to any array of doublewords.
True (it also receives a count of the number of array elements)
T/F. The USES operator lets you name all registers that are modified within a procedure.
True
T/F. The USES operator only generates PUSH instructions, so you must code POP instructions yourself.
False
T/F. The register list in the USES directive must use commas to separate the register names.
False
Which statement(s) in the ArraySum procedure (5.5.3) would have to be modified so it could accumulate an array of 16-bit words?
add eax, [esi] becomes ---> add ax, [esi]
add esi, 4 becomes ---> add esi, 2