2

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:

ORA A ;RE-SET AUXILIARY CARRY

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?

1 Answer 1

2

The 8080/8085 Assembly Language Programming Manual says:

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.

1
  • 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

You must log in to answer this question.

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