How are the carry and aux carry calculated for bitwise operations in the 8080

258 Views Asked by At

I am currently writing an 8080 emulator and am confused on why the carry flag is marked as "modified" in opcode lists such as

https://pastraiser.com/cpu/i8080/i8080_opcodes.html or http://www.emulator101.com/8080-by-opcode.html

is it just set to 0 or is there an actual way to calculate carry for a bitwise operation? I'm a bit confused as Pastraiser says it's modified and not just set to 0.

1

There are 1 best solutions below

0
Cactus On

The Intel 8080 Assembly Language Programming Manual is the authoritative source on questions like this. It has detailed descriptions for each instruction. For bitwise logical operations, it says the Carry flag is reset (i.e. set to 0):

ANA Logical and (sic!) Register or Memory WIith Accumulator

[...]

The specified byte is logically ANDed bit by bit with the contents of the accumulator. The Carry bit is reset to zero

And similarly for XRA and ORA.