I'm trying to figure out how the Auxiliary Carry flag on the 8080 is affected by logical instructions.

Reading the Intel 8080 manual, it seems that logical instructions do not affect AC:

The Auxiliary Carry bit will be affected by all addition, subtraction, increment, decrement, and compare instructions.

This is repeated in the detailed descriptions of the logical instructions themselves, like this for ORA:

Condition bits affected: Carry, zero, sign, parity

However, this test program does the following:


In addition, this opcode table and this encoding table both list the A flag as affected by logical instructions.

So I assume they're affected, but that this is undocumented behavior. Can anyone shed any light on the proper behavior here?

2 Answers 2


The 8080/8085 Assembly Language Programming Manual says on page 1-12 (PDF page 22):

The auxiliary carry flag is affected by all add, subtract, increment, decrement, compare, and all logical AND, OR, and exclusive OR instructions. (See the descriptions of these instructions in Chapter 3.) There is some difference in the handling of the auxiliary carry flag by the logical AND instructions in the 8080 processor and the 8085 processor. The 8085 logical AND instructions always set the auxiliary flag ON. The 8080 logical AND instructions set the flag to reflect the logical OR of bit 3 of the values involved in the AND operation.

OR and XOR operations clear the auxiliary flag on the 8080, which is why it appears in the corresponding opcode descriptions. AND operations set it as described above.

  • Thank you! I suppose it was undocumented until the 8085 came along, and the changes in behavior needed to be written down.
    – tobiasvl
    May 28, 2020 at 13:32
  • @tobiasvl No, it was documented much earlier, back in 1975 (see my answer below). It appears you may have had the misfortune to be looking at an 8080 manual that was superseded only a few months later.
    – cjs
    Apr 21 at 6:22

This was documented by Intel in 1975, though apparently not in the manual you're looking at (Intel 8080 Assembly Language Programming Manual Rev. B, 1975).

Section 4 of the Intel 8080 Microcomputer Systems User's Manual (98-153B), September 1975, has corrected (mostly? see below) documentation. Pages 4-8 and 4-9 now clearly document which flags are updated by the logical instructions in all but one case, saying for most of them, "The CY and AC flags are cleared."

enter image description here

The one exception is for AND between two registers or register and memory (ANA), which, rather than clearing the half-carry (auxiliary carry) flag, updates it:

enter image description here

Note that this documentation states that while ANA does update the half-carry, ANI clears the half-carry. This is different from what the 8080/8085 manual quoted by Stephen Kitt says, and most sources on the Internet, that both ANA and ANI update the half-carry.

Exactly how the half-carry value is determined does not seem to be described here, however. In the subsection "Condition Flags" on page 4-3 it says, "Unless indicated otherwise, when an instruction affects a flag, it affects it in the following manner," and the description of the half-carry is given on page [4-4], also indicating that it's updated by "logical operations":

enter image description here

It does not, however, seem to say how ANA should update the flag, since an AND operation causes neither a carry nor a borrow.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .