Podcast
Questions and Answers
Which category of 8086 instructions is primarily focused on transferring data between operands?
Which category of 8086 instructions is primarily focused on transferring data between operands?
What type of instructions would you use to control the execution flow in an 8086 program?
What type of instructions would you use to control the execution flow in an 8086 program?
Which of the following instructions would fall under the arithmetic and logical category?
Which of the following instructions would fall under the arithmetic and logical category?
What is the purpose of machine control instructions in 8086 assembly language?
What is the purpose of machine control instructions in 8086 assembly language?
Signup and view all the answers
Which instructions would be categorized as string manipulation instructions in 8086?
Which instructions would be categorized as string manipulation instructions in 8086?
Signup and view all the answers
Which type of instruction is intended for direct effect on the flag register?
Which type of instruction is intended for direct effect on the flag register?
Signup and view all the answers
What do shift and rotate instructions manipulate in 8086 assembly language?
What do shift and rotate instructions manipulate in 8086 assembly language?
Signup and view all the answers
Which of the following is NOT a category of 8086 instructions?
Which of the following is NOT a category of 8086 instructions?
Signup and view all the answers
What does the NEG instruction do with the specified destination?
What does the NEG instruction do with the specified destination?
Signup and view all the answers
Which instruction is used to convert a signed byte into a signed word?
Which instruction is used to convert a signed byte into a signed word?
Signup and view all the answers
What happens to the flags after executing the AND instruction?
What happens to the flags after executing the AND instruction?
Signup and view all the answers
When using the AND instruction, what type of operands can be used?
When using the AND instruction, what type of operands can be used?
Signup and view all the answers
What does the CWD instruction do?
What does the CWD instruction do?
Signup and view all the answers
What is the effect of the DAS instruction after a subtraction operation?
What is the effect of the DAS instruction after a subtraction operation?
Signup and view all the answers
What is the primary purpose of the TEST instruction?
What is the primary purpose of the TEST instruction?
Signup and view all the answers
Which of the following instructions does NOT affect any flags?
Which of the following instructions does NOT affect any flags?
Signup and view all the answers
What happens to the flags after executing the CMP instruction?
What happens to the flags after executing the CMP instruction?
Signup and view all the answers
In the XOR instruction, what is the effect on the destination operand?
In the XOR instruction, what is the effect on the destination operand?
Signup and view all the answers
What is the primary purpose of the TEST instruction?
What is the primary purpose of the TEST instruction?
Signup and view all the answers
When using SHL/SAL instructions, what is inserted into the least significant bits?
When using SHL/SAL instructions, what is inserted into the least significant bits?
Signup and view all the answers
What is a correct syntax for the CMP instruction comparing a register with data?
What is a correct syntax for the CMP instruction comparing a register with data?
Signup and view all the answers
Which flags are affected by the TEST instruction?
Which flags are affected by the TEST instruction?
Signup and view all the answers
In the context of the XOR instruction, what does 'data' typically represent?
In the context of the XOR instruction, what does 'data' typically represent?
Signup and view all the answers
Which statement is true regarding the SHL instruction?
Which statement is true regarding the SHL instruction?
Signup and view all the answers
What is the primary function of the XCHG instruction?
What is the primary function of the XCHG instruction?
Signup and view all the answers
Which of the following is NOT a valid syntax for the XCHG instruction?
Which of the following is NOT a valid syntax for the XCHG instruction?
Signup and view all the answers
In which case can AL or AX be used as a destination for the IN instruction?
In which case can AL or AX be used as a destination for the IN instruction?
Signup and view all the answers
What does the IN instruction do with the port address stored in the DX register?
What does the IN instruction do with the port address stored in the DX register?
Signup and view all the answers
Which memory reference is correctly described in relation to the XCHG instruction?
Which memory reference is correctly described in relation to the XCHG instruction?
Signup and view all the answers
Which of the following statements is true regarding the OUT instruction?
Which of the following statements is true regarding the OUT instruction?
Signup and view all the answers
What is the role of the DX register in the context of input operations?
What is the role of the DX register in the context of input operations?
Signup and view all the answers
For which operation is XCHG AX, DX an example?
For which operation is XCHG AX, DX an example?
Signup and view all the answers
Which conditional branch instruction transfers control if the Zero Flag (ZF) is set to 1?
Which conditional branch instruction transfers control if the Zero Flag (ZF) is set to 1?
Signup and view all the answers
What must be the range of displacement for branch instructions?
What must be the range of displacement for branch instructions?
Signup and view all the answers
Which branch instruction is executed when the Sign Flag (SF) is 0?
Which branch instruction is executed when the Sign Flag (SF) is 0?
Signup and view all the answers
Which instruction would you use to branch when the Overflow Flag (OF) is not set?
Which instruction would you use to branch when the Overflow Flag (OF) is not set?
Signup and view all the answers
How many conditional branch instructions are listed in the table?
How many conditional branch instructions are listed in the table?
Signup and view all the answers
What does the instruction JBE/JNA do?
What does the instruction JBE/JNA do?
Signup and view all the answers
Which branch instruction should be used when both the Sign Flag (SF) and Overflow Flag (OF) are not set?
Which branch instruction should be used when both the Sign Flag (SF) and Overflow Flag (OF) are not set?
Signup and view all the answers
Which instruction should be used to branch when the Parity Flag (PF) is set to 0?
Which instruction should be used to branch when the Parity Flag (PF) is set to 0?
Signup and view all the answers
In which scenario does JNE/JNC transfer control?
In which scenario does JNE/JNC transfer control?
Signup and view all the answers
Study Notes
8086 Instruction Set
- 8086 instructions are categorized into the following main types:
- Data copy /transfer instructions
- Arithmetic and Logical instructions
- Branch Instructions
- Loop instructions
- Machine control instructions
- Flag manipulation instructions
- Shift and Rotate instructions
- String manipulation instructions
Data Transfer Instructions
-
XCHG (Exchange): exchanges contents of specified source and destination operands which may be registers or a memory location
- Syntax:
-
XCHG AX, reg 16
(e.g.,XCHG AX, DX
) -
XCHG mem, reg
(e.g.,XCHG [BX], DX
) -
XCHG reg, reg
(e.g.,XCHG AL, CL
,XCHG DX, BX
)
-
- Syntax:
-
IN (Input the Port): reads an input port
- AL and AX are allowed destinations for 8 and 16-bit input operations
- DX register (implicit) carries the port address
- Syntax:
-
IN AL, DX
([AL] [PORT DX]
) -
IN AX, DX
([AX] [PORT DX]
) -
IN AL, PORT
([AL] [PORT]
) -
IN AX, PORT
([AX][PORT]
) -
IN AL, 0300H
(reads data from an 8-bit port whose address is 0300H and stores it in AL) -
IN AX
(reads data from a 16-bit port whose address is in DX and stores it in AX)
-
-
OUT (Output to the Port): writes to an output port
- DX register may carry the port address directly or implicitly
- Contents of AX or AL are transferred to a directly or indirectly addressed port after execution
- Syntax:
-
OUT DX, AL
([PORT DX] [AL]
) -
OUT DX, AX
([PORT DX] [AX]
) -
OUT PORT, AL
([PORT] [AL]
) -
OUT PORT, AX
([PORT] [AX]
) -
OUT 0300H, AL
(writes the content of AL to an 8-bit port with address 0300H) -
OUT AX
(writes the content of AX to a 16-bit port whose address is in DX)
-
Arithmetic Instructions
-
SUB (Subtract): subtracts the source operand from the destination operand
- The result is stored in the destination operand
- Syntax:
SUB dest, src
(e.g.,SUB AL, CH
)
-
DAS (Decimal Adjust After Subtraction): adjusts the result of subtraction to produce a valid packed BCD (Binary Coded Decimal) value
- Syntax:
DAS
- Syntax:
-
NEG (Negate): forms the 2’s complement of the specified destination operand
- Subtracts the contents of the destination from zero
- The result is stored back in the operand
- Affects all condition code flags
- Syntax:
NEG dest
(e.g.,NEG AX
)
-
CBW (Convert Signed Byte to Word): converts a signed byte to a signed word
- Copies the sign bit of the byte to all the bits in the higher byte of the result word
- The byte to be converted must be in AL
- The result will be in AX
- It does not affect any flag
- Syntax:
CBW
-
CWD (Convert Signed Word to Double Word): copies the sign bit of AX to all the bits of DX register
- Used before signed division
- It does not affect any other flag
- Syntax:
CWD
Logical Instructions
-
AND (Logical AND): performs a bit by bit AND operation on the source and destination operands
- The result is stored in the destination operand
- Syntax:
-
AND mem/reg1, mem/reg2
(e.g.,AND BL, CH
) -
AND mem,data
(e.g.,AND start,05H
) -
AND A, data
(e.g.,XOR AX, 1021H
) - where A: AL/AX
-
-
OR (Inclusive OR): performs a bit by bit OR operation on the source and destination operands
- The result is stored in the destination operand
- Syntax:
-
OR mem/reg1, mem/reg2
(e.g.,OR BL, CH
) -
OR mem,data
(e.g.,OR start,05H
) -
OR A, data
(e.g.,OR AX, 1021H
) - where A: AL/AX
-
-
NOT (Logical NOT): performs a bit by bit NOT operation on the destination operand
- The result is stored in the designation operand
- Syntax:
NOT dest
(e.g.,NOT AX
)
-
XOR (Exclusive OR): performs a bit by bit XOR operation on the source and destination operands
- The result is stored in the destination operand
- Syntax:
-
XOR mem/reg1, mem/reg2
(e.g.,XOR BL, CH
) -
XOR mem,data
(e.g.,XOR start,05H
) -
XOR A, data
(e.g.,XOR AX, 1021H
) - where A: AL/AX
-
-
CMP (Compare): subtracts the source operand from the destination operand without storing the result
- Affects the flags based on the subtraction result
- Syntax:
-
CMP mem/reg1, mem/reg2
(e.g.,CMP CX, BX
) -
CMP mem/reg, data
(e.g.,CMP CH, 03H
) -
CMP A, data
(e.g.,CMP AX, 1301H
) - where A: AL/AX
-
-
TEST (Logical Compare Instruction): performs a bit by bit logical AND operation on the two operands
- The result of the AND operation is not stored
- Affects the flags based on the result
- Syntax:
-
TEST mem/reg1, mem/reg2
(e.g.,Test CX,BX
) -
TEST mem/reg, data
(e.g.,TEST CH, 03H
) -
TEST A, data
(e.g.,TEST AX, 1301H
) - where A: AL/AX
-
Shift Instructions
-
SHL/SAL (Shift Logical/Arithmetic Left): shifts the operand word or byte bit by bit to the left
- Inserts zeros in the newly introduced least significant bits
- The count is either 1 or specified by register CL
- Syntax:
SHL/SAL dest, count
(e.g.,SHL AX, 1
)
-
SHR (Shift Right): shifts the operand word or byte bit by bit to the right
- Inserts zeros in the newly introduced most significant bits
- The count is either 1 or specified by register CL
- Syntax:
SHR dest, count
(e.g.,SHR AX, 1
)
-
SAR (Shift Arithmetic Right): shifts the operand word or byte bit by bit to the right
- Copies the sign bit to the newly introduced most significant bits
- The count is either 1 or specified by register CL
- Syntax:
SAR dest, count
(e.g.,SAR AX, 1
)
Branch Instructions
- Transfer execution control to specified address
- Short Jump: displacement must lie within – 80H to 7FH (or –128 to 127) bytes from the address of the branch instruction
-
Conditional Branch Instructions:
-
JZ/JE
(Transfer control if ZF=1 (Zero Flag)) -
JNZ/JNE
(Transfer control if ZF=0) -
JS
(Transfer control if SF=1 (Sign Flag)) -
JNS
(Transfer control if SF=0) -
JO
(Transfer control if OF=1 (Overflow Flag)) -
JNO
(Transfer control if OF=0) -
JP/JPE
(Transfer control if PF=1 (Parity Flag)) -
JNP
(Transfer control if PF=0) -
JB/JNAE/JC
(Transfer control if CF=1 (Carry Flag)) -
JNB/JNE/JNC
(Transfer control if CF=0) -
JBE/JNA
(Transfer control if CF=1 or ZF=1) -
JNBE/JA
(Transfer control if CF=0 or ZF=0) -
JL/JNGE
(Transfer control if neither SF=1 nor OF=1) -
JNL/JGE
(Transfer control if neither SF=0 nor OF=0) -
JNE/JNC
(Transfer control if ZF=1 or neither SF nor OF is 1) -
JNLE/JE
(Transfer control if ZF=? or at least any are of SF & OF is 1)
-
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on the 8086 instruction set, focusing on various categories such as data transfer, arithmetic, and control instructions. Understand the syntax and functionality of key instructions like XCHG and IN. This quiz will reinforce your understanding of assembly language concepts.