Assembly Language Instructions & Functions

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which instruction serves as a general-purpose instruction for transferring bytes or words between registers, memory locations, and immediate data?

  • `MOV` instruction (correct)
  • `POP` instruction
  • `PUSH` instruction
  • `IN` & `OUT` instructions

Which of the following statements about program control transfer instructions is false?

  • They enable data movement from one register to another.
  • They facilitate data transfer from memory to an internal register.
  • They are primarily for arithmetic operations. (correct)
  • They transfer data from an input port to an internal register.

Which of the following instructions is NOT typically used to perform bit rotation operations?

  • `ROR`
  • `REP` (correct)
  • `RCR`
  • `ROL`

Which of the following instructions does NOT perform a data copy or transfer function?

<p><code>DAS</code> (D)</p> Signup and view all the answers

Which of the following is the function of an assembler?

<p>Converting source code programs from assembly language into machine language (A)</p> Signup and view all the answers

If the Code Segment register (CS) contains 2001H and the Instruction Pointer (IP) contains 007CH, what is the physical memory location that will be accessed for the next instruction?

<p><code>2008CH</code> (A)</p> Signup and view all the answers

What is the correct code for the REG field when assembling the instruction MOV CL, CH?

<p><code>001</code> (C)</p> Signup and view all the answers

Given CS = 2000H and IP = 1000H, what is the memory address of the next instruction to be executed by the microprocessor?

<p><code>21000H</code> (A)</p> Signup and view all the answers

If SI = 1000H, what operation does the instruction MOV [SI], BH perform?

<p>Writes a byte of data from <code>BH</code> into memory location <code>1000H</code> (A)</p> Signup and view all the answers

If a descriptor has a Base of 23000000H, a Limit of 012FFH, and G (Granularity) = 1, what is the ending address of the described segment?

<p><code>242FFFFFH</code> (A)</p> Signup and view all the answers

If the MOD field contains 00, 01, or 10, and the R/M code is 001, what addressing mode is being used?

<p><code>DS:[BX+DI]</code> (A)</p> Signup and view all the answers

For an instruction, if the direction bit D=1, the data flow is considered to be...

<p>from the register REG field to the R/M field. (A)</p> Signup and view all the answers

In the instruction MOV BL,DS:[1234H], what is the code for R/M?

<p><code>110</code> (D)</p> Signup and view all the answers

In a compare (CMP) operation, where is the result of the comparison stored?

<p>Nowhere (B)</p> Signup and view all the answers

In protected mode, a selector value provides which of the following segment information EXCEPT:

<p>Ending address (B)</p> Signup and view all the answers

In protected mode memory, protection is implemented by restricting access to memory segments through which of the following?

<p>Both privilege levels and access rights (B)</p> Signup and view all the answers

In protected mode, access to a segment is allowed if:

<p>Both RPL = DPL and RPL &gt; DPL (A)</p> Signup and view all the answers

In real mode, what physical address is accessed by the segment-offset combination 0CD1:02E0?

<p><code>0CFF0H</code> (A)</p> Signup and view all the answers

In the RCL instruction, what function do the contents of the destination operand undergo?

<p>Carry flag is pushed into LSB &amp; MSB is pushed into the carry flag (B)</p> Signup and view all the answers

Which instruction is used to examine the state of individual bits or groups of bits without modifying them?

<p><code>Test</code> (B)</p> Signup and view all the answers

Which component selects the specific operation (addition, subtraction, move, etc.) that is performed by the microprocessor?

<p>Opcode (C)</p> Signup and view all the answers

Which flag acts as the Borrow flag in the SBB (Subtract with Borrow) instruction?

<p>Carry flag (C)</p> Signup and view all the answers

What is the primary operation performed by the instruction MOV DS:[2000H], AL?

<p>Copies byte-size data in AL to the memory (B)</p> Signup and view all the answers

The instruction MOV [BP], DL will assemble with which mm/mod value?

<p><code>01</code> (C)</p> Signup and view all the answers

Flashcards

MOV instruction

A general-purpose instruction to transfer bytes or words between registers, memory, and immediate values.

Program control transfer instructions

Instructions that transfer data directly between memory and internal registers, or between registers.

ROL, ROR, RCR

Instructions used to perform rotate operations.

Assembler

A utility program that converts source code programs from assembly language into machine language.

Signup and view all the flashcards

Memory Address Calculation (CS:IP)

The physical memory location is computed from CS (Code Segment) and IP (Instruction Pointer).

Signup and view all the flashcards

MOV [SI], BH

Writes the byte of data from BH into memory location pointed to by SI.

Signup and view all the flashcards

MOD field with 01

In MOD field, Addressing mode with displacement is selected.

Signup and view all the flashcards

Direction Bit (D=1)

Data flows from the register REG field to the R/M field

Signup and view all the flashcards

MOV BL,DS:[1234H]

The code for R/M = 110

Signup and view all the flashcards

MOV CL,DS:[1234H]

Instruction is MOV CL,DS:[1234H], code for mm is 00

Signup and view all the flashcards

CMP operation result

No flags are altered.

Signup and view all the flashcards

Selector Value in Protected Mode

A selector value does not provide the ending address.

Signup and view all the flashcards

Protected Mode Memory Protection

Protection is implemented by restricting access through privilege levels and access rights.

Signup and view all the flashcards

Protected Mode Segment Access

Access to the segment is allowed if RPL is greater or equal to DPL, or both a and b.

Signup and view all the flashcards

RCL Instruction Effect

A is shifted into LSB and MSB is pushed into the carry flag.

Signup and view all the flashcards

Test Instruction

It examines the state of individual bits or groups of bits.

Signup and view all the flashcards

Opcode

Selects what operation should be performed by the micro processor.

Signup and view all the flashcards

Carry Flag as Borrow Flag

Flag used in SBB when negative is borrowed.

Signup and view all the flashcards

MOV DS:[2000H], AL

Copies byte-size data in AL to the memory location specified by DS:[2000H].

Signup and view all the flashcards

MOV [BP], DL assembly

MOV [BP], DL will assemble with mm/mod=01

Signup and view all the flashcards

MOV BL,DS:[1234H] assembly size

The instruction is MOV BL,DS:[1234H] will assemble as a 4byte instruction.

Signup and view all the flashcards

MOV AX, 1234H

immediate addressing

Signup and view all the flashcards

MOV AX,[BX]

register indirect addressing mode

Signup and view all the flashcards

CMP (Compare) Instruction

Subtration performs in CMP instruction

Signup and view all the flashcards

Segment Address 1000H

The starting and ending address of the segment located by the segment register value 1000H is 10000H,1FFFFH.

Signup and view all the flashcards

Study Notes

General Purpose Instruction

  • A general-purpose instruction transfers a byte or word from register to register.
  • Can transfer data from memory to register or vice versa.
  • Can use immediate addressing.

Program Control Transfer Instructions

  • Transfer data from memory to an internal register.
  • Transfer data from one register to another.
  • Move data from an input port to an internal register.
  • Move data from an internal register to an output port.

Rotate Operations

  • ROL (Rotate Left), ROR (Rotate Right), and RCR are instructions used to perform rotate operations.
  • REP is not used to perform rotate operations.

Data Copy/Transfer Functions

  • MOV (Move) and PUSH are data copy/transfer function.
  • DAS is not a data copy/transfer function.

Assembler

  • Assembler serves as a utility program.
  • It converts source code programs from assembly language into machine language.

Memory Location Access

  • If CS contains 2001H and IP contains 007CH, the physical memory location accessed for the next instruction is 2008CH.

Assembling MOV CL, CH instruction

  • For the instruction MOV CL, CH, the code in the REG field when assembled is 001.

Memory Address of Next Instruction

  • Given CS = 2000H and IP = 1000H, the memory address of the next instruction executed by the microprocessor is 21000H.

MOV [SI], BH Instruction

  • If SI = 1000H, MOV [SI], BH writes a byte of data from BH into memory location 1000H

Descriptor Base and Limit

  • If a descriptor has Base = 23000000H, Limit = 012FFH, and G = 1, the described segment ends at 242FFFFFH

Addressing Mode

  • If the MOD field contains 00, 01, or 10 and the R/M Code is 001, the addressing mode is DS:[BX+DI].

Direction Bit in Instructions

  • If the direction bit D=1, data flows "to, from" the register REG field to the R/M field located in the second byte of an instruction.

Code for R/M in MOV BL,DS:[1234H]

  • If the instruction is MOV BL,DS:[1234H], the code for R/M = 110.

Code for mm in MOV CL,DS:[1234H]

  • If the instruction is MOV CL,DS:[1234H], the code for mm = 00.

Compare (CMP) Operation

  • During a compare (CMP) operation, the result of the comparison is not stored.

Selector Value in Protected Mode

  • In protected mode, the ending address is not segment information from a selector value.

Memory Protection in Protected Mode

  • In protected mode memory, protection is implemented by restricting access to memory segments through both privilege levels and access rights.

Access to Segment in Protected Mode

  • In protected mode, access to the segment is allowed if both RPL = DPL and RPL > DPL

Physical Address in Real Mode

  • In real mode, the physical address accessed by the segment-offset combination 0CD1:02E0 is 0CF01H.

RCL Instruction

  • In the RCL instruction, the carry flag is pushed into the LSB, and the MSB is pushed into the carry flag.

Examining State of Bits

  • The TEST instruction is used to examine the state of individual bits or groups of bits.

Microprocessor Operation Selection

  • The Opcode selects the operation (addition, subtraction, move, etc.) that is performed by the microprocessor.

Borrow Flag

  • The carry flag acts as the Borrow flag in the SBB instruction.

MOV DS:[2000H], AL Instruction

  • The instruction MOV DS:[2000H], AL copies a byte-size data in AX to the memory.

MOV [BP],DL Assembly

  • The instruction MOV [BP], DL will assemble with mm/mod= 01

Instruction Length

  • MOV BL,DS:[1234H] assembles as a 4-byte instruction.

MOV AX, 1234H Example

  • MOV AX, 1234H exemplifies immediate addressing mode.

MOV AX,[BX] Example

  • MOV AX,[BX] is an example of register indirect addressing mode.

CMP Instruction

  • To compare the source and destination operands, the CMP instruction performs subtraction between the operands.

Segment Register and Addressing

  • With a segment register value of 1000H, the segment starts at 10000H and ends at 1FFFFH.

Common Physical Memory Address

  • The segment:offset combinations a) A1B2:000C, c) A1B0:002C, and d) A1B1:001C point to a common physical memory address.

Memory Addressing with 32-bit Microprocessors

  • 32-bit microprocessors operating in protected mode can address up to 4GB of memory.

Address Bus for 80286 in Protected Mode

  • The 80286 can be operated in protected mode but only has a 24-bit address bus.

Machine Code Conversion

  • The machine code for the instruction ADC BX,DX is 13DA in hexadecimal.
  • The machine code for the instruction AND AL,0FCH is 24FC in hexadecimal.
  • The machine code for the instruction POP BP is 5D in hexadecimal.

Assembly Language Conversion

  • The assembly language equivalent of the machine code 8CD0H is MOVAX, SS.

Execution Results

  • Given the instructions MOV BL,04Fh and ADDBL, 0B1H, the execution results in ZF=0 evaluating to False.

Register Content After Instructions

  • Given the instructions:
    • MOVAX, 0FEEDH
    • ANDAX, 0F00DH
  • The final content of register AX will be F00Dh

Content of Register After Instruction

  • Given the instructions MOVAX, 11001100b and XORAX, OCH, the content of register AX after executing the instructions is 000Ch.

Target Address Calculation

  • In calculating the target address to jump to, a displacement is added to the contents of the IP register.

Division

  • In unsigned division of a doubleword in DX AX by a word in CX, the quotient is placed in AX, and the remainder is put in DX.
  • In unsigned division of a word in AX by a byte in DATA2, the quotient is placed in AL and remainder in AH.

Unsigned Multiplication

  • In unsigned multiplication of AX with BX, the product is placed in registers DX;AX.

Multiplication Fact

  • The statement "In unsigned multiplication of CX with a byte in AL, the product is placed in both AX and DX registers" is False.

Segment Registers

  • Segment registers should only contain segment addresses.

Assembly Instructions and Machine Code

  • The 100010dw mmregr/m template should be used for converting the assembly instructions to machine code except for "MOV ES, AX".

Logical AND Instruction

  • The instruction that performs a logical AND operation without storing the result in the destination operand is TEST.

Inverting the Carry Flag

  • The instruction CMC inverts the carry flag.

Bit Manipulation Instructions

  • Bit Manipulation Instructions are used to shift or rotate bits left or right in register or memory operands.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Assembly Dili ve Makine Komutları
7 questions
Machine & Assembly Language
20 questions
Use Quizgecko on...
Browser
Browser