Chapter 2
Chapter 2
Chapter 2
Aziza Umer
I The execution unit of 8086 tells the CPU from where to fetch
instructions or data, decodes instructions and executes
instructions.
I It contains Control Circuitry, Instruction Decoder, ALU,
and Register Organization(General purpose registers,
Flag registers, Pointers and Index registers).
I The control circuitry in the EU directs and control the internal
operations.
I The decoder translates the instructions fetched from memory
into a series of actions which the EU performs.
Register Organization
Operand/Temporary Register
I This register can not be used by the programmer. It is used
by the microprocessor to store any intermediate data or result.
ALU
I The different arithmetic operations performed in ALU are
addition, subtraction, multiplication, and division of binary
numbers, BCD numbers and ASCII code numbers.
I The logical operations performed are ANDing, ORing, and
EX-Oring, inverting, rotating data and shifting data.
Register Organization
Segment Register
I Six out of nine flags are used as status flags. Depending upon
the status of the result obtained in ALU, microprocessor will
store corresponding status bit 0/1 in this status..
Register Organization
Flag Registers
I Carry flag (CF): when there is carry out or borrow into of
MSB CF=1, otherwise CF=0.
I Auxiliary carry flag (AC): will be set to one if there is a
carry out of or a borrow into the MSB of the nibble.
I Parity flag (PF): set to 1 if result of byte operations or lower
byte of the word operation contain an even number of ones;
otherwise it is 0.
I Zero flag (ZF): set to 1 if the result of operation in ALU is
zero; otherwise it is 0.
I Sign flag (SF): if the result obtained is correct binary
number, then the sign flags bit will give correct sign of the
result. If SF=0/1, then the result is +ve/-ve respectively.
I Overflow flag (OF): when the sign binary result of the
8/16-bit is out of range then OF=1, and sign flag will be
incorrect..
I If carry/borrow into the MSB is equal to carry/borrow out of
the MSB, then the sign result is correct and OF=0.
Register Organization
Examples
Example
Memory Segmentation
Code Segment
Memory Segmentation
Data Segment
I What values are assigned to the SP and SS, and who assigns
them?
I It is the job of the DOS to assign the values for the SP and
SS since memory management is the responsibility of the
operating system.
I The top of the stack is the last stack location occupied.
I BP is another register that can be used as an offset into the
stack, but it has very special applications and is widely used
to access parameters passed between assembly language
programs and high-level language programs.
Memory Segmentation
Stack Segment(Example)
Memory Segmentation
Stack Segment(Example)
Example
Example
Overlapping