Wednesday, 27 July 2011

8085 Logical Instructions

        In my previous post we saw about arithmetic instructions of 8085uP. Now, we are going to discuss about some logical operations which we perform in registers, memory location and on flags.



As formerly seen in my previous post in this Series, we divided the Series into four parts:
LOGICAL INSTRUCTIONS
       ANA :
         It logically AND with the accumulator. It means that the accumulator is multiplied with some register values.
         e.g: If [A] = 20 >> 0 0 1 0 0 0 0 0
                [B] = 30 >> 0 0 1 1 0 0 0 0
                After instruction >> [A] = 0 0 1 0 0 0 0 0
       ANI :
        It logically AND with the accumulator using the immediate data.
          e.g: For   [A] = FE  (i.e 1111 1110 )
                 after ANI 07        ; 07 = 0000 0111
                 [A] = 06     (i.e 0000 0110 )
                                 
      ORA:
       It logically OR with the accumulator. It means that the accumulator is added with the registers.
           e.g: If [A] = FE (i.e 1111 1110 )
                  and [B] = 31 (i.e 0011 0001 )
             after instruction  [A ] = FF (i.e 1111 1111 )
      ORI :
           As u guessed, it logically OR with the accumulator using the immediate data.
e.g: if [A] = 7D (i.e 0111 1101 )
      after ORI 17            ;17 = 1 0 0 0 0 1 1 1
      [A] = FF (i.e 1111 1111 )

      XRA :
          It logically EX-OR with the accumulator. It means that if any two numbers are same its output will be 0 else if not same output will be 1 
e.g: If [A] = 7F                                (i.e 0111 1111 )
       and [B] = 32                              (i.e 0011 0010 )
                After instruction >> [A] = 4D (i.e 0100 1101 )
         XRI:
     It logically EX-OR with the accumulator using the immediate data.
         e.g: If[A] = FE           (i.e 1111 1110 )
                after  XRI 07  ; 07 = 0000 0111
                [A] = F9              (i.e 1111 1001 )

COMPARE INSTRUCTIONS:
     It compares the content of 8 bit data with the contents of accumulator Some 2 instructions are there here they are,

           CMP:
                It compares the conetents with the contents of accumulator. This instruction is used to check whether the numbers are same or zero etc.
           CPI:
      It compares with the contents of accumulator using immediate data.They are mostly used in 8 bit and 16 bit multiplication or division programs etc..

RLC :
     It means the that the contents of accumulator is rotated to left.
        e.g: [A] = 1 0 1 0 1 1
               after RLC
               [A] = 0 1 0 1 1 1

RRC:
     It is as same as RLC but it is rotated to right side.
       e.g: [A] = 1 1 1 1 1 0
              after RRC
              [A] = 0 1 1 1 1 1

RAL:
     It rotates each bit of accumulator to left with carry.
        e.g: If [C]=0 and [A]= 1 1 0 1 1 1 0 1
               after RAL
               [C] =1 and [A] = 1 0 1 1 1 0 1 0

RAR:
     It is as similar to RAL But I will rotate in right side.
        e.g: If [C] =0 and [A] = 1 1 1 1 1 0
               after RAR
               [C]=0 and [A] = 0 1 1 1 1 1


COMPLEMENT AND CARRY FLAG INSTRUCTIONS:
      These instructions are used to complement the data. The names of instructions are self-explaining abbreviations 
CMA: 
          It complements the accumulator.
             e.g: If [A] = 0 0 0 1
                    after CMA 
                    [A] = 1 1 1 0

CMC: 
          It complements the carry
            e.g: [C] = 0
                   after CMC
                   [C] = 1

STC: 
         It sets the carry.
         e.g: If [C] = 0 or 1
                after STC 
                [C] = 1

2 comments:

Post a Comment

தங்களது கருத்துக்களை இங்கே வெளியிடவும்...

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More