Introduction to Z80 Assembly Language Programming
An assembly language program is a set of instructions, written in the mnemonics of a given microprocessor, and in a sequence appropriate to a specified task. To write such programs, we should be familiar with the programming model (internal registers) of the microprocessor and its instruction set. This chapter introduces the Z80 programming model and provides such an overview of the Z80 instruction set.
The Z80 instruction set is classified into six categories, and each category is explained with examples. The chapter also discusses the instruction format and various addressing modes, Writing, assembling, and executing a program are illustrated by a simple problem of adding two Hex numbers. The flowcharting technique and symbols are discussed in the context of the illustrative program. The chapter concludes with a list of selected Z80 instructions:
OBJECTIVES
· Draw the Z80 programming model and identify the registers.
· Explain the functions of the accumulator, general-purpose registers, and alternate registers.
· Explain the functions of 16-bit registers and special-purpose registers.
· List the flags and explain the data conditions under which they are set or reset.
· Explain the terms operation code (opcode) and operand, and illustrate these terms by writing instructions.
· Classify the instructions in terms of their word size and specify the number of memory registers required to store the instructions in memory.
· List the six categories of the Z80 instruction set.
· Define and explain the term addressing mode.
· Write logical steps needed to solve a simple programming problem.
· Draw a flowchart from the logical steps of a given programming problem.
· Write mnemonics from the flowchart and convert the mnemonics into Hex code for a given programming problem.