Chapter_Three of Microprocessor
Chapter_Three of Microprocessor
1 Compiled by Yilkal B.
Chapter Outline
➢ Addressing modes:
➢ Example: JMP AX, in this instruction, the code execution control jumps to the current
➢ Example:
1. PUSH AX, this instruction copies the contents of AX register to the stack
2. POP AX, this instruction move the contents of AX register from the stack
Compiled by Yilkal B. 4
Cntd…
Compiled by Yilkal B. 5
I. Data addressing modes
❖ Note: We will use MOV instruction to explain all the data addressing modes.
1. Register addressing
➢ 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.
E.g.,
1. MOV AL, BL ; Copies 8-bit content of BL into AL
2. MOV AX, CX ; Copies 16-bit content of CX into AX
3. MOV ES, DS ; Not allowed (segment to segment)
4. MOV BL, DX ; Not allowed (mixed size)
5. MOV CS, AX ; Not allowed (Code segment register may not be destination register)
2. Immediate addressing: It 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. Compiled by Yilkal B. 7
Cntd…
E.g.,
Compiled by Yilkal B. 8
Cntd…
3. Direct data addressing: It moves a byte or word between a data segment memory
location and register.
❖ The instruction set does not support a memory to memory transfer except with the
MOV instruction.
❖ Direct addressing with a MOV instruction transfers data between a memory location,
located within the data segment, and the AL (8-bit) or, AX (16-bit).
❖ A MOV instruction using this type of addressing is usually a three byte long
instruction.
❖ The effective address is given directly in the source.
➢ 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 by default with register indirect addressing or any
other addressing modes that uses BX, DI or, SI to address memory.
Compiled by Yilkal B. 7
Cntd…
5. Register Relative addressing/ Base Address mode : It moves a byte or word between a register
and the memory location addressed by an index or base register (BP, BX, DI or SI) plus a
displacement.
➢ Remember that BX, DI or SI addresses data segment and BP addresses the stack segment.
E.g.,
1. MOV AX, [DI+100H] ; Copies the word content of the data segment memory location
addressed by DI plus 100H into AX.
2. MOV ARRAY[SI], BL ; Copies BL into the data segment memory location addressed by
ARRAY plus SI
Compiled by Yilkal B. 12
Cntd…
Compiled by Yilkal B. 13
Cntd…
7. Base Relative plus Index addressing : it transfers a byte or word between a register
and a memory location addressed by a base and an index register plus displacement.
❖ It is similar to base plus index addressing, but it adds a displacement beside using a
base register and an index register.
❖ This type of addressing mode often addresses a two-dimensional array of memory data.
E.g., 1. MOV DH, [BX+DI+20H] ; Copies the byte content of data segment memory location
addressed by the sum of BX, DI and 20H into DH.
2. MOV LIST[BP+DI], CL ; Copies CL into the stack segment memory location addressed by
the sum of LIST, BP, SI and 4.
➢ These branch instructions are instructions which are responsible for changing the
regular flow of the instruction execution and shifting the control to some other
location.
➢ In 8086 microprocessor, these instructions are usually JMP and CALL instructions.
➢ The Program memory Addressing Mode contains further three addressing modes
within it. They are:
a. Direct Program memory Addressing
b. Indirect Program memory Addressing
c. Relative Program memory Addressing
Compiled by Yilkal B. 15
a. Direct Program Memory Addressing
❖ Used for all jumps and calls by early microprocessor; also used in high-level
languages, such as BASIC.
❖The microprocessor uses this form, but not as often as relative and indirect program
memory addressing.
❖ The instructions for direct program memory addressing store the address with the opcode.
❖Often called a far jump because it can jump to any memory location for the next
instruction.
❖The only other instruction using direct program addressing is the intersegment or far
CALL instruction.
❖Usually, the name of a memory address, called a label, refers to the location that is
called or jumped to instead of the actual numeric address.
Compiled by Yilkal B. 16
b. Relative Program Memory Addressing
❖ Not available in all early microprocessors, but it is available to this family of
microprocessors.
❖ A JMP [2] instruction. This instruction skips over the 2 bytes of memory that follow
the JMP instruction.
Compiled by Yilkal B. 17
c. Indirect Program Memory Addressing
❖ The microprocessor allows several forms of program indirect memory addressing for
the JMP and CALL instructions.
❖ In 80386 and above, an extended register can be used to hold the address or indirect
address of a relative JMP or CALL.
❖ If a relative register holds the address, the jump is considered to be an indirect jump.
❖ For example, JMP [BX] refers to the memory location within the data segment at
the offset address contained in BX.
▪ at this offset address is a 16-bit number used as the offset address in the intersegment
jump
Compiled by Yilkal B. 18
III. Stack Memory-Addressing Modes
(b) POP CX removes data from the stack and places them into CX. Both instructions
are shown after execution.
Compiled by Yilkal B. 20
Compiled by Yilkal B. 21
End of Chapter Three
Any 3.1.8 Scaled-Index Addressing
Compiled by Yilkal B. 22