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 –––––––
- Changes no flag
Forms
movsxb ax, al8086 and later
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
alorbyte [rsi]. The high-byte registersah,bh,chanddhcannot be used with a REX prefix, including when the memory address uses an extended register such asr8.
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