2.5addressing modes in 8086

11

Upload: shamilacse

Post on 03-Apr-2015

122 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 2.5Addressing modes in 8086
Page 2: 2.5Addressing modes in 8086

register addressing : REGimmediate addressing: within Instructiondirect addressingregister indirect addressingbased addressingindexed addressingbased indexed addressing

Page 3: 2.5Addressing modes in 8086

◦ Register Operand Addressing Mode can be accessed in byte, word, or double word sizes. MOV AX, BX Byte: AL, AH, BL, BH, CL, CH, DL, DH

Word: AX, BX, CX, DX, SP, BP, SI, DI, CS, DS, SS, ES, FS, GSDouble Word: EAX, EBX, ECX, EDX, ESP, EBP, ESI, EDI

See Fig 3.8 in page 64◦ Immediate Operand Addressing

an operand is part of the instruction MOV AL, 15H 8 bits, 16 bits, and 32 bits in length See Fig 3.10 in page 67

Page 4: 2.5Addressing modes in 8086

ABCD

0000 IPCSDSSSESFSGS

AXBXCXDXSPBPSIDI

Address MemoryContent

Instruction80386MPU

0100

XXXX ABCD

01000 8B MOV AX, BX01001 C301002 XX

Page 5: 2.5Addressing modes in 8086

0000 IPCSDSSSESFSGS

AXBXCXDXSPBPSIDI

Address MemoryContent

Instruction80386MPU

0100 01000 B0 MOV AL, 15H01001 1501002 XX

XX15

Page 6: 2.5Addressing modes in 8086

16-bit Memory Operand Addressing Modes◦ 16-bit addressing modes and 32-bit addressing

modes◦ Physical address = Segment Base: EA(effective

address) Segment Base Address(SBA) : the starting location of

the segment EA : the offset of the operand from the beginning of

the segment of memory EA = Base + Index + Displacement Base = BX or BP, Index = SI or DI, displacement = 8-bit or 16-bit

Page 7: 2.5Addressing modes in 8086

◦ Direct Addressing Mode PA = Segment Base : Direct Address MOV CX, [1234H]

MOV CX, [1234H]IPCSDSSSESFSGSAXBXCXDXSPBPSIDI

0100001001010020100301004

8B0E3412XX

000001000200

XXXX03234 ED03235 BE

BEED

Page 8: 2.5Addressing modes in 8086

◦ Register Indirect Addressing Mode PA = Segment Base : Indirect Address {BX,BP,SI,DI} example : MOV AX, [SI]

MOV AX,[SI]IPCSDSSSESFSGSAXBXCXDXSPBPSIDI

0100001001010020100301004

8B04XXXXXX

000001000200

XXXX03234 ED03235 BE

BEED1234

Page 9: 2.5Addressing modes in 8086

Based Addressing Mode◦ PA = Segment Base : {BX or BP} + {8-bit or 16-bit displacement}◦ Base register : the beginning of a data structure (See Fig 3.16 (b) in

page 74◦ Example: MOV [BX]+1234H, AL

MOV [BX]+1234H, ALIPCSDSSSESFSGSAXBXCXDXSPBPSIDI

0100001001010020100301004

88073412XX

000001000200

04234 04235

1234

ED1000

Displacement

Base Register

+

Element 0Element 1

Data Structure

Element n-1

Page 10: 2.5Addressing modes in 8086

◦ Indexed Addressing Mode PA = Segment Base : {SI, DI}+{8-bit or 16-bit displacement} Displacement : the starting address of an array; Index: selects the specific

element in the array Example: MOV AL, [SI]+2000H

Index Register

Displacement

+

Element 0Element 1

Array of data

Element n-1

IPCSDSSSESFSGSAXBXCXDXSPBPSIDI

0100001001010020100301004

8A443412XX

000001000200

05234 05235

2000

XX1000

MOV AL, [SI]+1234H

BE

Page 11: 2.5Addressing modes in 8086

◦ Based-Indexed Addressing Mode PA= Seg Base: {BX, BP}+{SI,DI}+{8-bit or 16-bit

displacement} to access complex data structures See fig 3.20 in page 80 Example: MOV AH, [BX][SI]+1234H

opcode : 8A 44 34 12