9. 9
Addressing Modes:
• The term addressing modes refers to the way in which the
operand of an instruction is specified.
• When 80386 executes an instruction, it performs the specified
function on data. Operated data is stored in the memory location.
There are various techniques to specifyaddress of data. These
techniques are calledAddressing Modes.
• An addressing mode specifies how to calculate the effective
address (EA) of an operand.
13. • REGISTER ADDRESSING TRANSFERSACOPYOFABYTE
OR WORD FROM THE SOURCE REGISTER TO DESTINATION
REGISTER.
• 8-BIT REGISTER NAMES WITH REGISTER ADDRESSING:AH,AL,
BH, BL,CH, CL, DH, DL.
• 16-BIT REGISTER NAMES:AX, BX,CX, DX, SP
,BP
,SI,DI, IP
,CS, SS,
DSAND ES.
13
Register addressing
Destination
Note: Wewill use MOVinstruction to explain all the data addressing modes.
Source
MOV AX, BX
Opcode
17. 17
Immediate addressing
• Immediate addressing transfers the source, an immediate byte or word data, into the
destination
register.
• Immediate data means constant data,whereas data transferred from aregister or memory
location are variable data.
• Example: MOV BL, 44 ; Copies44 decimal (2CH) into BL
MOV AX, 44H ; Copies 0044H intoAX
MOV AL,‘A
’ ; CopiesASCII AintoAL
Data
4D12H
Register
BX
MOVBX,4D12H
Operation
2
19. Immediate addressing
MOV ECX,12345678H
• This instruction Copies the 12345678H In
ECX register.
• 32-bit data is given in the instruction and it will
be transferred to ECX register after instruction
execution.
2
20. • In this mode, the instruction contains the address of the actual
memory location where the operand's value is stored.
• The address of this memory location is referred to as the
effective address.
Direct addressing:
3
21. • The square brackets around the 1354 H denotes the
contents of the memory location.
• When executed, this instruction will copy the contents
of the memory location into BX register.
• This addressing mode is called direct because the
displacement of the operand from the segment base is
specified directly in the instruction.
Direct addressing:
3
24. Register indirect addressing
• In register indirect addressing, name of the
register which holds the effective address (EA)
will be specified in the instruction.
• Registers used to hold EA are any of the
following registers: BX, BP, DI and SI.
• Content of the DS register is used for base
address calculation.
4
25. 25
Register Indirect addressing
• Register addressing transfers abyte or word between aregister and memory location
addressed byan index or base register.
• The index and base registers are BP
,BX,DI and SI.These registers hold the offset address
of the memory location.
• The data segment is used bydefault with register indirect addressing or any other
addressing modesthat uses BX, DI or, SIto address memory
.
• IfBPregister addresses memory, the stack segment is used bydefault.
• The [ ] symbol denote indirect addressing in assembly language.
Register
CL
Memoryaddress
DSx 10+BX
MOV[BX], CL
Operation
27. Register indirect addressing
• Example: MOVCX, [BX] ; Copies the word contents of the data
segment memory location addressed by BXinto CX.
• MOV EAX, [EBX]
30. Indexed addressing
• ESI or EDI register is used to hold an index value for
Memory data and a displacement will be specified in the
Instruction.
• Displacement is added to the index value in ESI or EDI
register to obtain the EA.
• MOV EAX, [ESI+2040H]
• P.A=DS+ESI+2040
6
34. MOV EAX, [EBX+ESI]
The address of the data was represent in the
operand field of the instruction by combination of
base register and index register.
Based index addressing