Machine Language Instructions and Addressing Modes Quiz

GrandOcarina avatar
GrandOcarina
·
·
Download

Start Quiz

Study Flashcards

18 Questions

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

SP

What is the maximum number of descriptors that can be addressed by the segment register in protected mode?

8192

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

DS

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

CS

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

Both B and C

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

Register addressing

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

PUSH

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

8-bit registers

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

PUSHA

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

Register addressing mode

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

POPFD

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

REX prefix

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

Base relative addressing

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

Register relative addressing

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

It scales the second of two registers by a factor to access memory data.

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

MOV [4 * ECX], EDX

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

Address another portion of the program indirectly through a register or memory location.

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

Base relative-plus-index addressing

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.

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.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser