Adjust flag


The Adjust flag 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. 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 arithmetic.
The Auxiliary flag is set if during an "add" operation there is a carry from the low nibble to the high nibble, 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".