tags:

views:

99

answers:

5

MOV [1234H], AX means that the value of AX is copied to 1234 hexadecimal address in memory. So, please correct me if what I am saying is wrong, the [] operator functions as a pointer to, right?

This being said, I can't understand the following instruction: MOV [EBX], AX why the use of the [ ]? EBX is a general purpose register inside the processor, not a memory cell, so there is no pointer to it, right?

P.S. I am programming under masm32.

Thanks

+4  A: 

I believe in your question case EBX holds an address and the machine does a store.

DigitalRoss
+4  A: 

The meaning of [] is more "look at address...", so [1234H] means to look at address 0x1234, and [EBX] look at the address stored in EBX. Like the * operator in C/C++, if you're familiar with that.

CAdaker
+4  A: 

Register EBX here holds a value, which is an address. MOV [EBX], AX means that: take the value stored in register AX; write it to the address which is stored in EBX.

Erkan Haspulat
+2  A: 

Be careful with instructions like

MOV [EBX], AX

As AX is a 16-bit register, it may incur significant performance penalties unless the address that EBX holds, is not aligned.

+1  A: 

The brackets mean a level of indirection.
mov bx,ax means put ax in bx or register direct, use the register directly to store the value mov [bx],ax means register indirect, take the value in the register and use that as an address of the place to store the value. mov ax,1234h means immediate, put 1234h in AX mov [1234h],ax has a level of indirection in the same way as [bx] above, the thing in the brackets contains the address to the place to store the result.

I am rusty on my x86 syntax but if x86 has this and you were to see something like mov [bx+cx],ax that would mean add bx and cx and use that as the address to store the value in ax.

dwelch