![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8086 program to transfer a block of bytes by using string instruction
In this program we will see how to transfer a block from one location to another location.
Problem Statement
Write 8086 Assembly language program to transfer a block from one memory section to another memory section. The numbers are stored at memory offset 501 onwards. The block size is stored at memory offset 500.
Discussion
Here we are initially setting up the source index register with the source of data blocks, then set the destination index register to store into another block. Then set the Data segment register and Extra Segment register to 0000H. By using MOVSB instruction, the entire block is transferred from one location to another. We are taking the size of the block, then we have set the counter register (CX) with the size. Until the CX register turns to 0, the data will be transferred.
Input
Address | Data |
---|---|
… | … |
500 | 06 |
501 | 1A |
502 | 2B |
503 | 3C |
504 | 4D |
505 | 5E |
506 | 6F |
… | … |
Flow Diagram
Program
Output
Address | Data |
---|---|
… | … |
600 | 1A |
601 | 2B |
602 | 3C |
603 | 4D |
604 | 5E |
605 | 6F |
… | … |