8086 microprocessor
TRANSCRIPT
BISMILLAHIR RAHMANIR RAHIM
AS SALAMU ALAYKUM
8086-MICROPROCESSOR
MD. GALIB HOSSAINID-1436CSE00365
P-5
Microprocessor P-7
Types of Registers in 8086 P-9
General Purpose Registers P-16
Segment Registers P-18
Special Purpose Registers P-19
Flag Registers
• sort out the details
8086
MICROPROCESSOR
• It is an integrated circuit, which contains all the functions of the Central Processing Unit (CPU).
• It is not capable for handling the Boolean function.
• It contains only CPU, RAM, ROM, I/O, timer are separately interfaced.
• Examples:-
INTEL 8086, INTEL Pentium series
INTERNAL ARCHITECTURE OF 8086
TYPES OF REGISTERS IN 8086
General Purpose Register
s
Segment Register
s
Special Purpose Register
s
Flag Register
s
GENERAL PURPOSE REGISTERS•AX The Accumulator Register: (Divided into AH / AL)• It consist of 8-bit registers AL and AH, when they combine they used as 16-bit register.•Generates shortest machine code•Arithmetic, logic and data transfer•One number must be AL or AX•Multiplication and Division• Input and Output
GENERAL PURPOSE REGISTERS
•BX - the base address register (divided into BH / BL).
CX - the count register (divided into CH / CL):
1. Iterative code segments using the LOOP instruction2. Repetitive operations on strings with the REP command3. Count (in CL) of bits to shift and rotate
DX - the data register (divided into DH / DL):
1. DX:AX concatenated into 32-bit register for some MUL and DIV operations2. Specifying ports in some IN and OUT operations
GENERAL PURPOSE REGISTERS
GENERAL PURPOSE REGISTERS
SI - source index register:1. Can be used for pointer addressing of data
2. Used as source in some string processing instructions
3. Offset address relative to DS
GENERAL PURPOSE REGISTERS
DI - destination index register:1. Can be used for pointer addressing of data
2. Used as destination in some string processing instructions
3. Offset address relative to ES
GENERAL PURPOSE REGISTERS
BP - base pointer:1. Primarily used to access parameters passed via the stack
2. Offset address relative to SS
GENERAL PURPOSE REGISTERS
SP - stack pointer:1. Always points to top item on the stack2. Offset address relative to SS3. Always points to word (byte at even address)
4. An empty stack will had SP = FFFEh
THERE ARE FOUR TYPES OF SEGMENT REGISTERS:
•Code Segment
CS•Data SegmentDS•Extra Segment
ES•Stack Segment
SS
SEGMENT REGISTERS
•CS - points at the segment containing the current program.•DS - generally points at segment where variables are defined.• ES - extra segment register, it's up to a coder to define its usage.•SS - points at the segment containing the stack.
SPECIAL PURPOSE REGISTERS
• IP - the instruction pointer:1. Always points to next instruction to be executed2. Offset address relative to CS
• IP register always works together with CS segment register and it points to currently executing instruction
FLAG REGISTERS
•Flags Register is modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program
FLAG REGISTERS
•Carry Flag (CF):-•An addition causes this flag to be set to 1, if there is carry out of the MSB, and subtraction causes this to be set to 1 if borrow is needed.
FLAG REGISTERS
•Parity Flag (PF):-•This is set to 1 if the low-order 8 bits of the result of the previous operation contain an even number of 1s. Otherwise it is reset to 0.
FLAG REGISTERS
•Auxiliary Flag (AF):-•This flag is used executively for BCD arithmetic. It is set to 1 if there is a carry out of bit 3 during an addition and borrows by bit 3during a subtraction.
FLAG REGISTERS
•Zero Flag (ZF):-•This is set to 1 if the result of the previous operation is zero and 0 if the result of the previous operation is non-zero.
FLAG REGISTERS
•Sign Flag (SF):- •This is set to 1 when result is negative. When result is positive it is set to 0. Actually this flag take the value of the most significant bit. •Trap Flag (TF):-• It is used for on chip debugging.
FLAG REGISTERS
•Interrupt Enable Flag (IF):-•When this flag is set to 1 CPU reacts to interrupts from external devices.
FLAG REGISTERS
•Direction Flag (DF) :- •This flag is used by some instructions to process data chains, when this flag is set to 0. The processing is done forward, when this flag is set to 1 the processing is done backward.
FLAG REGISTERS
• Overflow Flag (OF):-• This is set to 1 when there is a signed overflow.• This indicates that the result is too large to fit in 8-bit
destination operand.• The sum of two positive signed operands exceeds 127• The difference of two negative operands is less than -128• Example:• When you add bytes 100 + 50 (result is not in range -
128...127).
FLAG REGISTER EXAMPLES
1101 0111 1011 1001+ 1101 0111 0111 1010
1010 1111 0011 0011• In the above example: • SF (Sign Flag) = 1• ZF (Zero Flag) = 0• PF (Parity Flag) =1• CF (Carry Flag) =1• AF (Auxiliary Flag) = 1• OF (Overflow Flag) =1
FLAG REGISTER EXAMPLES
0101 0110 0111 1110 - 0100 1110 1110 1010
0000 0111 1001 0100• In the above example:• SF (Sign Flag) = 0• ZF (Zero Flag) = 0• PF (Parity Flag) =0• CF (Carry Flag) =0• AF (Auxiliary Flag) = 0• OF (Overflow Flag) =0
THANK YOU
Allah hafiz