Question

I am trying to use AAD instruction in NASM 64-bit but it shows an error at compile time:

error: instruction not supported in 64-bit mode

Is there a way I can still use this instruction in 64-bit mode? Is there any other equivalent instruction I should be aware of?

Was it helpful?

Solution

The AAD instruction is invalid in 64-bit mode, but its operation is described in Intel's Software Developer's Manual, so you can implement the same functionality yourself if you need it:

tempAL ← AL;
tempAH ← AH;
AL ← (tempAL + (tempAH ∗ imm8)) AND FFH;
(* imm8 is set to 0AH for the AAD mnemonic.*)
AH ← 0;

The SF, ZF, and PF flags are set according to the resulting binary value in the AL register; the OF, AF, and CF flags are undefined.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top