Skip to content
Related Articles

Related Articles

8085 program to show masking of lower and higher nibbles of 8 bit number
  • Last Updated : 17 Oct, 2019

Problem – Write an assembly language program in 8085 microprocessor to show masking of lower and higher nibble of 8 bit number.

Example –

Assumption – 8 bit number is stored at memory location 2050. After masking of nibbles, lower order nibble is stored at memory location 3050 and higher order nibble is stored at memory location 3051.

Algorithm –

  1. Load the content of memory location 2050 in accumulator A.
  2. Move the content of A in register B.
  3. Perform AND operation of A with 0F and store the result in memory location 3050.
  4. Move the content of B in A.
  5. Perform AND operation of A with 0F and reverse the result by using RLC instruction 4 times.
  6. Store the result in memory location 3051.

Program –

MEMORY ADDRESSMNEMONICSCOMMENT
2000LDA 2050A <- M[2050]
2003MOV B, AB <- A
2004ANI 0FA <- A (AND) 0F
2006STA 3050M[3050] <- A
2009MOV A, BA <- B
200AANI 0FA <- A (AND) 0F
200CRLCrotate content of A left by 1 bit without carry
200DRLCrotate content of A left by 1 bit without carry
200ERLCrotate content of A left by 1 bit without carry
200FRLCrotate content of A left by 1 bit without carry
2010STA 3051M[3051] <- A
2013HLTEND

Explanation – Registers A, B are used:

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