It is said that the subtraction is performed in 2's complement in 8085 and so the flags must be set according to the operation. However,in the figure shown, i am unable to figure out the reason behind auxiliary carry flag being set to '0' and the same goes for carry flag. When i performed 2's complement operation, i found carry=1 (which is not taken into consideration in 2's complement) and i also found carry of 1 shifting from lower nibble to upper and so i thought auxiliary carry to be 1. But i found just the opposite for both of them.
Similarly in the second case shown below, manually i got the carry to be zero whereas the carry flag was set to 1.
According to 8085 manual here in page 118, the operation should be set. It looks like that GNUSim8085 has a bug. GNUSim8085 had several bugs, some of which they fixed in the latest version (including the bug with the DAA instruction), but it looks like there are still more auxiliary carry related bugs. Check here for a list of bugs which I found long ago with v1.3.7
I would recommend using gsim85 here https://gsim85.soft112.com/, as it seems that this has implemented the auxiliary carry operation correctly. This may be a bit difficult to use though.
Also, if you do not want a simulator but want an interface like the 8085 trainer kits, have a look at Dirty8085, which I wrote around 9 ~ 10 years ago, and recently fixed the auxiliary carry update.
来源:https://stackoverflow.com/questions/50221505/auxiliary-carry-and-carry-flags-in-8085