It's known and documented that on the Intel 8080 most logical operations (including all OR and XOR operations) clear the half-carry (auxiliary carry) flag. A known exception is the ANA instruction, which updates it instead.

According to the 8080/8085 Assembly Language Programming Manual (1981 version) referenced in the answer above, and also the 1978 version:

The 8080 logical AND instructions set the flag to reflect the logical OR of bit 3 of the values involved in the AND operation.

This appears to indicate that that all logical AND instructions, i.e. both ANA and ANI, update the half-carry. However, the Intel 8080 Microcomputer Systems User's Manual (98-153B) explicitly says that ANA and ANI have different behaviour:

  • ANA r and ANA m: "The CY flag is cleared."
  • ANI: "The CY and AC flags are cleared."

This is from a scan of the manual, page 4-8:

enter image description here

and page 4-9:

enter image description here

So which reference describes the actual behaviour of an 8080? Does ANI clear or update the half-carry flag? Do we have any actual tests of the behaviour on real 8080 CPUs that document this?

As a side note, the documentation seems to vary even more in the early days. Intel 8080 Microcomputer Systems User's Manual, September 1975, lists AC as affected by all AND instructions, but the Intel 8080 Assembly Language Programming Manual, Rev B, 1975, does not list AC as affected for either. Possibly it's worth building an errata document for all of these, covering the differences in technical descriptions of the 8080 between each one and which one(s) is/are correct and which erroneous.

  • I won't make this an answer since, my evidence is sketchy, but just looking in to the code of a decent 8080 emulator, that I use, the treatment of the half carry for all the ana instructions is the same. using the half carry after an ana operation would make your code dependent on an undocumented flag effect. My Jan 1975 8080 data book doesn't list the half carry among the list of flags, and states the ana instructions clear the carry, and imply the other status bits are set appropriately, and it's only mentioned that the DAA instruction depends on a carry out of bit 3.
    – scm
    Commented Apr 25 at 21:50
  • @scm Sorry, did you mean that it's the same for all the ANA instructions (just ANA but not ANI), or all the AND instructions (ANA and ANI)?
    – cjs
    Commented Apr 25 at 22:15
  • It is I that is sorry, I was using the terminology of the emulator code I have, I should have been more clear. It's all the AND instructions: ANA <reg>, ANA M, ANI <immediate>.
    – scm
    Commented Apr 25 at 22:28

1 Answer 1


For what it's worth, the MCS-80/85 Family User's Manual (October 1979) has yet another listing of instructions, and in this one it's made very clear that both ANA and ANI behave the same on the 8080:

The CY flag is cleared and AC is set (8085). The CY flag is cleared and AC is set to the OR’ing of bits 3 of the operands (8080).

enter image description here

(ANA r, which is not shown here, is the same as ANA m, as it was in the other manuals.)

Unfortunately I don't have any results of actual tests to confirm this.

  • 1
    Meanwhile I’m trying to come up with a reason why ORing bit 3s is useful for something. Perhaps not enough coffee yet this morning.
    – Jon Custer
    Commented Apr 21 at 16:16
  • 3
    It probably isn't, since they changed that in the 8085 just to set the half-carry (AC). I am guessing it was just an implementation side-effect, especially given that it wasn't documented in the earliest manuals. (The 1975 Intel 8080 Assembly Language Programming Manual (Rev B), says that ANA does not affect the Auxiliary Carry condition bit. Nor does ORA in that manual, for that matter. Just XRA.)
    – cjs
    Commented Apr 21 at 17:12
  • Agreed, I guess I was mostly hoping for some really weird niche case that somebody found that behavior useful for. Sigh.
    – Jon Custer
    Commented Apr 22 at 17:40

You must log in to answer this question.

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