<s>
A	O
half-carry	B-Device
flag	I-Device
(	O
also	O
known	O
as	O
an	O
auxiliary	O
flag	O
)	O
is	O
a	O
condition	O
flag	O
bit	O
in	O
the	O
status	B-General_Concept
register	I-General_Concept
of	O
many	O
CPU	B-Device
families	O
,	O
such	O
as	O
the	O
Intel	B-General_Concept
8080	I-General_Concept
,	O
Zilog	B-General_Concept
Z80	I-General_Concept
,	O
the	O
x86	B-Operating_System
,	O
and	O
the	O
Atmel	B-Architecture
AVR	I-Architecture
series	O
,	O
among	O
others	O
.	O
</s>
<s>
It	O
indicates	O
when	O
a	O
carry	B-Algorithm
or	O
borrow	O
has	O
been	O
generated	O
out	O
of	O
the	O
least	O
significant	O
four	O
bits	O
of	O
the	O
accumulator	B-General_Concept
register	O
following	O
the	O
execution	O
of	O
an	O
arithmetic	B-General_Concept
instruction	O
.	O
</s>
<s>
It	O
is	O
primarily	O
used	O
in	O
decimal	O
(	O
BCD	O
)	O
arithmetic	B-General_Concept
instructions	O
.	O
</s>
<s>
Normally	O
,	O
a	O
processor	O
that	O
utilizes	O
binary	O
arithmetic	B-General_Concept
(	O
which	O
includes	O
almost	O
all	O
modern	O
CPUs	B-Device
)	O
will	O
add	O
two	O
8-bit	O
byte	O
values	O
according	O
to	O
the	O
rules	O
of	O
simple	O
binary	O
addition	O
.	O
</s>
<s>
Since	O
the	O
lower	O
nibble	O
of	O
this	O
value	O
is	O
a	O
non-decimal	O
digit	O
(	O
D	B-Device
)	O
,	O
it	O
must	O
be	O
adjusted	O
by	O
adding	O
06	O
to	O
produce	O
the	O
correct	O
BCD	O
result	O
of	O
73	O
,	O
which	O
represents	O
the	O
decimal	O
value	O
73	O
.	O
</s>
<s>
This	O
result	O
does	O
not	O
have	O
a	O
non-decimal	O
low	O
nibble	O
,	O
but	O
it	O
does	O
cause	O
a	O
carry	B-Algorithm
out	O
of	O
the	O
least	O
significant	O
digit	O
(	O
lower	O
four	O
bits	O
)	O
into	O
the	O
most	O
significant	O
digit	O
(	O
upper	O
four	O
bits	O
)	O
.	O
</s>
<s>
This	O
is	O
indicated	O
by	O
the	O
CPU	B-Device
setting	O
the	O
half-carry	B-Device
flag	I-Device
.	O
</s>
<s>
(	O
Note	O
that	O
the	O
leading	O
1	O
digit	O
is	O
actually	O
a	O
carry	B-Algorithm
bit	I-Algorithm
.	O
)	O
</s>
<s>
Summarizing	O
,	O
if	O
the	O
result	O
of	O
a	O
binary	O
addition	O
contains	O
a	O
non-decimal	O
low	O
digit	O
or	O
causes	O
the	O
half-carry	B-Device
flag	I-Device
to	O
be	O
set	O
,	O
the	O
result	O
must	O
be	O
corrected	O
by	O
adding	O
06	O
to	O
it	O
;	O
if	O
the	O
result	O
contains	O
a	O
non-decimal	O
high	O
digit	O
,	O
the	O
result	O
must	O
be	O
further	O
corrected	O
by	O
adding	O
60	O
to	O
produce	O
the	O
correct	O
final	O
BCD	O
value	O
.	O
</s>
<s>
The	O
Auxiliary	O
Carry	B-Algorithm
Flag	I-Algorithm
(	O
AF	O
)	O
is	O
a	O
CPU	B-General_Concept
flag	I-General_Concept
in	O
the	O
FLAGS	B-General_Concept
register	I-General_Concept
of	O
all	O
x86-compatible	O
CPUs	B-Device
,	O
and	O
the	O
preceding	O
8080-family	O
.	O
</s>
<s>
The	O
flag	O
bit	O
is	O
located	O
at	O
position4	O
in	O
the	O
CPU	B-General_Concept
flag	I-General_Concept
register	O
.	O
</s>
<s>
It	O
indicates	O
when	O
an	O
arithmetic	B-General_Concept
carry	B-Algorithm
or	O
borrow	O
has	O
been	O
generated	O
out	O
of	O
the	O
four	O
least	O
significant	B-Language
bits	I-Language
,	O
or	O
lower	O
nibble	O
.	O
</s>
<s>
It	O
is	O
primarily	O
used	O
to	O
support	O
binary-coded	O
decimal	O
(	O
BCD	O
)	O
arithmetic	B-General_Concept
.	O
</s>
<s>
The	O
Auxiliary	O
Carry	B-Algorithm
flag	I-Algorithm
is	O
set	O
(	O
to	O
1	O
)	O
if	O
during	O
an	O
"	O
add	O
"	O
operation	O
there	O
is	O
a	O
carry	B-Algorithm
from	O
the	O
low	O
nibble	O
(	O
lowest	O
four	O
bits	O
)	O
to	O
the	O
high	O
nibble	O
(	O
upper	O
four	O
bits	O
)	O
,	O
or	O
a	O
borrow	O
from	O
the	O
high	O
nibble	O
to	O
the	O
low	O
nibble	O
,	O
in	O
the	O
low-order	O
8-bit	O
portion	O
,	O
during	O
a	O
subtraction	O
.	O
</s>
<s>
Otherwise	O
,	O
if	O
no	O
such	O
carry	B-Algorithm
or	O
borrow	O
occurs	O
,	O
the	O
flag	O
is	O
cleared	O
or	O
"	O
reset	O
"	O
(	O
set	O
to	O
0	O
)	O
.	O
</s>
