Logical Instructions IN 8086 PDF

Title Logical Instructions IN 8086
Course Btech
Institution APJ Abdul Kalam Technological University
Pages 4
File Size 39.5 KB
File Type PDF
Total Downloads 102
Total Views 134

Summary

LOGICAL INSTRUCTIONS IN 8086 WITH EXAMPLES....


Description

LOGICAL INSTRUCTIONS • The operations performed are 1. AND 2. OR 3. NOT 4. XOR 5. SHIFT 6. ROTATE • All the condition code flags will be affected depending on the result. 1. AND: Logical AND • The instruction bit by bits ANDs the source operand to destination operand. • Source can be:: 1. Immediate 2. Register 3. Memory loc • Destination can be 1. Register 2. Memory loc • Both the operand cannot be Memory locations or immediate values. Eg:: AND AX, 0008H AND AX, BX AND AX, [5000H] 2. OR: Logical OR • Carry out OR operation in the same way as AND operation. OR AX, 0008H OR AX, BX OR AX, [5000H] 3. NOT: Logical Invert

• The NOT instruction complements(convert) the contents of an operand register or a memory location, bit by bit. Eg:: NOT AX NOT [5000H] 4. XOR : Logical Exclusive OR • It is carried out in the similar way to the AND operation. • Operand constraints are similar. • XOR gives high o/p, when the 2 i/ps are dissimilar • Otherwise output is 0. • Eg:: XOR AX, 0001H XOR AX, BX XOR AX, [5000H] 5. TEST: Logical Compare Instruction • It performs a bit by bit logical AND operation on the two operands. • Each of the result is then set to 1, if the corresponding bits of both operands are 1 , else the bits are reset to 0. • The operands may be registers , memory or immediate data. • • Eg:: TEST AX, BX TEST [0500], 06H 6. SHL/SAL : Shift Logical/ Arithmetic Left • These instruction shift the operand word or byte bit by bit to left and insert zeros in the newly introduced least significand bits. 7. SHR : Shift Logical Right • Performs bit wise right shift on the operand word or byte that may reside in a register or a memory location by the specified count in the instruction and

inserts 0s in the shifted positions(MSB). • The result is stored in the destination operand. Eg:: SHR BX, 3 8. SAR : Shift Arithmetic Right • This instruction performs right shift on the operand word or byte, that may be register or memory location. • It insert MSB bits of the operand in the newly inserted positions. • The result is stored in the destination operand. Eg:: SAR BX, 3 9. ROR : Rotate Right without Carry • This instruction rotates the contents of the destination operand to the right(bitwise) either by one or by the count specified in the CL, excluding carry. • The LSB is pushed in to the carry flag and simultaneously it is transferred into the most significant bit position at each operation. • The operand may be register or memory and cannot be an immediate operand. Eg:: ROR AH , 4 10. ROL: Rotate Left without carry • This instruction rotes the content of destination operand to the left by the specified count(bit-wise) excluding carry. • The MSB bit is pushed into the carry flag as well as the LSB bit position at each operation. • The operand may be a register or memory location. Eg:: ROL AX, 3 11.RCR (Rotate Right through Carry) • This instruction rotates the mentioned bits in the register to the right side one by one such that rightmost bit that is being rotated is again stored as the MSB in the register, and it is also stored in the Carry Flag (CF). Eg: ROR AH, 4 12.RCL (Rotate Left through Carry) • This instruction rotates the mentioned bits in the register to the left side one by one such that leftmost bit that is being rotated it is stored in the Carry Flag (CF), and the bit in the CF moved as

the LSB in the register. Eg: RCL AL, 3...


Similar Free PDFs