Arithmetic and Logic Instructions: 8086 Assembler
Arithmetic and Logic Instructions: 8086 Assembler
Arithmetic and Logic Instructions: 8086 Assembler
http://ce.kashanu.ac.ir/sabaghian/assembly/8086 tutorial/...
8086 Assembler
As you may see there are 16 bits in this register, each bit is
called a ag and can take a value of 1 or 0.
Carry Flag (CF) - this ag is set to 1 when there is an
unsigned overow. For example when you add bytes
255 + 1 (result is not in range 0...255). When there is no
overow this ag is set to 0.
Zero Flag (ZF) - set to 1 when result is zero. For none
zero result this ag is set to 0.
Sign Flag (SF) - set to 1 when result is negative. When
result is positive it is set to 0. Actually this ag take the
value of the most signicant bit.
Overow Flag (OF) - set to 1 when there is a signed
overow. For example, when you add bytes 100 + 50
(result is not in range -128...127).
Parity Flag (PF) - this ag is set to 1 when there is even
number of one bits in result, and to 0 when there is odd
number of one bits. Even if result is a word only 8 low bits
are analyzed!
Auxiliary Flag (AF) - set to 1 when there is an unsigned
overow for low nibble (4 bits).
1 of 5
11/13/2015 08:19 AM
http://ce.kashanu.ac.ir/sabaghian/assembly/8086 tutorial/...
2 of 5
11/13/2015 08:19 AM
http://ce.kashanu.ac.ir/sabaghian/assembly/8086 tutorial/...
AND
AND
AND
AND
1
0
1
0
=
=
=
=
1
0
0
0
OR
OR
OR
OR
1
0
1
0
=
=
=
=
1
1
1
0
XOR
XOR
XOR
XOR
1
0
1
0
=
=
=
=
0
1
1
0
3 of 5
11/13/2015 08:19 AM
http://ce.kashanu.ac.ir/sabaghian/assembly/8086 tutorial/...
11/13/2015 08:19 AM
http://ce.kashanu.ac.ir/sabaghian/assembly/8086 tutorial/...
5 of 5
11/13/2015 08:19 AM