You are on page 1of 6

n

The TEST instruction performs a bit by bit logical AND operation on the two operands. The
result of this ANDing operation is not available for further use, but flags are affected.
SAL / SHL destination, count.
SAL and SHL are two mnemonics for the same instruction. This instruction shifts each bit in the
specified destination to the left and 0 is stored at LSB position. The MSB is shifted into the carry
flag. The destination can be a byte or a word. It can be in a register or in a memory location. The
number of shifts is indicated by count.
SHR: SHR destination, count
This instruction shifts each bit in the specified destination to the right and 0 is stored at MSB
position. The LSB is shifted into the carry flag. The destination can be a byte or a word. It can be
a register or in a memory location. The number of shifts is indicated by count.
SAR: SAR destination, count
This instruction shifts each bit in the specified destination some number of bit positions to the
right. As a bit is shifted out of the MSB position, a copy of the old MSB is put in the MSB
position. The LSB will be shifted into CF.
Eg. SAR BL, 1

ROL Instruction: ROL destination, count


This instruction rotates all bits in a specified byte or word to the left some number of bit
positions. MSB is placed as a new LSB and a new CF.
ROR Instruction: ROR destination, count
This instruction rotates all bits in a specified byte or word to the right some number of bit
positions. LSB is placed as a new MSB and a new CF.
RCL Instruction: RCL destination, count
This instruction rotates all bits in a specified byte or word some number of bit positions to the
left along with the carry flag. MSB is placed as a new carry and previous carry is place as new
LSB.
RCR Instruction: RCR destination, count
This instruction rotates all bits in a specified byte or word some number of bit positions to the
right along with the carry flag. LSB is placed as a new carry and previous carry is place as new
MSB.
RCL Instruction: RCL destination, count
This instruction rotates all bits in a specified byte or word some number of bit positions to the
left along with the carry flag. MSB is placed as a new carry and previous carry is place as new
LSB.
TASKS
TASK#1
Perform AND,OR,XOR& NOT operation in any two decimal numbers.
AND INSTRUCTION
CODE
org 100h
; add your code here
mov AX, 45A8H
mov Cx,0E87H
AND CX, AX
ret

OUTPUT

OR

INSTRUCTION
CODE
org 100h

; add your code here


org 100h

; add your code here


mov AX, 45A8H
mov Cx,0E87H
OR CX, AX

ret

OUTPUT

NOT INSTRUCTION
CODE
org 100h

; add your code here


org 100h

; add your code here

mov AX, 0016H


NOT AX
ret

OUTPUT
XOR INSTRUCTION

CODE
org 100h
; add your code here

MOV AX,0018H
MOV CX,0016H
XOR AX,CX
ret
OUTPUT

TASK#2
Multiply decimal 14 with decimal 14 using AND and shift operators
CODE
OUTPUT

CONCLUSION
In this lab we learn about logical operations and shift operators and perform the given tasks on
software.

You might also like