Does SUB B
on Intel 8080 set the auxiliary carry flag when the accumulator and the B register are 1 and 0, respectively? On Z80, which was designed to be a backward-compatible, albeit not fully, extension to 8080, the half-carry flag is defined so that it gets set if subtraction results in a borrow from bit 4 (Z80 CPU User Manual, p. 68). Therefore, "1 - 0" will reset the flag on Z80 because no borrow occurs in the subtraction. Is it also the case on 8080? More generally, does the auxiliary carry flag on 8080 behave in the exactly same way as the half-carry flag on Z80?
The official 8080 manuals appear less clear about when subtraction turns on the auxiliary carry flag than the Z80 manual. I have observed that some 8080 emulators turn the flag on for "1 - 0" but others do not. As another example, the first and second algorithms in Can someone explain this algorithm used to compute the auxiliary carry flag? will reset and set the flag for the subtraction, respectively.
SUB A
will turn the flag on. Note that no borrow occurs inSUB A
(or A - A).