Data block Transfer using String Instructions

Data block Transfer using String Instructions

 

Program Explanation 

  • Consider that a block of data of N bytes is present at source location. Now this block of N bytes is to be moved from source location to a destination location.
  • Let the number of bytes N = 10.
  • We will have to initialize this as count in the CX register.
  • We know that source address is in the SI register and destination address is in the DI register.
  • Clear the direction flag.
  • Using the string instruction move the data from source location to the destination location. It is assumed that data is moved within the same segment. Hence the DS and ES are initialized to the same segment value. 

 

Algorithm for Data block Transfer using String Instructions

 

Step I         :    You need to Initialize the data in the source memory as well as destination memory.

Step II       :    Initialize SI and DI with source and destination address.

Step III      :    Initialize CX register with the count.

Step IV      :    Initialize the direction flag to zero.

Step V        :    Transfer the data block byte by byte to destination.

Step VI      :    Decrements CX.

Step VII    :    Check for count in CX, if not zero go to step V else go to step VIII.

Step VIII   :    Stop.

Data block Transfer using String Instructions

 

 

Data block Transfer using String Instructions Program Code