ILLUSTRATIVE PROGRAM 3: BLOCK TRANSFER OF DATA BYTES USING Z80 SPECIAL INSTRUCTIONS This program transfers data from one memory block to another using the Z80 instruction LDIR. Problem Statement Modify the illustrative program (Section 8.6.3) using the instruction LDIR with the problem statement as follows: Transfer 1024 (1K) bytes from the memory block SOURCE […]
Continue reading…
Posts by Farahat
Z80 SPECIAL INSTRUCTIONS
Z80 SPECIAL INSTRUCTIONS The Z80 instruction set includes some instructions that perform more than one task. These instructions improve programming efficiency considerably. Some of these instructions are: Mnemonics Description DJNZ d Decrement B and Jump Relative on no zero (Z = 0) The instruction decrements register B, and if B # 0, it jumps to […]
Continue reading…
DEBUGGING A PROGRAM
DEBUGGING A PROGRAM Debugging a program is similar to troubleshooting hardware, but it is much more difficult and cumbersome. When a program fails to work, very few clues alert you to what exactly went wrong. Therefore, it is essential to search carefully for the errors in the program logic, machine code, and execution. The debugging […]
Continue reading…
Data Copy Between Z80 Registers and Memory
Data Copy Between Z80 Registers and Memory To copy data from and into memory, the 16-bit address of a selected memory register must be specified, and this memory address can be specified by using indirect, direct, or other addressing modes in the indirect addressing mode, the address of a memory location is loaded into the […]
Continue reading…
ILLUSTRATIVE PROGRAM 2: ADDITION WITH CARRY
ILLUSTRATIVE PROGRAM 2: ADDITION WITH CARRY The following program adds the number of bytes stored in memory and counts the number of carries generated. The maximum sum can be up to 16-bit. Problem Statement Add the following ten data bytes stored in memory with the starting address INBUF (Input Buffer). Store the sum in two […]
Continue reading…
ILLUSTRATIVE PROGRAM 1: BLOCK TRANSFEER OF DATA BYTES
ILLUSTRATIVE PROGRAM 1: BLOCK TRANSFEER OF DATA BYTES In practical applications, data transfer from one memory block to another is a common occurrence. This illustrative program demonstrates how to copy data bytes from one block of memory to another using the instructions discussed previously. Problem Statement Ten bytes of data are stored in a block […]
Continue reading…
PROGRAMMING TECHNIQUES: LOOPING. COUNTING, AND INDEXJHG
PROGRAMMING TECHNIQUES: LOOPING. COUNTING, AND INDEXJHG The examples illustrated in the previous sections are simple and can be solved manually. However, a computer is at its best, surpassing human capability, when it has to repeat such tasks as adding a large set of numbers or copying bytes from one block of memory locations to another. […]
Continue reading…
Z80 INSTRUCTIONS RELATED TO INDEX REGISTERS
Z80 INSTRUCTIONS RELATED TO INDEX REGISTERS The Z80 microprocessor includes two 16-bit index registers IX and IY, and they are used primarily as memory pointers. In the previous sections, we discussed instructions concerning data copy, arithmetic, and branch operations. The Z80 can perform these operations with the contents of memory registers using the index […]
Continue reading…
Relative Jump Instructions
Relative Jump Instructions The Z80 instruction set includes two types of relative Jump instructions: unconditional and conditional. The new address to which the program sequence is redirected is specified by an 8-bit offset (displacement) value relative to the Jump instruction. The displacement can be positive (forward jump), specified by the seven bits D6-D0 (the MSB […]
Continue reading…
BRANCH OPERATIONS
BRANCH OPERATIONS The branch instructions and their associated flags are the key to the power of a computer or its microprocessor. These instructions can change the sequence of execution based on certain data conditions indicated by the flags; thus, they are decision-making instructions. The branch instructions are classified into three categories, as listed in Chapter […]
Continue reading…