Lec 5
Lec 5
– Register Addressing.
– Immediate Addressing.
Addressing Modes:-
Addressing Modes:-
–Base–Plus–Index Addressing.
7
Data Addressing Modes (Cont.)
Base–Plus–Index Addressing:
10
Data Addressing Modes (Cont.)
• Note that The Intel assembler requires this
12
Data Addressing Modes (Cont.)
• A major use is to address elements in a
memory array.
memory array. 14
Data Addressing Modes (Cont.)
• The following Fig. shows an element (DI) of an
ARRAY (BX) is addressed.
15
Data Addressing Modes (Cont.)
Register Relative Addressing:
displacement addressing.
or SI). 16
Data Addressing Modes (Cont.)
• The next Fig. shows the operations of MOV
AX,[BX+1000H] instruction. When BX =
0100H and DS=0200H.
17
Data Addressing Modes (Cont.)
• Remember that BX, DI, or SI addresses
the data segment and BP addresses the
stack segment.
• The displacement is a number added to
the register within the [ ], as in the
MOV AL,[DI+2] instruction.
• or it can be a displacement is subtracted
from the register, as in MOV AL,[SI–1].
18
Data Addressing Modes (Cont.)
as in MOV AL,DATA[DI].
AL,DATA[DI+3] instruction. 19
Data Addressing Modes (Cont.)
20
Data Addressing Modes (Cont.)
• It is possible to address array data with
register relative addressing. The displacement
ARRAY adds to DI to generate a reference to
an array element.
21
Data Addressing Modes (Cont.)
Base Relative–Plus–Index Addressing:
• Similar to base–plus–index addressing,
but it adds a displacement besides uses a
base register and an index register to
form the memory address.
• This type of addressing mode often
addresses a two–dimensional array of
memory data. 22
Data Addressing Modes (Cont.)
24
Data Addressing Modes (Cont.)
25
Data Addressing Modes (Cont.)
• Suppose a file of many records exists in memory
27
Outline
Addressing Modes:-
instructions.
34
Program Memory Addressing (Cont.)
Indirect Program Memory Addressing:
• The microprocessor allows several forms of
program indirect memory addressing for the
JMP and CALL instructions.
• In 80386 and above, an extended register can
be used to hold the address or indirect address
of a relative JMP or CALL. For example, the
JMP EAX jumps to the location address by
35
register EAX.
Program Memory Addressing (Cont.)
• For example, if the BX register contains
1000H and a JMP BX instruction
executes, the MP jumps to offset address
1000H in the current code segment.
• If a register holds an address which
contains the required location to jump,
this type is also considered an indirect
36
program memory addressing.
Program Memory Addressing (Cont.)
38
Outline
Addressing Modes:-
43
Stack Memory Addressing (Cont.)
stack location.
46
Stack Memory Addressing (Cont.)
• Note that PUSH and POP store or
8086 – 80286.
register
– Base–Plus–Index Addressing.
50