0

I am trying to set the second byte of the content marked by the label variable to the content of the EAX register through advanced indexing. When I execute the code below:

movl %eax, 2(variable)

I receive the following error:

Error: junk `(variable)' after expression

Is there a way for me to accomplish moving the content of the EAX register into the second byte of variable?

Peter Cordes
  • 286,368
  • 41
  • 520
  • 731
Adam Lee
  • 346
  • 1
  • 11
  • 35
  • 1
    But note that EAX is 4 bytes wide; you can't store it into a single byte. So you'd be storing it to the 4 bytes *starting* at `memoizationMatrix+2` if you got the syntax right, `mov %eax, memoizationMatrix+2` Also, that's not "advanced" indexing, just a simple `[disp32]` absolute addressing mode with no base register. Also no index register involved. – Peter Cordes Nov 07 '20 at 09:09
  • You put a symbol name where only registers can go. Look at compiler output for `global_array[1] = 1` or something to see the right addressing-mode syntax. – Peter Cordes Nov 07 '20 at 09:10

0 Answers0