Machine Language Instructions and Addressing Modes Quiz
18 Questions
22 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which register is used to store the base address of the stack segment?

  • AX
  • SP (correct)
  • BX
  • BP
  • What is the maximum number of descriptors that can be addressed by the segment register in protected mode?

  • 4096
  • 32768
  • 16384
  • 8192 (correct)
  • Which register is used to store the base address of the data segment?

  • DS (correct)
  • AX
  • ES
  • BX
  • Which register is used to store the base address of the code segment?

    <p>CS</p> Signup and view all the answers

    Which instruction is used to transfer data between a segment register and a 16-bit register or memory location?

    <p>Both B and C</p> Signup and view all the answers

    Which addressing mode is used to specify any 8-bit or 16-bit register?

    <p>Register addressing</p> Signup and view all the answers

    Which instruction is used to transfer data between a register or memory location and the stack?

    <p>PUSH</p> Signup and view all the answers

    What type of registers are AH, AL, BH, and BL?

    <p>8-bit registers</p> Signup and view all the answers

    Which opcode is used to transfer all the 16-bit registers between the stack and the registers?

    <p>PUSHA</p> Signup and view all the answers

    Which addressing mode is used when the MOD field is set to 11?

    <p>Register addressing mode</p> Signup and view all the answers

    Which instruction transfers the contents of the EFLAGS between the microprocessor and the stack in 80386 and above?

    <p>POPFD</p> Signup and view all the answers

    To access 64-bit registers, what prefix is added that contains a fourth bit?

    <p>REX prefix</p> Signup and view all the answers

    Which addressing mode in the 80386 and above uses a base or index register, plus a displacement to access memory data?

    <p>Base relative addressing</p> Signup and view all the answers

    In the instruction 'MOV AX, [EBX + 2*ECX]', what type of addressing mode is being used?

    <p>Register relative addressing</p> Signup and view all the answers

    What is the unique feature of scaled-index addressing in the 80386 through Core2 architecture?

    <p>It scales the second of two registers by a factor to access memory data.</p> Signup and view all the answers

    Which of the following instructions is an example of scaled-index addressing?

    <p>MOV [4 * ECX], EDX</p> Signup and view all the answers

    What does indirect program addressing allow the JMP or CALL instructions to do?

    <p>Address another portion of the program indirectly through a register or memory location.</p> Signup and view all the answers

    Which type of memory array addressing is useful for accessing a two-dimensional array?

    <p>Base relative-plus-index addressing</p> Signup and view all the answers

    Study Notes

    Register Addressing

    • Any 8-bit register (AH, AL, BH, BL, CH, CL, DH, or DL) or any 16-bit register (AX, BX, CX, DX, SP, BP, SI, or DI) can be addressed.
    • The segment registers (CS, DS, ES, or SS) are also addressable for moving data between a segment register and a 16-bit register/memory location or for PUSH and POP.

    Segment Registers

    • In protected mode, the segment register contains three fields of information.
    • The leftmost 13 bits of the segment register address one of 8192 descriptors from a descriptor table.
    • The segment register contains a cache portion that is used in protected mode to hold the base address, limit, and access rights acquired from a descriptor.

    .MODEL Statement

    • The .MODEL statement is used with assembly language to identify the start of a file and the type of memory model used with the file.

    Extended Registers

    • In the 80386 through the Core2 microprocessors, the extended registers (EAX, EBX, ECX, EDX, ESP, EBP, EDI, and ESI) are also used for register addressing.
    • In the 64-bit mode, the registers are RAX, RBX, RCX, RDX, RSP, RBP, RDI, RSI, and R8 through R15.

    PUSH and POP Instructions

    • Data are transferred between a register or a memory location and the stack by the PUSH and POP instructions.
    • Variations of these instructions allow immediate data to be pushed onto the stack, the flags to be transferred between the stack, and all 16-bit registers can transfer between the stack and registers.

    Register Sizes

    • The 8-bit registers are AH, AL, BH, BL, CH, CL, DH, and DL.
    • The 16-bit registers are AX, BX, CX, DX, SP, BP, DI, and SI.
    • The 32-bit registers are EAX, EBX, ECX, EDX, ESP, EBP, EDI, and ESI.

    Memory Addressing

    • By default, all memory-addressing modes address data in the data segment unless BP or EBP addresses memory.
    • The BP or EBP register addresses data in the stack segment.
    • Direct program memory addressing is allowed with the JMP and CALL instructions to any location in the memory system.

    Addressing Modes

    • Base relative addressing uses a base register, plus a displacement to access memory data.
    • Base relative-plus-index addressing is useful for addressing a two-dimensional memory array.
    • Scaled-index addressing is unique to the 80386 through the Core2 and allows accessing words, doublewords, or quadwords in memory arrays.
    • Relative program addressing allows a JMP or CALL instruction to branch forward or backward in the current code segment by bytes.
    • Indirect program addressing allows the JMP or CALL instructions to address another portion of the program or subroutine indirectly through a register or memory location.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge on machine language instructions, addressing modes, data transfer operations between registers and memory, and the usage of PUSH and POP instructions. A focus on the MOD field, register codes, and variations of instructions is included in this quiz.

    More Like This

    Introduction to Machine and Assembly Language
    40 questions
    Machine Language and Semantic Analysis
    40 questions
    Programming 01: Machine Language
    37 questions

    Programming 01: Machine Language

    WarmheartedActinium2670 avatar
    WarmheartedActinium2670
    Use Quizgecko on...
    Browser
    Browser