1
$\begingroup$

enter image description here enter image description here

These two images are from Google search.

AUXILIARY CARRY FLAG: This flag is set to a 1 by the instruction just ending if a carry occurred from bit 3 to bit 4 of the A Register during the instruction’s execution

Explanation from Quora

It indicates when a carry or borrow has been generated out of the least significant four bits of the accumulator register following the execution of an arithmetic instruction. It is primarily used in decimal (BCD) arithmetic instructions.

Explanation from Wikipedia

These two different definitions really confuses me. As I experimented this on Keil using 8051, and it showed that AC is set when the carry occurs out of four low bits. What is the precise definition?

$\endgroup$
0
$\begingroup$

The two definitions are exactly the same. Don't forget that in computer science, we often start counting things at zero rather than at one.

$\endgroup$
  • $\begingroup$ But as you can see in two pictures, the first one shows the carry on 4th position (starting at zero), and the second one shows the carry on 3th position. How can it be explained? $\endgroup$ – Riddle Aaron Oct 7 '18 at 4:54
  • $\begingroup$ It looks like a mistake. In BCD, every decimal digit takes 4 bits. This is even evident from the very same picture. $\endgroup$ – Yuval Filmus Oct 7 '18 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.