movzxb

Move byte with zero extension

Zero-extends the byte source to the width of the destination register, filling the high bits with zero.

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/m8
An 8-bit general-purpose register or byte in memory, for example al or byte [rsi]. The high-byte registers ah, bh, ch and dh cannot be used with a REX prefix, including when the memory address uses an extended register such as r8.

It reads an unsigned byte and fills the added bits of a 16-, 32- or 64-bit destination with zeros. For example, movzxb rax, [rdi] reads one byte and produces a value from 0 to 255.

global _start

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

        movzxb rax, bl

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