Prof. Fayez F. M. El-Sousy Prof. Fayez F. M. El Prof. Fayez F. M. El - - Sousy Sousy Department of Electrical Engineering Department of Electrical Engineering College of Engineering College of Engineering Salman Salman bin bin Abdulaziz Abdulaziz University University Al Al - - Kharj Kharj , Saudi Arabia , Saudi Arabia Addressing Modes in Addressing Modes in Microprocessor Microprocessor 8086/8088 8086/8088
29
Embed
Addressing Modes in Microprocessor 8086/8088. Fayez F. M. El-Sousy Objectives of Addressing Modes in Microprocessor 8086/8088 Upon completion of this chapter, you will be able to:
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Prof. Fayez F. M. El-Sousy
Prof. Fayez F. M. ElProf. Fayez F. M. El--SousySousy
Department of Electrical EngineeringDepartment of Electrical Engineering
College of EngineeringCollege of Engineering
SalmanSalman bin bin AbdulazizAbdulaziz UniversityUniversity
AlAl--KharjKharj, Saudi Arabia, Saudi Arabia
Addressing Modes in Addressing Modes in
Microprocessor Microprocessor
8086/80888086/8088
Prof. Fayez F. M. El-Sousy
Objectives of Addressing Modes in Objectives of Addressing Modes in
Microprocessor 8086/8088Microprocessor 8086/8088
Upon completion of this chapter, you will be able to:Upon completion of this chapter, you will be able to:
�� Explain the operation of each dataExplain the operation of each data--addressing addressing
mode.mode.
�� Use the dataUse the data--addressing modes to form assembly addressing modes to form assembly
language statements.language statements.
�� Explain the operation of each program memoryExplain the operation of each program memory--
addressing mode.addressing mode.
�� Use the program memoryUse the program memory--addressing modes to addressing modes to
form assembly and machine language statements.form assembly and machine language statements.
Prof. Fayez F. M. El-Sousy
�� Select the appropriate addressing mode to Select the appropriate addressing mode to
accomplish a given task.accomplish a given task.
�� Detail the difference between addressing Detail the difference between addressing
memory data using real mode and protected memory data using real mode and protected
mode operation.mode operation.
�� Describe the sequence of events that place data Describe the sequence of events that place data
onto the stack or remove data from the stack.onto the stack or remove data from the stack.
�� Explain how a data structure is placed in Explain how a data structure is placed in
memory and used with software.memory and used with software.
Objectives of Addressing Modes in Objectives of Addressing Modes in
Microprocessor 8086/8088Microprocessor 8086/8088
Prof. Fayez F. M. El-Sousy
��Types of Addressing Modes:Types of Addressing Modes:
(1) Data Addressing Modes(1) Data Addressing Modes
Addressing Modes in Microprocessor Addressing Modes in Microprocessor
8086/80888086/8088
Prof. Fayez F. M. El-Sousy
�� An addressing mode means the method by which An addressing mode means the method by which an operand can be specified in a register or a an operand can be specified in a register or a memory locationmemory location
�� 8086/8088 provide a seven Addressing Modes8086/8088 provide a seven Addressing Modes:
MOV AX, 2550HMOV AX, 2550H ; move 2550H into AX; move 2550H into AX
MOV CX, 625MOV CX, 625 ; load the decimal value 625 into; load the decimal value 625 into
CXCX
MOV BL, 40HMOV BL, 40H ; load 40H into BL; load 40H into BL
�� The data must first be moved to a generalThe data must first be moved to a general--purpose purpose register and then to the segment register. register and then to the segment register.
��Moves a byte or word between a memory location and Moves a byte or word between a memory location and a register. a register.
��The data is in some memory The data is in some memory location(slocation(s) and the ) and the address of the data in memory comes immediately address of the data in memory comes immediately after the instruction after the instruction
��This address is the offset address This address is the offset address
��Example:Example:
MOV AX, [2400]MOV AX, [2400] ; move contents of DS:2400H; move contents of DS:2400H
into AXinto AX
��The physical address is calculated by combining the The physical address is calculated by combining the contents of offset location 2400 with DS contents of offset location 2400 with DS
Prof. Fayez F. M. El-Sousy
�� Example:Example:
Find the physical address of the memory location and its Find the physical address of the memory location and its contents after the execution of the following, assuming that DS contents after the execution of the following, assuming that DS = 1512H. = 1512H.
MOV AL, 3BH MOV AL, 3BH
MOV [3518], ALMOV [3518], AL
�� Solution:Solution:
�� First 3BH is copied into AL,First 3BH is copied into AL,
�� Then in line two, the contents of AL are moved to logical Then in line two, the contents of AL are moved to logical address DS:3518 which is 1512:3518. address DS:3518 which is 1512:3518.
�� Shifting DS left and adding it to the offset gives the physical Shifting DS left and adding it to the offset gives the physical address of 18638H (15120H + 3518H = 18638H). address of 18638H (15120H + 3518H = 18638H).
�� After the execution of the second instruction, the memory After the execution of the second instruction, the memory location with address 18638H will contain the value 3BH.location with address 18638H will contain the value 3BH.
�� Transfers a byte or word between a register and the memory locatTransfers a byte or word between a register and the memory location ion addressed by a base register (BP or BX) plus an index register (addressed by a base register (BP or BX) plus an index register (DI or DI or SI).SI).
�� Combining based and indexed addressing modes. Combining based and indexed addressing modes.
�� One base register and one index register are used.One base register and one index register are used.
�� Examples:Examples:
MOV [BX+DI], CL MOV [BX+DI], CL ; move contents of CL into DS:BX+DI; move contents of CL into DS:BX+DI
�� Moves a byte or word between a register and the memory location Moves a byte or word between a register and the memory location addressed by an index or base register plus a displacement.addressed by an index or base register plus a displacement.
�� The data The data in a segment of memory are addressed by adding the in a segment of memory are addressed by adding the displacement to the contents of a base or an index register (BP,displacement to the contents of a base or an index register (BP, BX, DI, BX, DI, or SI).or SI).
�� Examples:Examples:
MOV AX, [BX+4] MOV AX, [BX+4] ; move contents of DS:BX+4 into AX ; move contents of DS:BX+4 into AX
�� Assume that DS = 4500, SS = 2000, BX = 2100, SI = 1486, DI = Assume that DS = 4500, SS = 2000, BX = 2100, SI = 1486, DI = 8500, BP= 7814, and AX = 2512. Show the exact physical 8500, BP= 7814, and AX = 2512. Show the exact physical memory location where AX is stored in each of the following. Allmemory location where AX is stored in each of the following. Allvalues are in hex.values are in hex.
�� The base relativeThe base relative--plusplus--index addressing mode is similar to the index addressing mode is similar to the basebase--plusplus--index addressing mode, but adds a displacement index addressing mode, but adds a displacement besides using a base register and an index register to form the besides using a base register and an index register to form the memory address. memory address.
�� This type of addressing mode often addresses a twoThis type of addressing mode often addresses a two--dimensional dimensional array of memory data. array of memory data.
�� The data The data in a segment of memory are addressed by adding the in a segment of memory are addressed by adding the displacement to the contents of a base and an index register (BPdisplacement to the contents of a base and an index register (BP, , BX, DI, or SI).BX, DI, or SI).
�� Examples:Examples:
MOV [BX+DI+1], AX MOV [BX+DI+1], AX ; move contents of AX into; move contents of AX into