0
\$\begingroup\$

Why is the AC flag set while using the ANI instruction in 8085:

MVI A, A3H
ANI 97H
HLT

The sign flag is set which is understandable but the AC flag is also set which makes no sense because, there's no carry from the D3 bit to D4 bit. How is this happening?

\$\endgroup\$
1
\$\begingroup\$

ANI unconditionally sets AC. That's how it's defined.

ANI [...] [...] AC is set.

\$\endgroup\$
  • \$\begingroup\$ no reason then? \$\endgroup\$ – mathmaniage Oct 14 '17 at 10:00
  • \$\begingroup\$ Most likely the reason has to do with decoding the instruction. It probably happened to fit where other instructions unconditionally set AC so it was easier to just roll with it. \$\endgroup\$ – Ignacio Vazquez-Abrams Oct 14 '17 at 10:02

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.