Presentation is loading. Please wait.

Presentation is loading. Please wait.

III] Logical Group 1)ANA r : LOGICAL AND REGISTER WITH ACCUMULATOR Format : [A] [A] Λ [r] Addressing : Register addressing Group : Logical group Bytes.

Similar presentations


Presentation on theme: "III] Logical Group 1)ANA r : LOGICAL AND REGISTER WITH ACCUMULATOR Format : [A] [A] Λ [r] Addressing : Register addressing Group : Logical group Bytes."— Presentation transcript:

1

2 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 = 0 0 1 1 0 1 1 0 ___________ 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

3 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, & [C050] = 33 H Instruction : ANA M [A] : 25 H = 0 0 1 0 0 1 0 1 AND [C050] : 37 H = 0 0 1 1 0 1 1 1 ___________ 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

4 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 2 nd 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 = 0 0 1 0 0 0 1 0 ___________ 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

5 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 = 0 0 1 1 0 1 1 0 ___________ 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

6 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, & [C050] = 33 H Instruction : ORA M [A] : 25 H = 0 0 1 0 0 1 0 1 OR [C050] : 37 H = 0 0 1 1 0 1 1 1 ___________ 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

7 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 2 nd 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

8 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

9 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, & [C050] = 33 H Instruction : XRA M [A] : 25 H = 0 0 1 0 0 1 0 1 EX-OR [C050] : 37 H = 0 0 1 1 0 1 1 1 ___________ 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

10 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 2 nd 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

11 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] then Cy = 1 (ii)If [A] = [r] then Z = 1 (iii)If [A] > [r] 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

12 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 & [9900] = 22 H Instruction : CMP M After Execution : [A] = 88 H Cy = 0, Z = 0

13 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

14 III] Logical Group 13)RLC : ROTATE ACCUMULATOR LEFT Format : [A n+1 ] [A n ], [A 0 ] [A 7 ], [Cy] [A 7 ] 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 A 7 is stored in bit A 0 as well as in carry flag. Cy A 7 A 6 A 5 A 4 A 3 A 2 A 1 A 0 Example : Let [A] = 81 H & [Cy] = 0 Instruction : RLC Before Execution : After Execution : [A] = 03 H & Cy = 1 10000001 00000011 0 1

15 III] Logical Group 14)RRC : ROTATE ACCUMULATOR RIGHT Format : [A n ] [A n+1 ], [A 7 ] [A 0 ], [Cy] [A 0 ] 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 A 0 is stored in bit A 7 as well as in carry flag. Cy A 7 A 6 A 5 A 4 A 3 A 2 A 1 A 0 Example : Let [A] = 81 H & [Cy] = 0 Instruction : RRC Before Execution : After Execution : [A] = C0 H & Cy = 1 10000001 11000000 0 1

16 III] Logical Group 15)RAL : ROTATE ACCUMULATOR LEFT THROUGH CARRY Format : [A n+1 ] [A n ], [A 0 ] [Cy], [Cy] [A 7 ] 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 A 0 of accumulator & bit A 7 of accumulator is stored in carry flag. Cy A 7 A 6 A 5 A 4 A 3 A 2 A 1 A 0 Example : Let [A] = 81 H & [Cy] = 0 Instruction : RAL Before Execution : After Execution : [A] = 02 H & Cy = 1 10000001 00000010 0 1

17 III] Logical Group 16)RAR : ROTATE ACCUMULATOR RIGHT THROUGH CARRY Format : [A n ] [A n+1 ], [A 7 ] [Cy], [Cy] [A 0 ] 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 through carry flag. The carry flag is stored in bit A 7 bit A 0 is stored in carry flag. Cy A 7 A 6 A 5 A 4 A 3 A 2 A 1 A 0 Example : Let [A] = 81 H & [Cy] = 0 Instruction : RAR Before Execution : After Execution : [A] = 40 H & Cy = 1 10000001 01000000 0 1

18 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

19 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

20 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 ppt "III] Logical Group 1)ANA r : LOGICAL AND REGISTER WITH ACCUMULATOR Format : [A] [A] Λ [r] Addressing : Register addressing Group : Logical group Bytes."

Similar presentations


Ads by Google