Addressing Modes 1 DataAddressing Modes Instruction is divided




![MOV AL, DS: [123 A] memory AL EAX EBX ECX 5 B 4 B MOV AL, DS: [123 A] memory AL EAX EBX ECX 5 B 4 B](https://slidetodoc.com/presentation_image_h2/04c41350ef29349f92d08407015b5085/image-5.jpg)



![PROGRAM MEMORY-ADDRESSING MODES 1. 9 Direct Program Memory Addressing. JMP [10000 H] Opcode Offset(low) PROGRAM MEMORY-ADDRESSING MODES 1. 9 Direct Program Memory Addressing. JMP [10000 H] Opcode Offset(low)](https://slidetodoc.com/presentation_image_h2/04c41350ef29349f92d08407015b5085/image-9.jpg)
![3. Indirect Program Memory addressing. JMP AX JMP [BX] STACK MEMORY-ADDRESSING MODES. PUSH BX 3. Indirect Program Memory addressing. JMP AX JMP [BX] STACK MEMORY-ADDRESSING MODES. PUSH BX](https://slidetodoc.com/presentation_image_h2/04c41350ef29349f92d08407015b5085/image-10.jpg)
- Slides: 10
Addressing Modes 1. Data-Addressing Modes. Instruction is divided to two parts: Opcode ( operation code) tells the microprocessor which operation to perform. Operand, source and destination. 1
1. Register addressing. Transfers a copy of a byte or word from the source register or contents of a memory location to the destination register or memory location. MOV CX, DX MOV ECX, EDX MOV ES, DS (segment to segment) MOV CS, AX (code segment) MOV BL, DX 2 (mixed sizes) MOV BX, CX EBX B 1 D 6 76 FF ECX 11 AC 12 34 1234
2. Immediate addressing. Transfers the source (immediate byte or word data), into the destination register or memory location. MOV AL, 22 H MOV EBX, 12345678 H MOV EAX, 1234 H EAX ECX 3 B 1 D 6 76 FF
3. Direct addressing. Moves a byte or word between a memory location and a register. MOV CX, LIST MOV ESI, LIST a. Direct addressing (use AL, AX, and EAX), (three bytes long) MOV AX, NUMBER b. Displacement addressing ( almost any instruction in the instruction set), (four bytes long) MOV ES, DATA 4
MOV AL, DS: [123 A] memory AL EAX EBX ECX 5 B 4 B 1 D 6 76 FF B 4 123 B 123 A 1239
4. Register indirect addressing. Transfers a byte or word between a register and a memory location addressed by an index or base register. MOV AX, [BX] MOV AL, [ECX] in the 80386 and above, can address by any register (EAX, EBX, ECX, EDX, EBP, E DI, or ESI). 6
5. Base-plus-index addressing. Transfers a byte or word between a register and the memory location addressed by a base register (BP or BX) plus an index register (DI or SI). MOV [BX+DI], CL MOV [EAX+EBX], CL in the 80386 and above, any two registers (EAX, EBX, ECX, EDX, EBP, EDI, or ESI). 6. Register relative addressing. Moves a byte or word between a register and the memory location addressed by an index or base register plus a displacement. MOV AX, [BX+4] MOV AX, ARRAY[BX] MOV AX, [ECX+4] in 80386 and above, use any 32 -bit register except ESP. MOV AX, ARRAY[EBX] 7
7. Base relative – plus – index addressing. Transfers a byte or word between a register and memory location addressed by a base and an index register plus a displacement. MOV AX, [BX+DI+4] MOV AX, ARRAY[BX+DI] MOV EAX, ARRAY[EBX+ECX] 8. Scaled-index addressing. Available only in the 80386 and above. The second register of a pair of registers is modified by the scale factor of 2 x, 4 x, or 8 x to generate the operand memory address. MOV EDX, [EAX+4*EBX] Allows to access to word (2 x), doubleword ( 4 x), or quadword (8 x) memory array data. MOV AL, [2*EBX] 8
PROGRAM MEMORY-ADDRESSING MODES 1. 9 Direct Program Memory Addressing. JMP [10000 H] Opcode Offset(low) Offset(high) EA 00 00 Segment(low) Segment(high) 00 Relative Program Memory Addressing. JMP [2] 10000 EB 10001 10002 10003 10004 02 ----- 10
3. Indirect Program Memory addressing. JMP AX JMP [BX] STACK MEMORY-ADDRESSING MODES. PUSH BX POP AX 10 H-byte sp-1, L-byte sp-2 H-byte sp+1, L-byte sp