Hi to all coders out there,...
well i was just wondering... is there any difference!?!?



mov dword ptr [...], Const


...AND...



mov [...], Const


Dominik
Posted on 2004-10-03 19:08:02 by Dom
mostly not, sometimes the compiler complains if it isn't absolutely clear what is meant.

I personally did a

d$ TEXTEQU <dword ptr>
w$ TEXTEQU <word ptr>
b$ TEXTEQU <byte ptr>

and define each and every mov. Helps me keep my source organized and cuts down on typing ;)
Posted on 2004-10-03 19:44:16 by JimmyClif
There is a difference. The compiler does not know where the memory you are referring to is a dword or word or byte if you do not use dword ptr or word ptr or byte ptr. However if you are using masm and have already declared the variable, the compiler knows what type is the data so it does not really matter.
Posted on 2004-10-04 00:06:58 by roticv
indeed. and also, without variables, the assembler can assume things. when you do a mov al, it is obvious that the thing you want to get from edx is a byte. movzx eax, is a different story though. etc.
Posted on 2004-10-04 10:59:56 by lifewire
Hi Dominik
The 80x86 microprocessor family supports 3 type of operands:
Immediate, register, and memory.
Now u know how a register looks like. conventionally, a pointer
To a memory location is enclosed in square brackets, and immmediate
Operand is written outside them.
So in
Mov [401264], eax
The left operand is a pointer and right operand is register.
Immediate operands of mov and push instructions may be either pointer
or a constant.to determine the type of an immediate operand u have to analyse
how its value is used in a program. If it is used for addressing a memory operand
it?s a pointer else an operand.
Like in
Mov eax, ;suppose the arg_0 contains immediate value 0x4050fc
Add eax, ;let the value of arg_4 be 0x5. This operation indicates that
;one argument is pointer while other may be a pointer or a constant.
Mov byte ptr , 0ah ;snz the sum of immediate values is used address memory indirectly
;hence it is either a constant or a pointer.
;eax is most likely to be a pointer bcoz it is positioned in first place with byte ptr, but u cant say anything about
eax in mov [], 0ah. it may be either a constant or a pointer
;var4 is likely an index bcoz it comes second.

Hence I feel mov [],const is not same as mov dword ptr [], const
As 1st pointer u cant determine its type but compiler gets it done for u.but second type its necesarily a dword pointer type pointer.
It is always a better practise to use the second during coding

If I have not misunderstood you, I guess this is ur answer else correct me since I am still learning. Thank you
nickdigital
Posted on 2004-10-05 02:23:51 by nickdigital
One thing i forgot to point out was that
seeing
Mov eax,
Add eax,
Mov , 0ah

u can say here eax on thirdline is a pointer as u see how it is used.
but seeing just
Mov , 0ah
u cant say whether eax is a pointer or a constant.

please lemme know if it satisfied ur querry or i misunderstood ur question
thank u
nickdigital
Posted on 2004-10-05 03:20:51 by nickdigital