- Aug 12, 2014
- 522
- 3
- 81
Hello,
I've been reading Intel's manual and I reviewed an old chapter this morning.
I found the following:
For example, the following MOV instruction moves a value from register EAX into the segment
pointed to by the ES register. The offset into the segment is contained in the EBX register:
MOV ES:[EBX], EAX;
I'm curious here about the use of the brackets around EBX.
The use of brackets used this way, around a register or memory location, is supposed be a dereferenced pointer.
That is, brackets used that way are supposed to mean "treat what's between these brackets as a pointer and go to the memory address that this pointer points to and manipulate what you find there."
But, in the above quote, Intel doesn't dereference the pionter.
In the above example, apparently, using [EBX] is the same as just using EBX.
When I see something like ES:[EBX], I think take EBX and treat it like it's a pointer that points somewhere in the active default data segment, DS.
Take what you find there and use that as the offset in the ES segment.
But, apparently that's not how it's done.
Why?
Is this just some quirk of the language syntax?
The only other place I've seen something like this is with the LEA, load effective address, machine instruction.
The LEA instruction looks like this I think: LEA register1, [expression usually containing registers]
Here, the expression in the brackets is not used to dereference the pointer.
It's just used in itself to move the calculated expression itself into register1.
Does the segment : offset syntax work the same way?
I've been reading Intel's manual and I reviewed an old chapter this morning.
I found the following:
For example, the following MOV instruction moves a value from register EAX into the segment
pointed to by the ES register. The offset into the segment is contained in the EBX register:
MOV ES:[EBX], EAX;
I'm curious here about the use of the brackets around EBX.
The use of brackets used this way, around a register or memory location, is supposed be a dereferenced pointer.
That is, brackets used that way are supposed to mean "treat what's between these brackets as a pointer and go to the memory address that this pointer points to and manipulate what you find there."
But, in the above quote, Intel doesn't dereference the pionter.
In the above example, apparently, using [EBX] is the same as just using EBX.
When I see something like ES:[EBX], I think take EBX and treat it like it's a pointer that points somewhere in the active default data segment, DS.
Take what you find there and use that as the offset in the ES segment.
But, apparently that's not how it's done.
Why?
Is this just some quirk of the language syntax?
The only other place I've seen something like this is with the LEA, load effective address, machine instruction.
The LEA instruction looks like this I think: LEA register1, [expression usually containing registers]
Here, the expression in the brackets is not used to dereference the pointer.
It's just used in itself to move the calculated expression itself into register1.
Does the segment : offset syntax work the same way?