8080 / Z80 Assembly Language: Techniques for Improved Programming
On first thought, it might seem strange that another book on the 8080 and
Z-80 should appear at this time. Z-80 CPU cards generally became available
in 1977 and the 8080 CPU is even older. But the Z-80 computer seems to
become more popular with time. For example, the TRS-80 Model II announced
recently by Radio Shack, and Heath's H-89 both use the CPU~
High-level languages such as Pascal, APL, BASIC, FORTRAN, and C are now
run on the 8080 and Z-80. Furthermore, Microsoft has available a Z-80
card that can be easily inserted into the Apple Il computer. There should be
an increasing interest in the 8080 and Z-80 CPUs in the coming years, and I
believe, a great increase in the number of 8080 and Z-80 programmers. So,
there is a growing need for a book that covers programming for the 8080
and Z-80 assembly languages.
The combination of 8080 and Z-80 programming concepts into a single
work is quite natural. The Z-80 CPU is upward compatible from the 8080
so that all commercially available 8080 software will run on the Z-80.
Furthermore, 8080 assemblers, such as ASM provided withCP1M, can be
used to create programs that will run on either an 8080 system or a Z-80
system.
The purpose of this book is twofold. First, I want to provide a single
reference source for both 8080 and Z-80 assembly language programmers.
The appendixes are designed with this goal in mind. They begin with the
ASCII character set and a 64K memory map. These two appendixes are as
useful to those using higher level languages as they are to assembly language
programmers.
The 8080 and Z-80 instruction sets are listed both alphabetically and
numerically in the next four appendixes. This is follow~d by a cross reference
between the 8080 and the Z-80 mnemonics. An appendix describing
each instruction in detail then follows. Common acronyms are identifiednext in Appendix I, and some undocumented Z-80 instructions are discussed
in the final appendix. Collectively, the appendixes contain all of the
reference material needed to write 8080 or Z-80 assembly language programs.
The second purpose of this work is to demonstrate some useful techniques
of assembly language programming. As an editor for Interface Age, I
have seen numerous examples of inefficient or improper programming.
General principles of assembly language programming are discussed in
Chapters One through Five; specific programming examples are given in
Chapters Five through Ten. The reader can actually assemble the programs
them out.
The organization and operation of the 8080 and Z-80 CPUs is covered
in Chapter One. This includes a discussion of the general-purpose registers,
the flag registers, logical operations, branching, double-register operations,
rotation and shifting. The concepts of hexadecimal, octal, and binary numbers,
one's and two's complement arithmetic, and the use of logical operations
are presented in Chapter Two.
Stack operations with PUSH, POP, CALL and RET commands and the
passing of data between calling program and subroutine are given in Chapter
Three. Chapter Four is devoted to input and output techniques, including
an interrupt-dirven keyboard routine and a telephone transmission program.
Assembler macros are discussed in Chapter Five. Examples show how to
generate Z-80 instructions with an 8080 macro assembler, and how to emulate
Z-80 instructions on an 8080 CPU.
The reader can develop a small, powerful monitor in Chapter Six. using
the top-down programming method. The monitor contains the usual corIlmands
of dump, load, and go. In addition, there is a memory test, a routine
to search for one or two hex bytes or ASCII characters, a routine to replace
all occurrences of one byte with another, and a routine to perform input
and output through any port.
In Chapter Seven the nlonitor is converted to Z-80 instructions and
some additional features are added. Assembly-language subroutines for interconverting
between binary numbers and ASCII characters coded in one of
the common number bases are given in Chapter Eight. These routines perform
all of the input and output through the system monitor developed in
Chapter Six. Paper tape and magnetic tape routines are given in Chapter
Nine. This method of data transfer is still very popular. I frequently am
asked to read information on paper tape into our Z-80 computer so that it
can be transmitted over the telephone line to our campus Dec-20 computer.
CP/M is currently the most popular 8080/Z-80 operating system.
Chapter Ten demonstrates how assembly language programs can utilize CP/M
for all input and output by presenting three programs. One of these programs
allows the user to branch to any address from the system level. Nevertheless,
the use of CP/M is not the subject of this book. More information on
the use of the CP/M operating system can be obtained from Using CP/M: A
Self-Teaching Guide by Judi Fernandez and Ruth Ashley (John Wiley and
Sons, Inc., 1980).
http://rapidshare.com/files/136208314/_free-ebook-download.net_Z80Assembly.rar


LinkBack URL
About LinkBacks






Bookmarks