1 / 20

III] Logical Group

III] Logical Group. 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

atalo
Télécharger la présentation

III] Logical Group

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. III] Logical Group • 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 0010010 = 12 H After Execution : [A] = 12 H Flags : S = 0, Z = 0, P = 1 Ac = 1, Cy = 0

  2. III] Logical Group • 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 10 0 1 01 AND [C050] : 37 H = 0 0 1 1 0 1 1 1 ___________ 0 0100101 = 25 H After Execution : [A] = 25 H Flags : S = 0, Z = 0, P = 0 Ac = 1, Cy = 0

  3. III] Logical Group • 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 00 0 AND 22 H = 0 0 10 00 1 0 ___________ 0 0000000 = 00 H After Execution : [A] = 00 H Flags : S = 0, Z = 1, P = 0 Ac = 1, Cy = 0

  4. III] Logical Group • 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 1110110 = 76 H After Execution : [A] = 76 H Flags : S = 0, Z = 0, P = 0 Ac = 0, Cy = 0

  5. III] Logical Group • 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 10 0 1 01 OR [C050] : 37 H = 0 0 1 1 0 1 1 1 ___________ 0 0110111 = 37 H After Execution : [A] = 37 H Flags : S = 0, Z = 0, P = 0 Ac = 0, Cy = 0

  6. III] Logical Group • 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 = 10 0 0 100 0 OR 22 H = 0 0 10 00 1 0 ___________ 10 1 0 1010 = AA H After Execution : [A] = AA H Flags : S = 1, Z = 0, P = 1 Ac = 0, Cy = 0

  7. III] Logical Group • 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 0110 ___________ 0 11 0 01 00 = 64 H After Execution : [A] = 64 H Flags : S = 0, Z = 0, P = 0 Ac = 0, Cy = 0

  8. III] Logical Group • 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 10 0 1 0 1 EX-OR [C050] : 37 H = 0 0 1 1 0 1 11 ___________ 0 0010010 = 12 H After Execution : [A] = 12 H Flags : S = 0, Z = 0, P = 1 Ac = 0, Cy = 0

  9. III] Logical Group • 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 = 10 0 0 1 00 0 EX-OR 22 H = 0 0 10 00 1 0 ___________ 10 1 0 1010 = AA H After Execution : [A] = AA H Flags : S = 1, Z = 0, P = 1 Ac = 0, Cy = 0

  10. III] Logical Group • 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. • If [A] < [r] then Cy = 1 • If [A] = [r] then Z = 1 • 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

  11. III] Logical Group • 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. • If [A] < [[H-L]] then Cy = 1 & Z = 0 • If [A] = [[H-L]] then Cy = 0 & Z = 1 • 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

  12. III] Logical Group • 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. • If [A] < 8-bit data then Cy = 1 & Z = 0 • If [A] = 8-bit data then Cy = 0 & Z = 1 • 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

  13. III] Logical Group • 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 Before Execution : After Execution : [A] = 03 H & Cy = 1

  14. III] Logical Group • 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 Before Execution : After Execution : [A] = C0 H & Cy = 1

  15. III] Logical Group • 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 Before Execution : After Execution : [A] = 02 H & Cy = 1

  16. III] Logical Group • RAR : ROTATE ACCUMULATOR RIGHT THROUGH CARRY Format : [An] [An+1], [A7] [Cy], [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 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 : After Execution : [A] = 40 H & Cy = 1

  17. III] Logical Group • 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

  18. III] Logical Group • 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

  19. III] Logical Group • 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

More Related