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 –––––––
  • Leaves every flag unchanged

Forms

Operands

reg
The destination register, usually wider than the source, as in movzxb eax, bl.
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 in an instruction that also uses a 64-bit operand, spl, bpl, sil, dil, or r8 to r15 at any size.

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