Difference between memory and register

Muthupandi picture Muthupandi · Apr 23, 2014 · Viewed 7k times · Source

I saw assembly code like,

MOV [EAX], EBX

the above line, They are mentioned [EAX] is memory and EBX is Register. So, here what is the difference between [EAX] and EBX. What will happen in above instruction.

Answer

Netch picture Netch · Apr 23, 2014

In this syntax, brackets around a register means a memory location is used (as source or destination, according to the instruction) with starting address specified at the register (EAX in your case). For example, if EAX contained 1344 before the instruction, value from EBX is copied to logical memory addresses 1344-1347 (because this is 4 byte copying).

I hope this is enough to untangle them in your mind:) and please notice more complex cases are possible (e.g. MOV [EAX+ECX],EBX forms destination address as sum of two register values).