Hey everyone-
Is there anyway to get MASM to assemble a direct, numerical memory offset? For example:
EAX, DWORD PTR [00402000h]
always assembles as the immediete:
B8 00204000 - MOV EAX, 00402000
The only way to get MASM to do it is via the indirect access. I know it would have little real-world use, but to assemble a memory move as an immediete move, and not at least give a warning or something seems backwards.
-r
well - there are a couple ways that i have used
one is to create a label
org 402000h
SomeDword LABEL DWORD
.
.
.
mov eax,SomeDword
another way is to hard-code it
db 0B8h ;mov eax,[aaaaaaaa]
dd 402000h ;address
> another way is to hard-code it
> db 0B8h ;mov eax,[aaaaaaaa]
> dd 402000h ;address
Very ugly!
The correct thing is to use a segment register prefix:
mov EAX, DWORD PTR ds:[00402000h]
Quote from: japheth on October 16, 2009, 01:22:38 PM
The correct thing is to use a segment register prefix:
mov EAX, DWORD PTR ds:[00402000h]
Bingo, much obliged. More and more I find some of the logic behind MASM syntax completely bizarre.
thanks again
-r
ahhhhh - so THAT's the secret - lol
damnasm.exe
although "DWORD PTR" should not be required - "eax," forces that
mov eax,ds:[402000h]