2

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?

Riddle Aaron
  • 95
  • 1
  • 5

1 Answers1

1

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.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • 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? – Riddle Aaron Oct 07 '18 at 04:54
  • It looks like a mistake. In BCD, every decimal digit takes 4 bits. This is even evident from the very same picture. – Yuval Filmus Oct 07 '18 at 05:24