The difference between MOV [reg],reg .. MOV reg,reg

0

I'm new to Assembly, and i would like to finally solve this (my) problem

enter image description here

Well here it is, it seems that EAX reg has the value 00 00 93 19 and p2 00 00 10 00 (but as i understand it is used as an address) When MOV [p2],AX is done .. ([] means that it looks at 0x00001000 and at this address it will change those values to 19 ..etc according to the little endian strategy) So am i supposed to understand it like .. EAX has its own address as (for example (only for idea) 0x00000523 and at this address has the value 00 00 93 19 and p2 has its own adress 00 00 10 00 and the value 00 00 66 65 (before the change)

so after the change p2 will look like: address 00 00 10 00 and has value 00 00 93 19 ?

How would it look if I wrote MOV p2, AX

assembly
x86
asked on Stack Overflow Mar 4, 2016 by Arey Jeremy • edited Mar 4, 2016 by Arey Jeremy

2 Answers

0

In some (most?) x86 assemblers, the instruction mov p2,ax is the same as mov [p2],ax. Both are moving the contents of a register into memory at the address associated with p2.

They are both synonyms for:

mov word ptr p2, ax

As I recall, other assemblers would reject mov p2,ax as an invalid instruction, but mov [p2],ax was legal.

answered on Stack Overflow Mar 4, 2016 by Jim Mischel
0

After mov [p2], ax the address 00 00 10 00 content will be 00009319

mov p2,ax is not valid insofar as p2 do not represent an address.

EAX has its own address as (for example (only for idea) 0x00000523 and at this address has the value 00 00 93 19

That's wrong. EAX is a register and registers does not have own addresses. They just have content.

answered on Stack Overflow Mar 4, 2016 by Vlad

User contributions licensed under CC BY-SA 3.0