FLAGS register (computing) - Wikipedia, the free encyclopedia Page 1 of 3

FLAGS register (computing)

From Wikipedia, the free encyclopedia

This article discusses the flag register specific to the architecture. For a general discussion about flag registers, see .

The FLAGS register is the status register in x86 that contains the current state of the . This register is 16 bits wide. Its successors, the EFLAGS and RFLAGS registers are 32 bits and 64 bits wide, respectively. The wider registers retain compatibility with their smaller predecessors.

Intel x86 FLAGS Register Bit # Abbreviation Description Category [1] FLAGS 0 CF S 1 1 Reserved 2 PF S 3 0 Reserved 4 AF S 5 0 Reserved 6 ZF S 7 SF Sign flag S 8 TF (single step) X 9 IF enable flag X 10 DF C 11 OF S 12, 13 IOPL I/O privilege level (286+ only) X 14 NT Nested task flag (286+ only) X 15 0 Reserved EFLAGS 16 RF Resume flag (386+ only) X 17 VM flag (386+ only) X 18 AC Alignment check (486SX+ only) X 19 VIF Virtual (Pentium+) X 20 VIP Virtual interrupt pending (Pentium+) X 21 ID Identification (Pentium+) X 22 0 Reserved

http://en.wikipedia.org/wiki/FLAGS_register_(computing) 9/22/2010 FLAGS register (computing) - Wikipedia, the free encyclopedia Page 2 of 3

23 0 Reserved 24 0 Reserved 25 0 Reserved 26 0 Reserved 27 0 Reserved 28 0 Reserved 29 0 Reserved 30 0 Reserved 31 0 Reserved RFLAGS 32-63 0 Reserved

1. ^ S: Status flag C: Control flag X: System flag

Examples

Below is an example for changing the flag in DF (direction flag) from a 0 to a 1

mov bx , 400h ; Set the DF flag pushf ; Pushes the current flags onto the register pop ax ; Pop the flags from the stack into ax register push ax ; Push them back onto the stack for storage xor ax , bx ; XOR dest, src | Used for toggling the DF flag only, keep t push ax ; Push again to add the new value to the stack popf ; Pop the newly pushed into the FLAGS register ; ... Code here ... popf ; Pop the old FLAGS back into place

;In practical software, the cld and std mnemonics are used to clear and

See also

■ status register ■ flag byte ■ Flag (computing) ■ Program status word ■ ■ x86 ■ x86 ■ x86 instruction listings

http://en.wikipedia.org/wiki/FLAGS_register_(computing) 9/22/2010 FLAGS register (computing) - Wikipedia, the free encyclopedia Page 3 of 3

Retrieved from "http://en.wikipedia.org/wiki/FLAGS_register_(computing)" Categories: X86 architecture | Programming idioms | technology | | Digital registers | Operating system stubs | science stubs

■ This page was last modified on 22 September 2010 at 20:09. ■ Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of Use for details. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.

http://en.wikipedia.org/wiki/FLAGS_register_(computing) 9/22/2010