movabs
Move with explicit immediate or absolute offset
Copies a full-width immediate into a register, or transfers accumulator data using an absolute memory offset.
8086 and later
- Changes no flag
Forms
Operands
reg- A general-purpose register matching the operation’s size, for example
al,ax,eaxorrax. The byte registersah,bh,chanddhcannot be used with a REX prefix, which is required byspl,bpl,sil,dilandr8–r15. imm- An immediate value encoded in the instruction, written as a number, character or label. Its encoded width and any sign extension depend on the instruction; arithmetic immediates may be sign-extended, while shift counts are used without sign extension.
acc- The accumulator matching the operation’s size:
al,ax,eaxorrax. A shorter encoding may be available. moffs- An absolute memory address with no base or index register, such as
[label], used bymovto transfer data to or from the accumulator.
For example, movabs rax, 1 keeps the full 64-bit immediate and is 10 bytes, whereas NASM can shorten mov rax, 1 to a 32-bit register write. Both mov rax, 0x123456789abcdef0 and movabs rax, 0x123456789abcdef0 load the complete constant.
The byte, word and doubleword register-immediate forms use their respective immediate widths. The memory forms transfer data between an absolute address and al, ax, eax or rax. Use an explicit 64-bit memory offset in 64-bit code, for example movabs rax, [abs qword 0x1000]. Their lengths depend on the address and data widths. The 10-byte length applies to movabs reg64, imm64.
global _start
section .text
_start:
mov rax, 12
mov rbx, 5
mov rcx, 3
mov rsi, 9
movabs rax, 5
mov rax, 60 ; syscall 60: exit
xor rdi, rdi
syscall