What do the brackets mean in x86 asm?

x86 brackets
x86 assembly instructions
assembly square brackets
x86 assembly example
assembly mov
assembly lea
array in assembly x86
x86 mov

Given the following code:

L1     db    "word", 0

       mov   al, [L1]
       mov   eax, L1

What do the brackets ([L1]) represent?

[L1] means the memory contents at address L1. After running mov al, [L1] here, The al register will receive the byte at address L1 (the letter 'w').

What do square brackets mean in x86 assembly?, i want to know how to square bracket in nasm x86 assembly. what these lines do​? mov [num] , eax mov eax , [num]. mov [eax],num mov num ,  Asm x86 segmentation fault in reading from file. assembly,x86,segmentation-fault,mmap. The value in R8 at the time your program crashes is the file descriptor returned by the open syscall. Its value is probably 3 which isn't a valid address. You'll need to stores these values in a range of memory you've properly allocated.

Operands of this type, such as [ebp], are called memory operands.

All the answers here are good, but I see that none tells about the caveat in following this as a rigid rule - if brackets, then dereference, except when it's the lea instruction.

lea is an exception to the above rule. Say we've

mov eax, [ebp - 4]

The value of ebp is subtracted by 4 and the brackets indicate that the resulting value is taken as an address and the value residing at that address is stored in eax. However, in lea's case, the brackets wouldn't mean that:

lea eax, [ebp - 4]

The value of ebp is subtracted by 4 and the resulting value is stored in eax. This instruction would just calculate the address and store the calculated value in the destination register. See What is the difference between MOV and LEA? for further details.

square bracket in nasm x86 assembly : asm, mov eax, 0ffffh ; move 0xFFFF into eax. We can move the contents of memory into a register and vice-versa by using square brackets to indicate '  I'm learning 32-bit 8086 assembly (for class) and I'm going over one of the sample programs. What does it mean when a register is enclosed in brackets? mov ebx, [ebx + 4] Also, is the 4 a literal

Simply means to get the memory at the address marked by the label L1.

If you like C, then think of it like this: [L1] is the same as *L1

An Introduction to Assembly Language: Part II, September 2002 in x86 Assembly. Hello, I'm a newbie to To what can the square brackets operator be applied to apart registers and labels??? Thx. Regards, Assembly Square Brackets. possible duplicate of What do the brackets mean in x86 asm? I always think of the square brackets as meaning dereferencing the value

The brackets mean to de-reference an address. For example

mov eax, [1234]

means, mov the contents of address 1234 to EAX. So:

1234 00001

EAX will contain 00001.

Assembly, manual, translates source files that are in assembly language format into In the above regular expressions, choices are enclosed in square brackets; a range of component of the address. sreg does not represent an address by itself. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more What do the brackets mean in x86 asm?

Direct memory addressing - al will be loaded with the value located at memory address L1.

Meaning of the [] and PTR operators???, I am trying to understand memory addressing in 8086 assembler. Especially use If I have a variable "str" and do the following, what does it mean: mov str, "H"  Labels. A label can be placed at the beginning of a statement. During assembly, the label is assigned the current value of the active location counter and serves as an instruction operand. There are two types of lables: symbolic and numeric. Symbolic Labels. A symbolic label consists of an identifier (or symbol) followed by a colon (:) (ASCII

[PDF] x86 Assembly Language Reference Manual, Carnegie Mellon. ‹#›. %rsp x86-‐64 Integer Registers. %eax. %ebx. %ecx. %edx. %esi Can represent a Most of the time parenthesis means dereference. assembly - What do the brackets mean in x86 asm? Given the following code: L1 db "word", 0 mov al,[L1] mov eax, L1 What do the brackets([L1]) represent?… What does X mean in EAX,EBX,ECX … in assembly?

Use of square brackets in 8086 memory addressing, x86 Assembly Language is a family of backward-compatible assembly languages, which Like all assembly languages, it uses short mnemonics to represent the Assembly languages are more typically used for detailed and time critical Arithmetic expressions in square brackets; additionally, size keywords like byte,  MASM uses the standard Intel syntax for writing x86 assembly code. The full x86 instruction set is large and complex (Intel's x86 instruction set manuals comprise over 2900 pages), and we do not cover it all in this guide. For example, there is a 16-bit subset of the x86 instruction set. Using the 16-bit programming model can be quite complex.

[PDF] Assembly, A simple form of syntax-describing notation will be used: Any item written without surrounding { } (braces) or < > (brackets) must be written exactly as it stands. Case is irrelevant when writing instructions. An item enclosed in < > (brackets) does not have its literal meaning, which is defined elsewhere.

Comments
  • Thanks for your reply, I am starting to learn asm. If I understand this correctly, "mov al, [L1]" would move 'w' into al, and "mov eax, L1" would move the address of L1 into eax. Is that correct?
  • yes. and if you did mov ebx,L1 -- mov al,[ebx] then al would be 'w' in that case too.
  • The exception to this is LEA.
  • @interjay, So why is it that the brackets are not needed in the second line: mov eax, L1?
  • @Pacerier It depends on the assembler you're using, but usually without the brackets it will get the memory address, not the contents.
  • The first link is dead. Here is a snapshot: web.archive.org/web/20180331051340/http://www.imada.sdu.dk/…
  • @Hritik Thanks for flagging the broken link! Fixed with a better link :)
  • this can be confusing since in C *p means that dereference p and stop retrieving chars when you'll reach \0 and not just dereference the first char in the sequence/string pointed by p
  • @user2485710 No, *p means dereference the char pointed by p. Strings have nothing to do with this.