Lecture# 4 The Microprocessor and It's Architecture: Course Instructor: Engr. Linta Khalil
Lecture# 4 The Microprocessor and It's Architecture: Course Instructor: Engr. Linta Khalil
Flag register of
8086
Microprocessor
• We can divide the flag bits into two sections.
The Status Flags, and the Control Flags.
1- Status Flags
• There are 6 flag registers in 8086
microprocessor which become set(1) or
reset(0) depending upon condition after either
Continue….. 8-bit or 16-bit operation.
• These flags are conditional/status flags.
• 5 of these flags are same as in case of 8085
microprocessor and their working is also same
as in 8085 microprocessor.
• S (sign)
After any operation if the MSB is 1, then it
indicates that the number is negative. And
this flag is set to 1
• Z(Zero)
Continue….. If the total register is zero, then only the Z flag
is set
• AC(auxiliary carry)
When some arithmetic operations generates
carry after the lower half and sends it to
upper half, the AC will be 1
• P (Parity)
This is even parity flag. When result has even
number of 1, it will be set to 1, otherwise 0 for
odd number of 1s
• C(Carry)
Holds the carry after addition or borrow after
subtraction and also indicates error
Continue…. conditions.
O (overflow)
The overflow flag is set to 1 when the result of a
signed operation is too large to fit.
• In 8086 there are 3 different flags which are
used to enable or disable some basic
operations of the microprocessor. These flags
and their functions are listed below.
• D (direction)
This is directional flag. This is used in string
2- Control Flag related operations.
D = 1, then the string will be accessed from
higher memory address to lower memory
address, and if D = 0, it will do the reverse.
• I(Interrupt Flag)
This is interrupt flag. If I = 1, then MPU will
recognize the interrupts from peripherals. For
I = 0, the interrupts will be ignored
• T(Trap Flag)
The trap flag enables trapping through
Continue…. an on-chip debugging feature.
❑ If T=1, cause interupt after the
execution of each instruction used for
debugging.
❑ If T=0, the trapping (debugging) feature
is disabled.
Segment Registers
• The segment registers stores the starting addresses of
a segment. To get the exact location of data or instruction
within a segment, an offset value (or displacement) is
required.
• Four segment registers in various versions of the
microprocessor.(The 8086–80286 microprocessors allow
four memory segments and the 80386– Core2
microprocessors allow six memory segments.
• A segment register functions differently in real mode
than in protected mode.
• Code Segment (CS) Register:
The user cannot modify the content of these
registers. Only the microprocessor's compiler
can do this.
CS is used for addressing memory location in the
code segment of the memory, where the
Continue….. executable program is stored.
• Data Segment (DS) Register:
The user can modify the content of the data
segment. DS points to the data segment of the
memory where the data is stored.
• Stack Segment (SS) Registers:
The SS is used to store the information about
the memory segment. The operations of the
SS are mainly Push and Pop.
• Extra Segment (ES) Register:
By default, the control of the compiler
Continue….. remains in the DS where the user can add and
modify the instructions. If there is less space in
that segment, then ES is used. ES is also used
for copying purpose.
• This mode allows the microprocessor to
Real Mode address only the first 1M byte of memory
space.
Memory • Is called conventional memory, or DOS
memory system
• An application program
containing a code, data, and
stack segment loaded into a DOS
system memory.
Segment and • A relocatable program is one that can be
Offset placed into any area of memory and executed
without change.
Addressing • Relocatable data are data that can be placed
in any area of memory and used without any
Scheme Allows change to the program.
Relocation