0% found this document useful (0 votes)
11 views16 pages

Lecture 6 (Addressing Modes)

The document discusses various data addressing modes in computer organization and system programming, including Register Addressing, Immediate Addressing, Direct Data Addressing, and others. It specifically details Register Indirect Addressing, Base-Plus-Index Addressing, Register Relative Addressing, and Base Relative-Plus-Index Addressing, along with examples and conventions used in assembly language. The document also mentions Scaled Index Addressing, unique to certain microprocessors, and provides references for further reading.

Uploaded by

yusuf tarek
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)
11 views16 pages

Lecture 6 (Addressing Modes)

The document discusses various data addressing modes in computer organization and system programming, including Register Addressing, Immediate Addressing, Direct Data Addressing, and others. It specifically details Register Indirect Addressing, Base-Plus-Index Addressing, Register Relative Addressing, and Base Relative-Plus-Index Addressing, along with examples and conventions used in assembly language. The document also mentions Scaled Index Addressing, unique to certain microprocessors, and provides references for further reading.

Uploaded by

yusuf tarek
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/ 16

CSIS 402 : COMPUTER ORGANIZATION

& SYSTEM PROGRAMMING


ADDRESSING MODES (II)
LECTURE 6 Dr. Sarah Azzam

Slides Based on Lecture Slides by Assoc. Prof. Dr. Amr Talaat


DATA ADDRESSING MODES
The data addressing modes are as follows:

Register Addressing

Immediate Addressing

Direct Data Addressing

Register Indirect Addressing

Base-Plus-Index Addressing

Register Relative Addressing

Base Relative-Plus-Index Addressing 2


REGISTER INDIRECT ADDRESSING
❑ Allows data to be addressed at any memory location through an offset
address held in any of the following registers: BP, BX, DI, and SI.

❑ In addition, 80386 and above allow register indirect addressing with any
extended register except ESP.

3
REGISTER INDIRECT ADDRESSING Little Indian
Convention

MOV AX, [BX]

BX=1000H, DS=0100H

4
REGISTER INDIRECT ADDRESSING
❑ The data segment is used by default with register indirect addressing or
any other mode that uses BX, DI, or SI to address memory.

❑ If the BP register addresses memory, the stack segment is used by default.


 these settings are considered the default for these four index and base registers

❑ For the 80386 and above,


 EBP addresses memory in the stack segment by default.

 EAX, EBX, ECX, EDX, EDI, and ESI address memory in the data segment by
default. 5
BASE-PLUS-INDEX ADDRESSING
❑ Similar to indirect addressing because it indirectly addresses memory data.

❑ The base register often holds the beginning location of a memory array.
 the index register holds the relative position of an element in the array

 whenever BP addresses memory data, both the stack segment register and BP generate
the effective address

6
BASE-PLUS-INDEX ADDRESSING
An example of the Base-Plus-Index addressing modes.
Here an element (DI) of an array (BX) is addressed.

7
BASE-PLUS-INDEX ADDRESSING
Locating Data with Base-Plus-Index Addressing

MOV DX, [BX+DI]

o The Intel assembler requires this addressing mode appear as [BX][DI] instead of
[BX + DI].

o The MOV DX,[BX + DI] instruction is MOV DX,[BX][DI] for a program written for
the Intel ASM assembler.

8
BASE-PLUS-INDEX ADDRESSING
Little Indian
Convention

MOV DX, [BX+DI]

BX=1000H, DS=0100H, DI=0010H

9
REGISTER RELATIVE ADDRESSING
❑ Similar to base-plus-index addressing and displacement addressing.
 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).

10
REGISTER RELATIVE ADDRESSING

MOV AX, [BX+1000H]

BX=0100H, DS=0200H

11
BASE RELATIVE-PLUS-INDEX ADDRESSING
❑ Least-used addressing mode.

❑ The following figure shows how data are MOV AX, [BX+SI+100H]
referenced if the instruction executed by
the microprocessor is MOV AX,[BX + SI +
DS=1000H

100H].
 displacement of 100H adds to BX and SI
to form the offset address within the data
segment.

❑ This addressing mode is too complex for


frequent use in programming. 12
BASE RELATIVE-PLUS-INDEX ADDRESSING
❑ Base Relative Plus-Index addressing modes used to access a file that contains
multiple records (REC).

13
SCALED INDEX ADDRESSING
❑ Unique to 80386 - 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, 8x

Examples of scaled-index instructions.

MOV AX,[ EBX + 2*ECX]

14
MOV [4 * ECX ],EDX
15
REFERENCE TEXTBOOK
[1] “80X86 IBM PC and Compatible Computers: Assembly Language, Design, and Interfacing”
by Muhammad Ali Mazidi , Janice Mazidi Gillispie and Janice Gillispie Mazidi

[2] “The Intel microprocessors 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium, Pentium Pro
processor, Pentium II, Pentium III, Pentium 4, and Core2 with 64-bit extensions: architecture, programming,
and interfacing” by Barry B. Brey”

16

You might also like