Chapter 2 The Microprocessor and Its Architecture Summary
Chapter 2 The Microprocessor and Its Architecture Summary
▪ Program Segments
▪ Code Segment Code Segment
▪ Data Segment
▪ Little Endian Convention
▪ Stack Segment
▪ Flag Register
▪ 80286 and above contain program-invisible registers to control and operate protected memory and other features of the microprocessor
▪ 80386 through Core2 microprocessors contain full 32-bit internal architectures.
▪ 8086 through the 80286 are fully upward-compatible to the 80386 through Core2.
The programming model 8086 through Core2 microprocessor including the 64-bit extensions.
RCX
▪ RCX, ECX, CX, CH, or CL.
▪ a (Count) general-purpose register that also holds the count for various
▪ Flags never change for any data transfer or program control
instructions
operation.
▪ Some of the flags are also used to control features found in the
RDX microprocessor.
▪ RDX, EDX, DX, DH, or DL.
▪ a (Data) general-purpose register holds a part of the result from a
multiplication or part of dividend before a division.
Segment Registers
Generate memory addresses when combined with other registers in the
RBP microprocessor.
▪ RBP, EBP, or BP.
▪ points to a memory (Base Pointer) location for memory data transfers
1. CS (Code Segment) holds code (programs and procedures)
used by the microprocessor.
HL AL
8086 CPU
BIU EU
(Bus Interface Unit) (Execution Unit)
The 8086 CPU logic has been partitioned into two functional units:
▪ Bus Interface Unit (BIU)
▪ Execution Unit (EU)
The major reason for this separation is to increase the processing speed of the processor.
السبب الرئيسي لهذا التقسيم هو زيادة سرعة المعالج
EU و تأخذ منها تعليمات األسمبلي و البينات و ترسلها الي الI/O مع ال الذاكرة و مع الBIU تتعامل ال BIU بتنفيذ التعليمات المرسلة لها من الEU تقوم ال
❖ Fetch:
registers نقل تعليمة األسمبلي من الذاكرة الي المعالج واخزنها في واحدة من ال
❖ Decode
الخ.فهم نوع ال تعليمة األسمبلي هل هي جمع ام طرح
❖ execute
registers تنفيذ تعليمة األسمبلي وكتابة الناتج في واحد من ال
There are two ways to make the CPU process information faster:
:هناك طريقتين لتحسين أداء المعالج
Pipelining allows the CPU to fetch and execute at the same time.
تجعل المعالج يستطيع تجهيز لتعليمات و تنفيذها في نفس الوقتPipelining إضافة فكرة ال
Pipelining in the 8088/86 by splitting the internal structure of the microprocessor into two sections:
: عن طريق تقسيم الهيكل الداخلي للمعالج الدقيق إلى قسمين8088/86 في معالجPipelining يمكن اضافة ال
8086 CPU
BIU EU
CX addressable as CH, or CL FLAGS indicate the condition of the microprocessor and control its
▪ a (count) general-purpose register that also holds the count for various
instructions Segment Registers
DX CS (Code Segment) holds code (programs and procedures) used by the
addressable as DH, or DL. microprocessor.
▪ a (data) general-purpose register holds a part of the result from a
multiplication or part of dividend before a division
DS (Data Segment) contains most data used by a program.
BP Base Pointer ▪ Data are accessed by a content of other registers that hold.
▪ points to a memory (base pointer) location for memory data transfers
SS (Stack Segment) defines the area of memory used for the stack.
▪ stack entry point is determined by the stack segment and stack pointer
DI Destination Index registers.
▪ often addresses (destination index) string destination data for the string ▪ The BP register also addresses data within the stack segment.
instructions.
ES (Extra Segment) an additional data segment used by some
instructions to hold destination data.
SI Source Index
▪ The (source index) register addresses source string data for the string
instructions.
CX addressable as CH, or CL
▪ a (count) general-purpose register that also holds the count for various
instructions
DX
addressable as DH, or DL.
▪ a (data) general-purpose register holds a part of the result from a
multiplication or part of dividend before a division
SP stack pointer CS (Code Segment) holds code (programs and procedures) used by the
▪ addresses an area of memory called the stack. microprocessor.
▪ the (stack pointer) stores data through this pointer.
DS (Data Segment) contains most data used by a program.
BP Base Pointer ▪ Data are accessed by a content of other registers that hold.
▪ points to a memory (base pointer) location for memory data transfers
SS (Stack Segment) defines the area of memory used for the stack.
DI Destination Index ▪ stack entry point is determined by the stack segment and stack pointer
▪ often addresses (destination index) string destination data for the string registers.
instructions. ▪ The BP register also addresses data within the stack segment.
BX register (base index) sometimes holds offset address of a location in the memory system
BX, addressable as BH, BL.
General-Purpose (Data) Registers in all versions of the microprocessor.
.
a (count) general-purpose register that also holds the count for various instructions
CX, addressable as CH, or CL
a (data) general-purpose register holds a part of the result from a multiplication or part of
DX, addressable as DH, or DL.
dividend before a division.
often addresses (destination index) string destination data for the string instructions.
Index Registers DI Destination Index.
The (source index) register addresses source string data for the string instructions.
SI Source Index
Assembly
Instuctions
القاعدة Examples
Data can be moved among all the register as long as the source MOV AL, DX ; Error
and destination registers match in size. MOV BX, AH ; Error
Rule 1 الي اخر طالما متساوين في الحجمregister ينفع انقل بينات من أي
Data cannot be moved directly into segment registers. MOV DS, 2459H ; Error
segment register مينفعش أنقل قيمة ثابته في أي واحد من ال
MOV AX, 2345H ; load 2345H into AX
Rule 2 (To load a value into a segment register, first load it to a non- MOV DS, AX ; load the value of AX into DS
segment register and then move it to the segment register.)
و بعدين انقله للsegment غيرregister ممكن انقل القيمة الثابتة في أي:(الحل
) segment
Rule 3 If a value less than FFH is moved into a 16-bit register, the rest of MOV BX, 5 ; the result will be BX = 0005H;
the bits are assumed to be all zeros. MOV BL, 5 ; the result will be BL = 05H;
Moving a value that is too large into a register will cause an MOV BL, 7F2H ; ILLEGAL: 7F2H is larger than 8 bits
error. MOV AX, 2FE456H ; ILLEGAL: the value is larger than AX
Rule 4 اللي هخزن فيهRegister مينفعش أنقل بيانات حجمها اكبر من ال
▪ CS (Code Segment)
holds code (programs and procedures) used by the microprocessor.
▪ DS (Data Segment)
contains most data used by a program.
▪ SS (Stack Segment)
defines the area of memory used for the stack.
▪ ES (Extra Segment)
an additional data segment used by some instructions to hold destination data.
address
▪ To execute a program, the 8086 fetches the instructions from the code segment.
▪ The logical address of an instruction always consists of a CS (code segment) and an IP (instruction pointer), shown in 𝐂𝐒: 𝐈𝐏
format.
▪ The physical address for the location of the instruction is generated by shifting the CS left one hex digit and then adding it to
the IP.
In 8086 microprocessors, the area of memory set aside for data is called the data segment.
Code segment is associated with CS and IP, the data segment uses register DS and an offset value.
Assume that the offset for the data segment begins at 200H. The data is placed in memory locations:
𝐃𝐒: 𝟎𝟐𝟎𝟎 = 𝟐𝟓
𝐃𝐒: 𝟎𝟐𝟎𝟏 = 𝟏𝟐
𝐃𝐒: 𝟎𝟐𝟎𝟐 = 𝟏𝟓
𝐃𝐒: 𝟎𝟐𝟎𝟑 = 𝟏𝐅
𝐃𝐒: 𝟎𝟐𝟎𝟒 = 𝟐𝐁
If the data had to be stored at a different offset address, say 450H, the program would have to be rewritten.
One way to solve this problem would be to use a register to hold the offset address.
The 8086/88 allows only the use of registers BX, SI, and DI as offset registers for the data segment.
In cases like this, the low byte goes to the low memory location and the high byte goes to the high memory address.
In example above, memory location DS:1500 contains F3H and memory location DS:1501 contains 35H.
DS: 1500 = F3
DS: 1501 = 35
In the big-endian method, the high byte goes to the low address.
In the little-endian method, the high byte goes to the high address and the low byte to the low address.
All Intel microprocessors and many mini-computers use the little-endian convention
For every byte of data saved on the stack, SP is decremented once, and since push is With every pop, the top 2 by1es of the stack are copied to the register specified by the
saving the contents of a 16-bit register, it is decremented twice. instruction and the stack pointer is incremented twice.
d8 (carry) d7 (sign) d6 d5 d4 d3 d2 d1 d0