
ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٦٢
2. ADDRESING MODES IN 8086
We use the MOV instruction to describe the data-addressing modes. Figure 1 shows the MOV
instruction .
ﺳﻮف
ﻧﺴﺘﺨﺪم
اﻳﻌﺎز
MOV
ﻟﻮﺻﻒ
اﻧﻤﺎط
ﻋﻨﻮﻧﺔ
اﻟﺒﯿﺎﻧﺎت
واﻟﺸﻜﻞ
رﻗﻢ
واﺣﺪ
ﻳﺒﯿﻦ
اﻻﺻﯿﻐﺔ
ﻟﻜﺘﺎﺑﺔ
اﻻﻳﻌﺎز
MOV
AX , BX
OPCODE Destination Source
Fig -1- The MOV instruction
We also use the ADD instruction to the same purpose and Figure 2 will shows the ADD
instruction.
ADD AX , CX
OPCODE Destination Source
Fig -2- The ADD instruction
وﺳﻮف
ﻧﺴﺘﺨﺪم
اﻳﻌﺎز
ADD
ﻟﻨﻔﺲ
اﻟﻐﺮض
وﻳﻤﺜﻞ
اﻟﺸﻜﻞ
رﻗﻢ
2
اﻟﺼﯿﻐﺔ
ﻟﻜﺘﺎﺑﺔ
اﻻﻳﻌﺎز
Note: Addressing mode is a method of specifying an operand .
ﻣﻼﺣﻈﺔ
:
ﻧﻤﻂ
اﻟﻌﻨﻮﻧﺔ
ﻳﻤﺜﻞ
ﻃﺮﻳﻘﺔ
ﻟﺘﺤﺪﻳﺪ
operand
.
2.l.Register Addressing: With the register addressing, the operand to be accessed is specified
as residing in an internal register of 8086. All registers of 8086 can be used except Flag
register, Table -1- shows many variations of register move instructions, A segment-to-segment
register MOV instruction is the only type of MOV instruction not allowed. Note that the code
segment register is not normally changed by a MOV instruction because the address of the next
instruction in both
IP and CS. If only CS were changed, the address of the next instruction would
be unpredictable. Therefore, changing the CS register with MOV instruction is not allowed .
ﺒﺎﺴﺘﺨﺩﺍﻡ
ﻋﻨﻭﻨﺔ
ﺍﻟﻤﺴﺠﻼﺕ
ﻓﺎﻥ
ﺍﻟﻤﻌﺎﻤل
ﺍﻟﺫﻱ
ﻴﺠﺏ
ﻤﻌﺎﻟﺠﺘﻪ
ﻴﺘﻡ
ﺘﺤﺩﻴﺩﻩ
ﻋﻠﻰ
ﺍﺴﺎﺱ
ﺍﻨﻪ
ﻤﻭﺠﻭﺩ
ﻓﻲ
ﺍﺤﺩ
ﻤﺴﺠﻼﺕ
ﻤﻌﺎﻟﺞ
8086
ﺍﻟﺩﺍﺨﻠﻴﺔ
.
ﻭﻴﻤﻜﻥ
ﺍﺴﺘﺨﺩﺍﻡ
ﻜل
ﻤﺴﺠﻼﺕ
ﺍﻟﻤﻌﺎﻟﺞ
8086
ﻤﺎﻋﺩﺍ
ﻤﺴﺠل
FLAG
.
ﻭﻴﺒﻴﻥ

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٧٢
ﺍﻟﺠﺩﻭل
١
ﺍﺸﻜﺎل ﻤﺨﺘﻠﻔﺔ ﻤﻥ
ﺍﻴﻌﺎﺯﺍﺕ ﺍﻟﻨﻘل ﺒﻴﻥ ﺍﻟﻤﺴﺠﻼﺕ
.
ﻭﻟﻜﻥ ﻓﻘﻁ ﺍﻟﺘﻨﺎﻗل ﺒﻴﻥ ﻤﺴﺠﻼﺕ ﺍﻟﻤﻘﺎﻁﻊ ﻏﻴﺭ ﻤﺴﻤﻭﺡ ﺒﻪ
.
ﻭﻴﺠﺏ ﺍﻻﻨﺘﺒﺎﻩ ﺍﻟﻰ ﺍﻥ ﻤﺴﺠل ﻤﻘﻁﻊ
code
ﻻﻴﻤﻜﻥ ﺘﻐﻴﻴﺭ ﻗﻴﻤﺘﻪ ﻤﻥ ﺨﻼل ﺍﻴﻌﺎﺯ
MOV
ﻭﺫﻟﻙ ﻻﻥ
ﻋﻨﻮان اﻻﯾﻌﺎز اﻟﺘﺎﻟﻲ ﻓﻲ
اﻟﺘﻨﻔﯿﺬ ﯾﺘﻢ اﯾﺠﺎده ﻣﻦ ﺧﻼل اﺷﺘﺮاك ﻛﻞ ﻣﻦ
IP
و
CS
.
واذا ﺗﻢ ﺗﻐﯿﯿﺮ ﻗﯿﻤﺔ
CS
ﻓﻘﻂ ﻓﺎن ﻋﻨﻮان اﻻﯾﻌﺎز اﻟﺘﺎﻟﻲ ﯾﻜﻮن ﻏﯿﺮ ﻣﻌﺮف
وﻟﺬﻟﻚ ﻓﺎﻧﮫ ﻻﯾﻤﻜﻦ ﺗﻐﯿﯿﺮ ﻗﯿﻤﺔ ﻣﺴﺠﻞ ﻣﻘﻄﻊ اﻟﺒﯿﺎﻧﺎت ﻣﻦ ﺧﻼل اﯾﻌﺎز
MOV
.
Assembly Language
SIZE
Operation
MOV AL , BL
8 – bits
Copies AL into BL
MOV CH , CL
8 – bits
Copies CL into CH
MOV AX , CX
16 – bits
Copies CX into AX
MOV SP , BP
16 – bits
Copies BP into SP
MOV DS , AX
16 – bits
Copies AX into DS
MOV SI , DI
16 – bits
Copies DI into SI
MOV BX , EX
16 – bits
Copies ES into BX
MOV CX , BX
16 – bits
Copies BX into CX
MOV SP , DX
16 – bits
Copies DX into SP
MOV ES , DS
Not allowed (segment-to-segment)
MOV BL , DX
Not allowed (mixed sizes)
MOV CS , AX
Not allowed (the code segment register
may not be the destination register)
TABLE -1- Examples of the register – addressed instructions.
2.2Immediate Addressing: The term immediate implies that data immediately follow the
hexadecimal opcode in the memory. Table -2- shows many variations of immediate move
instructions.
ان
ﻣﺼﻄﻠﺢ
اﻻﻧﻲ
ﻳﻌﻨﻲ
ان
اﻟﺒﯿﺎﻧﺎت
ﻣﻮﺟﻮدة
ﻣﺒﺎﺷﺮة
ﺑﻌﺪ
اﻟﺮﻣﺰ
اﻟﺴﺎدس
ﻋﺸﺮي
ﻟﻼﻳﻌﺎز
ﻓﻲ
اﻟﺬاﻛﺮة

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٨٢
و
اﻟﺠﺪول
2
ﻳﺒﯿﻦ
ﻣﺠﻤﻮﻋﺔ
ﻣﺨﺘﻠﻔﺔ
ﻣﻦ
اﻳﻌﺎزات
اﻟﻨﻘﻞ
اﻻﻧﯿﺔ
.
Assembly Language
SIZE
Operation
MOV BL , 44
8 – bits
Copies a 44 decimal into BL
MOV AX , 44H
16 – bits
Copies a 0044H into AX
MOV SI , 0
16 – bits
Copies a 0000H into SI
MOV CH , 100
8 – bits
Copies a 100 decimal into CH
MOV AL , ‘A’
8 – bits
Copies an ASCII A into AL
MOV AX , ‘AB’
16 – bits
Copies an ASCII BA into AX
MOV CL , 11001110B
8 – bits
Copies a 11001110 binary into
CL
TABLE -2- Examples of the immediate – addressed instructions.
2.3.Memory Operand Addressing Modes: To reference an operand in memory, the 8086
must calculate the physical address (PA) of the operand and then initiate a read or write
operation of this storage location. The 8086 MPU is provided with a group of addressing modes
known as the memory operand addressing modes for this purpose. Physical address can
computed from a segment base address (SBA) and an effective address (EA). SBA identifies
the starting location of the segment in memory, and EA represents the offset of the operand
from the beginning of this segment of memory.
ﻟﻼﺷﺎرة
اﻟﻰ
ﻣﻌﺎﻣﻞ
ﻓﻲ
اﻟﺬاﻛﺮة
ﻓﺎن
ﻋﻠﻰ
ﻣﻌﺎﻟﺞ
8086
ان
ﻳﺤﺴﺐ
اﻟﻌﻨﻮان
اﻟﻔﯿﺰﻳﺎﺋﻲ
)
PA
(
ﻟﻤﻌﺎﻣﻞ
وم
ﺛﻢ
اﻋﻄﺎء
اﻣﺮ
ﻗﺮاءة
او
ﻛﺘﺎﺑﺔ
ﻟﻤﻮﻗﻊ
اﻟﺨﺰن
.
وﺑﺎﻟﺘﺎﻟﻲ
ﻓﺎن
اﻟﻤﻌﺎﻟﺞ
8086
ﻳﻘﺪم
ﻣﺠﻤﻮﻋﺔ
ﻣﻦ
ﻧﻤﺎذج
اﻟﻌﻨﻮﻧﺔ
واﻟﺘﻲ
ﺗﻌﺮف
ﻧﻤﺎذج
ﻋﻨﻮﻧﺔ
ﻣﻌﺎﻣﻼت
اﻟﺬاﻛﺮة
واﻟﻤﺨﺼﺼﺔ
ﻟﮫﺬا
اﻟﻐﺮض
.
وﻳﺘﻢ
ﺣﺴﺎب
اﻟﻌﻨﻮان
اﻟﻔﯿﺰﻳﺎﺋﻲ
ﻣﻦ
ﺧﻼل
ﻣﻘﻄﻊ
اﻟﻘﺎﻋﺪة
SBA
واﻟﻌﻨﻮان
اﻟﻔﻌﺎل
EA
.
وﻳﺤﺪد
SBA
ﻣﻘﻊ
اﻟﺒﺪاﻳﺔ
ﻟﻠﻤﻘﻄﻊ
ﻓﻲ
اﻟﺬاﻛﺮة
وﻳﻤﺜﻞ
EA
اﻻزاﺣﺔ
ﻟﻠﻤﻌﺎﻣﻞ
ﻣﻦ
ﺑﺪاﻳﺔ
اﻟﻤﻘﻄﻊ
ﻓﻲ
اﻟﺬاﻛﺮة
.

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٩٢
PA=SBA(segment):EA(offset)
PA=segment base :base + index + Displacement
−
−
+
+
=
nt
displaceme
bit
nt
displaceme
bit
DI
SI
BP
BX
ES
SS
DS
CS
PA
16
8
:
EA= base + index+ Displacement
Not all these elements are always used in the effective address calculation. In fact, a number of
memory addressing modes are defined by using various combinations of these elements. Next,
we will examine each of the memory operand addressing modes in detail.
ﻟﯿﺲ
ﻛﻞ
ھﺬه
اﻟﻌﻨﺎﺻﺮ
ﺳﯿﺘﻢ
اﺳﺘﺨﺪاﻣﮫﺎ
داﺋﻤﺎ
ﻓﻲ
ﺣﺴﺎب
اﻟﻌﻨﻮان
اﻟﻔﻌﺎل
.
وﻓﻲ
اﻟﺤﻘﯿﻘﺔ
ﻓﺎن
ﻣﺠﻤﻮﻋﺔ
ﻣﻦ
ﻧﻤﺎذج
ﻋﻨﻮﻧﺔ
اﻟﺬاﻛﺮة
ﻳﺘﻢ
ﺣﺴﺎﺑﮫﺎ
ﺑﺎﺳﺘﺨﺪام
ﻣﺠﺎﻣﯿﻊ
ﻣﺨﺘﻠﻔﺔ
ﻣﻦ
ھﺬه
اﻟﻌﻨﺎﺻﺮ
.
وﺳﯿﺘﻢ
دراﺳﺔ
ﻛﻞ
ﻧﻤﻮذج
ﻣﻦ
ﻧﻤﺎذج
ﻋﻨﻮﻧﺔ
اﻟﺬاﻛﺮة
ﺑﺎﻟﺘﻔﺼﯿﻞ
.
a. Direct Addressing Mode: Direct addressing mode is similar to immediate addressing in that
information is encoded directly into the instruction. However, in this case, the instruction
opcode is followed by an effective address, instead of the data. As shown below:
ﻧﻤﻮذج اﻟﻌﻨﻮﻧﺔ اﻟﻤﺒﺎﺷﺮ
:
ﯾﺸﺎ
ﺑﮫ ﻧﻤﻮذج اﻟﻌﻨﻮﻧﺔ اﻟﻤﺒﺎﺷﺮة اﻟﻌﻨﻮﻧﺔ اﻻﻧﯿﺔ ﻓﻲ اﻧﮫ اﻟﻤﻌﻠﻮﻣﺎت ﺗﺮﻣﺰ ﻣﺒﺎﺷﺮة ﻓﻲ
اﻻﯾﻌﺎز
.
ﻓﺎﻧﮫ ﻓﻲ ھﺬه اﻟﺤﺎﻟﺔ ﻓﺎن رﻣﺰ اﻻﯾﻌﺎز ﺳﯿﺘﺒﻌﮫ اﻟﻌﻨﻮان اﻟﻔﻌﺎل ﺑﺪﻻ ﻣﻦ اﻟﺒﯿﺎﻧﺎت وﻛﻤﺎ، لﺎﺣ ﺔﯾا ﻰﻠﻋو
ﻣﻮﺿﺢ ﻓﻲ ادﻧﺎه
:

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٠٣
}
{
=
address
Direct
ES
SS
DS
CS
PA
:
Default is DS
Direct addressing with a MOV instruction transfer data between a memory location, located
within the data segment, and the AL or AX register. A MOV instruction using this type of
addressing is usually a 3- byte instruction.
ان
اﻳﻌﺎز
MOV
وﺑﺎﺳﺘﺨﺪام
اﻟﻌﻨﻮﻧﺔ
اﻟﻤﺒﺎﺷﺮة
ﻳﺘﻨﺎﻗﻞ
اﻟﺒ
ﯿﺎﻧﺎت
ﺑﯿﻦ
ﻣﻮﻗﻊ
اﻟﺬاﻛﺮة
واﻟﻤﻌﻨﻮن
ﺿﻤﻦ
ﻣﻘﻄﻊ
اﻟﺒﯿﺎﻧﺎت
وﻣﺴﺠﻞ
AX
و
AL
.
واﻳﻌﺎز
MOV
اﻟﺬي
ﻳﺴﺘﺨﺪم
ھﺬا
اﻟﻨﻮع
ﻣﻦ
اﻟﻌﻨﻮﻧﺔ
ھﻮ
ﺑﻄﻮل
ﺛﻼﺛﺔ
ﺑﺎﻳﺘﺎت
.
Example 2-1 The instruction:
MOV AL , DS:[2000 H] or MOV AL,[2000 H]
is three bytes instruction which move the contents of the memory location with offset 2000 in
the current data segment into internal register AL.
The symbol [ ] mean contents of the memory.
ﺍﻥ
ﺍﻻﻴﻌﺎﺯ
ﺍﻟﺫﻱ
ﺒﻁﻭل
ﺜﻼﺜﺔ
ﺒﺎﻴﺘﺎﺕ
ﻴﻨﻘل
ﻤﺤﺘﻭﻯ
ﺍﻟﺫﺍﻜﺭﺓ
ﺍﻟﺫﻱ
ﻟﻪ
ﺍﻻﺯﺍﺤﺔ
2000
ﻓﻲ
ﻤﻘﻁﻊ
ﺍﻟﺒﻴﺎﻨﺎﺕ
ﺍﻟﺤﺎﻟﻲ
ﺍﻟﻰ
ﺍﻟﻤﺴﺠل
AL
.

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
١٣
b.Register Indirect Addressing Mode: This mode is similar to the direct address except that
the effective address held in any of the following register: BP, BX, SI, and DI. As shown below:
ﻨﻤﻭﺫﺝ
ﻋﻨﻭﻨﺔ
ﺍﻟﻤﺴﺠل
ﻏﻴﺭ
ﺍﻟﻤﺒﺎﺸﺭ
ﻴﺸﺎﺒﻪ
ﻨﻤﻭﺫﺝ
ﺍﻟﻌﻨﻭﻨﺔ
ﺍﻟﻤﺒﺎﺸﺭﺓ
ﻤ
ﺎﻋﺩﺍ
ﺍﻨﻪ
ﺍﻟﻌﻨﻭﺍﻥ
ﺍﻟﻔﻌﺎل
ﻴﻭﻀﻊ
ﻓﻲ
ﻭﺍﺤﺩ
ﻤﻥ
ﻫﺫﻩ
ﺍﻟﻤﺴﺠﻼﺕ
ﺤﺼﺭﺍ
BP, BX, SI, and DI
=
DI
SI
BP
BX
ES
SS
DS
CS
PA
:
Default is DS
Example 2-2: The instruction:
MOV AX, DS: [SI] or MOV AX, [SI]
move the contents of the memory location that is offset from the beginning of the current data
segment by the value of EA in register SI into internal register AX. For instance, we show that
if SI contains 1234
16
and DS contains 0200
16
, the result produced by executing the instruction is
that the contents of the memory location at address:
ـﻧﻘﻞ ﻣﺤﺘﻮﯾﺎت ﻣﻮﻗﻊ اﻟﺬاﻛﺮة واﻟﺬي ازاﺣﺘﮫ ﻣﻦ ﺑﺪاﯾﺔ ﻣﻘﻄﻊ اﻟﺒﯿﺎﻧﺎت ﻣﺤﺪدة ﻣﻦ ﺧﻼل اﻟﻘﯿﻤﺔ ﻟﻠ
EA
واﻟﻤﻮﺟﻮدة
ﻓﻲ اﻟﻤﺴﺠﻞ
SI
اﻟﻰ اﻟﻤﺴﺠﻞ
AX
.
وھﻨﺎ ﻧﺴﺘﻄﯿﻊ ان ﻧﺒﯿﻦ ﻓﻲ ادﻧﺎه ان ﻣﺴﺠﻞ
SI
واﻟﺬﯾﺤﺘﻮي اﻟﻘﯿﻤﺔ
1234
16
وﻣﺴﺠﻞ
DS
واﻟﺬي ﯾﺤﻮي
0200
16
ﻓﺎن اﻟﻨﺎﺗﺞ ﯾﺘﻢ اﻧﺘﺎﺟﮫ ﻣﻦ ﺧﻼل ﺗﻨﻔﯿﺬ اﻻ
ﯾﻌﺎز ﻟﻤﻮﻗﻊ اﻟﺬاﻛﺮة اﻟﻤﺤﺪد
ﺑﺎﻟﻌﻨﻮان
:
PA = 02000
16
+ 1234
16
= 03234
16
are
moved to the AX register.

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٢٣
Instruction using register indirect addressing mode
c.Based Addressing Mode: In the based addressing mode, the effective address of the operand
is obtained by adding a direct or indirect displacement to the contents of either base register
BX
or base pointer register BP. The physical address calculate as shown below:
ﻓﻲ
ﻧﻤﻮذج
ﻋﻨﻮﻧﺔ
اﻟﻘﺎﻋﺪة
ﻳﺘﻢ
اﻟﺤﺼﻮل
ﻋﻠﻰ
اﻟﻌﻨﻮان
اﻟﻔﻌﺎل
ﻟﻤﻌﺎﻣﻞ
ﻓﻲ
اﻟﺬاﻛﺮة
ﻣﻦ
ﺧﻼل
اﺿﺎﻓﺔ
ازاﺣﺔ
ﻣﺒﺎﺷﺮة
اوﻏﯿﺮ
ﻣﺒﺎﺷﺮة
)
displacement
(
اﻟﻰ
ﻣﺤﺘﻮى
ﻣﺴﺠﻞ
اﻟﻘﺎﻋﺪة
BX
اوﻣﺆﺷﺮ
ﻣﺴﺠﻞ
اﻟﻘﺎﻋﺪة
PB
وﻳﺘﻢ
ﺣﺴﺎب
اﻟﻌﻨﻮان
اﻟﻔﯿﺰﻳﺎﺋﻲ
وﻛﻤﺎ
ﻣﻮﺿﺢ
:
Before MPU After
ADRESS MEMORY
CONTENT
INSTRUCTION
0000
IP
0002
01000
8B
MOV AX,[SI]
0100
CS
0100
01001
04
0200
DS
0200
01002
xx
NEXT INSTRUCTION
SS
ES
xxxx
AX BEED
BX
CX
02000
xx
DATA SEG AFTER EX
DX
02001
xx
SP
BP
03234
ED
1234
SI
1234
03235
BE
DI

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٣٣
−
−
+
=
nt
displaceme
bit
nt
displaceme
bit
BP
BX
ES
SS
DS
CS
PA
16
8
:
Example 2-3: If BX=1000, DS=0200, and AL=EDH, for the following instruction:
MOV [BX] + 1234H, AL
EA=BX+1234H EA=1000H+1234H EA=2234H PH=DS0+EA
PH=02000H+2234H PH=4234H
So it writes the contents of source operand AL (EDH) into the memory location 04234H.
وﺑﺎﻟﺘﺎﻟﻲ
ﻓﺎﻧﻪ
ﻳ
ﻜﺘﺐ
ﻣﺤﺘﻮى
ﻣﻌﺎﻣﻞ
اﻟﻤﺼﺪر
ﻓﻲ
اﻟﻤﺴﺠﻞ
AL (EDH)
ﻓﻲ
ﻣﻮﻗﻊ
اﻟﺬاﻛﺮة
04234H
If BP is used instead of BX, the calculation of the physical address is performed using the
contents of the stack segment (SS) register instead of DS. This permits access to data in the
stack segment of memory.
واذا
ﺗﻢ
اﺳﺘﺨﺪام
BP
ﺑﺪﻻ
ﻣﻦ
BX
ﻓﺎن
ﺣﺴﺎب
اﻟﻌﻨﻮان
اﻟﻔﯿﺰﻳﺎﺋﻲ
ﻳﺘﻢ
ﻣﻦ
ﺧﻼل
ﻣﺤﺘﻮى
SS
ﻣﻘﻄﻊ
اﻟﻤﻜﺪس
ﺑﺪﻻ
ﻣﻦ
DS
وھﺬا
ﻳﺴﻤﺢ
ﺑﺎﺳﺘﺨﺪام
اﻟﺒﯿﺎﻧﺎت
ﻓﻲ
ﻣﻘﻄﻊ
اﻟﻤﻜﺪس
ﻟﻠﺬاﻛﺮة
.
d
.Indexed Addressing Mode: In the Indexed addressing mode, the effective address of the
operand is obtained by adding a direct or indirect displacement to the contents of either SI or DI
register. The physical address calculate as shown below:
ﻓﻲ
ﺣﺎﻟﺔ
ﻧﻤﻮذج
اﻟﻌﻨﻮﻧﺔ
اﻟﻤﻔﮫﺮﺳﺔ
،
ﻓﺎن
اﻟﻌﻨﻮاﻧﻢ
اﻟﻔﻌﺎل
ـﻟﻠ
operand
ﻳﺘﻢ
اﻟﺤﺼﻮل
ﻋﻠﯿﻪ
ﻣﻦ
اﺿﺎﻓﺔ
اﻻزاﺣﺔ
اﻟﻤﺒﺎﺷﺮة
او
ﻏﯿﺮ
اﻟﻤﺒﺎﺷﺮة
اﻟﻰ
ﻣﺤﺘﻮى
ﻣﺴﺠﻞ
SI or DI
وﻳﺘﻢ
ﺣﺴﺎب
اﻟﻌﻨﻮان
اﻟﻔﯿﺰﻳﺎﺋﻲ
ﻛﻤﺎ
ﻓﻲ
ادﻧﺎه
−
−
+
=
nt
displaceme
bit
nt
displaceme
bit
DI
SI
ES
SS
DS
CS
PA
16
8
:

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٤٣
e.Based-Indexed Addressing Mode: Combining the based addressing mode and the indexed
addressing mode results in a new, mere powerful mode known as based-indexed addressing
mode. This addressing mode can be used to access complex data structures such as two-
dimensional arrays. Notice that the displacement, which is a
fixed value, locates the array in
memory. The base register specifies the m coordinate of the array, and the index register
identifies the n coordinate. Simply changing the values in the base and index registers permits
access to any element in the array.
ان
ﻋﻤﻠﯿﺔ
اﻟﺠﻤﻊ
ﺑﯿﻦ
ﻧﻤﻮذج
ﻋﻨﻮﻧﺔ
اﻟﻘﺎﻋﺪة
وﻧﻤﻮذج
ﻋﻨﻮﻧﺔ
اﻟﻔﮫﺮﺳﺔ
ﻳﺆدي
اﻟﻰ
اﻧﺘﺎج
ﻧﻤﻮذج
ﺟﺪﻳﺪ
اﻛﺜﺮ
ﻛﻔﺎءة
ﻳﻌﺮف
ﺑﻨﻤﻮذج
ﻋﻨﻮﻧﺔ
اﻟﻘﺎﻋﺪة
اﻟﻤﻔﮫﺮﺳﺔ
.
وﻳﺴﺘﺨﺪم
ھﺬا
اﻟﻨﻮع
ﻣﻦ
اﻟﻌﻨﻮﻧﺔ
ﻟﻤﻌﺎﻟﺠﺔ
ھﯿﺎﻛﻞ
اﻟﺒﯿﺎﻧﺎت
اﻟﻤﻌﻘﺪة
ﻣﺜﻞ
اﻟﻤﺼﻔﻮﻓﺎت
ﺛﻨﺎﺋﯿﺔ
اﻻﺑﻌﺎد
.
وﺗﺤﺪد
اﻻزاﺣﺔ
ﻣﻮﻗﻊ
ﺧﺰن
اﻟﻤﺼﻔﻮﻓﺔ
ﻓﻲ
اﻟﺬاﻛﺮة
.
وﻳﺤﺪد
ﻣﺴﺠﻞ
اﻟﻘﺎﻋﺪة
اﺣﺪاﺛﻲ
m
وﻣﺴﺠﻞ
اﻟﻔﮫﺮﺳﺔ
اﺣﺪاﺛﻲ
n
ﻟﻤ
ﺼﻔﻮﻓﺔ
m × n
وﺑﺘﻐﯿﯿﺮ
ﺑﺴﯿﻂ
ﻓﻲ
ﻗﯿﻤﺔ
ﻛﻞ
ﻣﻦ
ﻣﺴﺠﻠﻲ
اﻟﻔﮫﺮﺳﺔ
واﻟﻘﺎﻋﺪة
ﻳﺴﻤﺢ
ﻟﻨﺎ
ﺑﻤﻌﺎﻟﺠﺔ
اي
ﻋﻨﺼﺮ
ﻓﻲ
اﻟﻤﺼﻔﻮﻓﺔ
.
−
−
+
+
=
nt
displaceme
bit
nt
displaceme
bit
DI
SI
BP
BX
ES
SS
DS
CS
PA
16
8
:
Examples
Ex1 : Show the effect before and after execution of the instructions below if you know
CS=55FF , DS=8EEA , IP for first instruction =88AD ,SI=8987
Data location for second instruction =1111H
MOV CX,22EEH OPCODE=B9
ADD CX,SI+[654A] OPCODE=038CH
SOL

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٥٣
واﻻن ﯾﺘﻢ ﺣﺴﺎب ﻋﻨﻮان اﻟﺒﯿﺎﻟﻨﺎت ﻓﻲ اﻟﺬاﻛﺮة ﻣﻦ ﺧﻼل اﻟﻌﻤﻠﯿﺔ اﻟﺮﯾﺎﺿﯿﺔ اﻟﺘﺎﻟﯿﺔ
FINAL ADRESS=DS0
SI
654A +
THAT IS MEAN 8EEA0
8987
654A +
9DD71
Before MPU After
ADRESS MEMORY
CONTENT
INSTRUCTION
88AD
IP
88B4
5E89D
B9
MOV CX,22EEH
55FF
CS
5E89E
EE
8EEA
DS
5E89F
22
SS
5E8A0
8C
ADD CX,SI+[654A]
ES
5E8A1
03
AX
5E8A2
4A
BX
5E8A3
65
CX
22EE
33FF
5E8A4
XX
NEXT INSTRUCTION
DX
SP
BP
8EEA0
BEFORE
DATA AFTER
8987
SI
DI
9DD71
11
9DD72
11

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٦٣
Ex2 : Show the effect before and after execution of the instructions below if you know
CS=34EA , DS=67AD , IP for SECOND instruction =4468 ,BX=2A3A
MOV AX,33ACH OPCODE=B8
ADD AX,BX OPCODE=03C3H
MOV BX+[7653] ,AX OPCODE=8987
SOL
Before MPU After
ADRESS MEMORY
CONTENT
INSTRUCTION
4465
IP
446E
39305
B8
MOV AX,33ACH
34EA
CS
39306
AC
67AD
DS
39307
33
SS
39308
C3
ADD AX,BX
ES
39309
03
AX
33AC
5DE6
3930A
87
MOV BX+[7653H]
,AX
2A3A
BX
3930B
89
CX
3930C
53
DX
3930D
76
SP
3930E
XX
NEXT INSTRUCTION
BP
SI
67AD0
BEFORE
DATA AFTER
DI
71B5D
XX
E6
71B5E
XX
5D

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٧٣
Ex3 : Show the effect before and after execution of the instructions below if you know
CS=66AF , DS=747E , IP for THRID instruction =3587 ,BP=4D5C,SS=834B, SI=589E
MOV DX,4568H OPCODE=BA
MOV BP+[891AH],4FE2H OPCODE=C786H
ADD BP+[891AH] ,DX OPCODE=0196H
SOL
Before MPU After
ADRESS MEMORY
CONTENT
INSTRUCTION
357D
IP
358A
6A51D
BA
MOV DX,4568H
66FA
CS
6A51E
68
747E
DS
6A51F
45
834B
SS
6A520
86
MOV BP+[891AH],4FE2H
ES
6A521
C7
AX
6A522
1A
BX
6A523
89
CX
6A524
E2
XXXX DX
4568
6A525
4F
SP
6A526
96
MOV BP+[891AH],DX
4D5C
BP
6A527
01
589E
SI
6A528
1A
DI
6A529
89
6A52A
XX
NEXT INSTRUCTION

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٨٣
ـﻭﻻﺠل ﺤﺴﺎﺏ ﻤﻭﻗﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻓﻲ ﻤﻘﻁﻊ ﺍﻟ
STACK
ﻻﻨﻨﺎ
ﻨﺘﻌﺎﻤل ﻤﻊ
BP
ﻧﻘﻮم ﺑﻤﺎﯾﻠﻲ
ADDRESS=SS0 834B0
BP 4D5C
891A +
90B26
Ex4 : Show the effect before and after execution of the instructions below if you know
CS=589D ,DS=682D , IP for THRID instruction =427A ,BP=7E3B,SS=973F, SI=36EA
BX=4782, DATA IN FOURTH INSTRUCTION IS 743EH
MOV CX,976AH OPCODE=B9
MOV BX+SI+[56D5H],885FH OPCODE=C780H
MOV AX, BX+SI+[56D5H] OPCODE=8B80
ADD BP+[572EH] , AX OPCODE=0186H
SOL
834B0
BEFORE
START OF STACK SEG
AFTER
90B26
E2
4A
90B27
4F
95

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٩٣
Before
MPU
After
ADRESS
MEMORY
CONTENT
INSTRUCTION
4271
IP
4282
5CC41
B9
MOV CX,976AH
589D
CS
5CC42
6A
682D
DS
5CC43
97
973F
SS
5CC44
80
MOV BX+SI+[56D5H],885FH
ES
5CC45
C7
XXXX
AX
885F
5CC46
D5
4782
BX
5CC47
56
XXXX
CX
976A
5CC48
5F
DX
5CC49
88
SP
5CC4A
80
MOV AX, BX+SI+[56D5H]
7E3B
BP
5CC4B
8B
36EA
SI
5CC4C
D5
DI
5CC4D
56
5CC4E
86
ADD BP+[572EH] , AX
5CC4F
01
5CC50
2E
5CC50
57
5CC52
XX
NEXT INSTRUCTION

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ
٠٤
ﻭﻻﺠل ﺤﺴﺎﺏ ﻤﻭﻗﻊ ﺍ
ﺍﻻﻴﻌﺎﺯ ﺍﻟﺜﺎﻟﺙ
ـﻓﻲ ﻤﻘﻁﻊ ﺍﻟ
CODE
ﻻﻨﻨﺎ ﻨﺘﻌﺎﻤل ﻤﻊ
IP
ﻧﻘﻮم ﺑﻤﺎﯾﻠﻲ
ADDRESS=CS0 589D0
IP 427A +
5CC4A
ﻭﻻﺠل ﺤﺴﺎﺏ ﻤﻭﻗﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻓﻲ
ﺍﻻﻴﻌﺎﺯ ﺍﻟﺜﺎﻨﻲ ﻓﻲ
ـﻤﻘﻁﻊ ﺍﻟ
DATA
ﻻﻨﻨﺎ ﻨﺘﻌﺎﻤل ﻤﻊ
BX
و
SI
ﻧﻘﻮم ﺑﻤﺎﯾﻠﻲ
ADDRESS=DS0 682D0
BX 4782
SI 36EA
56D5 +
75811
ـﻭﻻﺠل ﺤﺴﺎﺏ ﻤﻭﻗﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻓﻲ ﻤﻘﻁﻊ ﺍﻟ
STACK
ﻻﻨﻨﺎ ﻨﺘﻌﺎﻤل ﻤﻊ
BP
ﻧﻘﻮم ﺑﻤﺎﯾﻠﻲ
ADDRESS=SS0 973F0
BP 7E3B
572E +
A4959
682D0
BEFORE
DATA SEG AFTER
75811
XX
5F
75812
XX
88
973F0
BEFORE
STACK SEG AFTER
A4959
3E
9D
A495A
74
FC