Skip to content
Related Articles

Related Articles

8085 program to move blocks of bits from source location to a destination location

View Discussion
Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 22 May, 2018

Problem – Write a program to move blocks of bits from source location starting at 2500 to destination location starting from 2600 where size of blocks is 05 bytes.

Example –

Algorithm –

  1. Load register pair H-L with the address 2500H
  2. Load register pair D-E with the address 2600H
  3. Move the content at memory location into accumulator
  4. Store the content of accumulator into memory pointed by D-E
  5. Increment value of register pair H-L and D-E by 1
  6. Decrements value of register C by 1
  7. If zero flag not equal to 1, go to step 3
  8. Stop

Program –

2000MVIC, 05[C] <- 05
2002LXIH, 2500[H-L] <- 2500
2005LXID, 2600[D-E] <- 2600
2008MOVA, M[A] <- [[H-L]]
2009STAXD[A] -> [[D-E]]
200AINXH[H-L] <- [H-L] + 1
200BINXD[D-E] <- [D-E] + 1
200CDCRC[C] <- [C] – 1
200DJNZ2008Jump if not zero to 2008

Explanation – Registers A, D, E, H, L, C are used for general purpose:

  1. MOV is used to transfer the data from memory to accumulator (1 Byte)
  2. LXI is used to load register pair immediately using 16-bit address (3 Byte instruction)
  3. MVI is used to move data immediately into any of registers (2 Byte)
  4. STAX is used to store accumulator into register pair indirectly (3 Byte instruction)
  5. DCR is used to decrease register by 1 (1 Byte instruction)
  6. INX is used to increase register pair by 1 (1 Byte instruction)
  7. JNZ is used to jump if not zero to given memory location (3 Byte instruction)
  8. HLT is used to halt the program
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!