80386 Addressing Modes
Addressing Modes: Definition and classification
Memory segmentation
20-Bit Physical address=base
address+ offset
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.
Addressing Modes:
1
• 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
Register addressing
MOV EAX,EDX
• Copy the contents of EDX register to the EAX
register
1
REGISTER ADDRESSING MODE
MOV EX, DS ; Not allowed (segment to segment)
MOV BL, DX ; Not allowed (mixed size)
MOV CS,AX ; Not allowed (Code segment register maynot be destination register)
• Code segment register (CS) is never used as destination.
• Segment to segment MOVinstruction is not allowed.
• Example: MOV AL, BL
MOV AX, CX
; Copies 8-bit content ofBLintoAL
; Copies 16-bit content of CX intoAX
1
2
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
Immediate addressing
2
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
• 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
• 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
Direct addressing:
3
Direct addressing:
3
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
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
Register Indirect addressing
Register indirect addressing
• Example: MOVCX, [BX] ; Copies the word contents of the data
segment memory location addressed by BXinto CX.
• MOV EAX, [EBX]
Base addressing
5
Base addressing
5
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
Indexed
Addressing
6
Scale Indexed
Addressing
7
MOV EAX,[ESI*02]
Based index addressing
8
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
Based index addressing
9
Based Scaled Index
addressing
10
11

All-addressing-modes of the 80386 /microprocessor.pptx

  • 1.
    80386 Addressing Modes AddressingModes: Definition and classification
  • 2.
  • 8.
  • 9.
    9 Addressing Modes: • Theterm 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.
  • 10.
  • 12.
  • 13.
    • REGISTER ADDRESSINGTRANSFERSACOPYOFABYTE 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
  • 14.
    Register addressing MOV EAX,EDX •Copy the contents of EDX register to the EAX register 1
  • 15.
    REGISTER ADDRESSING MODE MOVEX, DS ; Not allowed (segment to segment) MOV BL, DX ; Not allowed (mixed size) MOV CS,AX ; Not allowed (Code segment register maynot be destination register) • Code segment register (CS) is never used as destination. • Segment to segment MOVinstruction is not allowed. • Example: MOV AL, BL MOV AX, CX ; Copies 8-bit content ofBLintoAL ; Copies 16-bit content of CX intoAX 1
  • 16.
  • 17.
    17 Immediate addressing • Immediateaddressing 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
  • 18.
  • 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 thismode, 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 squarebrackets 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
  • 22.
  • 23.
  • 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
  • 26.
  • 27.
    Register indirect addressing •Example: MOVCX, [BX] ; Copies the word contents of the data segment memory location addressed by BXinto CX. • MOV EAX, [EBX]
  • 28.
  • 29.
  • 30.
    Indexed addressing • ESIor 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
  • 31.
  • 32.
  • 33.
  • 34.
    MOV EAX, [EBX+ESI] Theaddress of the data was represent in the operand field of the instruction by combination of base register and index register. Based index addressing
  • 35.
  • 36.
  • 37.
  • 38.