Processor Basics 117
four of these registers may be used as multiple 8-bit registers also. In other words, two separate and inde-
pendent 8-bit registers, AL and AH form the 16-bit register AX, and so on. AL also serves the purpose
of an 8-bit accumulator and offers some special features. SP is the stack pointer register, whose content
would be added as an offset with SS register of BIU to generate 20-bit stack address, in the same fashion
as was explained in the case of CS and IP registers.
The remaining three 16-bit registers in EU, namely base pointer (BP), source index (SI) register and
destination index (DI) register are provided to store different offset values, to be added with the DS
register (of BIU) to generate 20-bit target addresses using various addressing modes.
Intel 8086 offers a 16-bit ag register. Bit-wise ag-assignment of this register is shown in Figure 5.21 .
Lower 8-bits of this ag register matches (by functions) with the 8-bit ag register of 8085 microproces-
sor (compare with Figure 5.15 ). Thus CF, PF, AF, ZF and SF are to indicate Carry out from MSB (MSB
might be bit-7 or bit-15, depending upon the register usage), parity of result, Auxiliary carry for BCD
arithmetic, zero or non-zero result and sign of the result, respectively.
Four new (not present in 8085) ags of 8086 are trap ag (TF), interrupt ag (IF), direction ag
(DF) and over ow ag (OF). They are to be used for single stepping, interrupt handling, string direction
checking and arithmetic operations, respectively.
5.8.3 Memory Segmentation
In Sections 5.8.2, we have been already introduced to the facts that 8086 can directly address 1 MB
of memory through its 20 address lines. We have also noticed that four segment registers (ES, CS, SS
and DS) are provided to contain the base address, whereas offsets from other registers of EU are added
with these segment registers to generate the 20-bit address to communicate with external memory
devices (RAM or ROM both). It was indicated that this method offers some advantages, which we
shall discuss now.
By its designers, 8086 was allowed to execute multiple programs. It is not the exact case of paral-
lel processing. Rather it was visualized by the designers that several programs may reside within the
main memory and the processor should be able to execute a few instructions of each program (in turn)
and then switch to the next program, creating an illusion that all programs are being executed con-
currently. In computer-community the technical term adopted to express this is multi-programming .
This is because of the existence of multiple programs within the memory area, memory handling and
data security had always been the challenge for the designers of multi-programming units. In 8086, by
implementing the base-offset registers’ addition technique, the procedure of memory handling and data
security have been made easier for the programmers. Note that during the execution of any program,
the IP register (within BIU) is automatically incremented by one after fetching every byte of instruc-
tions. As the IP register is a 16-bit register, it is able to handle any 64 kB memory area. Therefore, the 1
MB memory may be segmented to smaller divisions of 64 kB each (16 such divisions are possible) and
each 64 kB segment may be allotted to one program (rather to its instruction codes). Every such seg-
ment would have a unique base address, which may be stored in a table for easier access. This feature
is illustrated through Figure 5.22 .
Figure 5.21 Details of flag register of 8086
M05_GHOS1557_01_SE_C05.indd 117M05_GHOS1557_01_SE_C05.indd 117 4/29/11 5:06 PM4/29/11 5:06 PM