0% found this document useful (0 votes)
6 views

Lecture #05, Microprocessor-Flags

The document provides an overview of the 8086 microprocessor's flag register, detailing its structure as a 16-bit register with 9 flags used for indicating conditions and controlling operations. It explains the function of control flags (TF, IF, DF) and status flags (CF, PF, AF, ZF, SF, OF) in various arithmetic and logical operations. The lecture is part of a course on microprocessors at the University of Dhaka, presented by Dr. Sharnali Islam.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Lecture #05, Microprocessor-Flags

The document provides an overview of the 8086 microprocessor's flag register, detailing its structure as a 16-bit register with 9 flags used for indicating conditions and controlling operations. It explains the function of control flags (TF, IF, DF) and status flags (CF, PF, AF, ZF, SF, OF) in various arithmetic and logical operations. The lecture is part of a course on microprocessors at the University of Dhaka, presented by Dr. Sharnali Islam.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

EEE-3103: Microprocessor and Interfacing

Lecture #5: 8086 Microprocessor


Flag Register

Dr. Sharnali Islam


Department of Electrical and Electronic Engineering
University of Dhaka
[email protected]

Slides used resources from:


Prof. Sazzad M.S. Imran, PhD, EEE DU
Web resources UNDERSTANDING 8085/8086 MICROPROCESSORS - Sen
Registers of 8086

Status Registers:
16-bit register → flag register or Program Status Word (PSW).
7 bits remain unused,
9 are used to indicate conditions of flags.
9 flags → 6 condition flags + 3 control flags.
Control flags = TF, IF and DF.
Condition flags = OF, SF, ZF, AF, PF and CF.
Registers of 8086

Control Flags of 8086 (Programable):


TF = 1 → processor operates in single stepping mode. ISS
Book 213 page.
interrupt is recognized, TF flag is cleared. PUSH TF
PUSH IF

CPU runs ISS (interrupt service subroutine).


TF = 0
IF = 0

IRET → CPU returns to main program from ISS,


TF flag is restored.

TF = set/reset → push flag register on stack,


POP TF
POP IF

change TF as desired,
pop flag register from stack. IRET
Registers of 8086

Control Flags of 8086:


IF = 1 → maskable interrupt INTR is enabled.
interrupt is recognized, IF flag is cleared.
IRET in ISS → IF is restored to its original value.
STI = IF set instruction and CLI = IF clear instruction.
When 8086 is reset, IF is cleared.

DF is used in string operations.


STD = DF set instruction and CLD = DF clear instruction.
DF = 1 → DI and SI are automatically decremented
access string from highest memory location down to lowest memory location.
Registers of 8086

Status Flags:
CF = 1 if
carry out of MSB position resulting from addition operation or
borrow is needed out of MSB position during subtraction.

PF = 1 if
lower 8-bits of result of operation contains even number of 1’s.

AF = 1 if
Set on carry from or borrow to the low-order 4-bits of AL; cleared Otherwise

ZF = 1 if
result of arithmetic or logical operation is zero.
Registers of 8086

Status Flags:
SF = 1 if
MSB of result of operation is 1.
used for unsigned numbers.

OF = 1 if
result is too large to be fitted in number of destination bits available.
used for signed arithmetic operation.

You might also like