- Trending Categories
- 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
8085 program to move blocks of bits from source location to a destination location
Problem Statement − Move a block of 16 data stored from 8050H to 805FH to a target location from 8070F to 807FH.
Address | Hex Codes | Label | Mnemonic | T-States | Comment |
---|---|---|---|---|---|
8000 | 21 50 80 |
START: | LXI H, 8050H | 10 | Setup HL pair as a pointer for source memory. |
8003 | 11 70 80 |
LXI D, 8070H | 10 | Set up DE pair as a pointer for destination memory | |
8006 | 06 10 |
MVI B, 10H | 7 | Set up B to count 16 bytes | |
8008 | 7E | LOOP: | MOV A, M | 7 | Get data byte from source. |
8009 | 12 | STAX D | 7 | Store data byte as destination | |
800A | 23 | INX H | 6 | Point HL to next source location | |
800B | 13 | INX D | 6 | Point DE to next destination | |
800C | 05 | DCR B | 4 | Decrement count | |
800D | C2 08 80 |
JNZ LOOP | 10 | If counter is not 0, go back to transfer next byte. | |
8010 | 76 | HLT | 5 | Stop | |
Total 17 Bytes | Total 69 T-States |
Total T-States = TOutside_loop + TInside_loop
TOutside_loop = (10+10+7+5) = 32
TInside_loop = ((7+7+6+6+4+10) * 16 - 3) = (40 * 16 - 3) = 637
so Total T-States = 32 + 637 = 669
The Main program is started from location 8000H – 8010H.
Source Data Block from 8050H – 805FH.
Destination block from 8070H – 807FH
Input | Output | ||
---|---|---|---|
Address | Value | Address | Value |
8050H | 00 | 8070H | 00 |
8051H | 11 | 8071H | 11 |
8052H | 22 | 8072H | 22 |
8053H | 33 | 8073H | 33 |
8054H | 44 | 8074H | 44 |
8055H | 55 | 8075H | 55 |
8056H | 66 | 8076H | 66 |
8057H | 77 | 8077H | 77 |
8058H | 88 | 8078H | 88 |
8059H | 99 | 8079H | 99 |
805AH | AA | 807AH | AA |
805BH | BB | 807BH | BB |
805CH | CC | 807CH | CC |
805DH | DD | 807DH | DD |
805EH | EE | 807EH | EE |
805FH | FF | 807FH | FF |
Advertisements