Arithmetic group Instruction ,8085 programming



    b)Arithmetic, 
The microprocessor is performed arithmetic operations like addition subtraction ,increment and decrement . these arthmetc operations have the following mnemonics..
ADD Add to Accumulator
ADI Add Immediate Data to Accumulator
ADC Add to Accumulator Using Carry Flag
ACI Add Immediate data to Accumulator Using Carry
SUB Subtract from Accumulator
SUI Subtract Immediate Data from Accumulator
SBB Subtract from Accumulator Using Borrow (Carry) Flag
SBI Subtract Immediate from Accumulator Using Borrow (Carry) Flag
INR Increment Specified Byte by One
DCR Decrement Specified Byte by One
INX Increment Register Pair by One
DCX Decrement Register Pair by One
DAD Double Register Add; Add Content of Register    b)Arithmetic, 
The microprocessor is performed arithmetic operations like addition subtraction ,increment and decrement . these arthmetc operations have the following mnemonics..
ADD R/M
a)      ADD R
·         1 byte add instruction
·         add the content of accumulator to the content of specified register/memory and stores the result in the accumulator
·         e.g. ADD  B; A   ß  [A]+[B]
let us take a example :
MVI   A,20h    ;Stores 20h data in Accumulator
MVI   B,30h     ;Stores 30h in register B
ADD  B            ;Adds the content of a  Accumulator with content of B register
HLT
The program adds the data 20h and 30h and stores in the Accumulator.
Output
A:50     B:30

b)      ADD M

Adds the data of the memory location pointed by the HL pair with the Accumulator and stores the result in the Accumulator.[A]ß[A] + [[M]]
Lets see an example:
          LXI   H,2040h  ;Loads 2040h in HL pair i.e H:20h L:20h
          MVI  M,60h      ;moves 60h to memory location pointed by Hl pair
          MVI  A,30        ;moves immediate data 20h in Accumulator
          ADD  M            ;adds the data of memory location 2040  i.e 60h with data in Acc.
          HLT
         
ADI

·         BYTE add immediate instruction
·         add the 8-bit data with the content of the accumulator AND stores the result in accumulator. [A]ß
·         eg ADI 54 H . [A]ß[A]+54
·          
SUB R/M
·         1 byte subtract instruction.
·         add the content of accumulator to the content of specified register/memory and stores the result in the accumulator
·         SUB A;
SUI 8 bit data
·         byte subtract immediate instruction
·         Subtract  the 8-bit data with the content of the accumulOR AND stores the result in accumulator.
·         SUI 62H;
INR  R/M
DCR  R/M
-          1 byte Increment decrement  instruction
-          Increment and decrement of the content of the specified register  and memory
-          DCR B;
-          DCR M;
-          INR A;
-          INR M;

INX  Rp
DCX  Rp
-          Byte increment decrement register pair
-          Increment and decrement the content of the register pair by 1.
-          Act as 16 counter made from the content of register pair.
Eg INX  B;
DCX  D;

ADC  R/M (addition with carry -1 byte instruction)
ACI 8 bit data (immediate addition with carry -2 byte)
Adds the content of the register /memory 8 bit data  whatever used with the content of accumulator. And with the previous carry and stores result back to the accumulator.

SBB R/m(Subtraction with borrow/1 byte instruction)
          SBI 8 bit (immediate subtraction with borrow – 2 byte instruction )
Subtracts the content of register or 8 bit data from the content of accumulator taking previous borrow as count.




DAD Rp

-1 byte adition instruction
-add register  pair (B or D or H) with H pair and stores 16 bit result in H pair.


DAA
1 byte Decimal adjustment Accumulator
Used only the addition
The content of accumulator after addition is changed from binary (Hex) to two 4 bits BCD (Binary Coded Decimal) digits

1)      The arithmetic operations  add and subtract are  performed in relation to the content  of accumulator  the features of these  instruction are they assume implicitly that the accumulator is one of operand;
2)      They modify all the flag according to the data conditions of all the result.
3)      they  place the result in accumulator
4)      They do not affect the content of operand register or memory
But the INR  & DCR operations can be performed in any register and memory.
The instruction INX and DCX do not affect the flag.

No comments:

Post a Comment

its cool