X86-assembly/Instructions/cmovnz

From aldeid
Jump to navigation Jump to search

Description

  • mov if Zero Flag (ZF) is not set
cmovnz dest, source
IF ZF == 0:DEST = SOURCE

Example

mov ecx, 0x00000024
mov edx, 0x00000000
mov eax, 0x0000009A     ; AL = 0x9A
scasb                   ; ES:[EDI] = 0x9A => ZF = 1 because AL == BYTE PTR[EDI]
cmovnz  cx, dx          ; No change because ZF = 1
mov ecx, 0x00000023
mov edx, 0x00000000
mov eax, 0x000000C4     ; AL = 0xC4
scasb                   ; ES:[EDI] = 0x90 => ZF = 0 because AL != BYTE PTR[EDI]
cmovnz  cx, dx          ; ECX = EDX = 0 because ZF == 0