lect2-c1
lect2-c1
AH AL
General
purpose BH BL
register
CH CL Program control
DH DL
CS
SP
Pointer DS
Segment
Register BP
SS Register
Index SI
Register ES
DI
Bus Bus
Control
Logic
ALU : 1
Arithmetic and
logic unit 2
Instruction
3 Queue
CU:
Control unit 4
Flags Register
Instruction
Pointer
٩
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
The organization of 8086 Processor is partitioned into two logical units
a. Bus Interface unit (BIU)
b. Execution Unit (EU)
: ﺍﻟﻰ ﻭﺤﺩﺘﻴﻥ ﻤﻨﻁﻘﺘﻴﻥ ﻫﻤﺎ8086 ﻴﺘﻡ ﺘﻘﺴﻴﻡ ﻫﻴﻜﻴﻠﺔ ﺍﻟﻤﻌﺎﻟﺞ
ﻭﺤﺩﺓ ﺍﻟﺘﻨﻔﻴﺫ.ﺏ
ﻭﺒﺎﻟﺘﺎﻟﻲ ﻴﺠﺏ ﺍﻥ ﺘﻘﻭﻡ ﻭﺤﺩﺓ ﺠﻠﺏ ﺍﻻﻴﻌﺎﺯ ﺒﺠﻠﺏ ﺍﻻﻴﻌﺎﺯﺍﺕ ﻤﻥ ﺍﻟﺫﺍﻜﺭﺓ ﻭﻭﻀﻌﻬﺎ ﻓﻲ ﻁﺎﺒﻭﺭ، ﻤﻭﺠﻭﺩ ﻓﻲ ﺍﻟﺫﺍﻜﺭﺓ
ﻭﻫﺫﻩ ﺍﻟﺨﺎﺼﻴﺔ ﺘﻤﻜﻥ ﻭﺤﺩﺓ. ﺍﻴﻌﺎﺯﺍﺕ ﺒﺎﻻﻋﺘﻤﺎﺩ ﻋﻠﻰ ﻨﻭﻉ ﺍﻟﻤﻌﺎﻟﺞ٧ ﺍﻴﻌﺎﺯﺍﺕ ﺍﻟﻰ٥ ﺍﻻﻴﻌﺎﺯﺍﺕ ﻭﺍﻟﺫﻱ ﻴﺘﺭﻭﺍﺡ ﻁﻭﻟﻪ ﺒﻴﻥ
١٠
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
ﺠﻠﺏ ﺍﻻﻴﻌﺎﺯﺍﺕ ﻤﻥ ﺘﺤﻀﻴﺭ ﻤﺠﻤﻭﻋﺔ ﺍﻴﻌﺎﺯﺍﺕ ﺠﺎﻫﺯﺓ ﻟﻠﺘﻨﻔﻴﺫ ﻭﻗﺩ ﺘﻡ ﺠﻠﺒﻬﺎ ﻤﺴﺒﻘﺎ ﻤﻥ ﺍﻟﺫﺍﻜﺭﺓ ﻭﺒﺎﻟﺘﺎﻟﻲ ﺘﻭﻓﻴﺭ ﻁﺎﺒﻭﺭ ﻤﻥ
Manage the segment register and controlling the process of addressing the memory is another
function of BIU. The segment register is considering the most important set of registers in 8086
CPU and we have four types of segments:
ﺘﻌﺘﺒﺭ ﻤﺴﺠﻼﺕ. ﺘﻨﻅﻴﻡ ﻤﺴﺠﻼﺕ ﺍﻟﺘﺠﺯﺌﺔ ﻭﺍﻟﺴﻴﻁﺭﺓ ﻋﻠﻰ ﻋﻤﻠﻴﺔ ﻋﻨﻭﻨﺔ ﺍﻟﺫﺍﻜﺭﺓ ﻫﻭ ﻭﻅﻴﻔﺔ ﺍﺨﺭﻯ ﻟﻭﺤﺩﺓ ﺠﻠﺏ ﺍﻟﻤﻌﻠﻭﻤﺎﺕ
: ﻭﻫﻨﺎﻙ ﺍﺭﺒﻌﺔ ﺍﻨﻭﺍﻉ ﻤﻥ ﻤﺴﺠﻼﺕ ﺍﻟﺘﺠﺯﺌﺔ8086 ﺍﻟﺘﺠﺯﺌﺔ ﻫﻲ ﺍﻫﻡ ﻤﺠﻤﻭﻋﺔ ﻤﺴﺠﻼﺕ ﻀﻤﻥ ﻤﺴﺠﻼﺕ ﺍﻟﻤﻌﺎﻟﺞ
Let us first define the segment as a special area defined in a program that begins on paragraph
boundary, that is, at a location evenly divisible by 16, or hex 10. Although a segment may be
located, almost anywhere in memory and in real mode (executing one program in one time) the
size of segment is 64 KB and the size of the space it takes in memory is equal to the space
required for the program execution. In addition, we note that there is another mode of operating
is called protected mode (executing more than one program in one time) which can process
working in it.
ﻓﻲ ﺍﻟﺒﺩﺍﻴﺔ ﻟﻨﻌﺭﻑ ﺍﻟﻤﻘﻁﻊ ﻭﺍﻟﺫﻱ ﻫﻭ ﻋﺒﺎﺭﺓ ﻋﻥ ﻤﻨﻁﻘﺔ ﺨﺎﺼﺔ ﻤﻌﺭﻓﺔ ﻤﻥ ﻓﺒل ﺍﻟﺒﺭﻨﺎﻤﺞ ﻭﺍﻟﺘﻲ ﺘﺒﺩﺍ ﺒﻤﺎ ﻴﻌﺭﻑ ﺒﺎل
ﻭﻴﻤﻜﻥ. ﻓﻲ ﺍﻟﻨﻅﺎﻡ ﺍﻟﺴﺎﺩﺱ ﺍﻟﻌﺸﺭﻱ10 ﺍﻭ16 ﻭﻫﻭﻋﻨﻭﺍﻥ ﻤﻭﻗﻊ ﻓﻲ ﺍﻟﺫﺍﻜﺭﺓ ﻴﻘﺒل ﺍﻟﻘﺴﻤﺔ ﻋﻠﻰParagraph boundary
١١
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
( )ﺘﻨﻔﻴﺫ ﻨﺭﻨﺎﻤﺞ ﻭﺍﺤﺩ ﻓﻲ ﻭﻗﺕ ﻭﺍﺤﺩ ﻓﺎﻥreal mode) ﺍﻴﻥ ﻴﻜﻭﻥ ﺍﻟﻤﻘﻁﻊ ﻓﻲ ﺍﻱ ﻤﻜﺎﻥ ﺒﺎﻟﺫﺍﻜﺭﺓ ﻭﻓﻲ ﻨﻤﻁ ﺍﻟﺘﺸﻐﻴل ﺍﻟﻤﻌﺎﻟﺞ
ﻭﺴﻴﻜﻭﻥ ﻫﻨﺎﻙ ﻤﺴﺠل ﺒﻨﻔﺱ ﺍﻻﺴﻡ.ﻭﺴﻴﺭﺘﺒﻁ ﻨﻅﺎﻡ ﺍﻟﺘﺸﻐﻴل ﻤﻊ ﻫﺫﺍ ﺍﻟﻤﻭﻗﻊ ﺍﻟﻤﺨﺯﻭﻥ ﺒﻪ ﺍﻻﻴﻌﺎﺯ ﺍﻻﻭل ﻟﻴﺘﻡ ﺘﻨﻔﻴﺫ ﺍﻟﺒﺭﻨﺎﻤﺞ
. Code ﻓﻴﺘﻡ ﺘﻌﺭﻴﻑ ﺍﻜﺜﺭ ﻤﻥ ﻤﻘﻁﻊ ﻟﻠـ64KB ﻭﺍﺫﺍ ﻜﺎﻥ ﺤﺠﻡ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺍﻜﺒﺭ ﻤﻥ.ﻴﺤﺘﻔﻅ ﺒﻌﻨﻭﺍﻥ ﺒﺩﺍﻴﺔ ﺍﻟﻤﻘﻁﻊ
2. Data Segment
The data segment contains a program's defined data, constants, and work areas. The data
segment (DS) register addresses the data segment. If your data area requires more than 64KB,
your program need to defines more than one data segment.
ﻭﻴﻌﻨﻭﻥ ﻤﺴﺠل ﺨﺎﺹ ﻟﻬﺫﺍ. ﻤﻨﺎﻁﻕ ﺍﻟﻌﻤل، ﺍﻟﺜﻭﺍﺒﺕ، ﻴﺤﺘﻭﻱ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻋﻠﻰ ﺍﻟﺒﻴﺎﻨﺎﺕ ﺍﻟﻤﻌﺭﻓﺔ ﻤﻥ ﻗﺒل ﺍﻟﺒﺭﻨﺎﻤﺞ
. ﻓﻴﺘﻡ ﺘﻭﻟﻴﺩ ﺍﻜﺜﺭ ﻤﻥ ﻤﻘﻁﻊ ﺒﻴﺎﻨﺎﺕ64KB ﻭﺍﺫﺍ ﻜﺎﻥ ﻤﻘﻁﻊ ﻴﺤﺘﺎﺝ ﺍﻜﺜﺭ ﻤﻥ. ﺍﻟﻐﺭﺽ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ
3. Stack segment
In simple terms, the stack contains any data and addresses that you need to save temporarily
during an execute a subroutines related to the main program. The stack segment register
addresses the stack segment.
( ﻴﺤﺘﻔﻅ ﺒﺸﻜل ﻤﺅﻗﺕ ﺒﺎﻱ ﺒﻴﺎﻨﺎﺕ ﺍﻭ ﻋﻨﻭﺍﻨﻴﻥ ﻴﺤﺘﺎﺠﻬﺎ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺍﻟﺭﺌﻴﺴﻲ ﺍﺜﻨﺎﺀ ﺘﻨﻔﻴﺫStack) ﺍﻥ ﺍﻟﻤﻜﺩﺱ،ﺒﻜﻠﻤﺎﺕ ﺒﺴﻴﻁﺔ
. Stack ﻭﻫﻨﺎﻙ ﻤﺴﺠل ﺨﺎﺹ ﻴﻌﻨﻭﻥ ﻤﻘﻁﻊ ﺍﻟـ.ﺒﺭﻨﺎﻤﺞ ﻓﺭﻋﻲ ﻤﺭﺘﺒﻁ ﺒﻪ
١٢
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
Segment Boundaries
The segment is begin with an address called paragraph boundary which mean an address begin
with digit 0 from the right side of 5 digits address .Therefore, it will be choose an location with
address starting with zero digit. Because of the length of any segment is 64KB, which equal to
65536 locations and when convert to hexa after subtract one of the number the result, is
FFFFH.
ﻭﺍﻟﺫﻱ ﻴﻌﻨﻲ ﺍﻥ ﺍﻟﻌﻨﻭﺍﻥ ﻴﺒﺩﺍ ﺒﺭﻗﻡ ﺼﻔﺭ ﻤﻥ ﺠﻬﺔ ﺍﻟﻴﻤﻴﻥ ﻟﻌﻨﻭﺍﻥ ﻤﻥparagraph boundary ﻴﺒﺩﺍ ﺍﻟﻤﻘﻁﻊ ﺒﻌﻨﻭﺍﻥ ﻴﺴﻤﻰ
ﻭﺍﻟﺫﻱ ﻴﺴﺎﻭﻱ64KB ﻭﺒﺴﺒﺏ ﺍﻥ ﺤﺠﻡ ﺍﻟﻤﻘﻁﻊ ﻫﻭ. ﻭﺒﺎﻟﺘﺎﻟﻲ ﻓﺎﻨﻪ ﺴﻴﺨﺘﺎﺭ ﻋﻨﻭﺍﻥ ﻤﻭﻗﻊ ﻴﺒﺩﺍﺀ ﺒﺎﻟﺭﻗﻡ ﺼﻔﺭ، ﺨﻤﺴﺔ ﺍﺭﻗﺎﻡ
.FFFFH ﻤﻭﻗﻊ ﻭﻋﻨﺩﻤﺎ ﺘﺤﻭل ﺍﻟﻰ ﺍﻟﻨﻅﺎﻡ ﺍﻟﺴﺎﺩﺱ ﻋﺸﺭﻱ ﻤﻁﺭﻭﺡ ﻤﻨﻬﺎ ﻭﺍﺤﺩ ﻓﺎﻥ ﺍﻟﻨﺎﺘﺞ ﻤﺴﺎﻭﻱ ﺍﻟﻰ٦٥٥٣٦
The segment begins with address 0000H to FFFFH as the offset inside the segment. Therefore,
we will use a set of register to locate the staring address of segment and can define as:
A segment register is 16 bits long and provides for addressing an area of memory known as the
current segment, to reduce the complexity of processor register it store 4 digits instead of 5
digits and insert 0 digit from right of the address of segment register.
ﻭﺒﺎﻟﺘﺎﻟﻲ ﺴﻴﺘﻡ ﺍﺴﺘﺨﺩﺍﻡ ﻤﺠﻤﻭﻋﺔ ﻤﻥ ﺍﻟﻤﺴﺠﻼﺕ. ﻭﻜﻤﺎﻓﺔ ﺍﺯﺍﺤﺔ ﺩﺍﺨل ﺍﻟﻤﻘﻁﻊFFFFH ﺍﻟﻰ0000H ﻴﺒﺩﺍ ﺍﻟﻤﻘﻁﻊ ﺒﺎﻟﻌﻨﻭﺍﻥ
ﻭﺍﻟﺘﻲ ﺘﺴﺘﺨﺩ ﻟﻌﻨﻭﻨﺔ ﻤﺴﺎﺤﺔ16bit ﺒﺎﻨﻪ ﻤﺴﺠل ﺒﻁﻭل:ﻭﺍﻟﺘﻲ ﺘﺤﺘﻔﻅ ﺒﻌﻨﻭﺍﻨﻴﻥ ﺍﻟﺒﺩﺍﻴﺔ ﻟﻠﻤﻘﺎﻁﻊ ﻭﻴﻤﻜﻥ ﺘﻌﺭﻴﻑ ﻤﺴﺠل ﺍﻟﻤﻘﻁﻊ
ﻭﻤﻥ ﺍﺠل ﺘﻘﻠﻴل ﺘﻌﻘﻴﺩ ﻤﺴﺠل ﺍﻟﻤﻌﺎﻟﺞ ﻓﺎﻨﻪ ﻴﺨﺯﻥ ﺍﺭﺒﻌﺔ ﺍﺭﻗﺎﻡ ﺒﺩﻻ ﻤﻥ ﺨﻤﺴﺔ ﻤﻊ ﺍﻀﺎﻓﺔ، ﻤﻥ ﺍﻟﺫﺍﻜﺭﺓ ﺘﺴﻤﻰ ﺍﻟﻤﻘﻁﻊ ﺍﻟﺤﺎﻟﻲ
1. Code Segment register (CS): contains the starting address of a program's code segment. For
normal programming purpose, you need not reference the CS register.
ﻭﻓﻲ ﺍﻟﺒﺭﻤﺠﺔ ﺍﻟﻌﺎﺩﻴﺔ ﻻﻴﺘﻡ ﺍﻻﺸﺎﺭﺓ ﺍﻟﻰ ﻫﺫﺍ. ﻤﺴﺠل ﻤﻘﻁﻊ ﺍﻟﺒﺭﻨﺎﻤﺞ ﻭﻫﻭ ﻴﺤﻭﻱ ﻋﻠﻰ ﻋﻨﻭﺍﻥ ﺍﻟﺒﺩﺍﻴﺔ ﻟﻤﻘﻁﻊ ﺍﻟﺒﺭﻨﺎﻤﺞ
.ﺍﻟﻤﺴﺠل
١٣
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
2. Data Segment register (DS): contains the starting address of a program data segment.
Instructions use this address to locate data.
ﻤﺴﺠل ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﻫﻭ ﻴﺤﻭﻱ ﻋﻠﻰ ﻋﻨﻭﺍﻥ ﺍﻟﺒﺩﺍﻴﺔ ﻟﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﺍﻻﻴﻌﺎﺯﺍﺕ ﺘﺴﺘﺨﺩﻡ ﻫﺫﺍ ﺍﻟﻌﻨﻭﺍﻥ ﻟﺘﺤﺩﻴﺩ ﻤﻭﻗﻊ
.ﺍﻟﺒﻴﺎﻨﺎﺕ
3. Stack Segment register (SS) Permits the implementation of a stack in memory, which a
program uses for temporary storage of address of a program's stack segment in the SS register.
For normal programming purpose, you need not directly reference the SS register.
ﻤﺴﺠل ﻤﻘﻁﻊ ﺍﻟﻤﻜﺩﺱ ﻭﺍﻟﺫﻱ ﻴﺴﻤﺢ ﺒﺎﺴﺘﺨﺩﺍﻡ ﺍﻟﻤﻜﺩﺱ ﻓﻲ ﺍﻟﺫﺍﻜﺭﺓ ﻭﺍﻟﺫﻱ ﻴﺴﺘﺨﺩﻡ ﻤﻥ ﻗﺒل ﺍﻟﺒﺭﻨﺎﻤﺞ ﻟﻠﺨﺯﻥ ﺍﻟﻤﺅﻗﺕ ﻭﻫﻭ
.ﻭﻓﻲ ﺍﻟﺒﺭﻤﺠﺔ ﺍﻟﻌﺎﺩﻴﺔ ﻻﻴﺘﻡ ﺍﻻﺸﺎﺭﺓ ﺍﻟﻰ ﻫﺫﺍ ﺍﻟﻤﺴﺠل.ﻴﺤﺘﻔﻅ ﺒﻌﻨﻭﺍﻥ ﺒﺩﺍﻴﺔ ﻤﻘﻁﻊ ﺍﻟﻤﻜﺩﺱ
4. Extra Segment register (ES): used by some string (character data) operations to handle
memory addressing. The ES (Extra segment) register is associated with DI (index register).
A program that requires the use of the ES may initialize with an appropriate segment address.
ES ﻭﺘﺭﺘﺒﻁ ﻤﺴﺠل.ﻤﺴﺠل ﺍﻟﻤﻘﻁﻊ ﺍﻻﻀﺎﻓﻲ ﻭﻫﻭ ﻴﺴﺘﺨﺩﻡ ﻤﻊ ﻋﻤﻠﻴﻼﺕ ﺍﻟﺴﻼﺴل ﺍﻟﺤﺭﻓﻴﺔ ﻋﻨﺩﻤﺎ ﺘﺴﺘﺨﺩﻡ ﻋﻨﻭﺍﻨﻴﻥ ﺍﻟﺫﺍﻜﺭﺓ
.ﻭﻫﻲ ﺘﻭﻟﺩ ﺍﻥ ﺍﺤﺘﺎﺝ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺍﻟﺘﻌﺎﻤل ﻤﻊ ﺍﻟﺴﻼﺴل ﺍﻟﺤﺭﻓﻴﺔ. DI ﻤﻊ ﻤﺴﺠل ﺍﻟﻔﻬﺭﺴﺔ
5. FS AND GS registers Additional extra segment registers on the 80386 and later processors.
Example: Find the configuration of segments generated by two programs , first Program A deal
with arithmetic operations and has 800KB in its programming section and 600KB in its data
sections and 900 KB in stack sections while second Program B has 1048 KB code and 660KB
data and 2066 KB as stack memory. And Find the total number of segments generated.
ﻓﻲ ﺠﺯﺀ800KB ﺠﺩ ﻜﻴﻑ ﻴﺘﻡ ﺘﻨﻅﻴﻡ ﺍﻟﻤﻘﺎﻁﻊ ﺍﻟﻤﻭﻟﺩﺓ ﻤﻥ ﺨﻼل ﺒﺭﻨﺎﻤﺠﻴﻥ ﺍﻻﻭل ﻴﺘﻌﺎﻤل ﻤﻊ ﻋﻤﻠﻴﺎﺕ ﺭﻴﺎﻀﻴﺔ ﻭﻴﻤﺘﻠﻙ
660KB ﻭCode ﻜـ1048 ﺒﻴﻨﻤﺎ ﻴﻤﺘﻠﻙ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺍﻟﺜﺎﻨﻲStack ﻟﺠﺯﺀ900KB ﻟﺠﺯﺀ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭ600KB ﺍﻟﺒﺭﻤﺠﺔ ﻭ
. ﻭﺠﺩ ﻋﺩﺩ ﺍﻟﻤﻘﺎﻁﻊ ﺍﻟﻜﻠﻴﺔ ﺍﻟﻤﺘﻭﻟﺩﺓ ﻤﻥ ﻗﺒل ﺍﻟﺒﺭﻨﺎﻤﺠﻴﻥ. Stackٍ ﻜـ2066KB ﻭData ﻜـ
١٤
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
Sol
The default size of any 64 KB and we have three types of segments
ﻭﻟﺩﻴﻨﺎ ﺜﻼﺜﺔ ﺍﻨﻭﺍﻉ64KB ﺍﻥ ﺍﻟﺤﺠﻡ ﺍﻻﺼﻠﻲ ﻟﻠﻤﻘﻁﻊ ﻫﻭ
، ﻭﺘﺤﺘﻭﻱ ﻫﺫﻩ ﺍﻟﻭﺤﺩﺓ ﻋﻠﻰ ﻭﺤﺩﺓ ﺍﻟﺤﺴﺎﺏ ﻭﺍﻟﻤﻨﻁﻕ ﻭﻭﺤﺩﺓ ﺍﻟﺴﻴﻁﺭﺓ ﻭﻋﺩﺩ ﻤﻥ ﺍﻟﻤﺴﺠﻼﺕ.ﻤﻥ ﺍﻟﺫﺍﻜﺭﺓ ﺍﻟﻰ ﻭﺤﺩﺓ ﺍﻟﺘﻨﻔﻴﺫ
The Three pointer registers are the IP, SP, and BP.
.IP,SP,BP ﻫﻨﺎﻙ ﺜﻼﺜﺔ ﺍﻨﻭﺍﻉ ﻤﻥ ﻤﺴﺠﻼﺕ ﺍﻟﺘﺎﺸﻴﺭ ﻭﻫﻲ
١٥
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
Instruction Pointer (IP) register
The 16-bit IP register contains the offset address of the next instruction that is to execute. The
IP is associated with CS register in that The IP indicates the current instruction within the
currently executing code segment. You do not normally reference the IP register in program,
but you can change its value when using the DEBUG program to test a program. The 80386
and later processors have an extended 32-bit IP called the EIP.
ﺤﻴﺙ ﻴﺘﻭﻟﺩCS ﻤﻊ ﻤﺴﺠلIP ﻭﺒﺎﺭﺘﺒﺎﻁ ﻤﺴﺠل، ﻋﻠﻰ ﻋﻨﻭﺍﻥ ﺍﻻﺯﺍﺤﺔ ﻟﻼﻴﻌﺎﺯ ﺍﻟﺘﺎﻟﻲ ﻓﻲ ﺍﻟﺘﻨﻔﻴﺫIP 16-bit ﻴﺤﺘﻭﻱ ﻤﺴﺠل
ﺒﺸﻜل ﺍﻋﺘﻴﺎﺩﻱ ﻤﻥ ﻗﺒلIP ﻭﻻﻴﻤﻜﻥ ﺍﻟﺘﺤﻜﻡ ﺒﻘﻴﻤﺔ ﻤﺴﺠل.ﻋﻨﻭﺍﻥ ﺍﻻﻴﻌﺎﺯ ﺍﻟﺤﺎﻟﻲ ﻀﻤﻥ ﻤﻘﻁﻊ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺍﻟﺫﻱ ﻴﻨﻔﺫ ﺤﺎﻟﻴﺎ
ﻭﺍﻟﺫﻱ ﻴﻘﻭﻡ ﺒﺘﺩﻗﻴﻕ ﺍﻟﺒﺭﻨﺎﻤﺞ ﻤﻥ ﺍﻻﺨﻁﺎﺀ ﺤﻴﺙDEBUG ﻭﻟﻜﻥ ﻴﻤﻜﻥ ﺘﻐﻴﻴﺭ ﻗﻴﻤﺘﻪ ﻓﻲ ﺤﺎﻟﺔ ﺍﺴﺘﺨﺩﺍﻡ ﺒﺭﻨﺎﻤﺞ،ﺍﻟﻤﺴﺘﺨﺩﻡ
ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ ﺍﻟﺘﻲ ﺒﻌﺩﻫﺎ ﺘﺤﺘﻭﻱ ﻋﻠﻰ80386 ﻭﻤﻌﺎﻟﺠﺎﺕ.IP ﻴﻤﻜﻨﻨﺎ ﻤﻥ ﺠﻌل ﺍﻟﺒﺭﻨﺎﻤﺞ ﻴﻨﻔﺫ ﺨﻁﻭﺓ ﺨﻁﻭﺓ ﻭﺍﻟﺘﺤﻜﻡ ﺒﺎﻟﻤﺴﺠل
١٦
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
ﺍﻥ ﺍﻟﻤﻌﺎﻟﺞ.stack ﻭﻫﻲ ﻤﺠﻤﻭﻋﺔ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﺍﻟﻌﻨﻭﺍﻨﻴﻥ ﻭﺍﻟﻤﺭﺭﺓ ﺍﻟﻰ، ﻴﺅﺸﺭ ﺍﻟﻤﻌﺎﻤﻼﺕ16 bit ﺫﻭBP ﻴﺴﺘﺨﺩﻡ ﻤﺴﺠل
ﻭﺍﻟﺘﻲ ﺒﻌﺩﻫﺎ ﺘﻤﺘﻠﻙ ﺍﻟﻨﻭﻉ ﺍﻟﻤﻭﺴﻊ80386 ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ.BP ﻤﻊ ﺍﻻﺯﺍﺤﺔ ﺍﻟﻤﻭﺠﻭﺩ ﻓﻲSS ﻴﺠﻤﻊ ﺒﻴﻥ ﺍﻟﻌﻨﻭﺍﻥ ﻓﻲ ﺍﻟﻤﺴﺠل
.EBP ﺒﺕ ﻭﺍﻟﻤﺴﻤﻰ32 ﻤﻥ ﻫﺫﺍ ﺍﻟﻤﺴﺠل ﺫﻭ
١٧
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
Therefore the value of DS=DA36
And the of the address in the instruction is in Octal and we must converted into Hexadecimal
4 2 3 7
100 010 011 111
8 9 F
Therefore, the value of address in the instruction is 089F
١٨
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
3.General – Purpose Registers
The AX, BX, CX and DX general – purpose registers are the workhorses of the system. They
are unique in that you can address them as one word or as a 1- byte portion. The leftmost byte is
the "high" portion and the rightmost byte is the "low" portion. For example, the AX register
consists of an AH (high) and an AL (low) portion, and you can reference any portion by its
name. The 80386 and later processors support all the general – purpose registers, plus 32-bit
extended versions of them: the EAX, EBX, ECX, and EDX.
ﻭﻫﻲ ﺍﻟﻤﺴﺠﻼﺕ. ﻤﺴﺠﻼﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻤﺔ ﻭﻤﻨﺎﻁﻕ ﺍﻟﻌﻤل ﻓﻲ ﺍﻟﻨﻅﺎﻡAX, BX, CX and DX ﺘﻌﺘﺒﺭ ﺍﻟﻤﺴﺠﻼﺕ
ﺍﻟﺘﻲ ﻴﻤﻜﻥ ﺍﻥ ﺘﻘﺴﻡ ﺍﻟﻰ ﺠﺯﺌﻴﻥ ﻜل ﻤﻨﻬﺎ ﺒﺤﺠﻡ ﺒﺎﻴﺕ ﻭﺍﺤﺩ ﻭﻴﺴﻤﻰ ﺍﻟﺠﺯﺀ8086 ﺍﻟﻭﺤﻴﺩﺓ ﻀﻤﻥ ﻤﺠﻤﻭﻋﺔ ﻤﺴﺠﻼﺕ ﻤﻌﺎﻟﺞ
ﻭﺠﺯﺀAH(high) ﻜﻤﺜﺎل ﻓﺎﻨﻪ ﻴﺘﻜﻭﻥ ﻤﻥAX ﻭﻟﻭ ﺍﺨﺫﻨﺎ ﻤﺴﺠل. low ﻭﺍﻟﺠﺯﺀ ﺍﻟﻰ ﺍﻟﻴﻤﻴﻥ ﺒﺎلhighﺍﻟﻰ ﺍﻟﻴﺴﺎﺭ ﺒﺎﻟـ
ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ ﺍﻟﺘﻲ ﺒﻌﺩﻫﺎ ﺘﺩﻋﻡ ﻜل ﺍﻨﻭﺍﻉ80386 ﻭﺍﻟﻤﻌﺎﻟﺞ. ﻭﻴﺘﻡ ﺍﻻﺸﺎﺭﺓ ﺍﻟﻰ ﺍﻱ ﺠﺯﺀ ﻤﻥ ﺨﻼل ﺍﺴﻤﻪAL(low) ﺍﺨﺭ ﻫﻭ
.EAX, EBX, ECX, and EDX ﺍﻟﻤﻭﺴﻌﺔ ﻤﻥ ﻫﺫﻩ ﺍﻟﻤﺴﺠﻼﺕ ﻭﻫﻲ32-bit ﻤﺴﺠﻼﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻡ ﺍﻀﺎﻓﺔ ﻨﺴﺦ
The following assembler instructions move zeros to the AX, BH, and ECX registers,
respectively:
ﻋﻠﻰ ﺍﻟﺘﻭﺍﻟﻲAX, BH, and ECX ﻭﺍﻴﻌﺎﺯﺍﺕ ﺍﻴﺴﻤﺒﻠﻲ ﺍﻟﺘﺎﻟﻴﺔ ﺘﻨﻘل ﺍﻟﺼﻔﺭ ﺍﻟﻰ ﻤﺴﺠﻼﺕ
MOV AX,00
MOV BH,00
MOV ECX,00
AX register
The AX register, the primary accumulator, is used for operations involving input / output and
most arithmetic. For example, the multiply, divide, and translate instructions assume the use of
the AX. Also, some instructions generate more efficient code if they reference the AX rather
than another register.
AX
AH AL
EAX
١٩
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
ﻴﻌﺘﺒﺭ ﺍﻟﻤﺴﺠل AXﻫﻭ ﺍﻟﻤﺭﻜﻡ ﺍﻻﺴﺎﺴﻲ ﻭﻫﻭ ﻴﺴﺘﺨﺩﻡ ﻟﻌﻤﻠﻴﺎﺕ ﺍﻻﺩﺨﺎل ﻭﺍﻻﺨﺭﺍﺝ ﻭﻤﻌﻅﻡ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ .ﻭﻜﻤﺜﺎل ﻋﻠﻰ
ﻫﺫﻩ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﻀﺭﺏ ،ﺍﻟﻘﺴﻤﺔ ،ﻭﺍﻴﻌﺎﺯﺍﺕ ﺍﻟﻨﻘل ﺘﻔﺘﺭﺽ ﺍﺴﺘﺨﺩﺍﻡ .AXﺒﻌﺽ ﺍﻻﻴﻌﺎﺯﺍﺕ ﺘﻭﻟﺩ codeﺍﻜﺜﺭ ﻜﻔﺎﺀﺓ ﺍﺫﺍ ﻜﺎﻥ
BX register
The BX is known as the base register since it is the only general – purpose register that can be
used as an index to extend addressing. Another common purpose of the BX is for computations.
BX
BH BL
EBX
ﻴﺴﻤﻰ ﻤﺴﺠل BXﺒﻤﺴﺠل ﺍﻟﻘﺎﻋﺩﺓ ﺤﻴﺙ ﺍﻨﻪ ﺍﻟﻤﺴﺠل ﺍﻟﻭﺤﻴﺩ ﺍﻟﺫﻱ ﻴﻤﻜﻥ ﺍﻥ ﻴﺴﺘﺨﺩﻡ ﻜﻤﺅﺸﺭ ﻀﻤﻥ ﺍﻟﻌﻨﻭﻨﺔ ﺍﻟﻤﻭﺴﻌﺔ.
CX register
The CX is known as the count register. It may contain a value to control the number of times a
loop is repeated or a value to shift bits left or right. The CX may also be used for many
computations.
CX
CH CL
ECX
ﻴﻌﺭﻑ ﺍﻟﻤﺴﺠل CXﺒﺎﻨﻪ ﻤﺴﺠل ﺍﻟﻌﺩﺍﺩ .ﻭﻫﻭ ﻗﺩ ﻴﺤﺘﻭﻱ ﻋﻠﻰ ﻗﻴﻤﺔ ﺘﺴﻴﻁﺭ ﻋﻠﻰ ﻋﺩﺩ ﻤﺭﺍﺕ ﺘﻜﺭﺍﺭ ﺘﻨﻔﻴﺫ ﺤﻠﻘﺔ ﺘﻜﺭﺍﺭﻴﺔ ﺍﻭ
ﻗﻴﻤﺔ ﺘﺯﺤﻴﻑ ﺒﺘﺘﺎﺕ ﺍﻟﻰ ﺍﻟﻴﻤﻴﻥ ﺍﻭ ﺍﻟﻴﺴﺎﺭ ،ﻭﻴﻤﻜﻥ ﺍﻥ ﻴﺴﺘﺨﺩﻡ ﻓﻲ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ.
٢٠
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
DX register
The DX is known as the data register. Some input / output operations require its use, and
multiply and divide operations that involve large values assume the use of the DX and AX
together as a pair.
DX
DH DL
EDX
ﻭﺘﺴﺘﺨﺩﻡ ﻓﻲ ﺒﻌﺽ ﻋﻤﻠﻴﺎﺕ ﺍﻻﺩﺨﺎل ﻭﺍﻻﺨﺭﺍﺝ ﻭﻜﺫﻟﻙ ﻓﻲ ﻋﻤﻠﻴﺎﺕ ﺍﻟﻀﺭﺏ، ﺒﺎﻨﻪ ﻤﺴﺠل ﺍﻟﺒﻴﺎﻨﺎﺕDX ﻴﻌﺭﻑ ﻤﺴﺠل
. ﻜﻤﺴﺠﻠﻴﻥ ﻤﺯﺩﻭﺠﻴﻥDX ﻭAX ﻭﺍﻟﻘﺴﻤﺔ ﻻﻋﺩﺍﺩ ﻜﺒﻴﺭﺓ ﺤﻴﺙ ﻴﺘﻡ ﺍﺴﺘﺨﺩﺍﻡ ﻜل ﻤﻥ ﺍﻟﻤﺴﺠﻠﻴﻥ
You may use any of these general – purpose registers for addition and subtraction of 8 - bit,
16 – bit, or 32 – bit values.
ﺒﺕ١٦ ﺒﺕ ﻭ٨ ﻭﻴﻤﻜﻥ ﺍﻥ ﻴﺴﺘﺨﺩﻡ ﺍﻱ ﻤﻥ ﻫﺫﻩ ﺍﻟﻤﺴﺠﻼﺕ ﺫﺍﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻡ ﻓﻲ ﻋﻤﻠﻴﺎﺕ ﺍﻟﺠﻤﻊ ﻭﺍﻟﻁﺭﺡ ﻭﺒﺎﺤﺠﺎﻡ ﺒﻴﺎﻨﺎﺕ
. ﺒﺕ٣٢ﻭ
4.Index Registers
The SI and DI registers are available for indexed addressing and for use in addition and
subtraction.
.ﺘﺴﺨﺩﻡ ﻤﺴﺠﻼﺕ ﺍﻟﻔﻬﺭﺴﺔ ﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﻌﻨﻭﻨﺔ ﺍﻟﻤﻔﻬﺭﺴﺔ ﻭﻜﺫﻟﻙ ﻓﻲ ﻋﻤﻠﻴﺎﺕ ﺍﻟﺠﻤﻊ ﻭﺍﻟﻁﺭﺡ
SI register
The 16 – bit source index register is required for some string (character) operations. In this
context, the SI is associated with the DS register, The 80386and later processors support a 32 –
bit extended register, the ESI.
ﻤﻊSI ﻭﻓﻲ ﻫﺫﻩ ﺍﻟﺤﺎﻟﺔ ﻴﺭﺘﺒﻁ ﻤﺴﺠل. ﺒﺕ ﻴﺴﺘﺨﺩﻡ ﻤﻊ ﺒﻌﺽ ﻋﻤﻠﻴﺎﺕ ﺍﻟﺴﻼﺴل ﺍﻟﺤﺭﻓﻴﺔ١٦ ﺍﻥ ﻤﺴﺠل ﻓﻬﺭﺴﺔ ﺍﻟﻤﺼﺩﺭ ﺫﻭ
.ESI ﺒﺕ ﻭﺒﺎﺴﻡ٣٢ ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ ﺍﻟﺘﻲ ﺒﻌﺩﻩ ﺘﺩﻋﻡ ﺍﻟﻨﻭﻉ ﺍﻟﻤﻭﺴﻊ ﻤﻥ ﻫﺫ ﺍﻟﻤﺴﺠل ﻭﺒﻁﻭل80386 ﻭﻤﻌﺎﻟﺞ، DS ﻤﺴﺠل
٢١
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
DI register
The 16 – bit destination index register is required for some string (character) operations. In this
context, the DI is associated with the ES register, The 80386and later processors support a 32 –
bit extended register, the EDI.
ﻤﻊDI ﻭﻓﻲ ﻫﺫﻩ ﺍﻟﺤﺎﻟﺔ ﻴﺭﺘﺒﻁ ﻤﺴﺠل. ﺒﺕ ﻴﺴﺘﺨﺩﻡ ﻤﻊ ﺒﻌﺽ ﻋﻤﻠﻴﺎﺕ ﺍﻟﺴﻼﺴل ﺍﻟﺤﺭﻓﻴﺔ١٦ ﺍﻥ ﻤﺴﺠل ﻓﻬﺭﺴﺔ ﺍﻟﻤﺴﺘﻘﺭﺫﻭ
.EDI ﺒﺕ ﻭﺒﺎﺴﻡ٣٢ ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ ﺍﻟﺘﻲ ﺒﻌﺩﻩ ﺘﺩﻋﻡ ﺍﻟﻨﻭﻉ ﺍﻟﻤﻭﺴﻊ ﻤﻥ ﻫﺫ ﺍﻟﻤﺴﺠل ﻭﺒﻁﻭل80386 ﻭﻤﻌﺎﻟﺞ، ES ﻤﺴﺠل
Flags Register
Nine of the bits of the flags register are common to all 8086 – family processors to indicate the
current status of the computer and the results of processing. Many instructions involving
comparisons and arithmetic change the status of the flags, which some instructions may test to
determine subsequent action.
ﻭﺍﻟﻜﺜﻴﺭ ﻤﻥ، ﻭﺍﻟﺘﻲ ﺘﺒﻴﻥ ﺍﻟﺤﺎﻟﺔ ﺍﻟﺤﺎﻟﻴﺔ ﻟﻠﻤﻌﺎﻟﺠﺔ8086 ﻫﻲ ﻤﺸﺘﺭﻜﺔ ﻟﻜل ﻋﺎﺌﻠﺔ ﻤﻌﺎﻟﺞflags ﺘﺴﻌﺔ ﻤﻥ ﺍﻟﺒﺘﺘﺎﺕ ﻟﻤﺴﺠل
ﻭﺍﻟﻨﻭﻉ ﺍﻻﺨﺭ ﻴﺩﻗﻕ ﻗﻴﻤﺘﻬﺎ ﻟﻴﺤﺩﺩ ﻋﻠﻰ ﺍﺴﺎﺱ ﺍﻟﺘﺩﻗﻴﻕ ﺍﺠﺭﺍﺀ ﻋﻤﻠﻴﺔflags ﺍﻻﻴﻌﺎﺯﺍﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ ﻭﺍﻴﻌﺎﺯﺍﺕ ﺍﻟﻤﻘﺎﺭﻨﺔ ﺘﻐﻴﺭ ﺤﺎﻟﺔ
.ﻤﻌﻴﻨﺔ
.flag ﻴﺩﻗﻘﺎﻥ ﻫﺫﺍJO and JNO ﻭﺍﻻﻴﻌﺎﺯﻴﻥ. ﺤﺎﻟﺔ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ ﺒﺎﺭﻗﺎﻡ ﻤﻊ ﺍﺸﺎﺭﺍﺕ
2. DF(direction). Determine left or right direction for moving or comparing string (character)
data. When the flag is 0, the string operation performs left – to – right data transfer, when the
flag is 1, the string operation performs right – to – left data transfer.
٢٢
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
ﻴﺤﺩﺩ ﺍﺘﺠﺎﻩ ﺍﻟﻴﻤﻴﻥ ﺍﻭﺍﻟﻴﺴﺎﺭ ﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﻨﻘل ﺍﻭﺍﻟﻤﻘﺎﺭﻨﺔ ﻟﺒﻴﺎﻨﺎﺕ ﺴﻼﺴل ﺤﺭﻓﻴﺔ .ﻋﻨﺩﻤﺎ ﻴﻜﻭﻥ ﻗﻴﻤﺔ flagﻫﻭ ﺼﻔﺭ ،ﻓﺎﻥ ﻋﻤﻠﻴﺔ
ﺍﻟﺴﻠﺴﻠﺔ ﺍﻟﺤﺭﻓﻴﺔ ﺴﻭﻑ ﺘﻨﻘل ﺍﻟﺒﻴﺎﻨﺎﺕ ﻤﻥ ﺍﻟﻴﺴﺎﺭ ﺍﻟﻰ ﺍﻟﻴﻤﻴﻥ ،ﻋﻨﺩﻤﺎ ﻴﻜﻭﻥ ﻗﻴﻤﺔ flagﻫﻭ ﻭﺍﺤﺩ ،ﻓﺎﻥ ﻋﻤﻠﻴﺔ ﺍﻟﺴﻠﺴﻠﺔ ﺍﻟﺤﺭﻓﻴﺔ
3. IF(interrupt). Indicates that all external interrupts, such as keyboard entry, are to be
processed or ignored. Which mean all interrupts are disables when 0, and enables when 1.
ﻴﺒﻴﻥ ﺍﻥ ﻜﺎﻨﺕ ﻜل ﻋﻤﻠﻴﺎﺕ ﺍﻟﻤﻘﺎﻁﻌﺔ ﺍﻟﺨﺎﺭﺠﻴﺔ ﻤﺜل ﺍﺩﺨﺎل ﻤﻥ ﻗﺒل ﻟﻭﺤﺔ ﺍﻟﻤﻔﺎﺘﻴﺢ ﺴﻭﻑ ﻴﺘﻡ ﺍﻟﺘﻌﺎﻤل ﻤﻌﻬﺎ ﺍﻭ ﺍﻫﻤﺎﻟﻬﺎ ،ﻭﻫﺫﺍ
ﻴﻌﻨﻲ ﻓﺎﻥ ﻜل ﺍﻟﻤﻘﺎﻁﻌﺎﺕ ﺴﻭﻑ ﻴﺘﻡ ﺍﻫﻤﺎﻟﻬﺎ ﻋﻨﺩﻤﺎ ﺘﻜﻭﻥ ﻗﻴﻤﺔ ﻫﺫﺍ flagﺘﺴﺎﻭﻱ ﺼﻔﺭ .ﻭﻋﻨﺩﻤﺎ ﺘﻜﻭﻥ ﻗﻴﻤﺔ flagﺘﺴﺎﻭﻱ
4. TF(trap). Permits operation of the processor in single – step mode. Debugger programs such
as DEBUG set the trap flag so that you can step through execution a single instruction at a time
to examine the effect on registers and memory.
ﺘﺴﻤﺢ ﺒﺘﺤﻭﻴل ﻋﻤل ﺍﻟﻤﻌﺎﻟﺞ ﺍﻟﻰ ﺤﺎﻟﺔ ﺍﻟﺨﻁﻭﺓ ﺍﻟﺨﻁﻭﺓ .ﻭﺒﺭﺍﻤﺞ ﺍﻟﺘﺼﺤﻴﺢ ﻤﺜل ﺒﺭﻨﺎﻤﺞ DEBUGﻴﺤﻭل ﻗﻴﻤﺔ ﻫﺫﺍ flag
ﺍﻟﻰ ﻭﺍﺤﺩ ﺤﻴﺙ ﻴﺴﻤﺢ ﺒﺘﺤﻭﻴل ﺘﻨﻔﻴﺫ ﺍﻟﺒﺭﻨﺎﻤﺞ ﻤﻥ ﺘﻨﻔﻴﺫ ﺒﺭﻨﺎﻤﺞ ﻤﺘﻜﺎﻤل ﺍﻟﻰ ﺘﻨﻔﻴﺫ ﺍﻴﻌﺎﺯ ﻭﺍﺤﺩ ﻓﻲ ﻜل ﻤﺭﺓ ﻭﺫﻟﻙ ﻟﻔﺤﺹ ﺘﺎﺜﻴﺭ
= 5. SF(sign). Contains the resulting sign of an arithmetic operation (0 = positive and 1
negative) or ( the first bit from left from unsigned number). JG(Jump if Greater) and JL (Jump
if Less) test this flag.
ﻴﺤﺘﻭﻱ ﻫﺫﺍ flagﻋﻠﻰ ﻗﻴﻤﺔ ﺍﻻﺸﺎﺭﺓ ﻟﻨﺎﺘﺞ ﻋﻤﻠﻴﺔ ﺭﻴﺎﻀﻴﺔ ﺤﻴﺙ ﻴﻤﺜل) ﺼﻔﺭ ﺍﻻﺸﺎﺭﺓ ﺍﻟﻤﻭﺠﺒﺔ ﻭﺍﻟﻭﺍﺤﺩ ﺘﻤﺜل ﺍﻻﺸﺎﺭﺓ ﺍﻟﺴﺎﻟﺒﺔ(
ﺍﻭ ﺍﻭل ﺒﺕ ﻤﻥ ﺠﻬﺔ ﺍﻟﻴﺴﺎﺭ ﻓﻲ ﺤﺎﻟﺔ ﻜﻭﻨﻬﺎ ﻋﻤﻠﻴﺔ ﺭﻴﺎﻀﻴﺔ ﻭﻟﻜﻥ ﻻﺭﻗﺎﻡ ﺒﺩﻭﻥ ﺍﺸﺎﺭﺍﺕ .ﻭﺘﺴﺘﺨﺩﻡ ﺍﻻﻴﻌﺎﺯﻴﻥ JGﺍﻗﻔﺯ ﺍﺫﺍ
= 6. ZF (zero). Indicates the result of an arithmetic or comparison operation (0 = nonzero and 1
zero result ). JE ( Jump if Equal) and JZ( Jump if Zero) test this flag.
٢٣
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
ﻫﻭ ﺼﻔﺭ ﻋﻨﺩﻤﺎflag ﻭﺘﺼﺒﺢ ﻗﻴﻤﺔ. ﻫﻭ ﻭﺍﺤﺩflag ﻴﺒﻴﻥ ﺍﻥ ﻜﺎﻥ ﺍﻟﻨﺎﺘﺞ ﻟﻌﻤﻠﻴﺔ ﺭﻴﺎﻀﻴﺔ ﺍﻭ ﻤﻘﺎﺭﻨﺔ ﻫﻭ ﺼﻔﺭ ﻓﺘﺼﺒﺢ ﻗﻴﻤﺔ
ﺍﻗﻔﺯ ﺍﺫﺍ ﻜﺎﻥ ﻫﻨﺎﻙ ﺼﻔﺭ ﺘﺩﻗﻕJZ ﺍﻗﻔﺯ ﺍﺫﺍ ﻜﺎﻥ ﻫﻨﺎﻙ ﺘﺴﺎﻭﻱ ﻭJE ﻭﺍﻻﻴﻌﺎﺯﻴﻥ، ﻴﻜﻭﻥ ﻗﻴﻤﺔ ﺍﻟﻨﺎﺘﺞ ﺍﻱ ﻋﺩﺩ ﻏﻴﺭ ﺍﻟﺼﻔﺭ
.flag ﻫﺫﺍ
7. AF( auxiliary carry). Contains a carry out of bit 3 on 8 – bit data, for specialized arithmetic.
It concerned with arithmetic on ASCII and BCD packed fields.
ﺒﺘﺎﺕ٨ ﺨﻼل ﻋﻤﻠﻴﺔ ﺭﻴﺎﻀﻴﺔ ﻟﺒﻴﺎﻨﺎﺕ ﺒﻁﻭلbit 3 ﻤﻥ ﺍﻭل ﺍﺭﺒﻊ ﺒﺘﺎﺕ ﻤﻥcarry ﺍﻟﺫﻱ ﻴﻭﻟﺩ ﻋﻨﺩﻤﺎ ﻴﻌﺒﺭcarry ﺘﺎﺨﺫ ﻗﻴﻤﺔ
.BCD ﻭASCII ﻭﻀﻤﻥ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ ﺍﻟﺨﺎﺼﺔ ﻭﻫﻲ ﻤﺨﺘﺼﺔ ﺒﺎﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺘﻲ ﺘﺠﺭﻯ ﻋﻠﻰ
8. PF (parity).Indicates even or odd parity of a low – order ( rightmost) 8 – bit data operation.
JPO( Jump if parity Odd) and JPE(Jump if parity Even) test this flag.
ﺍﻗﻔﺯ ﺍﺫﺍ ﻜﺎﻥJPO ﻭﺍﻻﻴﻌﺎﺯﻴﻥ. ﺒﺘﺎﺕ ﻭﻓﻘﻁ ﻟﻠﺠﻬﺔ ﺍﻟﻴﻤﻨﻰ٨ ﻟﻌﻤﻠﻴﺎﺕ ﺭﻴﺎﻀﻴﺔ ﻤﻥeven or odd parity ﻴﺒﻴﻥ ﺤﺎﻟﺔ
9. CF (carry). Contains carries from a high – order (leftmost) bit following an arithmetic
operation; also, contains the contents of the last bit of a shift or rotate operation. JC and JNC
test this flag.
ﻫﻲ ﺤﺎﻟﺔ ﺍﻟﺒﺕ ﺍﻻﻀﺎﻓﻲ ﺒﻌﺩ ﺍﺨﺭ ﺒﺕ ﻤﻥ ﺠﻬﺔ ﺍﻟﻴﺴﺎﺭ ﺍﻭ ﺍﻟﺒﺕ ﺍﻟﻨـﺎﺘﺞ ﻤﻥ ﻋﻤﻠﻴﺔ ﺘﺯﺤـﻴـﻑ ﺍﻭ ﺩﻭﺭﺍﻥ ﻭﺍﻻﻴﻌــﺎﺯﻴﻥ
The flags are in the flags register in the following locations ( which you need memorize):
Flag O D I T S Z A P C
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit no.
The flags most relevant to assembly programming are OF, SF, ZF, CF for comparison and
arithmetic operations, and DF for the direction of string operations. The 80286 and later
processors have some flags used for internal purposes, concerned primarily with protected
٢٤
ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ
mode. The 80386 and later processors have a 32 – bit extended flags register known as
Eflags.
ﻭ، ﻭﺍﻟﺘﻲ ﺘﺴﺘﺨﺩﻡ ﻓﻲ ﺍﻟﻌﻤﻠﻴﺎﺕ ﺍﻟﺭﻴﺎﻀﻴﺔ ﻭﻋﻤﻠﻴﺎﺕ ﺍﻟﻤﻘﺎﺭﻨﺔOF, SF, ZF, CF ﺍﻟﻤﺴﺘﺨﺩﻤﺔ ﻫﻲflags ﺍﻥ ﺍﻻﻜﺜﺭ
ﻓﻤﺎ80286 ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ، ﻴﺴﺘﺨﺩﻡ ﻟﺘﺤﺩﻴﺩ ﺍﻻﺘﺠﺎﻫﺎﺕ ﻓﻲ ﻋﻤﻠﻴﺎﺕ ﺍﻟﺘﻌﺎﻤل ﻤﻊ ﺍﻟﺴﻼﺴل ﺍﻟﺤﺭﻓﻴﺔDF flag ﻜﺫﻟﻙ ﻓﺎﻥ
80386 ﻭﺍﻟﻤﻌﺎﻟﺠﺎﺕ، protected ﻭﺨﺎﺼﺔ ﻋﻨﺩﻤﺎ ﺘﻌﻤل ﻓﻲ ﺤﺎﻟﺔ، ﺘﺴﺘﺨﺩﻡ ﻓﻲ ﺍﻏﺭﺍﺽ ﺩﺍﺨﻠﻴﺔflags ﺒﻌﺩﻫﺎ ﺘﻤﺘﻠﻙ
2. a program deal with four subroutine one of them is Arabic program for bank customer.
SOL:
1. 1
4E 0100 1110
8A 1000 1010 +
1101 1000
DF , IF , TF not effected
ZF=0
SF=1
CF=0
AC=1
PF=1
2. ZF,SF,CF,AC,PF not effected
DF=1
IF=1
TF=0
٢٥