
INTRODUCTION
as the base, the logical address can be made up of many different types of values: it can be just the immediate data value contained in the instruction, or, it can be the sum of an immediate data value, plus a base register, plus an index register.
F or the sum of the addition to be
result is always 20-bits ofphysical address.
Note that since logical addresses are always
On the other hand, segment registers are very useful when you have a large programming task and you want isolation between your program code and the data area or isolation between module data and the stack informa- tion, etc. Segmentation also makes it easy to build relocatable and/ or reentrant programs.
RELOCATABLE AND REENTRANT
PROGRAMS
In many cases, the task of relocating an 8088 program (relocation means having the ability to run the same program in several different areas of memory without changing the pro- gram itself) simply requires moving the program code and then adjusting of the code segment register to point to the base of the new code area. Since programs can be writ- ten for the 8088 where branches or jumps in program flow may occur using new locations
relative only to the instruction pointer, the program does not care what value is kept in the code segment register. Figure
Likewise in a reentrant program, a single program uses mUltiple data areas. Before the reentrant code is entered the second time, the data segment register value is changed so that a different data area is made available to the program.
ADDRESSING MODES
Now, let's continue our discussion of address- ing modes, providing more detail about how addresses are formed.
The 8088 has 24 different addressing modes to generate logical addresses. Figure
Exactly how the 8088 selects an addressing mode for a given instruction is encoded within the bits of the instruction code. This is discussed in more detail in Chapter 2.
If we examine the most complex and power- ful of the addressing modes, which includes base register, index register, and displace- ment in the logical address,it can be seen that some fairly complex data structures can be easily addressed in a single instruction by the 8088.