movsxb
Move byte with sign extension
Sign-extends the byte source to the width of the destination register and copies the result there.
386 and later
CFPFAFZFSFDFOF –––––––
- Leaves every flag unchanged
Forms
movsxb ax, al8086 and later
Operands
reg- The destination register, usually wider than the source, as in
movsxb eax, bl. r/m8- An 8-bit general-purpose register or byte in memory, for example
alorbyte [rsi]. The high-byte registersah,bh,chanddhcannot be used in an instruction that also uses a 64-bit operand,spl,bpl,sil,dil, orr8tor15at any size.
It reads an 8-bit register or memory value and sign-extends it into a 16-, 32- or 64-bit destination register. For example, movsxb rax, [rdi] reads one byte. A 32-bit destination clears the upper half of its 64-bit register after producing the 32-bit result.
global _start
section .text
_start:
mov rax, 12
mov rbx, 5
mov rcx, 3
mov rsi, 9
movsxb rax, bl
mov rax, 60 ; syscall 60: exit
xor rdi, rdi
syscall