You are on page 1of 5

Title:

To display and manipulate the output of logical instructions using emu8086 software tool.

Objectives:
 To display and manipulate the output of AND, OR, NOT and XOR Instructions using emu8086
software tool.
 To display and manipulate the output of RCL, ROR, ROL and RCR Instructions using emu8086
software tool.
 To display and manipulate the output of SHL SHR and SAL Instructions using emu8086 software
tool.

Introduction:
AND instruction do the logical AND on two 8-bit or 16-bit data. It means AND
instruction take two operands. For this instruction we have same size of operand. If we have same size of
operand this instruction will work correctly otherwise we will get the error. Syntax of AND instruction is
like “AND BH, AH ”. OR instruction is logical instruction and same as AND instruction but working of
OR instruction is different. This instruction also takes two operands. XOR instruction is also logical
instruction. Its syntax is same as previous instruction have. Next instruction is NOT instruction. It will
negate the values means if we have binary number in one register then after executing of this instruction.
We have 0 in result. It takes one operand.
We have 4 types of rotate instruction. RLC instruction stands for “Rotate Left through
Carry” positions the bits in a register or in memory. It depends on the sequence. In this instruction,
operands are shifted one bit one time. If we write “RCL BL 6 ”. It means we are this command
accomplish RCL operation on BL 6 times. Result will we stored in register that we are using. Next is
ROL instruction. It stands for “Rotate Left”. Result of this instruction depends on scenario. As we write
“ROL SI 14” . It means we are shifting left SI register 14 times. RCR instruction stands for “Rotate Right
through Carry”, behaves like reverse in RCL. We write this instruction “RCR AH, CL”. It means mean
contents of AH register is rotated right times the value of CL. Result will be stored in AH register. ROR
instruction stands for “Rotate Right”. It will shift right the values of registers.
SHL instruction stands for “Shift left” and SAL instruction stands for “Shift Arithmetic
Left”. When we use instruction SHL. It will shift the value toward left side simple. When we use SAL. It
means it shift value towards left side but when is shift the value then take one on that bit if here is zero
bit. SHR instruction stand for “Shift Right” and SAR stands for “Shift Arithmetic Right”. Both
instructions will work in reverse of previous instruction SHL/SAL.

Methodology:
In prelab task1, we will count the 1’s in number. First take value in ay register. Then take
value of which we want to check 1’s of the number in another register. Now write label that will start
loop. Now use mov command that will swap the content of value to first value that we take. Now use
AND instruction to AND with first value it will gives one and make one if we have same values in first
value and other value. Now add this AND operation number in AL register. We want to store value in AL
register Now increment the loop with 1.
In prelab task2, we will do the same task as we have done already. But we use OR
instruction instead of AND instruction. For storing the result, we use AL register.
In prelab task3, take two values. Now we perform OR operation on both values. As want
to set 1 on right most bits of second number. And store the result in SI register.
In task1, take any value in AX register and take value in BX register. Now perform Not
operation on BX. Then add 1 in BX register. Now Add this resultant value in Ax. We will get the required
answer.
In task2, we will take value in register AX. Now we will take value in CX register and
take value ‘‘0h’’ in DX register. Make label and now function loop start shift left AX value by 1. Now
increment the value in DX. Now Count the Number. We will get the resultant answer.
In task3, we will repeat this task as we have done in the previous task.

Result:
PreTask1:

PreTask2:
PreTask3:

InTask1:

InTask2:
InTask3:

InTask4:
(a):

(b):
Conclusion:
In this lab we learn to display and manipulate the logical instructions. This lab is to
familiar with logical instructions like AND, OR, NOT and XOR etc. we learn how can we use logical
instructions with combination of commands.

You might also like