Wednesday, August 21, 2013

Addressing Mode: Logical Group

Logical Group:  A microprocessor is basically a programmable logic chip which can perform all the logic function of the hardwired logic through it instruction set. The 8085 instruction sets the 8085 instruction set includes such logic functions as AND, OR and NOT. The following features hold true for all logic instruction.


a.     The instruction implicitly assumes that the accumulator is one of the operands.

b.     All instruction reset (0) carry flag except the instruction complement (CMA)

c.      They modify Z, P, and S according to the data condition of the result.

d.     Place the result in accumulator

The logical operations have the following instructions.

i.                    ANA R/M

·        Logically AND the content of register or memory with the content of accumulator.

·        CY flag is reset and AC set

·        E.g. ANA B ;  A<-A&&B

ii.                  8 bit data ANI

·        Logically AND 8-bit data immediately with the content of accumulator

·        E.g. ANI 72H; A&&72H

iii.                ORA R/M

·        Logically OR the content of register or memory with the content of accumulator

·        CY flag reset and AC reset.

·        E.g. ORA B; A||B

iv.               ORI 8 bit data

·        Logically OR the 8 bit data immediately with the content of accumulator.

·        E.g. ORI 72H; A||72H

v.                 XRA R/M

·        Logically, X-OR the content of register or memory with the content of accumulator.

·        CY flag is reset and AC reset the other as per result

vi.               XRI 8 bit data

·        Logically, X-OR 8 bit data immediately with the content of accumulator.

·        E.g. XRI 72H; A<-Ax||72H

vii.             CMA

·        Complement the content of accumulator

·        No flags affected

·        E.g. CMA; A<-A|

viii.           STC

·        Set carry flag

ix.                CMC

·        Complement carry flag

x.                  CMP R/M

CPI 8-bit data

·        Compares the content of register/memory or 8 bit immediate data with the content of accumulator.

   

CY
   

Z
   

A < R/M or 8-bit data
   

1
   

0
   

A-R<0

A > R/M or 8-bit data
   

0
   

0
   

A-R>0

A = R/M or 8-bit data
   

0
   

1
   

A-R=0

Logically Rotate Instructions

i.                    RLC (Rotate Accumulator Left)

ii.                  RAL (Rotate Accumulator Left Through Carry)

iii.                RRC (Rotate Accumulator Right without Carry)

iv.               RAR (Rotate Accumulator Right Through Carry)

Note:   The rotate instructions are primarily used in arithmetic multiply and divide for serial data transfer. E.g. if accumulator contains 08H 00001000, by rotating 08H to right accumulator A becomes (00000100). It is equal to dividing by 2. However, this procedure is invalid logic 1 is rotated D7 to D0 or vice versa.

Example: 80H -> 10000000 (left)

                01H -> 00000001 (right)    invalid

No comments:

Post a Comment