01-11-2016, 04:24 PM
1463132472-Intel80808085AssemblyLanguageProgramming1977Intel.pdf (Size: 5.51 MB / Downloads: 5)
INTRODUCTION
Almost every line of source coding in an assembly language source program translates directly into a machine
instruction for a particular processor. Therefore, the assembly language programmer must be familiar with both
the assembly language and the processor for which he is programming. '
The first part of this chapter describes the assembler. The second part describes the features of the 8080 microprocessor
from a programmer's point of view. Programming diffel'ences between the 8080 and the 8085 microprocessors
are relatively minor. These differences are described in a short section at the end of this chapter.
WHAT IS AN ASSEMBLER?
An assembler IS a software tool - a program - deSigned to simplify the task of Writing computer programs. If
you have ever written a computer program directly in a machine-recognizable form such as binary or hexadecimal
code, you will appreciate the advantages of programming in a symbolic assembly language,
Assembly language operation codes (opcodes) are easily remembered (MOY for move instructions, JMP for jump).
You can also symbolically express addresses and values referenced in the operand field of instructions. Since you
assign these names, you can make them as meaningful as the mnemonics for the instructions. For example, if your
program nust manipulate a date as data, you can assign it the symbolic name DATE. If your program contains a
set of instructions used as a timing loop (a set of instructions executed repeatedly until a specific amount of time
has passed), you can name the instruction group TIMER.
What the Assembler Does
To use the assembler, you first need a source program. The source program consists of programmer-written
assembly language instructions. These instructions are written using mnemonic opcodes and labels as described
previously.
Assembly language source programs must be in a machine-readable form when passed to the assembler. The
Intellec development system includes a text editor that will help you maintain source programs as paper tape
files or diskette files. You can then pass the resulting source program fife to the assembler. (The text editor is
described in the ISIS-II System User's GUide.)
The assembler program performs the clerical task of translating symbolic code into ob/ect code which can be
executed by the 8080 and 8085 microprocessors. Assembler output consists of three possible files: the object
fife containing your program translated into object code; the list file printout of your source code, the assemblergenerated
object code, and the symbol table; and the symbol-crass-reference file, a listing of the symbol-crossreference records.
Oblect Code
For most mlcrxomputer applications, you probably will eventually load the oblect program into some form of
read only men ory, However, do not forget that the Intellec development system IS an 8080 microcomputer
system with raldom access memory, In most cases you can load and execute your oblCct program on the
development s"stem for teSlJng and debugging, TIllS allows you to test your program before your prototype
application sys:em IS fully developed,
A special featu,'e of this assembler IS that it allows you to request oblect code In a relocatable format. This frees
the programm( r from worrYing about the eventual mix of read only and random access memory In the application
system; indivicual porlJons of the program can be relocated as needed when the application design is final. Also,
a lal'ge progranl can be broken Into a number of separately assembled modules, Such modules are both easier to
code and to te;t, See Chapter 4 of this manual for a more thorough description of the advantages of the relocation
feature,
Program Listing
The program liitlng prOVides a permanent record of both the source program and the object code, The assembler
also provides diagnostic messages for common programming errors in the program listing. For example, if you
specify al6-bl value for an InstruclJon that can use only an 8-blt value, the assembler tells you that the value
exceeds the pe'missible range.
Symbol-Crass-Reference Listing
The symbol-crass-reference listing is another of the diagnostic tools provided by the assembler. Assume, for
example, that your program manipulates a data field named DATE, and that testing reveals a program logic
error In the handling of this data. The symbol-crass-reference listing simplifies debugging this error because it
POints you to each instruction that I"eferences the symbol DATE.
Do You Need the Assembler?
The assembler IS but one of several tools available for developing microprocessor programs. Typically, choosing
the most suitable tool IS based on cost restraints versus the required level of performance. You or your company
must determine cost restraints; the reqUired level of performance depends on a number of variables:
• The number of programs to be written: The greater the number of programs to be written, the more
you need development support. Also, It must be pOinted out that there can be penalties for not
wl"lting programs. When your application has access to the power of a microprocessor, you may be
able to provide customers with custom features through program changes. Also, you may be able to
add features through programming.
o The time allowed for programming: As the time allowed for programmll1g decreases, the need for
programmll1g support II1creases.
• The level of support for eXisting programs: Sometimes programming errors are not discovered until
the program has been 111 use for quite a while. Your need for programming support II1creases if you
agree to correct such errors for YOUI" customers. The number of supported programs In use can
multiply this requirement. Also, program support 15 frequently subrect to stringent time constraints.
If none of the factors described above apply to your Situation, you may be able to get along without the
assembler. Intel's PROMPT-80, for example, allows you to enter programs directly Into programmable read only
memory. You enter the program manually as a string of hexadeCimal digits. Such manual programming IS relatively
slow and more prone to human error than computer-assisted programmll1g. However, manual systems are one of
the least expensive tools available for mlcmprocessor programming. Manual systems may be SUitable for limited
applications, hobbyists, and those who want to explol"e possible applications for microprocessors.
If most of the factors listed preViously apply to you, you should explore the advantages of PL(M. PL/M IS
Intel's high-level language for program development. A high-level language is directed more to problem solVing
than to a particular microprocessor. TIllS allows you to write programs much more qUickly than a hardware·
oriented language such as assembly language. As an example, assume that a program must move five characters
from one location 111 memory to anothcr. Thc following cxample illustratcs the coding differences between
assembly language and PL/M. Since II1structions have not yet been described, the asscmbly language instructions
arc rcprescn ted by a flowchart.
OVERVIEW OF 8080/8085 HARDWARE
To the programmer, the computer comprises the following parts:
• Memory
• The program cou nter
• Work registers
• Condition flags
• The stack and stack pointer
• Input/output ports
• The instruction set
Of the components listed above, memory is not part of the processor, but is of interest to the programmer.
Memory
Since the program required to drive a microprocessor resides'in memory, all microprocessor applications require
some memory. There are two general types of memory: read only memory (ROM) and random access memory
(RAM).
ROM
As the name Implies, the processor can only read instructions and data from ROM; it cannot alter the contents
of ROM. By contrast, the processor can both read from and write to RAM. Instructions and unchanging data
are permanently fixed into ROM and remain intact whether or not power is applied to the system. For this
reason, ROM is typically used for program storage in single-purpose microprocessor applications. With ROM you
can be certain that the program is ready for execution when power is applied to the system. With RAM a program
must be loaded into memory each time power is applied to the processor. Notice, however. that storing programs
in RAM allows a multi-purpose system since different programs can be loaded to serve different needs.
Two special types of ROM PROM (Programmable Read Only Memory) and EPROM (Eraseable Programmable
Read Only Memory) are frequently used during program development. These memories are useful during
program development since they can be altered by a special PROM programmer. In high-volume commercial
applications. these special memories are usually replaced by less expensive ROM's.
RAM
Even if your program resides entirely in ROM. your application is likely to require some random access memory.
Any time your program attempts to write any data to memory, that memory must be RAM. Also, if your program
uses the stack. you need RAM. If your program modifies any of its own instructions (this procedure is
discouraged), those instructions must reside in RAM.
The mix of ROM and RAM In an application IS important to both the system designer and the programmer.
Normally, the programmer must know the physical addresses of the RAM in the system so that data variables can be assignee within those addresses. However, the relocation feature of this assembler allows you to code a
program witho!lt concern for the ultimate placement of data and instructions; these program elements can be
repositioned aLer the program has been tested and after the system's memory layout IS final. The relocation
feature is fully explained in Chapter 4 of this manual.