Introduction to Z80 Instructions and Programming Techniques

Introduction to Z80 Instructions and Programming Techniques

 

 

farbfernseher_31_cm_nec_autocolor

When a microcomputer is asked to execute a program stored in its memory, it reads one in­struction at a time and performs the task spec­ified by the instruction. Each instruction in the program is a command, in binary, to the micro­processor to perform an operation. In Chap­ter 6, we examined briefly the Z80 instruction set and its capability. In this chapter, we will introduce a few selected instructions and illus­trate them with examples. These instructions are selected from three groups: data copy, arith­metic, and branch operations.

A computer is at its best, relative to hu­man capability, when it is asked to repeat such. Simple tasks as adding or copying. The programming techniquesــــ such as looping, index­ing, and countingــــ necessary to perform such tasks are introduced and illustrated with two programs. This chapter also includes a brief dis­cussion of debugging programs.

Finally, a group of special Z80 instructions that perform multiple tasks are introduced with illustrative examples.

OBJECTIVES

· Explain the functions of data copy instruc­tions and how the contents of the source register and the destination registers are affected.

· List four types of data copy operations and explain the term addressing mode.

· Explain how a memory address is specified to copy data from and to a memory register.

· Explain how data are transferred from and to I/O devices.

· Explain the functions of arithmetic instruc­tions (ADD, SUB, INC, DEC) and how flags are affected by these instructions.

· Write a set of commands using data copy and arithmetic instructions to perform a given task.

· Explain the functions of unconditional and conditional jump instructions and how they are used for decision making.

· Draw a flowchart of a conditional loop to il­lustrate the indexing and counting tech­niques.

· List the seven blocks of a generalized flow­chart illustrating data acquisitions and data processing.

· Write a program to copy data from one block of memory to another block including the case of overlapping blocks.

· Write a program to perform arithmetic oper­ations on given data stored in memory.

· List the types of errors that frequently occur in writing assembly language programs and in hand assembling the code. Recognize the er­rors in a given program.

· List Z80 special instructions and explain how they provide more flexibility and improve ef­ficiency in writing Z80 programs.

· Modify the previously written programs us­ing the Z80 special instructions.

Leave a comment

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