Featured

    Featured Posts

Describe various arithmetic instructions with examples in 8085 microprocessor.


Describe various arithmetic instructions with examples in 8085 microprocessor.

The arithmetic group of instruction include following instructions :
ADD R
ACI data
SBB M
DCR R
ADD M
DAD Rp
SUI data
DCR M
ADC R
SUB R
SBI data
INX Rp
ADC M
SUB M
INR R
DCX Rp
ADI data
SBB R
INR M
DAA
Some of the describe as follows :

ADD R :
Description : Add register R contents to accumulator. This instruction adds the contents of register R and accumulator and stores the result in accumulator. The example of R are all general purpose register such as A, B, C, D, E, H and L. In addition to the result in accumulator all the flags are modified to reflect the result of operation.

Operation : A + R -> A
example :  ADD : A + B -> A. Suppose A = 40 H and B = 65 H.
  A 0100 0000
+B 0110 0101
  A 1010 0101

ADC R :
Description : Add register cut carry flag contents to accumulator. This instruction adds the contents of register R, Carry flag CY and accumulator and stores the result in accumulator. The example of R are all general purpose registers such as A, B, C, D, E, H and L. In addition to the result in accumulator all the flags are modified to reflect the result of operation.
Operation : A + R -> Cy -> A
Example : ADC : A + B + Cy -> A.
Suppose b = 20, A = 3 F and Cy = set and ADC B is instruction is executed.
A = 0011 1111
B = 0011 0000
Cy = 
A = 0110 0000

ADI data :
Description : Add immediate data to accumulator. This instruction adds the 8 bit data specified along with the instruction to accumulator and result is stored in accumulator. All flags are also modified to reflect the result of operation. The storing format of this instruction will be 1st byte opcode and 2nd byte operand (data).
Operation : A + data -> A
Example : ADI B7 H : add B7 H data to accumulator and store result in accumulator. Suppose A = 59 H instruction ADI B7 is executed
A = 0101 1001
M = 1011 0111
     10110 0000

DAD Rp :
Discription : This instruction adds the contents of specified register pair to HL pair and stores the result in HL pair. The example of Rp are SP, BC, DE and HL. Only carry flag is modified to reflect the result operation
Operation : Rp + HL -> HL
Example : (i) DAD B : BC + HL -> HL
(ii) DAD SP : SP + HL -> HL
  DAD B
Suppose B = 21, C = 45,, H = 80, L = 35, is executed.
 2145 BC
+8035 HL
  A17A HL

SUB M :
Description : Subtract memory location contents from accumulator. This instruction subtracts memory location contents from accumulator and result is placed in accumulator. The subtraction is performed in the same ways as SUB R instruction. All flags are modified to reflect the result of operation.
Example : SUB M : A - (HL) -> A.
Suppose A = 50H, H = C2, L = 00, at memory location C200 : 20 H is stored and instruction SUB M is executed.
(C200)= 0010 0000
2's com = 1110 0000
       A = 0101 0000
2's cop. = 1110 0000
           [1] 0011 0000

SUI data :
Description : Subtract immediate data from accumulator.
This instruction subtracts the data specified along with instruction from accumulator. The subtraction is performed by using 2's complement method and operation is same as SUB R instruction.
Operation : A - data -> A
Example : SUI 50 : A - 50 -> A.
Suppose A = 20 and instruction SUI 50 is executed.

INR M :
Description : Increment memory contents by one. This instruction increments the contents of memory location address by HL register pair by 1 and result is stored back at the same memory location. Only carry flag is not modified, all other flags are modified.
Operation : (HL0 + 1 or M + 1 -> M
Example : INR M : (HL) + 1 -> (HL).
Suppose H = C2, L = 02, at memory location C202 : 04 is stored, flag reg = 10 *1*0*1 and instruction INR M is executed.

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.
Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com