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.
When I dissassemble the exe file it ends up like this : mov eax,401000. I'm trying to get memory content.
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.
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.
MASM won't assemble direct memory references. Assemble manually.
; mov eax, [40100h]
db 0A1h
dd 40100h
MASM won't assemble direct memory references. Assemble manually.
; mov eax, [40100h]
db 0A1h
dd 40100h
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
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
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.
"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
mov eax, dword ptr ds:[00040100h]
works too..
I use ML.EXE ver.7.00.9466
Regards,
Lingo
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
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