very informativr and easy to learn about the register
Size: 105.71 KB
Language: en
Added: Aug 04, 2022
Slides: 12 pages
Slide Content
Flag Register Prepared By: Mr. Afraz Butt Unit No. 3
What is register A register (CPU register) is one of a small set of data holding places that are part of the computer processor . A register may hold an instruction , a storage address, or any kind of data (such as a bit sequence or individual characters). There are various types of Registers those are used for various purpose. Among of the some Mostly used Registers named as AC or Accumulator Register , Data Register or DR, the AR or Address Register , program counter (PC), Memory Data Register (MDR) , Index register , Memory Buffer Register and Flag Register .
What is Flag Register? For the 8086,8088 processor, the processor state is implemented as nine individual bits called Flags. Each decision made by the 8086 is based on the values of these flags. The flags are placed in the FLAG registers. They are classified as: Status Flags or Control Flags 2
Flag Register A 16-bit register, also called Program Status Word (PSW). Seven bits remain unused while the rest nine are used. Six are status flags and three are control flags. The FLAGS register is the status register in Intel x86 microprocessors that contains the current state of the processor. This register is 16 bits wide
Flag Register The following figure manifests the Flags register. Status Flags in bit: 0, 2, 4, 6, 7,11 Control Flags in bit: 8,9,10 Rest of the bits have no significance.
Parity Flag PF = 1 if the low byte of a result has an even number of one bits (even parity). It is 0 if the low byte has, odd parity. For example, if the result of a word addition is FFFEh , then the low byte contains 7 one bits, so PF=0. 15 = 1111 15=1111 15=1111 14=1110
Carry Flag CF = 1 if there is a carry out from the most significant bit ( msb ) on addition, or subtraction There Is a borrow into the msb on subtraction; [ msb = most significant bit] Otherwise, it is 0. CF is also affected by shift and rotate Instructions. 101 010 ==== 1 1 1
Auxiliary Carry Flag AF = 1 if there is a carry out from bit 3 on addition, or a borrow into bit 3 on subtraction. AF is used in Binary Coded Decimal (BCD) operations.
Signed Flag SF = 1 if the msb of a result is 1; it means the result is negative if you are giving a signed interpretation. SF = 0 if the msb is 0 .
Zero Flag ZF (Zero Flag) is set (ZF=1) when result of an arithmetic or logical operation is zero. For non-zero result this flag is reset (ZF=0). 111 111 ==== 000
Overflow Flag OF (Overflow Flag) set to 1 when there is a signed overflow . For example, when you multiply FFH by 11H (result is not one byte).
Control Flags The control flags can be set/reset by the programmer. 1. DF (Direction Flag) : controls the direction of operation of string instructions. (DF=0 Ascending order DF=1 Descending order) 2. IF (Interrupt Flag): controls the interrupt operation in 8086μP. (IF=0 Disable interrupt IF=1 Enable interrupt) 3. TF (Trap Flag): controls the operation of the microprocessor. (TF=0 Normal operation TF=1 Single Step operation)