

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 Program to Exchange 10 bytes
In this program we will see how to exchange a block of 10-byte data using 8085.
Problem Statement
Write 8085 Assembly language program to exchange a block of data, where block size is 10.
Discussion
The data are stored at location 8010H to 8019H and 9010H to 9019H. The location 8000H is holding the number of bytes to exchange. In this case number of bytes are 10D so it will be 0AH.
The logic is very simple, The HL and DE register pair is pointing the first and second data block respectively. By taking the data we are just swapping the values of each memory locations. Then repeating this process to swap two blocks completely.
Input
Address | Data |
---|---|
. . . | . . . |
8000 | 0A |
. . . | . . . |
8010 | 00 |
8011 | 11 |
8012 | 22 |
8013 | 33 |
8014 | 44 |
8015 | 55 |
8016 | 66 |
8017 | 77 |
8018 | 88 |
8019 | 99 |
. . . | . . . |
9010 | 84 |
9011 | 63 |
9012 | 12 |
9013 | 47 |
9014 | 48 |
9015 | AD |
9016 | BC |
9017 | 2A |
9018 | 8F |
9019 | 99 |
. . . | . . . |
Flow Diagram
Program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 21, 10, 80 | LXI H, 8000H | Point 8000Hto get byte count | |
F003 | 4E | MOV C, M | Load Count from memory | |
F004 | 21, 10, 80 | LXI H,8010H | Point first block address | |
F007 | 11, 10, 90 | LXI D,9010H | Point second block address | |
F00A | 46 | LOOP | MOV B, M | Take element from first block to B |
F00B | 1A | LDAX D | Take element from second block to Acc | |
F00C | 77 | MOV M, A | Store Acc content to second block | |
F00D | 78 | MOV A, B | Load B to A | |
F00E | 12 | STAX D | Store into second block | |
F00F | 23 | INX H | Point to next address of first block | |
F010 | 13 | INX D | Point to next address of second block | |
F011 | 0D | DCR C | Decrease the count variable | |
F012 | C2, 0A, F0 | JNZ LOOP | When block is not completed, jump to LOOP | |
F015 | 76 | HLT | Terminate the program |
Output
Address | Data |
---|---|
. . . | . . . |
8010 | 84 |
8011 | 63 |
8012 | 12 |
8013 | 47 |
8014 | 48 |
8015 | AD |
8016 | BC |
8017 | 2A |
8018 | 8F |
8019 | 99 |
. . . | . . . |
9010 | 00 |
9011 | 11 |
9012 | 22 |
9013 | 33 |
9014 | 44 |
9015 | 55 |
9016 | 66 |
9017 | 77 |
9018 | 88 |
9019 | 99 |
. . . | . . . |
- Related Questions & Answers
- 8085 program to exchange a block of bytes in memory
- 8085 Program to find the HCF of two given bytes
- 8085 program to add two consecutive bytes of an array
- 8085 program to subtract two consecutive bytes of an array
- Program to find the HCF of two given bytes in 8085 Microprocessor
- 8085 program to exchange content of HL register pair with DE register pair
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to access and exchange the content of Flag register with register B
- 8085 program to count total even numbers in series of 10 numbers
- 8085 program to count total odd numbers in series of 10 numbers
- C++ Program to Generate Random Hexadecimal Bytes
- Program to convert KiloBytes to Bytes and Bits in C++
- Differentiate between floating currency exchange rate and fixed currency exchange rate
- C# program to count number of bytes in an array
- 8085 Program to compute LCM
Advertisements