Documente Academic
Documente Profesional
Documente Cultură
NOT Operand
Given:
DL[25H]
RESULT[DAH]
DL =
FLAGS: SF = 1; ZF =
= 0;
II.
Example:
NOT DL
DH = 2525H;
0
1
0
1
1
0
1
0
DAH;
0; PF = 1; AF = undefined; CF = 0; OF
AND
The AND instruction implements the bitwise AND operation.
Performs Logical Multiplication.
Logically AND the source and the destination operands and stores the result in
the destination operand.
If the matching bits from both the operands are 1 return 1, otherwise it returns 0.
Syntax:
AND D, S
Example:
AND BL, DL
Given: BH = 1015H; DH = 2525H;
BL[15H]
0
0
0
1
0
DL[25H]
0
0
1
0
0
RESULT[05H]
0
0
0
0
0
BL = 05H;
FLAGS: SF = 0; ZF = 0; PF = 1; AF = undefined; CF = 0; OF = 0;
III.
OR
1
1
1
0
0
0
1
1
1
A
B
Result Logically OR the source and the
destination operands and stores the result
1
1
1
in the
destination operand.
1
0
1
If the matching
bits from either or both operands are 1
0
1
1
0
0
0
return 1,
otherwise it returns 0.
Syntax:
OR [D], [Data]
Example:
OR BL, DL
Given: BH = 1015H; DH = 2525H;
BL[15H]
DL[25H]
RESULT[35H]
BL =
FLAGS: SF = 0; ZF =
= 0;
IV.
Syntax:
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
35H;
0; PF = 1; AF = undefined; CF = 0; OF
XOR
It is also called as Exclusive-OR
The XOR instruction implements the bitwise XOR operation.
Logically XOR the source and the destination operands and stores the result in the
destination operand.
If and only if the bits from the operands are different return 1, otherwise return 0.
XOR [D], [Data]
Example: XOR BL, DL
Given:
BH = 1015H; DH = 2525H;
BL[15H]
0
0
0
1
0
DL[25H]
0
0
1
0
0
RESULT[30H]
0
0
1
1
0
BL = 30H;
FLAGS: SF = 0; ZF = 0; PF = 0; AF = undefined; CF = 0; OF = 0;
V.
TEST
1
1
0
0
0
0
1
1
0
Logically AND the source and the destination operands and discarded the result but
the values of status flags are updated.
Syntax:
Example:
TEST BL, DL
Given: BH = 1510H; DH = AAAAH;
BL[10H]
0
0
0
1
0
DL[AAH]
1
0
1
0
1
RESULT[00H]
0
0
0
0
0
BL = 10H
FLAGS: SF = 0; ZF = 1; PF = 0; AF = undefined; CF = 0; OF = 0;
VI.
0
0
0
0
1
0
0
0
0
OTHERS
1. NEG (Negate)
It converts the specified operand to its 2's compliment equivalent and the
result returned to the reversing the sign of an integer.
Syntax:
NEG DL
Given: DH = AAAAH;
0
0
0
0
0
0
0
0
0
DL[AAH]
1
0
1
0
1
0
1
0
RESULT[36H][-170] 1
0
1
0
1
0
1
1
0
sign bit
REFERENCES:
1. http://8086pro.blogspot.com/2010/08/logical-instructions.html
2. http://www.tutorialspoint.com/assembly_programming/assembly_logical_instructi
ons.htm
3. http://www.slideshare.net/HassnainJamil/logic-instructions-in-assemblylanguage-x8086
4. https://www.google.com.ph/url?
sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0ahUKEwiRnuKi5dvKAhUD
mpQKHfD9AiIQFgguMAM&url=https%3A%2F%2Ffaculty.psau.edu.sa
%2Ffiledownload%2Fdoc-7-pdf-f9827b6430547fd3f2c94fabf299fb97original.pdf&usg=AFQjCNHjBGtE9KcSHTt6uHxE36BlzTMoQw&cad=rja