- 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
Block movement without overlap in Z-80
In this section, we will see how we can use the Zilog Z-80 Microprocessor to move a block of data to another location. There is one assumption, there is sufficient distance between source and destination. So blocks are non-overlapping. Basically the block movement is not exact moving, it is copying the data to other locations.
The number of items in the block is given at location 5000H, and the block is located at position 5050H.
So before movement, the items in the memory is looking like this.
Address | Value |
---|---|
5000H | 04H |
. . . | |
5050H | 89H |
5051H | 7AH |
5052H | 2FH |
5053H | 56H |
. . . |
Now, we are writing a program at location 8000H to move the block contents to other locations.
Program
Address | Hex Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
8000 | 21 00 50 | LD HL, 5000H | Load the HL pair with 5000H | |
8003 | DD 21 50 50 | LD IX, 5050H | Set the index register with 5050H | |
8007 | DD 7E 00 | LOOP | LD A, (IX+00H) | Load Acc with IX + 00H |
800A | DD 77 20 | LD (IX+20H), A | Load content of Acc at IX + 20H | |
800D | DD 23 | INC IX | Increase the Index Register | |
800F | 35 | DEC (HL) | Decrease the content of memory location, pointed with HL pair | |
8010 | C2 07 80 | JP NZ, LOOP | Jump to Loop, when Zero flag is off | |
8013 | 76 | HALT | Stop the program |
Output
Address | Value |
---|---|
5000H | 04H |
. . . | |
5050H | 89H |
5051H | 7AH |
5052H | 2FH |
5053H | 56H |
. . . | |
5070H | 89H |
5071H | 7AH |
5072H | 2FH |
5073H | 56H |
. . . |
Advertisements
To Continue Learning Please Login
Login with Google