Lecture #05, Microprocessor-Flags
Lecture #05, Microprocessor-Flags
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
change TF as desired,
pop flag register from stack. IRET
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.