movzxw

Move word with zero extension

Copies a word source into a register, filling added high bits with zeros when the destination is wider.

386 and later

Intel's reference: MOVZX

CFPFAFZFSFDFOF –––––––
  • Changes no flag

Forms

Operands

reg
The destination register. Its width is selected independently of the source width; widening uses a larger destination.
r/m16
A 16-bit general-purpose register or word in memory, for example ax or word [rsi].

It reads 16 bits and zero-extends them into a 32- or 64-bit destination. NASM also accepts a 16-bit destination; that copies the word without widening and preserves the remaining bits of the 64-bit register.

global _start

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

        movzxw rax, bx

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