Adjust flag
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]