0% found this document useful (0 votes)
26 views

Addressing Modes - Microprocessors

Addressing modes define how source and destination operands are specified in instructions. Common addressing modes include: - Immediate addressing stores data immediately after the opcode. - Direct addressing moves data directly between a memory location and register within the data segment. - Register indirect addressing uses an offset address held in a register like BP or BX to access memory locations. - Base-plus-index addressing indirectly addresses memory by adding the contents of an index register to a base register.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Addressing Modes - Microprocessors

Addressing modes define how source and destination operands are specified in instructions. Common addressing modes include: - Immediate addressing stores data immediately after the opcode. - Direct addressing moves data directly between a memory location and register within the data segment. - Register indirect addressing uses an offset address held in a register like BP or BX to access memory locations. - Base-plus-index addressing indirectly addresses memory by adding the contents of an index register to a base register.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

ADDRESSING

MODES
Presented by: Mayank Rawal, Suyash Mehra,
Anushka Singhal, Om Aryan
Addressing modes are the different ways in which a source
operand is specified in an instruction and an opcode defines the
operation to perform.
MOV instruction is a common and flexible instruction. It provides a
basis for the explanation of data-addressing modes
Source is to the right and destination is to the left, next to the
opcode MOV.
An opcode, or operation code, tells the microprocessor which
operation to perform
Each statement in an assembly language program consists of four
parts or fields.
The MOV instruction shows the source, destination, and direction of data
flow.
The most common form of data addressing.
The microprocessor contains these 8-bit register names
used with register addressing: AH, AL, BH, BL, CH, CL, DH, and
DL.•16-bit register names: AX, BX, CX, DX, SP, BP, SI, and DI.
A register is the source of the operand
Data is stored in a register and a particular register refers to it
The effect of executing the MOV BX, CX instruction at the point just before the BX
register changes
Immediate Addressing Mode
Term immediate implies that data immediately follow the
hexadecimal opcode in the memory.
Immediate Addressing Mode
As with the MOV instruction illustrated in, the source data
overwrites the destination data
Immediate Addressing Mode
The letter H appends hexadecimal data.
If hexadecimal data begin with a letter, the assembler requires the
data start with a 0 – to represent a hexadecimal F2, 0F2H is used in
assembly language
An ASCII-coded character or characters maybe depicted in the
immediate form if the ASCII data are enclosed in apostrophes. – be
careful to use the apostrophe (’) for ASCII data and not the single
quotation mark (‘)
Binary data are represented if the binary number is followed by the
letter B – in some assemblers, the letter Y
Immediate Addressing Mode
Direct Addressing Mode
Direct addressing moves data between a memory location
and a register.
Two basic forms of direct data addressing:
a) Direct addressing
b) Displacement addressing
Address is formed by adding the displacement to the default
data segment (DS) address or an alternate segment address.
a. Direct Addressing
Direct addressing with a MOV instruction transfers data between a
memory location, located within the data segment, and the AL(8-
bit), AX (16-bit), or EAX (32-bit) register .
MOV AL, DATA loads AL from the data segment memory location
DATA (1234H).
DATA is a symbolic memory location, while 1234H is the actual
hexadecimal location
This instruction transfers a copy of contents of memory location 11234H into AL.
– the effective address is formed by adding 1234H (the offset address) and
10000H (the data segment address of 1000H times 10H) in a system operating in the
real mode.
Notice the difference between
b. Displacement Addressing
• Almost identical to direct addressing, except the instruction is 4
bytes wide instead of 3.
•In 80386 through Pentium 4, this instruction can be up to 7 bytes wide
if a 32-bit register and a 32-bit displacement are specified.
•This type of direct data addressing is much more flexible because
most instructions use it.
Register Indirect Addressing Mode

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.
Ex: MOV [BX],CX
Address = DS x 10H + BX
Note the difference between
Base-Plus-Index Addressing
Similar to indirect addressing because it indirectly addresses memory
data.

Figure shows how data are addressed by the MOV DX,[BX + DI]
instruction when themicroprocessor operates in the real mode.

The Intel assembler requires this addressingmode appear as[BX[DI]


instead of[BX +DI].

The MOVDX,[BX + DI] instruction is MOVDX,[BX][DI] for a program written


for the Intel ASM assembler.
Notice that memory address 02010H is accessed becauseDS=0100H,BX=1000HandDI=0010H.
Address =DS x 10 + BX + DI = 01000+01000+0010 = 02010H and 02011H
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)

Figure shows the operation of theMOV AX,[BX+1000H]instruction.

t
The operation of theMOV AX, [BX+1000H]instructon,
whenBX=0100HandDS=0200H.
Address Generation =DS X 10H
[BX+offset]=02000+100+1000=3100Hand3101H
BASE RELATIVE PLUS INDEXING

Least-used addressing mode.


Figure 3–12 shows how data are referenced if the instruction executed
by the microprocessor is MOV AX,[BX + SI + 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.
SCALED-INDEX ADDRESSING

It 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
A scaling factor of 1x is implied and need not be included in the assembly
language instruction (MOV AL,[EBX + ECX]).

You might also like