Frage

Using LAHF the AH register can be loaded with the higher order byte of the flag register.

The flag register has 7 undefined registers. I have two questions:

  1. Are the undefined bits considered in the LAHF operation?
  2. If the are considered,are the undefined bits in the flag register taken as binary 1 or binary 0?
War es hilfreich?

Lösung

The flags SF, ZF, AF, PF, and CF are copied to AH bits 7, 6, 4, 2, and 0, respectively. The contents of the remaining bits 5, 3, and 1 of AH is generally accepted as undefined. This is true if you look at the older instruction sets, for example the 80386 one.

However the more recent IA-32 Intel® Architecture Software Developer’s Manual Volume 2: Instruction Set Reference spells out explicit bit states for LAHF:

Operation
AH ← EFLAGS(SF:ZF:0:AF:0:PF:1:CF);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top