
ARCHITECTURE AND INSTRUCTIONS
been prefetched and that it is waiting in the instruction queue, an assumption that is valid under most, but not all operating conditions. A series of fast executing (fewer than two clocks per opcode byte) instructions can drain the queue and increase execution time.
Execution time also is slightly impacted by the interaction of the CPU's internal instruc- tion execution unit (EU) and BU's interface unit (BIU) when memory operands must be read or written. If the EU needs access to memory, it may have to wait for up to one clock if the BIU has already started an instruction fetch bus cycle. The EU can detect the need for a memory operand and post a bus request far enough in advance of its need for this operand to avoid waiting a
With typical instruction mixes, the time actu- ally required to execute a sequence of instructions will typically be within
ASSEMBLY LANGUAGE PROGRAMMING[1]
This section, while not meant to be a com- pendium of all features and rules of
[1]Edited and reprinted with permission of Hayden Book Co. from The 8086 Primer. by Stephen P. Morse. Copyright 1980.
to enable you to write meaningful programs. Not covered are many advanced
Object Code
Let's first consider a simple program that reads in word values from input port 5, increments each value read, and writes the results to output port 2. The program is as follows:
Memory Address | Memory Contents |
|
(Hexadecimal) | (Binary) | Comments |
00000 | 11100101 | read word into AX... |
00001 | 00000101 | ...from input port 5 |
00002 | 01000000 | increment AX |
00003 | 11100111 | write word from AX... |
00004 | 00000010 | ...to output port 2 |
00005 | 11101011 | repeat by jumping... |
00006 | 11111001 | ...back seven bytes |
00007 |
|
|
The first two columns specify the address and contents of each relevant memory location and, as such, constitute the only form of the program comprehensible to the processor. This is called object code, and the language of l's and O's in which the object code is writ- ten is called machine language. Once we have the program in object code form, we can store it in memory and then have the 8088 execute it.
Source Code
Writing a program in l's and O's is tedious and repetitive, a task that computers do well. So, instead of writing the program in machine language, we write the program in a language more familiar to us and then use a computer to translate it into the 8088's lan- guage. A program written in this more familiar language is called source code, and the computer program that translates source code into object code)s called a translator. (Fig.
There are two kinds of translator languages for writing source code: assembly languages and