0

I was wondering if something could explain pointers in Assembly to me. For example, what would mov( eax, [ebx] );, mov( &iValue, EBX );, and mov( VarName[ eax ], al ); mean? Thank you!

Gabriel
  • 1
  • 2
  • Is `iValue` a global variable you declared somewhere? I'd assume that's equivalent to AT&T syntax `mov $iValue, %EBX`, to put the label address into a register, with a mov-immediate. For the others, those look like normal Intel-syntax addressing modes for memory operands, see [Referencing the contents of a memory location. (x86 addressing modes)](https://stackoverflow.com/q/34058101) (HLA uses `op(src, dst)` order, I think, like AT&T syntax, opposite of the rest of Intel syntax.) – Peter Cordes Jun 01 '21 at 01:51
  • iValue was just a random variable used in an example that my professor using to explain. Also, thank you! – Gabriel Jun 01 '21 at 01:58
  • Ok, but does HLA not have *local* variables? In normal asm, you can only `mov` an address as an absolute; to get the address of a local variable (on the stack) into a register, you'd need `lea 4(%esp), %ebx` or whatever. (Intel `lea ebx, [esp+4]`). If HLA doesn't try to attach names to stack locations (the way MASM does with `proc` / `local` stuff), then yes, all "variables" are what C would call global or static variables, and would have symbol names just like labels in code. – Peter Cordes Jun 01 '21 at 02:01

0 Answers0