Lab 9 Objective: To Study and Understand The Assembly Language Instructions For Basic Logic Operations

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

LAB 9

Objective
To study and understand the Assembly Language instructions for basic logic
operations.

Basic Logic Operations


A logic operation works on a bitwise level. Starting on the left, a bit from each
operand has the logical operation performed and the results in a Boolean value.
This process proceeds until all the bits have had the logical operation performed.
The Intel 8086 Microprocessor instruction set contains instruction for performing
basic logic operations. The examples of these logic operations are AND, OR,
NOT, XOR and NEG instructions.

AND Instruction
The AND Operation is used to set bits to 0. AND a bit with 1, it stays the same.
AND a bit with 0, it becomes 0.

A B A.B
0 0 0
1 0 0
0 1 0
1 1 1
Two Inputs AND Gate

Program
Input

84
Output

OR Instruction
The OR Operation is used to set bits to 1. OR a bit with 0, it stays the same. OR a
bit with 1, it becomes 1.

A B A+B
0 0 0
1 0 1
0 1 1
1 1 1
Two Inputs OR Gate

85
Program
Input

Output

86
NOT Instruction
NOT instruction is an inverter.

A A̅
0 1
1 0
NOT Gate

Program
Input

Output

87
XOR Instruction
The XOR Operation is used to set bits to the opposite value. XOR a bit with 0, it
stays the same. XOR a bit with 1, it becomes the opposite value.

A B A⊕B
0 0 0
1 0 1
0 1 1
1 1 0
Two Input XOR Gate

Program
Input

Output

88
NEG Instruction
NEG instruction is act as 2’s complement.

Program
Input

Output

89
TEST Instruction
TEST instruction is used to check which flag is ON and OFF i.e., CF, PF, ZF.

Program
Input

Output

90
Conclusion
In this lab, we have learnt about the Assembly Language instructions for basic
logic operations. We have also implemented these instructions i.e., AND, OR,
NOT, XOR, NEG and TEST instructions in program using Emu8086.

91

You might also like