Assembly Language Instructions

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 instruction is designed for transferring bytes or words between registers, memory locations, or employing immediate addressing?

  • IN & OUT
  • POP
  • PUSH
  • MOV (correct)

Which of the following is NOT a function of program control transfer instructions?

  • Transferring data from one register to another
  • Transferring data from an internal register to memory
  • Moving program execution to a subroutine (correct)
  • Transferring data from memory to an internal register

Which of the following is NOT a bit rotation instruction?

  • REP (correct)
  • ROR
  • RCR
  • ROL

Which instruction does NOT perform data copy or transfer?

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

If CS contains 2001H and IP contains 007CH, what is the physical memory location accessed for the next instruction?

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

For the instruction MOV CL, CH, what is the code in the REG field when assembled?

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

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

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

If SI = 1000H, what does MOV [SI], BH do?

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

If a descriptor has Base = 23000000H, Limit = 012FFH and G = 1, the described segment ends at which address?

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

If the MOD field contains a 00, 01, or 10 and R/M Code is 001, what addressing mode is indicated?

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

If the direction bit, D=1, data flows in which direction between the register REG field and the R/M field?

<p>&quot;to, from&quot; (C)</p> Signup and view all the answers

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

<p>110 (A)</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 gives the following segment information EXCEPT which one?

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

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

<p>both a and b (A)</p> Signup and view all the answers

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

<p>both a and b (A)</p> Signup and view all the answers

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

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

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

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

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

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

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

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

Which flag acts as the Borrow flag in the SBB instruction?

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

Which best describes, what the instruction MOV DS:[2000H], AL performs?

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

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

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

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

<p>4-byte (C)</p> Signup and view all the answers

The instruction, MOV AX, 1234H is an example of which addressing mode?

<p>immediate addressing mode (D)</p> Signup and view all the answers

The instruction, MOV AX,[BX] is an example of which addressing mode?

<p>register indirect addressing mode (C)</p> Signup and view all the answers

To compare the source and destination operands, what operation does the CMP instruction perform between the operands?

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

What is the starting and ending addresses of the segment located by the segment register value, 1000H?

<p>&quot;10000H,1FFFFH&quot; (B)</p> Signup and view all the answers

Which of the following segment:offset combinations points to a common physical memory address? a) A1B2:000C, b) A1B0:200C, c) A1B0:002C, d) A1B1:001C

<p>&quot;a, c and d&quot; (A)</p> Signup and view all the answers

32-bit microprocessors operating in protected mode could address up to _______ of memory.

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

80286 could be operated in protected mode but with only have _______ for address bus.

<p>24-bit (B)</p> Signup and view all the answers

Given the following, what is the content of the destination after executing the instructions: MOV AX, 0FEEDh AND AX, 0F00Dh

<p>AX = F00Dh (C)</p> Signup and view all the answers

Given the following what is the content of the register after executing the instruction MOV AX, 11001100b XOR AX, 0CH

<p>AX = 000Ch (A)</p> Signup and view all the answers

One must never use the segment registers as data registers to hold arbitrary values because:

<p>They should only contain segment addresses (B)</p> Signup and view all the answers

The 100010dw mmregr/m template should be used for converting the following assembly instructions to machine code except:

<p>&quot;MOV ES, AX&quot; (A)</p> Signup and view all the answers

Which of these instructions perform a logical AND operation but the result of the operation is NOT stored in the destination operand?

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

Which single instruction inverts the carry flag?

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

Which group of instructions is used to shift or rotate bits left or right in register or memory operands?

<p>Bit Manipulation Instructions (B)</p> Signup and view all the answers

C=1 AL=1010 1011. Determine the data after executing each instruction. RCR AL, 5

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

C=0 AL=1100 0111. Determine the data after executing each instruction. ROL AL, 2

<p>1F (A)</p> Signup and view all the answers

C=0 AL=0100 1101. Determine the data after executing each instruction. SAR AL, 4

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

C=1 AL=0011 1011, Determine the data after executing each instruction. SHL AL, 3

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

This mnemonic instruction rotates left with carry the low count register content, twenty times.

<p>RCL CL, 20 (D)</p> Signup and view all the answers

This mnemonic instruction logically adds the content of data register and the data contained at the memory location addressed by 0919h and the segment register, DS. The answer is stored at the data register.

<p>OR DX, DS:[0919H] (B)</p> Signup and view all the answers

This mnemonic instruction jumps to a memory location labeled as ANGAT after performing addition, and there is a carry.

<p>JC ANGAT (D)</p> Signup and view all the answers

This mnemonic instruction immediately adds the data valued 0919H with the accumulator and the carry.

<p>ADC AX, 0919H (A)</p> Signup and view all the answers

Flashcards

MOV instruction

Transfers byte or word from register to register, memory to register, register to memory or with immediate addressing.

Program control transfer instructions

Instructions for the transfer of data from memory to internal register, from internal register to memory, from one register to another register, from input port to internal register, from internal register to output port, etc.

Assembler

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

2008CH

The physical memory location accessed by the next instruction when CS is 2001H and IP is 007CH.

Signup and view all the flashcards

001

For the instruction MOV CL, CH, the code in the REG field as assembled.

Signup and view all the flashcards

21000H

Memory address of the next instruction executed by the microprocessor, given CS = 2000H and IP= 1000H.

Signup and view all the flashcards

Writes a byte

Describes what MOV [SI], BH does if SI = 1000H.

Signup and view all the flashcards

242FFFFFH

With Base = 23000000H, Limit = 012FFH and G =1, the descriptor segment ends at this value.

Signup and view all the flashcards

DS:[BX+DI]

If MOD field contains 00, 01, or 10 and R/M Code is 001 the addressing mode is this.

Signup and view all the flashcards

"to, from"

With direction bit, D=1, data flows in this direction between the register REG field and the R/M field.

Signup and view all the flashcards

110

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

Signup and view all the flashcards

00

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

Signup and view all the flashcards

Nowhere

In a compare (CMP) operation, the result of a comparison is stored here.

Signup and view all the flashcards

Ending Address

This selector value is not given by segment information in protected mode.

Signup and view all the flashcards

Privilege Levels

Where protection is implemented in protected mode memory by restricting access to memory segments.

Signup and view all the flashcards

RPL = DPL

In protected mode, access to the segment is only allowed if this statement is true.

Signup and view all the flashcards

0CFf0H

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

Signup and view all the flashcards

Carry flag pushed

For RCL instruction, the destination contents does following function.

Signup and view all the flashcards

Test

Used to examine the state of individual bits, or groups of bits.

Signup and view all the flashcards

Opcode

Selects the operation (addition, subtraction, move, and so on) that is performed by the microprocessor.

Signup and view all the flashcards

Carry flag

Flag that acts as Borrow flag for the instruction SBB.

Signup and view all the flashcards

Copies byte-size data

What the instruction MOV DS:[2000H], AL does.

Signup and view all the flashcards

01

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

Signup and view all the flashcards

4-byte

The instruction MOV BL,DS:[1234H] will assemble as a instruction of this size.

Signup and view all the flashcards

Immediate addressing

The instruction MOV AX, 1234H is an example of addressing mode.

Signup and view all the flashcards

Register indirect

The instruction MOV AX,[BX] is an example of addressing mode.

Signup and view all the flashcards

Subtraction

To compare the source and destination operands, CMP instruction performs this action.

Signup and view all the flashcards

DX;AX

Instruction with incorrect description that places in AX and DX registers the product of AX with BX

Signup and view all the flashcards

Segment addresses

Need to know the cause for the fact that The segment registers cannot be used like data

Signup and view all the flashcards

MOV ES, AX

assembly instructions not matched by the template 100010dw mmregr/m.

Signup and view all the flashcards

TEST

Instruction does NOT store into D.O and uses logical AND operation

Signup and view all the flashcards

CMC

Assembly's instructions to inverse carry_reg

Signup and view all the flashcards

Instructions

In this group we change the position in register or the position in ram memory for bits

Signup and view all the flashcards

Study Notes

  • The MOV instruction is a general-purpose instruction to transfer a byte or word between registers, memory locations, or with immediate addressing
  • Program control transfer instructions are for transferring data from memory to internal registers, internal register to memory, from one register to another, from an input port to an internal register, and from an internal register to an output port

Rotate Operations

  • REP is not used to perform rotate operations.

Data Copy/Transfer Function

  • DAS is not a data copy/transfer function.

Assembler

  • An assembler is a utility program that 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.

Instruction Code

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

Memory Address

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

MOV Instruction Operation

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

Descriptor and Segment End

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

Addressing Mode

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

Data Flow Direction

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

R/M Code

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

Code for mm Field

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

Comparison Operation Result

  • In a compare (CMP) operation, the result of the comparison is stored nowhere

Segment Information in Protected Mode

  • In protected mode, a selector value gives the following segment information EXCEPT the ending address

Protected Mode Memory

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

Segment Access in Protected Mode

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

Physical Address in Real Mode

  • In real mode, with a segment-offset combination of 0CD1:02E0, the physical address accessed is 0CFF0H

RCL Instruction

  • In the RCL instruction, the Carry Flag is pushed into the LSB & MSB is pushed into the Carry Flag

Examining Bits

  • Test is used to examine the state of individual bits, or groups of bits.

Operation Selection

  • Opcode selects the operation (addition, subtraction, move, and so on) that is performed by the microprocessor.

Borrow Flag

  • The flag that acts as the Borrow flag in the SBB instruction is the carry flag

MOV Instruction

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

mm/mod for MOV Instruction

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

Instruction Byte Size

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

Addressing Mode

  • The instruction MOV AX, 1234H is an example of immediate addressing mode

Addressing Mode Example

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

CMP Instruction Action

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

Segment Register Value

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

Common Physical Memory Address

  • The segment:offset combinations pointing to a common physical memory address are a) A1B2:000C and b) A1B0:200C, and c) A1B0:002C

Memory Addressing in Protected Mode

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

Address Bus in Protected Mode

  • The 80286 could be operated in protected mode but only has 24-bit for the address bus.

ADC BX,DX Machine Code in Hexadecimal

  • 13DA is the machine code in hexadecimal for the instruction ADC BX,DX

AND AL,0FCH Machine Code in Hexadecimal

  • 24FC is the machine code in hexadecimal for the instruction AND AL,0FCH

POP BP Machine Code in Hexadecimal

  • 5D is the machine code in hexadecimal for the instruction POP BP

Machine Code to Assembly

  • Given the machine code 8CD0H, the equivalent assembly language is MOV AX,SS

Given Instruction - MOV BL, 04Fh

  • Given the instruction MOV BL,04Fh, adding the instruction ADD BL, 0B1H will result in ZF=0 being false.

AND AX, 0F00Dh

  • Given MOV AX, 0FEEDh and AND AX, 0F00Dh, the content of AX will equal F00Dh

XOR AX, 0CH

  • Given MOV AX, 11001100b followed by XOR AX, 0CH, the content of AX will equal 000Ch

Jump to Address

  • When calculating the target address to jump to, a displacement is added to the contents of the instruction pointer (IP).

Unsigned Division

  • In unsigned division of a doubleword in DX AX by a word in CX, the quotient will be placed in AX and the remainder in DX
  • In unsigned division of a word in AX by a byte in DATA2, the quotient will be placed in AL and the remainder in AH
  • In unsigned multiplication of AX with BX, the product will be placed in DX;AX

Unsigned multiplication with CX

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

Segment Registers

  • The segment registers should only contain segment addresses

Assembly Instructions

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

Logical AND

  • The instruction that performs the logical AND operation whose result is not stored in the destination operand is TEST

Carry Flag

  • CMC inverts the carry flag.

Bit Manipulation Instructions

  • This group of instructions is used to shift or rotate bits left or right in register or memory operands

Data after executing each instruction

  • Given C=1 AL=1010 1011, RCR AL, 5 will result in BD
  • Given C=1 AL=1010 1011, ROR AL, 4 instruction will result in BA
  • Given C=0 AL=1100 0111, ROL AL, 2 will result in 1F
  • Given C=0 AL=0100 1101, SAR AL, 4 will result in 04
  • Given C=1 AL=1010 1010, SHR AL, 5 will result in 05
  • Given C=1 AL=0011 1011, SHL AL, 3 will result in D8
  • RCL CL, 20 rotates left with carry the low count register content twenty times
  • OR DX, DS:[0919H] logically adds the content of a data register and the data contained at the memory location addressed by 0919h and the segment register DS. The answer is stored at the data register
  • JC ANGAT jumps to a memory location labeled as ANGAT after performing addition, and if there is a carry.
  • ADC AX, 0919H immediately adds the data valued 0919H with the accumulator and the carry

Mnemonic instruction

  • INC ES:[BX+SI] adds one to the content of a memory location whose offset addresses are from the base index register and source index register
  • Given C=1 and AL=1011 1001, RCR AL, 5 will result in AL=9DH
  • Given C=1 and AL=1011 1001, SAR AL, 3 will result in AL=F7H
  • Given C=1 and AL=1011 1001, SHL AL, 3.. AL=C8H
  • Given C=1 and AL=1011 1001. After executing the instruction ROR AL, 3 . , AL=37H
  • Given C=1 and AL=1011 1001. After executing the instruction ROL AL, 2, AL=E6H
  • Given C=1 and AL=1011 1001. After executing the instruction SHR AL, 5, AL=05H
  • This mnemonic instruction rotates right the destination index register twenty-nine times. ROR DI, 29
  • The mnemonic instruction logically multiplies the contents of the base index register and multiplies the data contained in the address formed by FC45H and the data segment: AND BX, [FC45H]
  • The mnemonic instruction immediately adds the data valued 0929H with the count register. ADC CX, [0929H]
  • The mnemonic instruction sets bit number two of the lower base index register after testing is "BTS BL,2"
  • Given AL=1101 1101; C=1, the final content of the lower accumulator after executing the instruction SAR AL, 6 is AL=FFH
  • The mnemonic instruction that subtracts with borrow the data addressed formed by the source index register from the higher base index register is SBB BH, [SI]
  • Given AL=0111 1101; C=1, the final content of the lower accumulator after execution of the instruction SHL AL, 4 will equal AL = A0H
  • Given byte 1-1000 1000, byte 2 - 0011 0110 byte 3 - 1011 0111,and byte 4 - 0110 1101, the equivalent mnemonic MOV instruction - byte1 =MOV DH, [BP+6DB7H]
  • This mnemonic instruction complements the content of the lower base index register - NOT BL
  • Given the following bytes determine the mnemonic MOV instruction
  • Byte 1 - 1100 0110 Byte 2 - 0110 1001 Byte 3 - 1010 0110 Byte 4 - 1100 1100 Byte 5 - 1110 0101 Byte 6 - 1011 1001
  • MOV DS:[BX+DI+A6H], E5H is the equivalent instruction
  • What is the final content of the accumulator after executing the instruction ROR AL, 7. Given AL=1101 1001; C=1 is AL=B3H
  • If the accumulator =1001 1101; C=1, then the Final content of the accumulator is EEH after executing the instruction instruction RCL AL, 3.
  • CMP performs subtraction without changing the content of the destination.
  • To know the hand-code equivalent of line 1, if ONE: MOV AX, 1001H is the hand-codeequivalent B80110
  • To know the hand-code equivalent of Line 3, if MOV SI, [BP+DI] is shown in the following program and 8B33 is what you would use
  • To know the hand-code equivalent of LINE 4, if Code is MOV DI, [BX+SI] then. 8B38
  • If comparing a program of hand coding to help with its instruction set which is similar to, TWO: SUB DX, [BX+SI], it equals 2B10H
  • Code set line #9 is: MOV [DI], DX in, CMP [DI], SI and the equivalent code is 3935
  • Then for code set ten being JZ ONE is: in, CMP [DI], SI as, 74EA
  • Program line locations: One, ONE: MOV AX, 1001H
  • The hand code is 2863EH for 28643-28644
  • Code equivalent: From line #5 it would be addresses 28647-28649
  • Hand Code -Code from 8 would produce a range 2864E-2864F
  • For the final line # the displacement code is at 10: if there is more than zero, its at F3

Program Tasking: Quiz 6

1- task #7 is adding code into what we are doing: MOV AX, 0040H

2- the code required after 4- for program set 1: 1024 is DIV BL

in what we are doing is program setting 4 to do sub tasking, MOV DL, 8H

####3-In sub setting with #5. code calling for = 110 MOV AH, 00H ####4- code set #6 for code setting has to have, POP DX

5- setting calling to do task # 9 code has to = MOV BL, AL for setting it to = #0

####We have one task calling for #2 to have Bx at #5 having the subtask code end being = SUB AX, BX ####-what will happen when finished will be 1048H for task 7

#1 the result when finished #4 the code will have it equal equal a new range 0080 H is at #3

-To compare code it will tell how much stacked and if empty, with a blank setting stack. it will be nothing which is code end setting equals that

Notes on Program and Given Task

  • Program: What's the task for =2 program #5, is to 5 code.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser