Skip to content
Related Articles

Related Articles

8085 program to perform AND operation in nibbles of 8 bit number
  • Last Updated : 20 Jun, 2018

Problem – Write an assembly language program in 8085 microprocessor to perform AND operation between lower and higher order nibble of 8 bit number.

Example –

Assumption – 8 bit number is stored at memory location 2050. Final result is stored at memory location 3050.

Algorithm –



  1. Load the content of memory location 2050 in A.
  2. Perform masking of nibbles. Store the lower order nibble in B and higher order nibble in A.
  3. Perform AND operation between A and B by help of ANA instruction.
  4. Store the final result in memory location 3050.

Program –

MEMORY ADDRESSMNEMONICSCOMMENT
2000LDA 2050A <- M[2050]
2003ANI 0FA <- A (AND) 0F
2005MOV B, AB <- A
2006LDA 2050A <- M[2050]
2009ANI F0A <- A (AND) F0
200BRLCRotate accumulator left by one bit without carry
200CRLCRotate accumulator left by one bit without carry
200DRLCRotate accumulator left by one bit without carry
200ERLCRotate accumulator left by one bit without carry
200FANA BA <- A (AND) B
2010STA 3050M[3050] <- A
2013HLTEND

Explanation – Registers A, B are used for general purpose.

  1. LDA 2050: load the content of memory location 2050 in accumulator A.
  2. ANI 0F: perform AND operation in A and 0F. Store the result in A.
  3. MOV B, A: moves the content of A in register B.
  4. LDA 2050: load the content of memory location 2050 in accumulator A.
  5. ANI F0: perform AND operation in A and F0. Store the result in A.
  6. RLC: rotate the content of A left by one bit without carry. Use this instruction 4 times to reverse the content of A.
  7. ANA B: perform AND operation in A and B. Store the result in A.
  8. STA 3050: store the content of A in memory location 3050.
  9. HLT: stops executing the program and halts any further execution.
My Personal Notes arrow_drop_up
Recommended Articles
Page :