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

Intel's reference: MOV

CFPFAFZFSFDFOF –––––––
  • Leaves every flag unchanged

Forms

Operands

reg
A general-purpose register matching the operation’s size, for example al, ax, eax or rax.
imm
An immediate value: a constant written in the instruction as a number, a character or a label, for example 10, 0x1f, 'a' or msg. Open a row to see the size it has in each form, such as imm8 or imm32.
acc
The accumulator: al, ax, eax or rax, whichever matches the operation’s size. The form accepts no other register in this position.
moffs
An absolute memory address with no base or index register, such as [label], used by mov to 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