PDA

View Full Version : 8080 instruction flag question



vbriel
February 15th, 2010, 05:25 PM
Ok, I'm writing an emulator for a microcontroller and I'm stuck on SBB commands.

If A=0 and B=1 and Carry flag is set. If I do a SBB B the result in a is FE which is correct. The problem is, the half carry flag is setting. Is this correct? Reading the Intel manual it looks like this is correct, but I'm checking my work with Altair32 and it is not setting the HC flag on this.

Thanks,

Vince

vbriel
February 16th, 2010, 04:27 PM
Can somebody tell me if the aux carry (half carry) flag is only used for the DAA opcode?

Thanks,

Vince

Chuck(G)
February 16th, 2010, 05:19 PM
In the Intel 8080 and Z80, that is the case. In the original NEC 8080 ISTR that its setting was a bit different. It's probably safe to say that if your DAA emulation operates correctly, then you don't have to worry about the H flag.

There is a possibility that it could be used to tell CPU variants apart by some diagnostic programs, but I don't know that any such programs exist.