SUMMARY
This chapter introduced the Z80 programming model and provided an overview of the Z80 instruction set and the capability of the Z80 microprocessor. The important concepts and topics discussed in this chapter can be summarized as follows:
· The Z80 microprocessor has six general-purpose 8-bit registers (B, C, D, E, H, and L) as a primary set. In addition, it includes the alternate set of these registers, all of which can be used to exchange information with the primary set. The registers Band C, D and E, and Hand L can be combined to perform some l6-bit operations.
· The ALU section of the Z80 includes accumulator A and the flag register to indicate six different data conditions. It also includes the alternate accumulator A’ and flag register F’, which can be used to exchange information with A and F, respectively.
· Four flags-Sign, Zero, Carry, and Parity/Overflow-can be used for decision making and tested in connection with Jump, Call, and Return instructions. Two flags-Half-Carry.and Add/Subtract-are used internally for BCD operations and are unavailable for the programmer.
· The Z80 has four 16-bit registers-IX, IY, SP, and PC-used as memory pointers. Two index registers-IX and IY-can be used to point to memory location, and an address and the direction (backward or forward) can be specified with a displacement byte. The stack pointer (SP) is used to specify memory locations in a defined R/W memory segment called the stack. The program counter (PC) is used to sequence the program execution; it points to the next memory address from which the machine code is to be fetched.
· The Z80 includes two 8-bit special-purpose registers: Interrupt Vector (I) and Memory Refresh (R). The I register provides the high-order 8 bits of a 16-bit address to which the program is to be directed after an interrupt. The R register is a 7-bit counter and supplies an address for refreshing memory cells of a dynamic memory.
· The Z80 microprocessor operations are classified into six major groups: data copy (load), arithmetic, logic, bit manipulation, branch, and machine control.
· An instruction has two parts: opcode (operation to be performed) and operand (data to be operated on). The operand can be 8- or 16-bit data, an address, register, register pair, or it can be implicit.
· The method of specifying an operand is called the addressing mode.
· The instruction set is classified into four groups according to the word size: 1-, 2-, 3-, and 4-byte instructions.
· To write a simple assembly language program, the problem should be divided into small steps in terms of microprocessor operations, and these steps should be translated into Z80 mnemonics. Then, the Hex code is assembled by looking up the code in the instruction list; this is called either hand or manual assembly.
· To enter a program into the memory of a single-board microcomputer, Hex keys are used to enter the code, which is converted into binary code by the Key Monitor program of the system and stored in R/W memory. This binary code can then be read and executed by the microprocessor.