File

advertisement
III] Logical Group
1) ANA r : LOGICAL AND REGISTER WITH ACCUMULATOR
Format : [A]
[A] Λ [r]
Addressing : Register addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 1
The content of accumulator is logically ANDed with the content of
register r. result is placed in accumulator. S, Z & P flags are modified.
Cy flag is reset. Ac flag is set.
Example : Let [A] = 52 H & [C] = 36 H
Instruction : ANA C
[A] : 52 H = 0 1 0 1 0 0 1 0
[C] : 36 H = ___________
0011 0110
0 0 0 1 0 0 1 0 = 12 H
After Execution : [A] = 12 H
Flags :
S = 0, Z = 0, P = 1
Ac = 1, Cy = 0
III] Logical Group
2) ANA M : LOGICAL AND MEMORY WITH ACCUMULATOR
Format : [A]
[A] Λ [[H][L]]
Addressing : Register Indirect addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 1
The content of accumulator is logically ANDed with the content of
memory location whose address is stored in HL register pair. result is
placed in accumulator. S, Z & P flags are modified. Cy flag is reset. Ac
flag is set.
Example : Let [A] = 25 H, [H-L] = C050 H,
Instruction : ANA M
[A] : 25 H = 0 0 1 0 0 1 0 1
AND [C050] : 37 H =___________
0011 0111
&
0 0 1 0 0 1 0 1 = 25 H
After Execution : [A] = 25 H
Flags :
S = 0, Z = 0, P = 0
Ac = 1, Cy = 0
[C050] = 33 H
III] Logical Group
3) ANI data : AND IMMEDIATE DATA WITH ACCUMULATOR
Format : [A]
[A] Λ data
Addressing : Immediate addressing
Group : Logical group
Bytes : 2 Bytes
Flags : S, Z, P are modified Cy =0, Ac = 1
The content of accumulator is logically ANDed with the 8-bit
immediate data specified in 2nd byte of instruction. Result is placed in
accumulator. S, Z & P flags are modified. Cy flag is reset. Ac flag is
set.
Example : Let [A] = 88 H
Instruction : ANI 22 H
[A] : 88 H = 1 0 0 0 1 0 0 0
AND 22 H = ___________
0010 0010
0 0 0 0 0 0 0 0 = 00 H
After Execution : [A] = 00 H
Flags :
S = 0, Z = 1, P = 0
Ac = 1, Cy = 0
III] Logical Group
4) ORA r : LOGICAL OR REGISTER WITH ACCUMULATOR
Format : [A]
[A] V [r]
Addressing : Register addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically ORed with the content of
register r. result is placed in accumulator. S, Z & P flags are modified.
Cy & Ac flags are reset.
Example : Let [A] = 52 H & [C] = 36 H
Instruction : ORA C
[A] : 52 H = 0 1 0 1 0 0 1 0
[C] : 36 H = ___________
0011 0110
0 1 1 1 0 1 1 0 = 76 H
After Execution : [A] = 76 H
Flags :
S = 0, Z = 0, P = 0
Ac = 0, Cy = 0
III] Logical Group
5) ORA M : LOGICAL OR MEMORY WITH ACCUMULATOR
Format : [A]
[A] V [[H][L]]
Addressing : Register Indirect addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically ORed with the content of
memory location whose address is stored in HL register pair. result is
placed in accumulator. S, Z & P flags are modified. Cy & Ac flags are
reset.
Example : Let [A] = 25 H, [H-L] = C050 H,
Instruction : ORA M
[A] : 25 H = 0 0 1 0 0 1 0 1
OR [C050] : 37 H =___________
0011 0111
&
0 0 1 1 0 1 1 1 = 37 H
After Execution : [A] = 37 H
Flags :
S = 0, Z = 0, P = 0
Ac = 0, Cy = 0
[C050] = 33 H
III] Logical Group
6) ORI data : LOGICAL OR IMMEDIATE DATA WITH ACCUMULATOR
Format : [A]
[A] V data
Addressing : Immediate addressing
Group : Logical group
Bytes : 2 Bytes
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically ORed with the 8-bit
immediate data specified in 2nd byte of instruction. Result is placed in
accumulator. S, Z & P flags are modified. Cy & Ac flags are reset.
Example : Let [A] = 88 H
Instruction : ORI 22 H
[A] : 88 H = 1 0 0 0 1 0 0 0
OR 22 H = 0 0 1 0 0 0 1 0
___________
1 0 1 0 1 0 1 0 = AA H
After Execution : [A] = AA H
Flags :
S = 1, Z = 0, P = 1
Ac = 0, Cy = 0
III] Logical Group
7) XRA r : EXCLUSIVE OR REGISTER WITH ACCUMULATOR
Format : [A]
[A]  [r]
Addressing : Register addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically Exclusive ORed with the
content of register r. result is placed in accumulator. S, Z & P flags
are modified. Cy & Ac flags are reset.
Example : Let [A] = 52 H & [L] = 36 H
Instruction : XRA L
[A] : 52 H = 0 1 0 1 0 0 1 0
[L] : 36 H = 0 0 1 1 0 1 1 0
___________
0 1 1 0 0 1 0 0 = 64 H
After Execution : [A] = 64 H
Flags :
S = 0, Z = 0, P = 0
Ac = 0, Cy = 0
III] Logical Group
8) XRA M : EXCLUSIVE OR MEMORY WITH ACCUMULATOR
Format : [A]
[A]  [[H][L]]
Addressing : Register Indirect addressing
Group : Logical group
Bytes : 1 Byte
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically Exclusive ORed with the
content of memory location whose address is stored in HL register
pair. Result is placed in accumulator. S, Z & P flags are modified. Cy &
Ac flags are reset.
Example : Let [A] = 25 H, [H-L] = C050 H,
Instruction : XRA M
[A] : 25 H = 0 0 1 0 0 1 0 1
EX-OR [C050] : 37 H =___________
0011 0111
&
0 0 0 1 0 0 1 0 = 12 H
After Execution : [A] = 12 H
Flags :
S = 0, Z = 0, P = 1
Ac = 0, Cy = 0
[C050] = 33 H
III] Logical Group
9) XRI data : EXCLUSIVE OR IMMEDIATE DATA WITH ACCUMULATOR
Format : [A]
[A]  data
Addressing : Immediate addressing
Group : Logical group
Bytes : 2 Bytes
Flags : S, Z, P are modified Cy =0, Ac = 0
The content of accumulator is logically Exclusive ORed with the 8-bit
immediate data specified in 2nd byte of instruction. Result is placed in
accumulator. S, Z & P flags are modified. Cy & Ac flags are reset.
Example : Let [A] = 88 H
Instruction : XRI 22 H
[A] : 88 H = 1 0 0 0 1 0 0 0
EX-OR 22 H = 0 0 1 0 0 0 1 0
___________
1 0 1 0 1 0 1 0 = AA H
After Execution : [A] = AA H
Flags :
S = 1, Z = 0, P = 1
Ac = 0, Cy = 0
III] Logical Group
10) CMP r : COMPARE REGISTER WITH ACCUMULATOR
Format : [A] – [r]
Addressing : Register addressing
Group : Logical group
Bytes : 1 Byte
Flags : All
This compares the content of the given register with content of
accumulator. Comparison is done using subtraction of content of register
from the content of accumulator. The content of accumulator remains
unchanged.
(i)
If [A] < [r]
(ii) If [A] = [r]
(iii) If [A] > [r]
then Cy = 1
then Z = 1
then Cy = 0 & Z = 0
Example : Let [A] = 88 H & [L] = 99 H
Instruction : CMP L
After Execution : [A] = 88 H
Cy = 1, Z = 0
III] Logical Group
11) CMP M : COMPARE MEMORY WITH ACCUMULATOR
Format : [A] – [[H-L]]
Addressing : Register Indirect addressing
Group : Logical group
Bytes : 1 Byte
Flags : All
This compares the content of the memory location whose address is
stored in HL register pair with content of accumulator by subtracting the
content of the memory location from the content of accumulator. The
content of accumulator remains unchanged.
(i)
If [A] < [[H-L]]
then Cy = 1 & Z = 0
(ii) If [A] = [[H-L]] then Cy = 0 & Z = 1
(iii) If [A] > [[H-L]] then Cy = 0 & Z = 0
Example : Let [A] = 88 H & [H-L] = 9900 H
Instruction : CMP M
After Execution : [A] = 88 H
Cy = 0, Z = 0
&
[9900] = 22 H
III] Logical Group
12)CPI M : COMPARE IMMEDIATE DATA WITH ACCUMULATOR
Format : [A] – data
Addressing : Immediate addressing
Group : Logical group
Bytes : 2 Bytes
Flags : All
This compares the 8-bit immediate data with the content of
accumulator by subtracting the data from the content of accumulator. The
content of accumulator remains unchanged.
(i) If [A] < 8-bit data then Cy = 1 & Z = 0
(ii) If [A] = 8-bit data then Cy = 0 & Z = 1
(iii) If [A] > 8-bit data then Cy = 0 & Z = 0
Example : Let [A] = 58 H
Instruction : CPI 58
After Execution : [A] = 58 H
Cy = 0, Z = 1
III] Logical Group
13)RLC : ROTATE ACCUMULATOR LEFT
Format : [An+1] [An], [A0] [A7], [Cy] [A7]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Only Cy may be affected
The content of accumulator is rotated to left by 1-bit position. The
bit A7 is stored in bit A0 as well as in carry flag.
Cy
A7 A6 A5 A4 A3 A2 A1 A0
Example : Let [A] = 81 H & [Cy] = 0
Instruction : RLC
0
1
0
Before Execution :
0
0
0
0
0
1
After Execution :
0
0
0
0
1
1
1
0
0
[A] = 03 H & Cy = 1
III] Logical Group
14)RRC : ROTATE ACCUMULATOR RIGHT
Format : [An] [An+1], [A7] [A0], [Cy] [A0]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Only Cy may be affected
The content of accumulator is rotated to right by 1-bit position. The
bit A0 is stored in bit A7 as well as in carry flag.
Cy
A7 A6 A5 A4 A3 A2 A1 A0
Example : Let [A] = 81 H & [Cy] = 0
Instruction : RRC
0
1
0
Before Execution :
0
0
0
0
0
1
After Execution :
0
0
0
0
0
0
1
1
1
[A] = C0 H & Cy = 1
III] Logical Group
15)RAL : ROTATE ACCUMULATOR LEFT THROUGH CARRY
Format : [An+1] [An], [A0] [Cy], [Cy] [A7]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Only Cy may be affected
The content of accumulator is rotated to left by 1-bit position through
carry flag. The carry flag is stored in bit A0 of accumulator & bit A7 of
accumulator is stored in carry flag.
Cy
A7 A6 A5 A4 A3 A2 A1 A0
Example : Let [A] = 81 H & [Cy] = 0
Instruction : RAL
0
1
0
Before Execution :
0
0
0
0
0
1
After Execution :
0
0
0
0
1
0
1
0
0
[A] = 02 H & Cy = 1
III] Logical Group
16)RAR : ROTATE ACCUMULATOR RIGHT THROUGH CARRY
Format : [An] [An+1], [A7] [Cy], [Cy]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Only Cy may be affected
[A0]
The content of accumulator is rotated to right by 1-bit position through
carry flag. The carry flag is stored in bit A7 bit A0 is stored in carry flag.
Cy
A7 A6 A5 A4 A3 A2 A1 A0
Example : Let [A] = 81 H & [Cy] = 0
Instruction : RAR
Before Execution :
0
1
0
0
0
0
0
0
1
After Execution :
0
0
0
0
0
0
1
0
1
[A] = 40 H & Cy = 1
III] Logical Group
17)CMA : COMPLEMENT THE ACCUMULATOR
Format : [A]
[Ā]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : None
This instruction complements the content of accumulator. Result is
placed in accumulator.
Example : Let [A] = 5D H = 0 1 0 1 1 1 0 1
Instruction : CMA
After Execution : [A] = 1 0 1 0 0 0 1 0
= A2 H
III] Logical Group
18)CMC : COMPLEMENT CARRY
Format : [Cy]
[Cy]
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Cy
This instruction complements the content of carry flag.
Example : Let [Cy] = 1
Instruction : CMC
After Execution : [Cy] = 0
III] Logical Group
19)STC : SET CARRY
Format : [Cy]
1
Addressing : Implied addressing
Group : Logical group
Bytes : 1 Byte
Flags : Cy
This instruction sets the carry flag to 1.
Example : Let [Cy] = 0
Instruction : STC
After Execution : [Cy] = 1
Example : Let [Cy] = 1
Instruction : STC
After Execution : [Cy] = 1
Download