0% found this document useful (0 votes)
43 views55 pages

4 - Addressing Modes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views55 pages

4 - Addressing Modes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

University of Southeastern Philippines

COLLEGE OF ENGINEERING
Electronics Engineering Program

MICROPROCESSOR ARCHITECTURE

Addressing Modes

University of Southeastern Philippines


COLLEGE OF ENGINEERING 1
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
80X86 Family Microprocessors

ADDRESSING MODES:
Types of Addressing Modes for 8086/8088
1. Data addressing modes
2. Program-Memory Addressing Modes
3. Stack-Memory Addressing Modes

University of Southeastern Philippines


COLLEGE OF ENGINEERING 2
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
80X86 Family Microprocessors

ADDRESSING MODES:
Data Addressing Modes
An addressing mode means the method by which an operand can
be specified in a register or a memory location.
8086/8088 provide a seven Addressing Modes:
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
3
5. Base–Plus–Index Addressing
6. Register Relative Addressing
7. Base Relative–Plus–Index Addressing

University of Southeastern Philippines


COLLEGE OF ENGINEERING 3
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Addressing Mode


Copy of a byte or word from the source register to the destination
register.
Use of registers to hold the data to be manipulated.
Memory is not accessed when this addressing mode is executed.

Example: MOV BX, DX ; copy the contents of DX into BX


MOV ES, AX ; copy the contents of AX into ES
MOV AL, BH ; copy the contents of BH to contents of AL
4

Source and destination registers must have the same size

University of Southeastern Philippines


COLLEGE OF ENGINEERING 4
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Immediate Addressing Mode


Copy the source, an immediate byte or word of data, into the
destination register or memory location the source operand is a
constant
The operand comes immediately after the opcode
For this reason, this addressing mode executes quickly
Immediate addressing mode can be used to load information into
any of the registers except the segment registers and flag registers.

University of Southeastern Philippines


COLLEGE OF ENGINEERING 5
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Immediate Addressing Mode


Example:
MOV AX, 2550H ; move 2550H into AX
MOV CX, 625 ; load the decimal value 625 into CX
MOV BL, 40H ; load 40H into BL

Can you move directly the data to a segment register?

University of Southeastern Philippines


COLLEGE OF ENGINEERING 6
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Immediate Addressing Mode

NO!!

The data must first be moved to a general-purpose register and


then to the segment register.

Example:
MOV DS, 0123H ; illegal instruction!

University of Southeastern Philippines


COLLEGE OF ENGINEERING 7
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Direct Addressing Mode


Copy a byte or word between a memory location and a register.
The data is in some memory location(s) and the address of the
data in memory comes immediately after the instruction
This address is the offset address

University of Southeastern Philippines


COLLEGE OF ENGINEERING 8
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Direct Addressing Mode

This address is the offset address


Example:
MOV AX, [2400H] ; copy contents of DS:2400H into AX

The physical address is calculated by combining the contents of


offset location 2400 with DS
(DS X 10H) + Displacement
Consider that DS = 1000H
(1000H X 10H) + 2400H = 12400H physical address 9

University of Southeastern Philippines


COLLEGE OF ENGINEERING 9
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Direct Addressing Mode

This address is the offset address


Example:
Find the physical address of the memory location and its
contents after the execution of the following,
Assuming that DS = 1512H.
command:
MOV AL, 3BH
MOV [3518H], AL
10

University of Southeastern Philippines


COLLEGE OF ENGINEERING 10
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Direct Addressing Mode


Assuming that DS = 1512H.
command:
MOV AL, 3BH
MOV [3518H], AL
Solution:
First 3BH is copied into AL,
Then in line two, the contents of AL are moved to logical
address DS:3518H which is 1512:3518H.
Shifting DS left and adding it to the offset gives the
11
physical address of 18638H
(1512H X 10H + 3518H = 18638H).
After the execution of the second instruction, the
memory location with address 18638H will contain the value 3BH.
University of Southeastern Philippines
COLLEGE OF ENGINEERING 11
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Copy a byte or word between a register and a memory location
addressed by an index or base register.

The address of the memory location where the operand resides is


held by a register

The registers used for this purpose are SI, DI, and BX They must be
combined with DS in order to generate the 20-bit physical address.

12

University of Southeastern Philippines


COLLEGE OF ENGINEERING 12
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
MOV AX, [BX] ; copy into AX the contents of the memory
location pointed to by DS:BX,
If DS = 1000H and BX =1234H
The physical address is calculated as
1000Hx10H+1234=11234H

13

University of Southeastern Philippines


COLLEGE OF ENGINEERING 13
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
MOV AX, [BP]; copy into AX the contents of the memory
pointed to by SS:BP,
if SS = 100H and BP=1234H
The Physical address is calculated as
100H x10H +1234H =2234H
The same rules apply when using register SI or DI.
Example:
MOV CL, [SI] ; move contents of DS:SI into CL 14
MOV [DI], AH ; move contents of AH into DS:DI

University of Southeastern Philippines


COLLEGE OF ENGINEERING 14
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode

The same rules apply when using register SI or DI.


Example:
MOV CL, [SI] ; move contents of DS:SI into CL
MOV [DI], AH ; move contents of AH into DS:DI

15

University of Southeastern Philippines


COLLEGE OF ENGINEERING 15
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode

MOV CL, [SI] ; move contents of DS:SI into CL


MOV [DI], AH ; move contents of AH into DS:DI
Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
Show the contents of memory locations after the execution of
MOV [SI], AX ;

16

University of Southeastern Philippines


COLLEGE OF ENGINEERING 16
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode

MOV CL, [SI] ; move contents of DS:SI into CL


MOV [DI], AH ; move contents of AH into DS:DI
Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
Show the contents of memory locations after the execution of
MOV [SI], AX ; copy contents of AX into DS:SI

17

University of Southeastern Philippines


COLLEGE OF ENGINEERING 17
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
Show the contents of memory locations after the execution of
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
Why SI + 1?
18

University of Southeastern Philippines


COLLEGE OF ENGINEERING 18
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
Why SI + 1?
The memory location can only hold 8 bits where AX is 16 bits.
19

University of Southeastern Philippines


COLLEGE OF ENGINEERING 19
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
The physical address starts at
DS x 10H + SI
20

University of Southeastern Philippines


COLLEGE OF ENGINEERING 20
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
The physical address starts at
DS x 10H + SI (1120Hx10H + 2498H = 13698H).
21

University of Southeastern Philippines


COLLEGE OF ENGINEERING 21
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
The physical address starts at
DS x 10H + SI (1120Hx10H + 2498H = 13698H).
At Physical address 22
DS:SI = 13698H contains FEH,

University of Southeastern Philippines


COLLEGE OF ENGINEERING 22
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Indirect Addressing Mode


Example:
Assume that DS = 1120H, SI = 2498H, and AX = 17FEH
MOV [SI], AX ; copy contents of AX into DS:SI
Solution:
The contents of AX  logical address DS:SI and DS:SI + 1;
The physical address starts at
DS x 10H + SI (1120Hx10H + 2498H = 13698H).
At Physical address 23
DS:SI = 13698H contains FEH,
while DS:SI+1 = 13699H = 17H.

University of Southeastern Philippines


COLLEGE OF ENGINEERING 23
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

University of Southeastern Philippines


COLLEGE OF ENGINEERING 24
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BX+DI], CL ;

25

University of Southeastern Philippines


COLLEGE OF ENGINEERING 25
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BX+DI], CL ; copy contents of CL into DS:BX+DI

26

University of Southeastern Philippines


COLLEGE OF ENGINEERING 26
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BX+DI], CL ; copy contents of CL into DS:BX+DI
Physical Address =

27

University of Southeastern Philippines


COLLEGE OF ENGINEERING 27
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BX+DI], CL ; copy contents of CL into DS:BX+DI
Physical Address = DSx10H + BX+DI

28

University of Southeastern Philippines


COLLEGE OF ENGINEERING 28
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV CH, [BX+SI] ;

29

University of Southeastern Philippines


COLLEGE OF ENGINEERING 29
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV CH, [BX+SI] ; copy contents of the DS:BX+SI into CH

30

University of Southeastern Philippines


COLLEGE OF ENGINEERING 30
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV CH, [BX+SI] ; copy contents of the DS:BX+SI into CH
Physical Address =

31

University of Southeastern Philippines


COLLEGE OF ENGINEERING 31
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV CH, [BX+SI] ; copy contents of the DS:BX+SI into CH
Physical Address = DSx10H + BX+SI

32

University of Southeastern Philippines


COLLEGE OF ENGINEERING 32
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV AH, [BP+DI] ;

33

University of Southeastern Philippines


COLLEGE OF ENGINEERING 33
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV AH, [BP+DI] ; copy contents of the SS:BP+SI into AH

34

University of Southeastern Philippines


COLLEGE OF ENGINEERING 34
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV AH, [BP+DI] ; copy contents of the SS:BP+SI into AH
Physical Address =

35

University of Southeastern Philippines


COLLEGE OF ENGINEERING 35
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV AH, [BP+DI] ; copy contents of the SS:BP+SI into AH
Physical Address = SSx10H + BP+DI

36

University of Southeastern Philippines


COLLEGE OF ENGINEERING 36
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BP+SI], AL ; copy contents of AL into SS:BP+SI
Physical Address = SSx10H + BP+SI

37

University of Southeastern Philippines


COLLEGE OF ENGINEERING 37
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base-Plus-Index Addressing Mode


Copy a byte or word between a register and the memory location addressed by a
base register (BP or BX) plus an index register (DI or SI).
Combining based and indexed addressing modes.
One base register and one index register are used.
Examples:
MOV [BX+DI], CL ; copy contents of CL into DS:BX+DI
Physical Address = DSx10H + BX+DI
MOV CH, [BX+SI] ; copy contents of the DS:BX+SI into CH
Physical Address = DSx10H + BX+SI
MOV AH, [BP+DI] ; copy contents of the SS:BP+SI into AH
Physical Address = SSx10H + BP+DI 38
MOV [BP+SI], AL ; copy contents of AL into SS:BP+SI
Physical Address = SSx10H + BP+SI

University of Southeastern Philippines


COLLEGE OF ENGINEERING 38
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Copy a byte or word between a register and the memory location addressed by an
index or base register plus a displacement.
The data in a segment of memory are addressed by adding the displacement to the
contents of a base or an index register (BP, BX, DI, or SI).

Examples:
MOV AX, [BX+4H] ; move contents of DS:BX+4H into AX
Physical Address = DSx10 + BX+4H
MOV CH, [SI+5H] ; move contents of the DS:SI+5H into CH
Physical Address = DSx10 +SI+5H
MOV AH, [DI+1H] ; move contents of the DS:DI+1H into AH 39
Physical Address = DSx10 + DI+1H
MOV [BP+2H], AL ; move contents of AL into SS:BP+2H
Physical Address = SSx10 + BP+2H

University of Southeastern Philippines


COLLEGE OF ENGINEERING 39
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Assume that DS = 4500H, SS = 2000H, BX = 2100H, SI = 1486H,
DI = 8500H, BP= 7814H, and AX = 2512H.
Show the exact physical memory location where AX is stored in each of the
following.
All values are in hex.
1. MOV [BX+20H], AX
2. MOV [SI+10H], AX
3. MOV [DI+4H], AX
4. MOV [BP+12H], AX
40

University of Southeastern Philippines


COLLEGE OF ENGINEERING 40
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Assume that DS = 4500H, SS = 2000H, BX = 2100H, SI = 1486H,
DI = 8500H, BP= 7814H, and AX = 2512H.

1. MOV [BX+20H], AX

Solution:
Physical Address = segment reg. x 10 + (offset reg.) + displacement
1. DS:BX+20H location 47120H = (12H) and 47121H = (25H) 41

University of Southeastern Philippines


COLLEGE OF ENGINEERING 41
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Assume that DS = 4500H, SS = 2000H, BX = 2100H, SI = 1486H,
DI = 8500H, BP= 7814H, and AX = 2512H.

1. MOV [BX+20H], AX
2. MOV [SI+10H], AX

Solution:
Physical Address = segment reg. x 10 + (offset reg.) + displacement
1. DS:BX+20H location 47120H = (12H) and 47121H = (25H) 42
2. DS:SI+10H location 46496H = (12H) and 46497H = (25H )

University of Southeastern Philippines


COLLEGE OF ENGINEERING 42
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Assume that DS = 4500H, SS = 2000H, BX = 2100H, SI = 1486H,
DI = 8500H, BP= 7814H, and AX = 2512H.

1. MOV [BX+20H], AX
2. MOV [SI+10H], AX
3. MOV [DI+4H], AX

Solution:
Physical Address = segment reg. x 10 + (offset reg.) + displacement
1. DS:BX+20H location 47120H = (12H) and 47121H = (25H) 43
2. DS:SI+10H location 46496H = (12H) and 46497H = (25H )
3. DS:DI+4H location 4D504H = (12H) and 4D505H = (25H)

University of Southeastern Philippines


COLLEGE OF ENGINEERING 43
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Assume that DS = 4500H, SS = 2000H, BX = 2100H, SI = 1486H,
DI = 8500H, BP= 7814H, and AX = 2512H.

1. MOV [BX+20H], AX
2. MOV [SI+10H], AX
3. MOV [DI+4H], AX
4. MOV [BP+12H], AX
Solution:
Physical Address = segment reg. x 10 + (offset reg.) + displacement
1. DS:BX+20H location 47120H = (12H) and 47121H = (25H) 44
2. DS:SI+10H location 46496H = (12H) and 46497H = (25H )
3. DS:DI+4H location 4D504H = (12H) and 4D505H = (25H)
4. SS:BP+12H location 27826H = (12H) and 27827H = (25H)

University of Southeastern Philippines


COLLEGE OF ENGINEERING 44
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
BX = 100H, DS = 200H
MOV AX,[BX+1000H]

45

University of Southeastern Philippines


COLLEGE OF ENGINEERING 45
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
BX = 100H, DS = 200H
MOV AX,[BX+1000H]

Physical Address: 200H x 10H + 1000H + 100H = 3100H

46

University of Southeastern Philippines


COLLEGE OF ENGINEERING 46
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
BX = 100H, DS = 200H
MOV AX,[BX+1000H]

Physical Address: 200H x 10H + 1000H + 100H = 3100H


Since AX is a 16 bit register,

47

University of Southeastern Philippines


COLLEGE OF ENGINEERING 47
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
BX = 100H, DS = 200H
MOV AX,[BX+1000H]

Physical Address: 200H x 10H + 1000H + 100H = 3100H


Since AX is a 16 bit register,
the data of location 3100H will go to AL
and 3101H to AH

48

University of Southeastern Philippines


COLLEGE OF ENGINEERING 48
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Addressing ARRAY data:
MOV BX,OFFSET ARRAY ;Base is loaded with the beginning address of the array
MOV DI,10H ; DI is loaded with the element number
MOV AL,[BX+DI]
MOV DI, 20H
MOV [BX+DI],AL

49

University of Southeastern Philippines


COLLEGE OF ENGINEERING 49
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Register Relative Addressing Mode


Example:
Addressing ARRAY data:
MOV BX,OFFSET ARRAY
MOV DI,10H
MOV AL,[BX+DI]
MOV DI, 20H DI
MOV [BX+DI],AL BX

50

University of Southeastern Philippines


COLLEGE OF ENGINEERING 50
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base Relative-plus-Index Addressing Mode


The combination of the based and indexed addressing modes.
One base register and one index register are used.
Example:
MOV CL, [BX + DI - 4H] ; move contents from DS:BX + DI - 4H into CL
offset address: DS:BX + DI - 4H
physical address: DSx10H + BX + DI – 4H
MOV DX, [BP + SI +10H] ; move contents from SS:BP+SI+10H into DL
and SS:BP+SI+10H+1 into DH
offset address:SS:BP+SI+10H and SS:BP+SI+10H+1
physical address: SSx10H+BP+SI+10H and SSx10H+BP+SI+11H
51

University of Southeastern Philippines


COLLEGE OF ENGINEERING 51
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Data Addressing Modes

Base Relative-plus-Index Addressing Mode


The combination of the based and indexed addressing modes.
One base register and one index register are used.
Example:
MOV [BX+ DI +3H], AL ; move contents from AL into DS:BX + DI + 3H
offset address: DS:BX + DI + 3H
physical address: DSx10H + BX + DI + 4H
MOV [BP+ DI + 10H],BX ; move contents from BX into SS:BP+DI+10H
and SS:BP+DI+10H+1
offset address:SS:BP+DI+10H and SS:BP+DI+10H+1
physical address: SSx10H+BP+DI+10H and SSx10H+BP+DI+11H
52

University of Southeastern Philippines


COLLEGE OF ENGINEERING 52
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Program-Memory Addressing Modes

Used with the JMP and CALL instructions, consist of three


distinct forms:
1. Direct Program Memory Addressing
ex. JMP 1000H
2. Relative Program Memory Addressing
ex. JMP BX
3. Indirect Program Memory Addressing
ex. JMP [BX]

53

University of Southeastern Philippines


COLLEGE OF ENGINEERING 53
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
Stack-Memory Addressing Modes

The stack plays an important role in all microprocessors..


• It holds data temporarily and stores return addresses for procedures.
• The stack memory is a LIFO (last-in, first-out) memory, which describes
the way that data are stored and removed from the stack..
• Data are placed onto the stack with a PUSH instruction and removed with
a POP instruction.
• The CALL instruction also uses the stack to hold the return address for
procedures and a RET (return) instruction to remove the return address
from the stack
Example:
PUSH BX ; places the contents of BX register onto the stack
addressed by SP + SS x 10H
54
POP AX ; remove the data from the stack at the location addressed
by SP + SS x 10H and places the data into the AX register

University of Southeastern Philippines


COLLEGE OF ENGINEERING 54
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System
University of Southeastern Philippines
COLLEGE OF ENGINEERING
Electronics Engineering Program

MICROPROCESSOR ARCHITECTURE

Addressing Modes

University of Southeastern Philippines


COLLEGE OF ENGINEERING 55
Electronics Engineering Program
C&A: Microprocessor and Microcontroller System

You might also like