Intel 210200-002 manual Assembly Language PROGRAMMING1

Models: 210200-002

1 354
Download 354 pages 14.88 Kb
Page 53
Image 53

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 fu1l4-clock bus cycle. Of course, the EU does not have to wait if the instruction queue be- tween the BIU and EU is full, because the BIU is idle. (Note: 8088 queue contains 4 bytes.)

With typical instruction mixes, the time actu- ally required to execute a sequence of instructions will typically be within 5-10% of the sum of the individual timings given in the instruction set sequence. Cases can be con- structed, however, in which execution time may be much higher than the sum of the figures provided. The execution time for a given sequence of instructions, however, is always repeatable, assuming comparable ex- ternal conditions (interrupts, coprocessor activity, etc.) If the execution time for a given series of instructions must be determined exactly, the instructions should be run on an actual system hardware implementation.

ASSEMBLY LANGUAGE PROGRAMMING[1]

This section, while not meant to be a com- pendium of all features and rules of ASM-86 (the Intel assembler for 8088 instructions) covered in detail by the Intel iAPX 86,88 Assembly Language Reference Manual, pre- sents most of the ASM-86 features in a form

[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 ASM-86 features; attention is focused on underlying concepts of the language.

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. 2-11)

There are two kinds of translator languages for writing source code: assembly languages and high-level languages described below and illustrated in Fig. 2-12

2-18

Page 53
Image 53
Intel 210200-002 manual Assembly Language PROGRAMMING1