Flag Register 8086
Flag Register
The flags are a 16-bit register containing 9 one-bit flags. The figure gives the diagrammatic representation of the flag register.
D15 | D14 | D13 | D12 | D11 | D10 | D9 | D8 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
X/U | X/U | X/U | X/U | OF | DF | IF | TF | SF | ZF | X/U | AC | X/U | PF | X/U | CF |
Control Flag |
- Overflow Flag (OF):- This flag is set if an overflow occurs. I.e. if the result of a signed operation is large (too large positive number or too small negative number) enough to be accommodated in a destination register.
- Direction Flag (DF):- This is used by string manipulation instructions. If this flag bit is ‘0’, the string is processed beginning from the lowest address to the highest address. I.e. auto-incrementing mode. Otherwise, the string is processed from the highest address towards the lowest address, i.e. auto-decrementing mode.
- Interrupt-enable Flag (IF): – If this flag is set, the maskable interrupts are recognized by the CPU. Otherwise they are ignored.
- Single-step Flag (TF):– If this flag is set, the processor enters the single-step execution mode. In other words, a trap interrupt is generated after the execution of each instruction. The processor executes the current instruction and the control is transferred to the Trap interrupt service routine.
- Sign Flag (SF):– This flag is set when the result of any computation is negative. For signed computations, the sign flag equals the MSB of the result.
- Zero Flag (ZF) - Set if the result is zero.
- Auxiliary carry Flag (AF) :– Set if there was a carry from or borrow to bits 0-3 in the AL register.
- Parity Flag (PF):– Set if parity (the number of "1" bits) in the low-order byte of the result is even.
- Carry Flag (CF):–This flag is set when there is a carry-out of MSB in case of addition or borrow in case of subtraction. For example. When two numbers are added, a carry may be generated out of the most significant bit position. The carry flag, in this case, will be set to 1’. In case, no carry is generated, it will be ‘0.
REFERENCE
1 Microcomputer Systems: 8086/8088 Family - Architecture, Programming, and Design; Y. Liu and G. A. Gibson, 2nd Ed., PHI.
2 Microprocessor & Interfacing – D. Hall, TMH
3 The 8086 Microprocessor: Programming & Interfacing the PC, Kenneth J. Ayala, Penram International Publishing (India).
4 The Intel 8086/8088 Microprocessor Architecture, Programming Design & Interfacing – B.S. Chhabra, Dhanpat Rai Publishing Company.
5 The Intel Microprocessor 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium & Pentium Pro Processor: Architecture, Programming & Interfacing – Brey & Sharma, Pearson Education.
6 Advanced microprocessor, Rajasree, New Age International Publishers
7 Fundamentals of Microprocessor and Microcomputers – B. Ram, Dhanpat Rai Publishing Company.
8 Microprocessors: Principles and Applications by A Pal
9 Advanced Microprocessors and Peripherals by A K Ray and K M Bhurchandi
10 Microprocessors and Microcontrollers : Architecture, Programming and Interfacing Using 8085, 8086 and 8051 by Soumitra Kumar Mandal
11 Introduction to Microprocessors and Microcontrollers by Crisp John Crisp
12 Microprocessors And Microcontrollers by A Nagoor Kani
13 Microprocessors And Microcontrollers : Architecture, Programming and System Design 8085, 8086, 8051, 8096 by Krishna Kant
14 Microprocessors and Interfacing by Nikhil Marriwala, Katson Book, January, 2009
Comments
Post a Comment