All-addressing-modes of the 80386 /microprocessor.pptx
350 views
38 slides
Mar 10, 2024
Slide 1 of 38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
About This Presentation
addressing modes of 80386
Size: 3.95 MB
Language: en
Added: Mar 10, 2024
Slides: 38 pages
Slide Content
80 3 86 Addressing Modes A d d r es s ing M o des: D e f ini t i o n a nd cla s si f ic a t i o n
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 80 3 86 executes an instruction, it performs the specified function on data. Operated data is stored in the memory location. There are various techniques to specify address of data. These t e c hn i qu e s a r e c a ll e d A dd r e ss i n g M od e s . An addressing mode specifies how to calculate the effective address (EA) of an operand.
Addressing Modes:
1
Register addressing transfers a copy of a byte 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, DS and ES. Never mix an 8-bit register with 16-bit, it is not allowed in microprocessor. 13 Register addressing Destination Note: We will use MOV instruction to explain all the data addressing modes. Source M O V AX , BX Opcode
Register addressing MOV EAX,EDX Copy the contents of EDX register to the EAX register 1
Register Addressing Mode M O V E X , DS ; N o t a ll o w e d ( s e g m e n t to s e g m e n t) M O V BL , DX ; N o t a ll o w e d ( mi x e d s i z e ) MOV CS, AX ; Not allowed (Code segment register may not be destination register) Code segment register (CS) is never used as destination. Segment to segment MOV instruction is not allowed. E x a m p l e : M O V A L , B L M O V A X , CX ; C op i e s 8 - b it co n t e n t o f BL i n to A L ; C o p i e s 1 6 - b it c o n t e n t of C X i n to A X 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 a register or memory location are variable data. E x a m p l e : M O V B L , 4 4 ; C op i e s 4 4 de cima l ( 2 CH ) i n to BL M O V A X , 4 4 H ; C o p i e s 44 H i n to A X M O V A L , ‘ A ’ ; C o p i e s A S C I I A i n to A L Data 4 D 1 2 H R e g i s t e r BX M O V BX , 4D1 2 H 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 . Di r e ct a dd r e ss i n g : 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. Di r e ct a dd r e ss i n g : 3
Di r e ct a dd r e ss i n g : 3
Di r e ct a dd r e ss i n g : 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 a byte or word between a register and memory location addressed by a n i n d e x o r b as e r e g i s t e r . The index and base registers are BP, BX, DI and SI.These registers hold the offset address of the m e mo r y l o c a ti o n . The data segment is used by default with register indirect addressing or any other addressing modes th a t u s e s B X , DI o r , SI to a dd r e s s m e m o r y . If BP register addresses memory, the stack segment is used by default. The [ ] symbol denote indirect addressing in assembly language . Register CL M e m o r y a dd r e s s DS x 10 + B X M O V [ BX ] , CL Operation
Register Indirect addressing
Register indirect addressing Example: MOV CX, [BX] ; Copies the word contents of the data segment memory location a dd r e ss e d b y BX i n to 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