Adjust flag

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Sollyucko (talk | contribs) at 15:21, 11 December 2020 (Mention Alignment Check register, abbreviated as AC). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Intel CPU 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

The Adjust flag (AF) is a CPU flag in the FLAGS register of all x86-compatible CPUs, and the preceding 8080-family; it is also called the Auxiliary flag and the Auxiliary Carry flag (AC, though this may be confused with the Alignment Check register). The flag bit is located at position 4 in the CPU flag register. 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 during an "add" operation 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, during a subtraction. Otherwise, if no such carry or borrow occurs, the flag is cleared or "reset" (set to 0). [1]

See also

References

  1. ^ "The 8086 Family User Manual" (PDF). Intel. Retrieved 2 July 2020.