8088 microprocessor
8088 microprocessor
Below is a block diagram of the organizational layout of the Intel 8088 processor. It
includes two main sections: the Execution Unit (EU) and the Bus Interface Unit (BIU).
The EU takes care of the processing including arithmetic and logic. The BIU controls
the passing of information between the processor and the devices outside of the
processor such as memory, I/O ports, storage devices, etc.
General Registers
The general registers are categorized into two sets: data and address. The data
registers are for calculations; the address registers contain memory addresses and are
used to point to the locations in memory where data will be retrieved or stored.
Examining the diagram shows that there are four pairs of registers at the top labeled
AH, AL, BH, BL, CH, CL, DH, and DL. These are the data registers. Each of these
registers is 8 bits long. Each pair, however, can also operate as a single 16 bit register.
AH and AL can operate as a pair referred to as AX. This combining of registers is
simply a concatenation, the 8 bits of AL simply tacked to the end of the 8 bits of AH.
For example, if AH contains 101100002 (B016) and AL contains 010111112 (5F16),
then the virtual register AX contains 10110000010111112 (B05F16).
Example: If CX contains the binary value 0110 1101 0110 10112, what value does
CH have?
Answer: CH contains 0110 11012.
Intel has given each of these computational registers a name. These names are listed
below:
AX - Accumulator register
BX - Base register
CX - Counter register
DX - Data register
Below the data registers in the block diagram are the address registers: SP, BP, DI,
and SI. These are officially referred to as the pointer (SP and BP) and index registers
(DI and SI). These registers are used with the segment registers to point to specific
addresses in the memory space of the processor. We will address their operation in the
section on the segment registers. It is sufficient at this point to say that they act like
pointers in the programming language C or C++. Their basic function is as follows:
SP is the stack pointer and it points to the "top plate" or last piece of data placed on
the stack.
BP (base pointer), SI (source index), and DI (destination index) are all pointers that
the programmer has for their own use.
The Flags
Imagine the instrumentation on the dash board of a car. Blinking on and off
occasionally behind the speedometer, tachometer, fuel gauge, and such, are a number
of lights informally called "idiot lights". Each of these lights has a unique purpose.
One comes on when the fuel is low. Another light up when the high beams are on.
Another warns the driver of low coolant. There are many more lights, and depending
on the type of car you drive, some may even replace a gauge such as oil pressure.
Now let's go back to the processor. There are a number of "idiot lights" that the
processor can use, each one based on the result of the previous operation. For example,
the addition of two numbers might produce a negative sign, an erroneous overflow, a
carry, or a value of zero. Well, that would be four idiot lights: sign, overflow, carry,
and zero.
Each of these idiot lights, otherwise known as flags, can be represented with a single
bit. If the resulting number had a negative sign, the sign flag would equal 1. If the
result was not a negative number, (zero or greater than zero) the sign flag would equal
0. (Side note: Motorola processors more correctly refer to this flag as the negative
flag.)
For the sake of organization, these flags are grouped together to form a single number.
That number is the flags register shown at the bottom of the EU section of the
processor diagram. The individual bits of the flags are arranged as shown in the figure
below:
OF DF IF TF SF ZF AF PF CF
Fig: Flag Register
Example: Assume the flag register is set as shown below after an addition. Using
these flags, what can you tell us about the result?
TF DF IF OF SF ZF AF PF CF
0 0 0 0 1 0 0 0 1
Answer: As a result of the addition, there was no overflow (OF=0), the result is
negative (SF=1), it isn't zero (ZF=0, but you could've also told us that because it is
negative), and there was a carry.
Example: If you were to add the binary number 101101012 and 100101102, how
would the flags be set?
Answer: First, let's add the two numbers to see what the result is.
10110101
+10010110
101001011
EU Control System
The EU Control System is a set of gates that control the timing, passing of data, and
other items within the execution unit. It's analogous to a manager in business who
doesn't necessarily know the details of the operation, but they plan what happens,
where it happens, and when it happens.
Instruction Pointer
All program instructions located in memory are pointed using 16 bits of segment
register CS and 16 bits offset contained in the 16 bit instruction pointer (IP). The BIU
computes the 20 bit physical address internally using the logical address that is the
contents of CS and IP. 16 bit contents of CS will be shifted 4 bits to the left and then
adding the 16 bit contents of IP. Thus, all instructions of the program are relative
contents of IP. Simply stated, CS contains the base or start of the current code
segment, and IP contains the distance or offset from this address to the next
instruction byte to be fetched.