You are on page 1of 8

EEB531 Microprocessor Systems 3-1 Data-Addressing Modes

微處理機系統 • MOV (move data) instruction:


transfer bytes/words/doublewords of data
between registers, or
between register and memory
– MOVS: memory-to-memory transfer for strings

吳俊興
• opcode (operation code): MOV
高雄大學 資訊工程學系
• operands: AX and BX
March 2005
3

Outline Figure 3-2 8086-P4 Data-addressing Modes


3-1 Data-Addressing Modes
MOV (move data) instruction
8086 through 80286: register, immediate, direct, register indirect,
base-plus-index, register relative,
and base relative-plus-index
80386 and above: scaled-index

3-2 Program Memory-Addressing Modes


CALL and JUMP instructions
program relative, direct, and indirect

3-3 Stack Memory-Addressing Modes


PUSH and POP instructions
2 4
MOV Format 2. Immediate Addressing
6 11 8 8
Fig. 3–4 The operation of the MOV EAX,
displace-
MOV dw reg/mem 3456H instruction. This instruction copies
ment
the immediate data (13456H) into EAX.
d: direction (0: to reg; 1: from reg)
w: width (0: byte; 1:word)

Table 3-2 Examples of


immediate addressing
using MOV instruction.

5 7

1. Register Addressing Examples


Table 3-1 Examples of the
register-addressed instructions.

Fig. 3–3 The effect of executing


the MOV BX, CX instruction at
the point just before the BX
register changes. Note that only
the rightmost 16 bits of register
EBX change.

6 8
3. Direct Data Addressing 4. Register Indirect Addressing
Two forms: direct addressing and displacement addressing Addressing data at any location through an offset address held in
BP, BX, DI, and SI.

Figure 3-5 The operation of the


MOV AL,[1234H] instruction
when DS = 1000H.

9 11

Displacement Table 3-5 Example of register indirect addressing


Addressing

DS: BX, DI or SI
SS: BP
10 12
Figure 3–7 An array (TABLE) containing 50 bytes
Figure 3-8 An example showing how base-plus-index
that are indirectly addressed through register BX addressing mode functions for MOV DX,[BX+DI] instruction

Notice that memory address 02010H is accessed


because DS = 0100H, BX = 100H, and DI = 0010H.
13 15

5. Base-Plus-Index Addressing Table 3-6 Examples of base-plus-index addressing


• 1 base register (BP or BX) + 1 index register (DI or SI)
– base register: hold beginning location of a memory array
– index register: hold relative position of an element in the array
combined with SS for EBP or DS for others
• 80386+: combination of any two 32-bit extended
registers except ESP
– eg. MOV DL, [EAX+EBX]
• Two examples
– Locating data with base-plus-index addressing
• MOV DX, [BX+DI]
– Locating array data with base-plus-index addressing

14 16
Figure 3-9 Example of base-plus-index addressing Table 3-7 Examples of register relative
addressing

An element (DI)
of an ARRAY
(BX) is
addressed

17 19

6. Register Relative Addressing Addressing Array Data


with Register Relative
BX, DI, or SI addresses the DS segment and
BP addresses the SS segment
– MOV AX, [BX+1000H] Figure 3-11 Register relative addressing
used to address an element of ARRAY.
The displacement addresses the start of
ARRAY, and DI accesses an element.

18 20
7. Base Relative-Plus-Index Addressing Addressing Arrays with Base Relative-plus-index

Addressing data with base relative-plus-index

21 23

Figure 3-13 Base relativeplus-index addressing used to


Table 3-8 Example base relative-plus-index instructions
access a FILE that contains multiple records (REC)

22 24
8. Scaled-Index Addressing 3-2 Program Memory-Addressing Modes
• Direct Program Memory Addressing
• Relative Program Memory Addressing
• Indirect Program Memory Addressing

TABLE 3–9 Examples of scaled-index addressing.

25 27

3-3 Stack Memory-Addressing Modes


Example 3-10

26 28
29

Summary

Chapter 3 Addressing Modes


3-1 Data-Addressing Modes
3-2 Program Memory-Addressing Modes
3-3 Stack Memory-Addressing Modes

30

You might also like