How do I write this code in MASM32 and get correct assembly. mov eax,[401000]
When I dissassemble the exe file it ends up like this : mov eax,401000. I'm trying to get memory content.
Posted on 2003-01-11 23:42:09 by mrgone
What do you actually want to do? do you want to move the pointer to
an address into EAX? or do you want to move a value from a pointer
into EAX? The code above only moves the number 401000 into EAX.

In order to get that value did you look at the disassembly? because then
you would need to do it like this: mov eax,401000h The number is
in hex NOT decimal.
Posted on 2003-01-12 00:13:20 by natas
MASM won't assemble direct memory references. Assemble manually.


; mov eax, [40100h]
db 0A1h
dd 40100h
Posted on 2003-01-12 00:21:57 by comrade

MASM won't assemble direct memory references. Assemble manually.


; mov eax, [40100h]
db 0A1h
dd 40100h
What? I think your wrong there Comrade. Since I have never had any problems doing so with masm.
Posted on 2003-01-12 00:24:42 by natas
I just checked, and noticed the same. It actually assembles mov eax,401000h instead of mov eax,[401000h]. You have to do it manually, as comrade said.

I have used NAsm for a long time, it supports direct references and many other things, and the preprocessor is much better than MAsm's.

-Stealth
Posted on 2003-01-12 01:11:27 by Stealth

I just checked, and noticed the same. It actually assembles mov eax,401000h instead of mov eax,[401000h]. You have to do it manually, as comrade said.
Ahh your right! I checked it now and found out that I was thinking of something else. So Comrade is correct! ( :) )
Posted on 2003-01-12 01:29:11 by natas
"MASM won't assemble direct memory references. Assemble manually."

mov eax, dword ptr ds:[00040100h]

works too..

I use ML.EXE ver.7.00.9466

Regards,
Lingo
Posted on 2003-01-12 02:05:46 by lingo12
Yes, it seems to work on MAsm 6.15, too.

As I said, I've mostly been using NAsm, so I wasn't aware it requires the segment override even when accessing ds.
Anyway, the fact that mov eax,[401000h] assembles as mov eax,401000h without causing a warning, seems strange.

-Stealth
Posted on 2003-01-12 02:51:37 by Stealth