8085 Block movement without overlap


In this program, we will see how to move blocks of data from one place to another.

Problem Statement

Write 8085 Assembly language program to move a data block. The blocks are assumed to be non-overlapping. The block size is given, the block is starting from X and we have to move it to the location Y.

Discussion

The non-overlapping block movement is relatively an easy task. Here the block is starting at position X, we have to move it to position Y. The location Y is far away from X. So Y > X + block size.

In this program, the data are stored at location 8010H, and we will place it 9010H. The block size is stored at location 8000H.

We are loading the source address into HL pair, and destination address into DE register pair. We are simply taking the data from the source and placing it at the destination. 

Input

Address
Data
.
.
.
.
.
.
8000
07
.
.
.
.
.
.
8010
11
8011
22
8012
33
8013
44
8014
55
8015
66
8016
77
.
.
.
.
.
.

Flow Diagram

Program

Address
HEX Codes
Labels
Mnemonics
Comments
F000
21,00, 80


LXIH, 8000H
Load the location to find block size
F003
4E


MOVC, M
store block size into C register
F004
21,10, 80


LXI H, 8010H
load the source address to HL pair
F007
11,10, 90


LXI D, 9010H
load the destination address to DE pair
F00A
7E
LOOP
MOV A, M
Load Acc with the memory element
F00B
12


STAX D
Store acc content to the memory pointed by D
F00C
13


INX D
Increase DE register pair
F00D
23


INX H
Increase HL register pair
F00E
0D


DCR C
Decrease C register
F00F
C2,0A, F0


JNZ LOOP
Jump to Loop
F012
76


HLT
Terminate the program


Output

Address
Data
.
.
.
.
.
.
8000
07
.
.
.
.
.
.
8010
11
8011
22
8012
33
8013
44
8014
55
8015
66
8016
77
.
.
.
.
.
.
9010
11
9011
22
9012
33
9013
44
9014
55
9015
66
9016
77
.
.
.
.
.
.

Updated on: 30-Jul-2019

932 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements