Lecture 4 mciroprocessor
Lecture 4 mciroprocessor
Lecture 4
LECTURE OUTLINE
Data-addressing modes
o Register Addressing
o Immediate Addressing
o Direct Addressing
o Register indirect Addressing
o Base-plus-index Addressing
o Register Relative Addressing
o Relative-plus-index Addressing
o Scaled index Addressing
FIGURE 3–2 8086–Core2 data-addressing modes.
3- DIRECT ADDRESSING
Applied to many instructions in a typical program.
Address is formed by adding the displacement to the default data
segment address or an alternate segment address.
The MOV AL,[1234H] instruction, loads AL from the data segment
memory location (1234H) .
The MOV AL,DATA instruction, as represented by most assemblers,
loads AL from the data segment memory location DATA (1234H).
- Memory location DATA is a symbolic memory location, while the
1234H is the actual hexadecimal location.
FIGURE 3–5 The operation of the MOV AL,[1234H] instruction when DS = 1000H.
Figure 3–8 shows how data are addressed by the MOV DX,[BX+DI]
instruction when the microprocessor operates in the real mode.
FIGURE 3–8 An example showing how the base-plus-index addressing mode functions for the MOV
DX,[BX+DI] instruction. Notice that memory address 02010H is accessed because DS = 0100H, BX =
100H, and DI = 0010H.
Locating Array Data with Base-Plus-Index Addressing.
Suppose that a file of many records exists in memory and each record
contains many elements.
- The displacement addresses the file, the base register addresses a
record, and the index register addresses an element of a record.
Figure 3–13 illustrates this very complex form of addressing.
FIGURE 3–13 Base relative plus-index addressing used to access a FILE that contains
multiple records (REC).
TABLE 3–8 EXAMPLE BASE RELATIVE-PLUS-INDEX INSTRUCTIONS.
8- SCALED-INDEX ADDRESSING
Unique to the 80386 through the Core2 microprocessors.
- Uses two 32-bit registers (a base register and an index register) to
access the memory.
The second register (index) is multiplied by a scaling factor.
- The scaling factor can be 1x, 2x, 4x, or 8x.
A scaling factor of 1x is implied and need not be included in the
assembly language instruction (MOV AL,[EBX+ECX]).
TABLE 3–9 EXAMPLES OF SCALED-INDEX ADDRESSING.