lahf

Load ah from flags

Copies the low byte of rflags into ah.

8086 and later

Intel's reference: LAHF

CFPFAFZFSFDFOF –––––––
  • Changes no flag
  • Reads CF PF AF ZF SF

Forms

  • lahf

The operation of LAHF is:

 AH <-- SF:ZF:0:AF:0:PF:1:CF

See also SAHF.

global _start

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        lahf

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall