LIST OF SELECTED Z80 INSTRUCTIONS

6.6 LIST OF SELECTED Z80 INSTRUCTIONS

The Z80 instruction set includes 158 instructions resulting in 694 machine codes. The following list is a representative sample of each group described in Section "’6.2. The purpose of the list is to show you the overall capability of the Z80 and some logical patterns in its instruction. You should not study these instructions in detail; instead, you should search for logical patterns. Once you recognize log­ical patterns, you will be able to recognize the function of an instruction even if you have not seen it before.

Z80 Addressing Modes

Explanation

Example

1. Immediate

The byte following the opcode is the operand. This mode is used to load 8-bit data into a register.

LD B, 97H

2. Immediate Extended :

The two bytes following the opcode are the operands. This mode is used to load I6-bit data or address into a register.

LDBC,8045H

3. Register

The operand register is included as a part of the opcode. This mode is used to copy data from one Z80 register into another register. Copy data from register A into B

LD B,A

4. Implied

This refers to orations in which the opcode implies one or more Z80 registers as containing the operands. For example, instructions for logic operations imply that the accumulator is one of the operands and that the result is stored in the accumulator. Logically AND register B with A

ANDB

5. Register Indirect

This mode is used to copy data between the MPU and memory; the 16-bit contents in a register pair are used as a memory pointer. Copy the contents of memory location 2060H into register B. Register HL contains the address 2060H.

LD B, (HL)

6. Extended

The two bytes following the opcode specify the jump location. Jump to location 2080H

JP 2080H

7. Relative

In this mode, the second byte specifies the displacement value in a signed 2’s complement for a jump location. Jump forward 20 locations from the address of the next instruction.

JR 14H

8. Indexed

In this mode, the byte following the opcode specifies a displacement value that is added to one of the index registers to form a memory pointer. The index register IX contains 2060H; increment the contents of memory location 2070H

INC (IX + 10H)

9. Bit

This mode is used for bit operation (manipulation). In this mode, instruction specifies a bit from a register or a-­memory location using one of the three addressing modes (register, register indirect, or indexed). Set bit D7 in register B.

SET 7, B

10. Page Zero

The instruction set includes eight restart (one-byte call) instructions on memory page zero. In this mode, the memory location can be specified by using the low-order. byte, and the high-order byte is assumed to be 00H.Call restart memory location 0028H.

RST 28H

Leave a comment

Your email address will not be published. Required fields are marked *