-2

I have come upon x86 assembly code I don't understand and can't find anything about it. The bit of code i don't understand is parentheses around register ecx: movb (%ecx),%al. What does this code mean? I am familiar with registers and instructions, but have never come upon this.

I was trying to find something about it in videos and guides, but did not find anything.

Looks something like this in context

pushl %ebp 
movl %esp,%ebp 
movl 8(%ebp),%ecx 
...
movb (%ecx),%al  #<-- the code i am wondering about
Community
  • 1
  • 1

1 Answers1

0

The syntax (%reg) is the AT&T assembler syntax for dereferencing the content of a register as an address. It's equivalent to the Intel syntax [reg].

What you have there is the value in the partial register %al being written into the byte pointed to by the address in %ecx.

Govind Parmar
  • 20,656
  • 7
  • 53
  • 85