1

Are the following the same?

add eax, 2
mov [eax+2], ebx

vs mov [eax+4], ebx

am i correct to say that: Assuming initial value stored in eax to be 0x40000050, both will result in writing value stored in ebx to address location 0x40000054? Or does [eax+2] and [eax+4] refer to different locations?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
J. Cena
  • 23
  • 4
  • 2
    They store the value to the same location, but the first version also modifies `eax`. – Raymond Chen Dec 04 '21 at 15:00
  • Adding with add is the same as doing it in the addressing mode. You could test that with a debugger, after pointing EAX to the start of a zeroed array in the BSS for example. – Peter Cordes Dec 04 '21 at 15:06

0 Answers0