SUMMARY off INTRODUCTION TO Z80 INSTRUCTIONS AND PROGRAMMING TECHNIQUES
In this chapter, we illustrated a group of instructions from the Z80 set frequently used in writing programs. Instructions were selected from three groups: data copy, arithmetic, and branch. These instructions range from 1 byte to 4 bytes long. General characteristics of these instructions are as follows:
1. The data copy and load instructions copy the contents of the source into the destination without affecting the source contents. They do not affect the flags.
2. The arithmetic instructions (with some exceptions) assume one of the operands is the accumulator, and the result of an operation is usually stored in the accumulator. Most of these instructions affect the flags.
3. The conditional Jump instructions are decision-making instructions and are executed according to the status of the flags. Not all instructions affect the flags; in particular, the data copy instructions and 16-bit increment/decrement instructions do not affect the flags.
4. The Z80 microprocessor includes two index registers (IX and IY), which are used primarily as memory pointers. The instructions related to index registers have 2-byte Opcode and perform data copy and arithmetic operations with the contents of memory registers.
Programming techniques such as looping, counting, and indexing were discussed and a generalized flowchart was illustrated. Two illustrative programs were discussed in the context of this generalized flowchart.
Finally, some Z80 special instructions were introduced. These instructions perform multiple tasks; thus, they improve programming efficiency.