Adjust flag

From Wikipedia, the free encyclopedia
Jump to: navigation, search

The Adjust flag (also known as the Auxiliary flag) is a CPU flag in the FLAGS register of all x86-compatible CPUs. It is located at bit position 4. It indicates when an arithmetic carry or borrow has been generated out of the four least significant bits, or lower nibble. It is primarily used to support binary-coded decimal (BCD) arithmetic.

The Auxiliary flag is set (to 1) if there is a carry from the low nibble (lowest four bits) to the high nibble (upper four bits), or a borrow from the high nibble to the low nibble, in the low-order 8-bit portion of an addition or subtraction operation. Otherwise, if no such carry or borrow occurs, the flag is cleared (reset to 0).

See also[edit]

Status register
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 (bit position)
- - - - O D I T S Z - A - P - C Flags